Uploaded image for project: 'Axis2-C'
  1. Axis2-C
  2. AXIS2C-43

Buffer growth not working in guththila

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • None
    • guththila
    • None
    • windows

    Description

      I am not sure the current buffer growth in guththila is really growing the buffer. It appears to me
      to be growing the structure containing the buffer, but leaving the buffer at its original size.
      I also think the call to the growth routine may be reversing the new and old offsets such that the final
      offset if negative. Here are patches which I think are necessary.

      from guththila_xml_pull_parser.c...

      GUTHTHILA_DECLARE (int)
      guththila_xml_pull_parser_read (guththila_environment_t * environment,
      guththila_xml_pull_parser_t * parser)
      {
      int c = 0;
      if (parser->_next == parser->buffer->size)
      {
      if (parser->offset > 0)

      { guththila_xml_pull_parser_relocate_tokens (environment, parser, parser->offset); guththila_xml_pull_parser_shift (environment, parser); }

      else

      { /*- guththila_buffer_t *b = NULL; b = parser->buffer; */ /*+*/ int b = parser->buffer->size; parser->buffer = guththila_buffer_grow (environment, parser->buffer); /*- guththila_xml_pull_parser_relocate_tokens ( environment, parser, (b->size - parser->buffer->size));*/ /*+*/guththila_xml_pull_parser_relocate_tokens ( /*+*/ environment, parser, (parser->buffer->size - b)); }

      }
      c = guththila_reader_read (environment, (parser->buffer->buff),
      (parser->_next),
      (parser->buffer->size) - (parser->_next),
      parser->reader);
      parser->last += c;
      return !c;
      }

      from guththila_buffer.c...

      GUTHTHILA_DECLARE (guththila_buffer_t *)
      guththila_buffer_grow (guththila_environment_t * environment,
      guththila_buffer_t * name)
      {

      /+/guththila_char_t *x = NULL;
      /*- guththila_buffer_t *x = NULL; */
      name->size <<= 1;
      /+/x = (guththila_char_t *) GUTHTHILA_REALLOC (environment->allocator,
      /+/ name->buff,name->size);
      /*- x = (guththila_buffer_t *) GUTHTHILA_REALLOC (environment->allocator,
      name, name->size); */
      if
      /- name = x;/
      /+/name->buff = x;
      else
      /- return NULL;/
      /+/name->size >>= 1;
      return name;
      }

      Attachments

        Activity

          People

            xydinesh Dinesh Weerapurage
            edslattery Edward Slattery
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: