Changeset 111 for trunk/src/byteplex.c


Ignore:
Timestamp:
Apr 26, 2008, 8:13:13 AM (11 years ago)
Author:
cameron
Message:

Consolidation of error handling: xml_error.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/byteplex.c

    r103 r111  
    1313#include <sys/stat.h>
    1414#include "byteplex.h"
     15#include "xml_error.h"
    1516#include "multiliteral.h"
    1617#include "bytelex.h"
     
    239240        int bytes_read = CopyAndFill(src, lgth, byte_advance);
    240241        if (bytes_read % 2 != 0) {
    241                 printf("Error: Incomplete code unit at end of file.\n");
    242                 exit(-1);
     242                IncompleteCodeUnitError();
    243243        }
    244244        Set_limits((bytes_read + lgth)/2);
     
    249249        int bytes_read = CopyAndFill(src, lgth, byte_advance);
    250250        if (bytes_read % 4 != 0) {
    251                 printf("Error: Incomplete code unit at end of file.\n");
    252                 exit(-1);
     251                IncompleteCodeUnitError();
    253252        }
    254253        Set_limits((bytes_read + lgth)/4);
     
    270269                                        bytes_to_keep, advance_amt*2);
    271270        if (bytes_read % 2 != 0) {
    272                 printf("Error: Incomplete code unit at end of file.\n");
    273                 exit(-1);
     271                IncompleteCodeUnitError();
    274272        }
    275273        Set_limits((bytes_read + bytes_to_keep)/2);
     
    281279                                        bytes_to_keep, advance_amt*4);
    282280        if (bytes_read % 4 != 0) {
    283                 printf("Error: Incomplete code unit at end of file.\n");
    284                 exit(-1);
     281                IncompleteCodeUnitError();
    285282        }
    286283        Set_limits((bytes_read + bytes_to_keep)/4);
     
    317314        Byteplex * b = ByteplexFactory(e);
    318315        memcpy(b->src_buffer, buffer_bytes, buffer_size);
    319     printf("buffer_bytes = %s\n", buffer_bytes);
     316//printf("buffer_bytes = %s\n", buffer_bytes);
    320317        b->units_in_buffer = buffer_size / e->code_unit_size;
    321318        b->packs_in_buffer = (b->units_in_buffer + PACKSIZE -1)/PACKSIZE;
Note: See TracChangeset for help on using the changeset viewer.