diff options
| author | TOMITA Masahiro <tommy@tmtm.org> | 2025-11-27 11:10:43 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-27 15:10:43 +1300 |
| commit | 2e770cdf773d79327cfdeb8178a1cb9b340f4560 (patch) | |
| tree | 018ec8588024cfc038701a6e45bc4007c6a995a4 /io_buffer.c | |
| parent | a60cd8787cb65a6077f609652f6042143d81b227 (diff) | |
Fix argument handling in `IO::Buffer#each_byte` (#15309)
The method incorrectly ignored its first argument and treated the second argument as offset and the third as count.
This change makes the first argument be treated as offset and the second as count.
Also fix incorrect block parameter in comments.
Diffstat (limited to 'io_buffer.c')
| -rw-r--r-- | io_buffer.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/io_buffer.c b/io_buffer.c index abe7832bee..89f169176f 100644 --- a/io_buffer.c +++ b/io_buffer.c @@ -2231,7 +2231,7 @@ io_buffer_values(int argc, VALUE *argv, VALUE self) /* * call-seq: - * each_byte([offset, [count]]) {|offset, byte| ...} -> self + * each_byte([offset, [count]]) {|byte| ...} -> self * each_byte([offset, [count]]) -> enumerator * * Iterates over the buffer, yielding each byte starting from +offset+. @@ -2255,7 +2255,7 @@ io_buffer_each_byte(int argc, VALUE *argv, VALUE self) rb_io_buffer_get_bytes_for_reading(self, &base, &size); size_t offset, count; - io_buffer_extract_offset_count(RB_IO_BUFFER_DATA_TYPE_U8, size, argc-1, argv+1, &offset, &count); + io_buffer_extract_offset_count(RB_IO_BUFFER_DATA_TYPE_U8, size, argc, argv, &offset, &count); for (size_t i = 0; i < count; i++) { unsigned char *value = (unsigned char *)base + i + offset; |
