simple-mmap 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -130,12 +130,11 @@ static VALUE sm_mapped_file_read_window_data(VALUE vself, VALUE voffset, VALUE v
130
130
  return Qnil;
131
131
  }
132
132
 
133
- size_t curr;
134
- curr = offset;
133
+ size_t curr = offset;
135
134
  size_t i;
136
135
  for(i = 0; i < length; ++i) {
137
136
  //printf("i=%i offset=%i length=%i curr=%i map->len=%i\n", i, offset, length, curr, sm_map->len);
138
- if ((curr + i) > sm_map->len)
137
+ if ((offset + i) > sm_map->len)
139
138
  break;
140
139
  buff[i] = sm_map->map[curr++];
141
140
  }
@@ -43,6 +43,10 @@ class TestFileWindow < Test::Unit::TestCase
43
43
  assert_equal "z", @fw[25, 10]
44
44
  end
45
45
 
46
+ def test_get_all_bytes
47
+ assert_equal ('a'..'z').to_a.join, @fw[0, 26]
48
+ end
49
+
46
50
  def test_nil_on_negative_index
47
51
  assert_equal nil, @fw[-1]
48
52
  assert_equal nil, @fw[-1, 2]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-mmap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Johan S\xC3\xB8rensen"