IMG_xcf.c
changeset 82 fac87f1baeae
parent 80 e793c7a63324
child 95 7fcb46931afc
     1.1 --- a/IMG_xcf.c	Fri Feb 21 16:52:02 2003 +0000
     1.2 +++ b/IMG_xcf.c	Fri Feb 21 17:24:03 2003 +0000
     1.3 @@ -678,15 +678,15 @@
     1.4  
     1.5    unsigned char * (* load_tile) (SDL_RWops *, Uint32, int, int, int);
     1.6  
     1.7 +  /* Check to make sure we have something to do */
     1.8 +  if ( ! src ) {
     1.9 +    return NULL;
    1.10 +  }
    1.11 +
    1.12    /* Initialize the data we will clean up when we're done */
    1.13    surface = NULL;
    1.14    read_error = 0;
    1.15  
    1.16 -  /* Check to make sure we have something to do */
    1.17 -  if ( ! src ) {
    1.18 -    goto done;
    1.19 -  }
    1.20 -
    1.21    head = read_xcf_header (src);
    1.22  
    1.23    switch (head->compr) {
    1.24 @@ -714,7 +714,7 @@
    1.25    head->layer_file_offsets = NULL;
    1.26    offsets = 0;
    1.27  
    1.28 -  while (offset = SDL_ReadBE32 (src)) {
    1.29 +  while ((offset = SDL_ReadBE32 (src))) {
    1.30      head->layer_file_offsets = (Uint32 *) realloc (head->layer_file_offsets, sizeof (Uint32) * (offsets+1));
    1.31      head->layer_file_offsets [offsets] = offset;
    1.32      offsets++;
    1.33 @@ -757,7 +757,7 @@
    1.34    // read channels
    1.35    channel = NULL;
    1.36    chnls   = 0;
    1.37 -  while (offset = SDL_ReadBE32 (src)) {
    1.38 +  while ((offset = SDL_ReadBE32 (src))) {
    1.39      channel = (xcf_channel **) realloc (channel, sizeof (xcf_channel *) * (chnls+1));
    1.40      fp = SDL_RWtell (src);
    1.41      SDL_RWseek (src, offset, SEEK_SET);