Package: ruby-mkrf / 0.2.3+dfsg-5

0600_fix_test_libxml.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
Description: Port code from libxml example to Ruby1.9
Author: C├ędric Boutillier <cedric.boutillier@gmail.com>
Last-Update: 2012-07-04

--- a/test/sample_files/libxml-ruby-0.3.8/ext/xml/extconf.rb
+++ b/test/sample_files/libxml-ruby-0.3.8/ext/xml/extconf.rb
@@ -5,7 +5,7 @@
   exit 1
 end
 
-Mkrf::Generator.new('libxml_so', '*.c') do |g|
+Mkrf::Generator.new('libxml_so', ['*.c']) do |g|
 
   g.include_library('socket','socket')
   g.include_library('nsl','gethostbyname')
@@ -46,4 +46,4 @@
     crash('Need docbCreateFileParserCtxt')
   end
 
-end
\ No newline at end of file
+end
--- a/test/sample_files/libxml-ruby-0.3.8/ext/xml/libxml.h
+++ b/test/sample_files/libxml-ruby-0.3.8/ext/xml/libxml.h
@@ -13,8 +13,13 @@
 #define RUBY_LIBXML_VER_MIC   8
 
 #include <ruby.h>
+#if RUBY_INTERN_H
+#include <ruby/backward/rubyio.h>
+#include <ruby/util.h>
+#else
 #include <rubyio.h>
 #include <util.h>
+#endif
 #include <libxml/parser.h>
 #include <libxml/parserInternals.h>
 #include <libxml/debugXML.h>
--- a/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_document.c
+++ b/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_document.c
@@ -138,7 +138,7 @@
  */
 VALUE
 ruby_xml_document_dump(int argc, VALUE *argv, VALUE self) {
-  OpenFile *fptr;
+  rb_io_t *fptr;
   VALUE io;
   FILE *out;
   ruby_xml_document *rxd;
@@ -177,7 +177,7 @@
 VALUE
 ruby_xml_document_debug_dump(int argc, VALUE *argv, VALUE self) {
 #ifdef LIBXML_DEBUG_ENABLED
-  OpenFile *fptr;
+  rb_io_t *fptr;
   VALUE io;
   FILE *out;
   ruby_xml_document *rxd;
@@ -221,7 +221,7 @@
 VALUE
 ruby_xml_document_debug_dump_head(int argc, VALUE *argv, VALUE self) {
 #ifdef LIBXML_DEBUG_ENABLED
-  OpenFile *fptr;
+  rb_io_t *fptr;
   VALUE io;
   FILE *out;
   ruby_xml_document *rxd;
@@ -266,7 +266,7 @@
  */
 VALUE
 ruby_xml_document_format_dump(int argc, VALUE *argv, VALUE self) {
-  OpenFile *fptr;
+  rb_io_t *fptr;
   VALUE bool, io;
   FILE *out;
   ruby_xml_document *rxd;
--- a/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpath.c
+++ b/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpath.c
@@ -163,31 +163,31 @@
       ruby_xml_xpath_context_register_namespace(xxpc, rprefix, ruri);
       break;
     case T_ARRAY:
-      for (i = 0; i < RARRAY(argv[2])->len; i++) {
-	switch (TYPE(RARRAY(argv[2])->ptr[i])) {
+      for (i = 0; i < RARRAY_LEN(argv[2]); i++) {
+	switch (TYPE(RARRAY_PTR(argv[2])[i])) {
 	case T_STRING:
-	  cp = strchr(StringValuePtr(RARRAY(argv[2])->ptr[i]), (int)':');
+	  cp = strchr(StringValuePtr(RARRAY_PTR(argv[2])[i]), (int)':');
 	  if (cp == NULL) {
-	    rprefix = RARRAY(argv[2])->ptr[i];
+	    rprefix = RARRAY_PTR(argv[2])[i];
 	    ruri = Qnil;
 	  } else {
-	    rprefix = rb_str_new(StringValuePtr(RARRAY(argv[2])->ptr[i]), (int)((long)cp - (long)StringValuePtr(RARRAY(argv[2])->ptr[i])));
+	    rprefix = rb_str_new(StringValuePtr(RARRAY_PTR(argv[2])[i]), (int)((long)cp - (long)StringValuePtr(RARRAY_PTR(argv[2])[i])));
 	    ruri = rb_str_new2(&cp[1]);
 	  }
 	  /* Should test the results of this */
 	  ruby_xml_xpath_context_register_namespace(xxpc, rprefix, ruri);
 	  break;
 	case T_ARRAY:
-	  if (RARRAY(RARRAY(argv[2])->ptr[i])->len == 2) {
-	    rprefix = RARRAY(RARRAY(argv[2])->ptr[i])->ptr[0];
-	    ruri = RARRAY(RARRAY(argv[2])->ptr[i])->ptr[1];
+	  if (RARRAY_LEN(RARRAY_PTR(argv[2])[i]) == 2) {
+	    rprefix = RARRAY_PTR(RARRAY_PTR(argv[2])[i])[0];
+	    ruri = RARRAY_PTR(RARRAY_PTR(argv[2])[i])[1];
 	    ruby_xml_xpath_context_register_namespace(xxpc, rprefix, ruri);
 	  } else {
 	    rb_raise(rb_eArgError, "nested array must be an array of strings, prefix and href/uri");
 	  }
 	  break;
 	default:
-	  if (rb_obj_is_kind_of(RARRAY(argv[2])->ptr[i], cXMLNS) == Qtrue) {
+	  if (rb_obj_is_kind_of(RARRAY_PTR(argv[2])[i], cXMLNS) == Qtrue) {
 	    Data_Get_Struct(argv[2], ruby_xml_ns, rxns);
 	    rprefix = rb_str_new2((const char*)rxns->ns->prefix);
 	    ruri = rb_str_new2((const char*)rxns->ns->href);
--- a/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_parser.c
+++ b/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_parser.c
@@ -895,7 +895,7 @@
   ruby_xml_parser *rxp;
   ruby_xml_parser_context *rxpc;
   rx_io_data *data;
-  OpenFile *fptr;
+  rb_io_t *fptr;
   FILE *f;
 
   if (!rb_obj_is_kind_of(io, rb_cIO))
@@ -1214,7 +1214,7 @@
   data->str = str;
 
   Data_Get_Struct(rxp->ctxt, ruby_xml_parser_context, rxpc);
-  rxpc->ctxt = xmlCreateMemoryParserCtxt(StringValuePtr(data->str), RSTRING(data->str)->len);
+  rxpc->ctxt = xmlCreateMemoryParserCtxt(StringValuePtr(data->str), RSTRING_LEN(data->str));
 
   return(data->str);
 }
--- a/test/sample_files/libxml-ruby-0.3.8/ext/xml/libxml.c
+++ b/test/sample_files/libxml-ruby-0.3.8/ext/xml/libxml.c
@@ -5,7 +5,7 @@
 #include "libxml.h"
 
 /* Ruby's util.h has ruby_strdup */
-#include "util.h"
+//#include "util.h"
 
 #ifdef xmlMalloc
 #undef xmlMalloc