Ignore:
Timestamp:
12/27/07 12:14:01 (7 years ago)
Author:
xi
Message:

Another round of API update.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libyaml/trunk/src/writer.c

    r263 r264  
    2828    } 
    2929 
    30     /* Switch the pointer to the beginning of the buffer. */ 
     30    /* Switch the buffer into the input mode. */ 
    3131 
    32     emitter->output.capacity = emitter->output.pointer; 
     32    emitter->output.length = emitter->output.pointer; 
    3333    emitter->output.pointer = 0; 
    3434 
     
    3838    { 
    3939        if (emitter->writer(emitter->writer_data, 
    40                     emitter->output.buffer, emitter->output.capacity)) { 
    41             emitter->offset += emitter->output.capacity; 
    42             emitter->output.capacity = OUTPUT_BUFFER_CAPACITY; 
     40                    emitter->output.buffer, emitter->output.length)) { 
     41            emitter->offset += emitter->output.length; 
     42            emitter->output.length = 0; 
    4343            return 1; 
    4444        } 
    4545        else { 
    46             return WRITER_ERROR_INIT(emitter, "Write error", emitter->offset); 
     46            return WRITER_ERROR_INIT(emitter, 
     47                    "write handler error", emitter->offset); 
    4748        } 
    4849    } 
     
    5354    high = (emitter->encoding == YAML_UTF16LE_ENCODING ? 1 : 0); 
    5455 
    55     while (emitter->output.pointer != emitter->output.capacity) 
     56    while (emitter->output.pointer < emitter->output.length) 
    5657    { 
    5758        unsigned char octet; 
     
    114115                emitter->raw_output.buffer, emitter->raw_output.pointer)) { 
    115116        emitter->output.pointer = 0; 
    116         emitter->output.capacity = OUTPUT_BUFFER_CAPACITY; 
     117        emitter->output.length = 0; 
    117118        emitter->offset += emitter->raw_output.pointer; 
    118119        emitter->raw_output.pointer = 0; 
     
    120121    } 
    121122    else { 
    122         return WRITER_ERROR_INIT(emitter, "Write error", emitter->offset); 
     123        return WRITER_ERROR_INIT(emitter, 
     124                "write handler error", emitter->offset); 
    123125    } 
    124126} 
Note: See TracChangeset for help on using the changeset viewer.