Buffer growth not working in guththila
--------------------------------------

         Key: AXIS2C-43
         URL: http://issues.apache.org/jira/browse/AXIS2C-43
     Project: Axis2-C
        Type: Bug
  Components: Pull Parser - Guththila  
 Environment: windows
    Reporter: Ed Slattery
    Priority: Minor


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 (x)
        /*-  name = x;*/
        /*+*/name->buff = x;
    else
        /*- return NULL;*/
        /*+*/name->size >>= 1;
    return name;
}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to