zipruby 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of zipruby might be problematic. Click here for more details.

data/ChangeLog CHANGED
@@ -1,3 +1,11 @@
1
+ 2010-01-23 winebarrel
2
+
3
+ * fixes bug: [ruby-dev:40120] SEGV on zipruby with irb
4
+
5
+ 2009-06-11 winebarrel
6
+
7
+ * fixes bug: C macro mistake (reported by SHITAMORI Akira)
8
+
1
9
  2009-05-16 winebarrel
2
10
 
3
11
  * improve Zip::Archive#add_io, replace_io, add, replace
data/README.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  = Zip/Ruby
2
2
 
3
- Copyright (c) 2008 SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
3
+ Copyright (c) 2008-2010 SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
4
4
 
5
5
  == Description
6
6
 
@@ -86,6 +86,7 @@ https://rubyforge.org/frs/?group_id=6124
86
86
 
87
87
  # include directory in zip archive
88
88
  Zip::Archive.open('filename.zip') do |ar|
89
+ ar.add_dir('dirname')
89
90
  ar.add_file('dirname/foo.txt', 'foo.txt')
90
91
  # args: <entry name> , <source>
91
92
 
@@ -118,6 +118,7 @@ static VALUE zipruby_archive_alloc(VALUE klass) {
118
118
  p->flags = 0;
119
119
  p->tmpfilnam = NULL;
120
120
  p->buffer = Qnil;
121
+ p->sources = Qnil;
121
122
 
122
123
  return Data_Wrap_Struct(klass, zipruby_archive_mark, zipruby_archive_free, p);
123
124
  }
@@ -125,6 +126,7 @@ static VALUE zipruby_archive_alloc(VALUE klass) {
125
126
  static void zipruby_archive_mark(struct zipruby_archive *p) {
126
127
  rb_gc_mark(p->path);
127
128
  rb_gc_mark(p->buffer);
129
+ rb_gc_mark(p->sources);
128
130
  }
129
131
 
130
132
  static void zipruby_archive_free(struct zipruby_archive *p) {
@@ -162,6 +164,7 @@ static VALUE zipruby_archive_s_open(int argc, VALUE *argv, VALUE self) {
162
164
 
163
165
  p_archive->path = path;
164
166
  p_archive->flags = i_flags;
167
+ p_archive->sources = rb_ary_new();
165
168
 
166
169
  if (rb_block_given_p()) {
167
170
  VALUE retval;
@@ -232,6 +235,7 @@ static VALUE zipruby_archive_s_open_buffer(int argc, VALUE *argv, VALUE self) {
232
235
  p_archive->path = rb_str_new2(p_archive->tmpfilnam);
233
236
  p_archive->flags = i_flags;
234
237
  p_archive->buffer = buffer;
238
+ p_archive->sources = rb_ary_new();
235
239
 
236
240
  if (rb_block_given_p()) {
237
241
  VALUE retval;
@@ -683,6 +687,7 @@ static VALUE zipruby_archive_add_io(int argc, VALUE *argv, VALUE self) {
683
687
  }
684
688
 
685
689
  z->io = file;
690
+ rb_ary_push(p_archive->sources, file);
686
691
  z->mtime = TIME2LONG(mtime);
687
692
 
688
693
  if ((zsource = zip_source_io(p_archive->archive, z)) == NULL) {
@@ -745,6 +750,7 @@ static VALUE zipruby_archive_replace_io(int argc, VALUE *argv, VALUE self) {
745
750
  }
746
751
 
747
752
  z->io = file;
753
+ rb_ary_push(p_archive->sources, file);
748
754
  z->mtime = TIME2LONG(mtime);
749
755
 
750
756
  if ((zsource = zip_source_io(p_archive->archive, z)) == NULL) {
@@ -817,6 +823,7 @@ static VALUE zipruby_archive_add_function(int argc, VALUE *argv, VALUE self) {
817
823
  }
818
824
 
819
825
  z->proc = rb_block_proc();
826
+ rb_ary_push(p_archive->sources, z->proc);
820
827
  z->mtime = TIME2LONG(mtime);
821
828
 
822
829
  if ((zsource = zip_source_proc(p_archive->archive, z)) == NULL) {
@@ -875,6 +882,7 @@ static VALUE zipruby_archive_replace_function(int argc, VALUE *argv, VALUE self)
875
882
  }
876
883
 
877
884
  z->proc = rb_block_proc();
885
+ rb_ary_push(p_archive->sources, z->proc);
878
886
  z->mtime = TIME2LONG(mtime);
879
887
 
880
888
  if ((zsource = zip_source_proc(p_archive->archive, z)) == NULL) {
@@ -10,6 +10,7 @@ struct zipruby_archive {
10
10
  int flags;
11
11
  char *tmpfilnam;
12
12
  VALUE buffer;
13
+ VALUE sources;
13
14
  };
14
15
 
15
16
  void Init_zipruby_archive();
@@ -41,8 +41,9 @@ static ssize_t read_proc(void *state, void *data, size_t len, enum zip_source_cm
41
41
  return -1;
42
42
  }
43
43
 
44
+
44
45
  if (TYPE(src) != T_STRING) {
45
- return 0;
46
+ src = rb_funcall(src, rb_intern("to_s"), 0);
46
47
  }
47
48
 
48
49
  n = RSTRING_LEN(src);
data/zipruby.c CHANGED
@@ -312,6 +312,7 @@ static VALUE zipruby_archive_alloc(VALUE klass) {
312
312
  p->flags = 0;
313
313
  p->tmpfilnam = NULL;
314
314
  p->buffer = Qnil;
315
+ p->sources = Qnil;
315
316
 
316
317
  return Data_Wrap_Struct(klass, zipruby_archive_mark, zipruby_archive_free, p);
317
318
  }
@@ -319,6 +320,7 @@ static VALUE zipruby_archive_alloc(VALUE klass) {
319
320
  static void zipruby_archive_mark(struct zipruby_archive *p) {
320
321
  rb_gc_mark(p->path);
321
322
  rb_gc_mark(p->buffer);
323
+ rb_gc_mark(p->sources);
322
324
  }
323
325
 
324
326
  static void zipruby_archive_free(struct zipruby_archive *p) {
@@ -356,6 +358,7 @@ static VALUE zipruby_archive_s_open(int argc, VALUE *argv, VALUE self) {
356
358
 
357
359
  p_archive->path = path;
358
360
  p_archive->flags = i_flags;
361
+ p_archive->sources = rb_ary_new();
359
362
 
360
363
  if (rb_block_given_p()) {
361
364
  VALUE retval;
@@ -426,6 +429,7 @@ static VALUE zipruby_archive_s_open_buffer(int argc, VALUE *argv, VALUE self) {
426
429
  p_archive->path = rb_str_new2(p_archive->tmpfilnam);
427
430
  p_archive->flags = i_flags;
428
431
  p_archive->buffer = buffer;
432
+ p_archive->sources = rb_ary_new();
429
433
 
430
434
  if (rb_block_given_p()) {
431
435
  VALUE retval;
@@ -877,6 +881,7 @@ static VALUE zipruby_archive_add_io(int argc, VALUE *argv, VALUE self) {
877
881
  }
878
882
 
879
883
  z->io = file;
884
+ rb_ary_push(p_archive->sources, file);
880
885
  z->mtime = TIME2LONG(mtime);
881
886
 
882
887
  if ((zsource = zip_source_io(p_archive->archive, z)) == NULL) {
@@ -939,6 +944,7 @@ static VALUE zipruby_archive_replace_io(int argc, VALUE *argv, VALUE self) {
939
944
  }
940
945
 
941
946
  z->io = file;
947
+ rb_ary_push(p_archive->sources, file);
942
948
  z->mtime = TIME2LONG(mtime);
943
949
 
944
950
  if ((zsource = zip_source_io(p_archive->archive, z)) == NULL) {
@@ -1011,6 +1017,7 @@ static VALUE zipruby_archive_add_function(int argc, VALUE *argv, VALUE self) {
1011
1017
  }
1012
1018
 
1013
1019
  z->proc = rb_block_proc();
1020
+ rb_ary_push(p_archive->sources, z->proc);
1014
1021
  z->mtime = TIME2LONG(mtime);
1015
1022
 
1016
1023
  if ((zsource = zip_source_proc(p_archive->archive, z)) == NULL) {
@@ -1069,6 +1076,7 @@ static VALUE zipruby_archive_replace_function(int argc, VALUE *argv, VALUE self)
1069
1076
  }
1070
1077
 
1071
1078
  z->proc = rb_block_proc();
1079
+ rb_ary_push(p_archive->sources, z->proc);
1072
1080
  z->mtime = TIME2LONG(mtime);
1073
1081
 
1074
1082
  if ((zsource = zip_source_proc(p_archive->archive, z)) == NULL) {
@@ -2420,8 +2428,9 @@ static ssize_t read_proc(void *state, void *data, size_t len, enum zip_source_cm
2420
2428
  return -1;
2421
2429
  }
2422
2430
 
2431
+
2423
2432
  if (TYPE(src) != T_STRING) {
2424
- return 0;
2433
+ src = rb_funcall(src, rb_intern("to_s"), 0);
2425
2434
  }
2426
2435
 
2427
2436
  n = RSTRING_LEN(src);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zipruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - winebarrel
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-12 00:00:00 +09:00
12
+ date: 2010-01-23 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -104,6 +104,8 @@ files:
104
104
  - ChangeLog
105
105
  has_rdoc: true
106
106
  homepage: http://zipruby.rubyforge.org
107
+ licenses: []
108
+
107
109
  post_install_message:
108
110
  rdoc_options:
109
111
  - --title
@@ -125,9 +127,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
127
  requirements: []
126
128
 
127
129
  rubyforge_project: zipruby
128
- rubygems_version: 1.3.1
130
+ rubygems_version: 1.3.5
129
131
  signing_key:
130
- specification_version: 2
132
+ specification_version: 3
131
133
  summary: Ruby bindings for libzip.
132
134
  test_files: []
133
135