nokogumbo 1.1 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDM0N2MwNTE2MzI0MmFjNTZmYzQ5YTk2MDMwNWQ1YzVlNTk5NTMzYQ==
4
+ ZDM4N2U1MTA3MjkzNGQ1ZmU1OGY4NjljY2NiNzdlMGEwNzYyYTkwMA==
5
5
  data.tar.gz: !binary |-
6
- OTNlOWZkMDc0NTc3N2U5MjY1ODhlNTEwMmMxMmMxOTBiYTA0NTViZA==
6
+ YzQ1MTYzYTJjZjM1YjFkZTU2NThlZWFkMzhmODFjMTI4MDk2YzVlYw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YjI2NzhjYzE0ZjQ1OTA3MDRiNWJjOGZkNzRlZDNhOTQ2N2ViODZjNDFlOWE3
10
- Zjk1MTY0MmQ2ZDgwMTQxYzczNDQxYTFmYjdiNGY3ZjAwZDYxNzVlNjE2MWJh
11
- NDQyYzk5MGU5ZTZlNDdkZWUxMjE3ZjhmNWIxZWIzYzFkZDRkYTA=
9
+ ZDM3MDI2MjkwMzAyNTQ2ZmRhNDc3NmRlNjIzMjBlZjE5OGU2MGU3M2MyZDcw
10
+ MTgxOTBhOGUxZjkxYmZlZGZlN2I1NTVmYTBlM2E3NWZkNmFiODE4ZThjMjdj
11
+ N2E1M2RkNDljYjc4YWY0YmIxOGYyYTNjYTM1OWQzNDA0NjBiOTQ=
12
12
  data.tar.gz: !binary |-
13
- YjE4NDhmMTIxNTI5MThlM2Q1MmRkNmVkNWRmYmFjNjllYzQ3YTFkMWJmNWI1
14
- MWRkNDI2NzY0MWRhNjVlMjNjNmQ2NWZjOTQ3YzUwNzc3ZmNiMDBjNTBlZTBk
15
- YTZkYzU2NTQ3NDNmMzIxNzA4NzQ3ZDI2NmFjY2Y3YWU3MmFmNTY=
13
+ NmFkYjA3MjA3Njk5YTJiMmIyZWEyM2EyNGQ0ZjQxYzAwMTY2NDQwZmM3YmUz
14
+ YWQwM2YzNjFlOGM2OTljNjc1MzZlMTZmNDM1ODUwYmZkZjZhNzcyZGE0ZGMy
15
+ N2Y4YzA5ZWI4NjZiY2M5NGI2Nzk5MjNiZDE5MzMzNmM4Y2M2OWE=
@@ -28,6 +28,7 @@ unless have_library('gumbo', 'gumbo_parse')
28
28
  require 'fileutils'
29
29
  FileUtils.cp Dir["#{rakehome}/gumbo-parser/src/*"],
30
30
  "#{rakehome}/ext/nokogumboc"
31
+ $srcs = $objs = nil
31
32
  end
32
33
  end
33
34
 
@@ -578,7 +578,7 @@ static GumboInsertionMode get_appropriate_insertion_mode(
578
578
  // This performs the actual "reset the insertion mode" loop.
579
579
  static void reset_insertion_mode_appropriately(GumboParser* parser) {
580
580
  const GumboVector* open_elements = &parser->_parser_state->_open_elements;
581
- for (int i = open_elements->length - 1; i >= 0; --i) {
581
+ for (int i = open_elements->length; --i >= 0; ) {
582
582
  GumboInsertionMode mode =
583
583
  get_appropriate_insertion_mode(open_elements->data[i], i == 0);
584
584
  if (mode != GUMBO_INSERTION_MODE_INITIAL) {
@@ -762,7 +762,7 @@ static void foster_parent_element(GumboParser* parser, GumboNode* node) {
762
762
  GumboNode* foster_parent_element = open_elements->data[0];
763
763
  assert(foster_parent_element->type == GUMBO_NODE_ELEMENT);
764
764
  assert(node_tag_is(foster_parent_element, GUMBO_TAG_HTML));
765
- for (int i = open_elements->length - 1; i > 1; --i) {
765
+ for (int i = open_elements->length; --i > 1; ) {
766
766
  GumboNode* table_element = open_elements->data[i];
767
767
  if (node_tag_is(table_element, GUMBO_TAG_TABLE)) {
768
768
  foster_parent_element = table_element->parent;
@@ -1062,7 +1062,7 @@ static void acknowledge_self_closing_tag(GumboParser* parser) {
1062
1062
  // elements, and fills in its index if so.
1063
1063
  static bool find_last_anchor_index(GumboParser* parser, int* anchor_index) {
1064
1064
  GumboVector* elements = &parser->_parser_state->_active_formatting_elements;
1065
- for (int i = elements->length - 1; i >= 0; --i) {
1065
+ for (int i = elements->length; --i >= 0; ) {
1066
1066
  GumboNode* node = elements->data[i];
1067
1067
  if (node == &kActiveFormattingScopeMarker) {
1068
1068
  return false;
@@ -1085,7 +1085,7 @@ static int count_formatting_elements_of_tag(
1085
1085
  const GumboElement* desired_element = &desired_node->v.element;
1086
1086
  GumboVector* elements = &parser->_parser_state->_active_formatting_elements;
1087
1087
  int num_identical_elements = 0;
1088
- for (int i = elements->length - 1; i >= 0; --i) {
1088
+ for (int i = elements->length; --i >= 0; ) {
1089
1089
  GumboNode* node = elements->data[i];
1090
1090
  if (node == &kActiveFormattingScopeMarker) {
1091
1091
  break;
@@ -1289,7 +1289,7 @@ static bool has_an_element_in_specific_scope(
1289
1289
  va_end(args);
1290
1290
 
1291
1291
  bool result = false;
1292
- for (int i = open_elements->length - 1; i >= 0; --i) {
1292
+ for (int i = open_elements->length; --i >= 0; ) {
1293
1293
  const GumboNode* node = open_elements->data[i];
1294
1294
  if (node->type != GUMBO_NODE_ELEMENT) {
1295
1295
  continue;
@@ -1350,7 +1350,7 @@ static bool has_an_element_in_scope(GumboParser* parser, GumboTag tag) {
1350
1350
  // parameterize it.
1351
1351
  static bool has_node_in_scope(GumboParser* parser, const GumboNode* node) {
1352
1352
  GumboVector* open_elements = &parser->_parser_state->_open_elements;
1353
- for (int i = open_elements->length - 1; i >= 0; --i) {
1353
+ for (int i = open_elements->length; --i >= 0; ) {
1354
1354
  const GumboNode* current = open_elements->data[i];
1355
1355
  if (current == node) {
1356
1356
  return true;
@@ -1586,7 +1586,7 @@ static void maybe_implicitly_close_list_tag(
1586
1586
  GumboParser* parser, GumboToken* token, bool is_li) {
1587
1587
  GumboParserState* state = parser->_parser_state;
1588
1588
  state->_frameset_ok = false;
1589
- for (int i = state->_open_elements.length - 1; i >= 0; --i) {
1589
+ for (int i = state->_open_elements.length; --i >= 0; ) {
1590
1590
  const GumboNode* node = state->_open_elements.data[i];
1591
1591
  bool is_list_tag = is_li ?
1592
1592
  node_tag_is(node, GUMBO_TAG_LI) :
@@ -1761,7 +1761,7 @@ static bool adoption_agency_algorithm(
1761
1761
  // Step 4.
1762
1762
  GumboNode* formatting_node = NULL;
1763
1763
  int formatting_node_in_open_elements = -1;
1764
- for (int j = state->_active_formatting_elements.length - 1; j >= 0; --j) {
1764
+ for (int j = state->_active_formatting_elements.length; --j >= 0; ) {
1765
1765
  GumboNode* current_node = state->_active_formatting_elements.data[j];
1766
1766
  if (current_node == &kActiveFormattingScopeMarker) {
1767
1767
  gumbo_debug("Broke on scope marker; aborting.\n");
@@ -2873,7 +2873,7 @@ static bool handle_in_body(GumboParser* parser, GumboToken* token) {
2873
2873
  // If we see a), implicitly close everything up to and including it. If we
2874
2874
  // see b), then record a parse error, don't close anything (except the
2875
2875
  // implied end tags) and ignore the end tag token.
2876
- for (int i = state->_open_elements.length - 1; ; --i) {
2876
+ for (int i = state->_open_elements.length; --i >= 0; ) {
2877
2877
  const GumboNode* node = state->_open_elements.data[i];
2878
2878
  if (node->v.element.tag_namespace == GUMBO_NAMESPACE_HTML &&
2879
2879
  node_tag_is(node, end_tag)) {
@@ -3686,8 +3686,8 @@ static bool handle_in_foreign_content(GumboParser* parser, GumboToken* token) {
3686
3686
  add_parse_error(parser, token);
3687
3687
  is_success = false;
3688
3688
  }
3689
- int i = parser->_parser_state->_open_elements.length - 1;
3690
- while (i > 0) {
3689
+ int i = parser->_parser_state->_open_elements.length;
3690
+ for( --i; i > 0; ) {
3691
3691
  // Here we move up the stack until we find an HTML element (in which
3692
3692
  // case we do nothing) or we find the element that we're about to
3693
3693
  // close (in which case we pop everything we've seen until that
@@ -115,7 +115,7 @@ static void read_char(Utf8Iterator* iter) {
115
115
  // we want. If not, we set the iter_truncated flag, mark this as a bad
116
116
  // character, and adjust the current width so that it consumes the rest of the
117
117
  // iter.
118
- int code_point = c & mask;
118
+ uint64_t code_point = c & mask;
119
119
  if (iter->_start + iter->_width > iter->_end) {
120
120
  iter->_width = iter->_end - iter->_start;
121
121
  add_error(iter, GUMBO_ERR_UTF8_TRUNCATED);
@@ -136,6 +136,7 @@ static void read_char(Utf8Iterator* iter) {
136
136
  }
137
137
  code_point = (code_point << 6) | (c & ~0x80);
138
138
  }
139
+ if (code_point > 0x10FFFF) is_bad_char = true;
139
140
 
140
141
  // If we had a decode error, set the current code point to the replacement
141
142
  // character and flip the flag indicating that a decode error occurred.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nokogumbo
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Ruby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-12 00:00:00.000000000 Z
11
+ date: 2013-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri