xmlhash 1.3.4 → 1.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/ext/xmlhash/xmlhash.c +5 -2
- data/lib/xmlhash.rb +1 -1
- data/test/test_xmlhash.rb +7 -0
- metadata +2 -2
data/History.txt
CHANGED
data/ext/xmlhash/xmlhash.c
CHANGED
@@ -203,12 +203,15 @@ static VALUE parse_xml_hash(VALUE self, VALUE rb_xml)
|
|
203
203
|
m_current_encoding = rb_utf8_encoding();
|
204
204
|
#endif
|
205
205
|
|
206
|
+
m_result = Qnil;
|
207
|
+
|
206
208
|
data = (char*)calloc(RSTRING_LEN(rb_xml), sizeof(char));
|
207
209
|
memcpy(data, StringValuePtr(rb_xml), RSTRING_LEN(rb_xml));
|
208
210
|
|
209
211
|
reader = xmlReaderForMemory(data, RSTRING_LEN(rb_xml),
|
210
|
-
NULL, NULL, XML_PARSE_NOENT);
|
212
|
+
NULL, NULL, XML_PARSE_NOENT | XML_PARSE_NOERROR | XML_PARSE_NOWARNING );
|
211
213
|
init_XmlhashParserData();
|
214
|
+
|
212
215
|
if (reader != NULL) {
|
213
216
|
ret = xmlTextReaderRead(reader);
|
214
217
|
while (ret == 1) {
|
@@ -217,7 +220,7 @@ static VALUE parse_xml_hash(VALUE self, VALUE rb_xml)
|
|
217
220
|
}
|
218
221
|
xmlFreeTextReader(reader);
|
219
222
|
if (ret != 0) {
|
220
|
-
printf("%s : failed to parse\n", data);
|
223
|
+
/* printf("%s : failed to parse\n", data); */
|
221
224
|
}
|
222
225
|
}
|
223
226
|
|
data/lib/xmlhash.rb
CHANGED
data/test/test_xmlhash.rb
CHANGED
@@ -62,6 +62,7 @@ eos
|
|
62
62
|
GC.start
|
63
63
|
assert_equal ret, rubyoutput
|
64
64
|
}
|
65
|
+
|
65
66
|
10000.times {
|
66
67
|
ret = Xmlhash.parse(xml)
|
67
68
|
assert_equal ret, rubyoutput
|
@@ -125,6 +126,12 @@ eos
|
|
125
126
|
assert_equal ret.elements('files'), []
|
126
127
|
end
|
127
128
|
|
129
|
+
def test_garbage
|
130
|
+
# unfortunately it's rather challening testing nothing is printed to stderr
|
131
|
+
ret = Xmlhash.parse("asdasdaskdladka")
|
132
|
+
assert_equal nil, ret
|
133
|
+
end
|
134
|
+
|
128
135
|
def test_utf8
|
129
136
|
xml = '<package name="libconfig" project="home:coolo">
|
130
137
|
<title>libconfig – C/C++ Configuration File Library</title>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xmlhash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pkg-config
|