gdiff 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,6 +1,15 @@
1
+ 0.0.3
2
+ * Use print instead of puts, removing unneccessary newlines.
3
+ [Proposed by Leslie Vilijoen]
4
+ * Open files explicitly in binmode, to make it work under
5
+ windows. [Proposed by Leslie Vilijoen]
6
+ * Removed some signedness-errors from the suffixarray code.
7
+ * Made all the testcases pass again
8
+
9
+
1
10
  0.0.2
2
- * Removed bug reported by David Felstead, where gdiff crashed with certain
3
- large files.
11
+ * Removed bug, where gdiff crashed with certain large files.
12
+ [Reported by David Felstead]
4
13
 
5
14
  0.0.1
6
15
  * Improved documentation
data/bin/gdiff CHANGED
@@ -22,4 +22,5 @@ DOC
22
22
  end
23
23
 
24
24
  require "gdiff"
25
- puts Diff::GDiff.diff(File.read(ARGV[0]), File.read(ARGV[1])).pack
25
+ $stdout.binmode
26
+ $stdout.print Diff::GDiff.diff(File.read(ARGV[0]), File.read(ARGV[1])).pack
data/bin/gpatch CHANGED
@@ -22,4 +22,5 @@ DOC
22
22
  end
23
23
 
24
24
  require "gdiff"
25
- puts Diff::GDiff.unpack(File.read(ARGV[1])).apply_to(File.read(ARGV[0]))
25
+ $stdout.binmode
26
+ $stdout.print Diff::GDiff.unpack(File.read(ARGV[1])).apply_to(File.read(ARGV[0]))
@@ -45,7 +45,7 @@ inline int scan_string(unsigned char *source, size_t src_len,
45
45
 
46
46
  size_t find_longest_match(unsigned char *source, size_t src_len,
47
47
  unsigned char *target, size_t *tgt_len,
48
- unsigned int starts[], unsigned int ends[], unsigned int sa[])
48
+ unsigned int starts[], unsigned int ends[], int sa[])
49
49
  {
50
50
  size_t high = ends[*target] + 1;
51
51
  size_t low = starts[*target];
@@ -149,7 +149,7 @@ static VALUE SuffixArray_initialize(int argc, VALUE *argv, VALUE self)
149
149
  rb_iv_set(self, "@source", sa_source_str);
150
150
 
151
151
  // setup temporary variables for the source and length pointers
152
- unsigned char *sa_source = RSTRING(sa_source_str)->ptr;
152
+ unsigned char *sa_source = (unsigned char *) RSTRING(sa_source_str)->ptr;
153
153
  size_t sa_source_len = RSTRING(sa_source_str)->len;
154
154
 
155
155
  // error check the whole thing
@@ -231,14 +231,14 @@ static VALUE SuffixArray_longest_match(VALUE self, VALUE target, VALUE from_inde
231
231
 
232
232
 
233
233
  // get better pointers for the source (should already be in String form)
234
- unsigned char *source_ptr = RSTRING(sa_source)->ptr;
234
+ unsigned char *source_ptr = (unsigned char *) RSTRING(sa_source)->ptr;
235
235
  size_t source_len = RSTRING(sa_source)->len;
236
236
 
237
237
  // get the target as a string
238
238
  VALUE target_str = StringValue(target);
239
239
 
240
240
  // better pointers again, we also need target_len as an in/out parameter
241
- unsigned char *target_ptr = RSTRING(target_str)->ptr;
241
+ unsigned char *target_ptr = (unsigned char *) RSTRING(target_str)->ptr;
242
242
  size_t target_len = RSTRING(target_str)->len;
243
243
 
244
244
  // check the input for validity, returning nil like in array operations
@@ -297,14 +297,14 @@ static VALUE SuffixArray_longest_nonmatch(VALUE self, VALUE target, VALUE from_i
297
297
  size_t min = NUM2INT(min_match);
298
298
 
299
299
  // get better pointers for the source (should already be in String form)
300
- unsigned char *source_ptr = RSTRING(sa_source)->ptr;
300
+ unsigned char *source_ptr = (unsigned char *) RSTRING(sa_source)->ptr;
301
301
  size_t source_len = RSTRING(sa_source)->len;
302
302
 
303
303
  // get the target as a string
304
304
  VALUE target_str = StringValue(target);
305
305
 
306
306
  // better pointers again, we also need target_len as an in/out parameter
307
- unsigned char *target_ptr = RSTRING(target_str)->ptr;
307
+ unsigned char *target_ptr = (unsigned char *) RSTRING(target_str)->ptr;
308
308
  size_t target_len = RSTRING(target_str)->len;
309
309
 
310
310
  // check the input for validity, returning nil like in array operations
@@ -241,7 +241,7 @@ module Diff
241
241
 
242
242
  # Return a readable string representation
243
243
  def to_s
244
- self.operations.map { | operation | operation.to_s }
244
+ @operations.map { | operation | operation.to_s }
245
245
  end
246
246
 
247
247
  # Return a binary representation in GDiff format
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
1
3
  require "gdiff"
2
4
  require "test/unit"
3
5
 
metadata CHANGED
@@ -3,122 +3,121 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: gdiff
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.2
7
- date: 2006-02-10 00:00:00 +01:00
6
+ version: 0.0.3
7
+ date: 2006-07-21 00:00:00 +02:00
8
8
  summary: The Generic Diff Format (GDIFF) can be used to efficiently describe the differences between two arbirary files
9
9
  require_paths:
10
- - lib
11
- - lib
12
- - ext
10
+ - lib
11
+ - lib
12
+ - ext
13
13
  email: gdiff@brian-schroeder.de
14
14
  homepage: http://ruby.brian-schroeder.de/gdiff/
15
15
  rubyforge_project:
16
- description: "The Generic Diff Format (GDIFF) can be used to efficiently describe the
17
- differences between two arbirary files. The format does not make any assumptions
18
- about the type or contents of the files, and thus can be used to describe the
19
- differences between text files as well as binary files. The GDIFF format is
20
- itself a binary file format."
16
+ description: The Generic Diff Format (GDIFF) can be used to efficiently describe the differences between two arbirary files. The format does not make any assumptions about the type or contents of the files, and thus can be used to describe the differences between text files as well as binary files. The GDIFF format is itself a binary file format.
21
17
  autorequire: gdiff.rb
22
18
  default_executable:
23
19
  bindir: bin
24
20
  has_rdoc: true
25
21
  required_ruby_version: !ruby/object:Gem::Version::Requirement
26
22
  requirements:
27
- -
28
- - ">"
29
- - !ruby/object:Gem::Version
30
- version: 0.0.0
23
+ - - ">"
24
+ - !ruby/object:Gem::Version
25
+ version: 0.0.0
31
26
  version:
32
27
  platform: ruby
33
28
  signing_key:
34
29
  cert_chain:
35
30
  authors:
36
- - Brian Schroeder
31
+ - Brian Schroeder
37
32
  files:
38
- - COPYING.suffix_array
39
- - README.suffix_array
40
- - README
41
- - LICENSE.suffix_array
42
- - CHANGELOG
43
- - InstalledFiles
44
- - setup.rb
45
- - bin
46
- - doc
47
- - ext
48
- - lib
49
- - test
50
- - bin/gdiff
51
- - bin/gpatch
52
- - doc/index.html
53
- - doc/rdoc-style.css
54
- - doc/fr_method_index.html
55
- - doc/fr_class_index.html
56
- - doc/fr_file_index.html
57
- - doc/created.rid
58
- - doc/files
59
- - doc/classes
60
- - doc/files/ext
61
- - doc/files/lib
62
- - doc/files/ext/gdiff
63
- - doc/files/ext/gdiff/suffix_array
64
- - doc/files/ext/gdiff/suffix_array/sarray_c.html
65
- - doc/files/ext/gdiff/suffix_array/suffix_array_c.html
66
- - doc/files/ext/gdiff/suffix_array/extconf_rb.html
67
- - doc/files/ext/gdiff/suffix_array/lcp_c.html
68
- - doc/files/lib/gdiff_rb.html
69
- - doc/classes/SuffixArray.html
70
- - doc/classes/SAError.html
71
- - doc/classes/Diff.html
72
- - doc/classes/Diff
73
- - doc/classes/SuffixArray.src
74
- - doc/classes/Diff/GDiff.html
75
- - doc/classes/Diff/GDiff
76
- - doc/classes/Diff/GDiff/EPrematureEndOfStream.html
77
- - doc/classes/Diff/GDiff/ENoGdiffStream.html
78
- - doc/classes/Diff/GDiff/EGdiffError.html
79
- - doc/classes/Diff/GDiff/Operations.html
80
- - doc/classes/Diff/GDiff/Operations
81
- - doc/classes/Diff/GDiff/Operations/Copy.html
82
- - doc/classes/Diff/GDiff/Operations/Data.html
83
- - doc/classes/Diff/GDiff/Operations/Copy.src
84
- - doc/classes/Diff/GDiff/Operations/Data.src
85
- - doc/classes/Diff/GDiff/Operations/Copy.src/M000014.html
86
- - doc/classes/Diff/GDiff/Operations/Copy.src/M000015.html
87
- - doc/classes/Diff/GDiff/Operations/Copy.src/M000016.html
88
- - doc/classes/Diff/GDiff/Operations/Copy.src/M000017.html
89
- - doc/classes/Diff/GDiff/Operations/Data.src/M000009.html
90
- - doc/classes/Diff/GDiff/Operations/Data.src/M000010.html
91
- - doc/classes/Diff/GDiff/Operations/Data.src/M000011.html
92
- - doc/classes/Diff/GDiff/Operations/Data.src/M000012.html
93
- - doc/classes/Diff/GDiff/Operations/Data.src/M000013.html
94
- - doc/classes/SuffixArray.src/M000008.html
95
- - doc/classes/SuffixArray.src/M000001.html
96
- - doc/classes/SuffixArray.src/M000002.html
97
- - doc/classes/SuffixArray.src/M000003.html
98
- - doc/classes/SuffixArray.src/M000004.html
99
- - doc/classes/SuffixArray.src/M000005.html
100
- - doc/classes/SuffixArray.src/M000006.html
101
- - doc/classes/SuffixArray.src/M000007.html
102
- - ext/gdiff
103
- - ext/gdiff/COPYING
104
- - ext/gdiff/extconf.rb
105
- - ext/gdiff/lcp.c
106
- - ext/gdiff/LICENSE
107
- - ext/gdiff/README
108
- - ext/gdiff/sarray.3
109
- - ext/gdiff/sarray.c
110
- - ext/gdiff/sarray.h
111
- - ext/gdiff/suffix_array.c
112
- - lib/gdiff.rb
113
- - test/tc_gdiff.rb
33
+ - COPYING.suffix_array
34
+ - README.suffix_array
35
+ - README
36
+ - LICENSE.suffix_array
37
+ - CHANGELOG
38
+ - InstalledFiles
39
+ - setup.rb
40
+ - bin
41
+ - doc
42
+ - ext
43
+ - lib
44
+ - test
45
+ - bin/gdiff
46
+ - bin/gpatch
47
+ - doc/index.html
48
+ - doc/rdoc-style.css
49
+ - doc/fr_method_index.html
50
+ - doc/fr_class_index.html
51
+ - doc/fr_file_index.html
52
+ - doc/created.rid
53
+ - doc/files
54
+ - doc/classes
55
+ - doc/files/ext
56
+ - doc/files/lib
57
+ - doc/files/ext/gdiff
58
+ - doc/files/ext/gdiff/suffix_array
59
+ - doc/files/ext/gdiff/suffix_array/sarray_c.html
60
+ - doc/files/ext/gdiff/suffix_array/suffix_array_c.html
61
+ - doc/files/ext/gdiff/suffix_array/extconf_rb.html
62
+ - doc/files/ext/gdiff/suffix_array/lcp_c.html
63
+ - doc/files/lib/gdiff_rb.html
64
+ - doc/classes/SuffixArray.html
65
+ - doc/classes/SAError.html
66
+ - doc/classes/Diff.html
67
+ - doc/classes/Diff
68
+ - doc/classes/SuffixArray.src
69
+ - doc/classes/Diff/GDiff.html
70
+ - doc/classes/Diff/GDiff
71
+ - doc/classes/Diff/GDiff/EPrematureEndOfStream.html
72
+ - doc/classes/Diff/GDiff/ENoGdiffStream.html
73
+ - doc/classes/Diff/GDiff/EGdiffError.html
74
+ - doc/classes/Diff/GDiff/Operations.html
75
+ - doc/classes/Diff/GDiff/Operations
76
+ - doc/classes/Diff/GDiff/Operations/Copy.html
77
+ - doc/classes/Diff/GDiff/Operations/Data.html
78
+ - doc/classes/Diff/GDiff/Operations/Copy.src
79
+ - doc/classes/Diff/GDiff/Operations/Data.src
80
+ - doc/classes/Diff/GDiff/Operations/Copy.src/M000014.html
81
+ - doc/classes/Diff/GDiff/Operations/Copy.src/M000015.html
82
+ - doc/classes/Diff/GDiff/Operations/Copy.src/M000016.html
83
+ - doc/classes/Diff/GDiff/Operations/Copy.src/M000017.html
84
+ - doc/classes/Diff/GDiff/Operations/Data.src/M000009.html
85
+ - doc/classes/Diff/GDiff/Operations/Data.src/M000010.html
86
+ - doc/classes/Diff/GDiff/Operations/Data.src/M000011.html
87
+ - doc/classes/Diff/GDiff/Operations/Data.src/M000012.html
88
+ - doc/classes/Diff/GDiff/Operations/Data.src/M000013.html
89
+ - doc/classes/SuffixArray.src/M000008.html
90
+ - doc/classes/SuffixArray.src/M000001.html
91
+ - doc/classes/SuffixArray.src/M000002.html
92
+ - doc/classes/SuffixArray.src/M000003.html
93
+ - doc/classes/SuffixArray.src/M000004.html
94
+ - doc/classes/SuffixArray.src/M000005.html
95
+ - doc/classes/SuffixArray.src/M000006.html
96
+ - doc/classes/SuffixArray.src/M000007.html
97
+ - ext/gdiff
98
+ - ext/gdiff/COPYING
99
+ - ext/gdiff/extconf.rb
100
+ - ext/gdiff/lcp.c
101
+ - ext/gdiff/LICENSE
102
+ - ext/gdiff/README
103
+ - ext/gdiff/sarray.3
104
+ - ext/gdiff/sarray.c
105
+ - ext/gdiff/sarray.h
106
+ - ext/gdiff/suffix_array.c
107
+ - lib/gdiff.rb
108
+ - test/tc_gdiff.rb
114
109
  test_files:
115
- - test/tc_gdiff.rb
110
+ - test/tc_gdiff.rb
116
111
  rdoc_options: []
112
+
117
113
  extra_rdoc_files: []
114
+
118
115
  executables:
119
- - gpatch
120
- - gdiff
116
+ - gpatch
117
+ - gdiff
121
118
  extensions:
122
- - ext/gdiff/extconf.rb
119
+ - ext/gdiff/extconf.rb
123
120
  requirements: []
124
- dependencies: []
121
+
122
+ dependencies: []
123
+