Use RW_SEEK constants for RWseek()
authorSam Lantinga <slouken@libsdl.org>
Sun, 08 Nov 2009 17:13:36 +0000
changeset 236cce1251de477
parent 235 94dbd5b38765
child 237 d1a4fae44bd0
Use RW_SEEK constants for RWseek()
IMG.c
IMG_bmp.c
IMG_gif.c
IMG_jpg.c
IMG_lbm.c
IMG_pcx.c
IMG_png.c
IMG_pnm.c
IMG_tga.c
IMG_tif.c
IMG_xcf.c
IMG_xpm.c
IMG_xv.c
IMG_xxx.c
     1.1 --- a/IMG.c	Sun Nov 08 15:58:44 2009 +0000
     1.2 +++ b/IMG.c	Sun Nov 08 17:13:36 2009 +0000
     1.3 @@ -156,7 +156,7 @@
     1.4  	}
     1.5  
     1.6  	/* See whether or not this data source can handle seeking */
     1.7 -	if ( SDL_RWseek(src, 0, SEEK_CUR) < 0 ) {
     1.8 +	if ( SDL_RWseek(src, 0, RW_SEEK_CUR) < 0 ) {
     1.9  		IMG_SetError("Can't seek in this data source");
    1.10  		if(freesrc)
    1.11  			SDL_RWclose(src);
     2.1 --- a/IMG_bmp.c	Sun Nov 08 15:58:44 2009 +0000
     2.2 +++ b/IMG_bmp.c	Sun Nov 08 17:13:36 2009 +0000
     2.3 @@ -47,7 +47,7 @@
     2.4  			is_BMP = 1;
     2.5  		}
     2.6  	}
     2.7 -	SDL_RWseek(src, start, SEEK_SET);
     2.8 +	SDL_RWseek(src, start, RW_SEEK_SET);
     2.9  	return(is_BMP);
    2.10  }
    2.11  
    2.12 @@ -70,7 +70,7 @@
    2.13      bfCount = SDL_ReadLE16(src);
    2.14      if ((bfReserved == 0) && (bfType == type) && (bfCount != 0)) 
    2.15      	is_ICOCUR = 1;
    2.16 -	SDL_RWseek(src, start, SEEK_SET);
    2.17 +	SDL_RWseek(src, start, RW_SEEK_SET);
    2.18  
    2.19  	return (is_ICOCUR);
    2.20  }
    2.21 @@ -361,7 +361,7 @@
    2.22  	/* Load the palette, if any */
    2.23  	palette = (surface->format)->palette;
    2.24  	if ( palette ) {
    2.25 -		if ( SDL_RWseek(src, fp_offset+14+biSize, SEEK_SET) < 0 ) {
    2.26 +		if ( SDL_RWseek(src, fp_offset+14+biSize, RW_SEEK_SET) < 0 ) {
    2.27  			SDL_Error(SDL_EFSEEK);
    2.28  			was_error = SDL_TRUE;
    2.29  			goto done;
    2.30 @@ -393,7 +393,7 @@
    2.31  	}
    2.32  
    2.33  	/* Read the surface pixels.  Note that the bmp image is upside down */
    2.34 -	if ( SDL_RWseek(src, fp_offset+bfOffBits, SEEK_SET) < 0 ) {
    2.35 +	if ( SDL_RWseek(src, fp_offset+bfOffBits, RW_SEEK_SET) < 0 ) {
    2.36  		SDL_Error(SDL_EFSEEK);
    2.37  		was_error = SDL_TRUE;
    2.38  		goto done;
    2.39 @@ -489,7 +489,7 @@
    2.40  done:
    2.41  	if ( was_error ) {
    2.42  		if ( src ) {
    2.43 -			SDL_RWseek(src, fp_offset, SEEK_SET);
    2.44 +			SDL_RWseek(src, fp_offset, RW_SEEK_SET);
    2.45  		}
    2.46  		if ( surface ) {
    2.47  			SDL_FreeSurface(surface);
     3.1 --- a/IMG_gif.c	Sun Nov 08 15:58:44 2009 +0000
     3.2 +++ b/IMG_gif.c	Sun Nov 08 17:13:36 2009 +0000
     3.3 @@ -47,7 +47,7 @@
     3.4  			is_GIF = 1;
     3.5  		}
     3.6  	}
     3.7 -	SDL_RWseek(src, start, SEEK_SET);
     3.8 +	SDL_RWseek(src, start, RW_SEEK_SET);
     3.9  	return(is_GIF);
    3.10  }
    3.11  
    3.12 @@ -266,7 +266,7 @@
    3.13  
    3.14  done:
    3.15      if ( image == NULL ) {
    3.16 -        SDL_RWseek(src, start, SEEK_SET);
    3.17 +        SDL_RWseek(src, start, RW_SEEK_SET);
    3.18      }
    3.19      return image;
    3.20  }
     4.1 --- a/IMG_jpg.c	Sun Nov 08 15:58:44 2009 +0000
     4.2 +++ b/IMG_jpg.c	Sun Nov 08 17:13:36 2009 +0000
     4.3 @@ -195,7 +195,7 @@
     4.4  				} else if( (magic[0] != 0xFF) || (magic[1] == 0xFF) ) {
     4.5  					/* Extra padding in JPEG (legal) */
     4.6  					/* or this is data and we are scanning */
     4.7 -					SDL_RWseek(src, -1, SEEK_CUR);
     4.8 +					SDL_RWseek(src, -1, RW_SEEK_CUR);
     4.9  				} else if(magic[1] == 0xD9) {
    4.10  					/* Got to end of good JPEG */
    4.11  					break;
    4.12 @@ -212,7 +212,7 @@
    4.13  					Uint32 end;
    4.14  					start = SDL_RWtell(src);
    4.15  					size = (magic[2] << 8) + magic[3];
    4.16 -					end = SDL_RWseek(src, size-2, SEEK_CUR);
    4.17 +					end = SDL_RWseek(src, size-2, RW_SEEK_CUR);
    4.18  					if ( end != start + size - 2 ) is_JPG = 0;
    4.19  					if ( magic[1] == 0xDA ) {
    4.20  						/* Now comes the actual JPEG meat */
    4.21 @@ -228,7 +228,7 @@
    4.22  			}
    4.23  		}
    4.24  	}
    4.25 -	SDL_RWseek(src, start, SEEK_SET);
    4.26 +	SDL_RWseek(src, start, RW_SEEK_SET);
    4.27  	return(is_JPG);
    4.28  }
    4.29  
    4.30 @@ -393,7 +393,7 @@
    4.31  		if ( surface != NULL ) {
    4.32  			SDL_FreeSurface(surface);
    4.33  		}
    4.34 -		SDL_RWseek(src, start, SEEK_SET);
    4.35 +		SDL_RWseek(src, start, RW_SEEK_SET);
    4.36  		IMG_SetError("JPEG loading error");
    4.37  		return NULL;
    4.38  	}
    4.39 @@ -441,7 +441,7 @@
    4.40  
    4.41  	if ( surface == NULL ) {
    4.42  		lib.jpeg_destroy_decompress(&cinfo);
    4.43 -		SDL_RWseek(src, start, SEEK_SET);
    4.44 +		SDL_RWseek(src, start, RW_SEEK_SET);
    4.45  		IMG_SetError("Out of memory");
    4.46  		return NULL;
    4.47  	}
     5.1 --- a/IMG_lbm.c	Sun Nov 08 15:58:44 2009 +0000
     5.2 +++ b/IMG_lbm.c	Sun Nov 08 17:13:36 2009 +0000
     5.3 @@ -79,7 +79,7 @@
     5.4  			is_LBM = 1;
     5.5  		}
     5.6  	}
     5.7 -	SDL_RWseek(src, start, SEEK_SET);
     5.8 +	SDL_RWseek(src, start, RW_SEEK_SET);
     5.9  	return( is_LBM );
    5.10  }
    5.11  
    5.12 @@ -220,7 +220,7 @@
    5.13  			if ( size & 1 )	++size;  	/* padding ! */
    5.14  			size -= bytesloaded;
    5.15  			/* skip the remaining bytes of this chunk */
    5.16 -			if ( size )	SDL_RWseek( src, size, SEEK_CUR );
    5.17 +			if ( size )	SDL_RWseek( src, size, RW_SEEK_CUR );
    5.18  		}
    5.19  	}
    5.20  
    5.21 @@ -474,7 +474,7 @@
    5.22  
    5.23  	if ( error )
    5.24  	{
    5.25 -		SDL_RWseek(src, start, SEEK_SET);
    5.26 +		SDL_RWseek(src, start, RW_SEEK_SET);
    5.27  		if ( Image ) {
    5.28  			SDL_FreeSurface( Image );
    5.29  			Image = NULL;
     6.1 --- a/IMG_pcx.c	Sun Nov 08 15:58:44 2009 +0000
     6.2 +++ b/IMG_pcx.c	Sun Nov 08 17:13:36 2009 +0000
     6.3 @@ -82,7 +82,7 @@
     6.4  			is_PCX = 1;
     6.5  		}
     6.6  	}
     6.7 -	SDL_RWseek(src, start, SEEK_SET);
     6.8 +	SDL_RWseek(src, start, RW_SEEK_SET);
     6.9  	return(is_PCX);
    6.10  }
    6.11  
    6.12 @@ -250,7 +250,7 @@
    6.13  done:
    6.14  	free(buf);
    6.15  	if ( error ) {
    6.16 -		SDL_RWseek(src, start, SEEK_SET);
    6.17 +		SDL_RWseek(src, start, RW_SEEK_SET);
    6.18  		if ( surface ) {
    6.19  			SDL_FreeSurface(surface);
    6.20  			surface = NULL;
     7.1 --- a/IMG_png.c	Sun Nov 08 15:58:44 2009 +0000
     7.2 +++ b/IMG_png.c	Sun Nov 08 17:13:36 2009 +0000
     7.3 @@ -281,7 +281,7 @@
     7.4  			is_PNG = 1;
     7.5  		}
     7.6  	}
     7.7 -	SDL_RWseek(src, start, SEEK_SET);
     7.8 +	SDL_RWseek(src, start, RW_SEEK_SET);
     7.9  	return(is_PNG);
    7.10  }
    7.11  
    7.12 @@ -492,7 +492,7 @@
    7.13  		free(row_pointers);
    7.14  	}
    7.15  	if ( error ) {
    7.16 -		SDL_RWseek(src, start, SEEK_SET);
    7.17 +		SDL_RWseek(src, start, RW_SEEK_SET);
    7.18  		if ( surface ) {
    7.19  			SDL_FreeSurface(surface);
    7.20  			surface = NULL;
     8.1 --- a/IMG_pnm.c	Sun Nov 08 15:58:44 2009 +0000
     8.2 +++ b/IMG_pnm.c	Sun Nov 08 17:13:36 2009 +0000
     8.3 @@ -63,7 +63,7 @@
     8.4  			is_PNM = 1;
     8.5  		}
     8.6  	}
     8.7 -	SDL_RWseek(src, start, SEEK_SET);
     8.8 +	SDL_RWseek(src, start, RW_SEEK_SET);
     8.9  	return(is_PNM);
    8.10  }
    8.11  
    8.12 @@ -232,7 +232,7 @@
    8.13  done:
    8.14  	free(buf);
    8.15  	if(error) {
    8.16 -		SDL_RWseek(src, start, SEEK_SET);
    8.17 +		SDL_RWseek(src, start, RW_SEEK_SET);
    8.18  		if ( surface ) {
    8.19  			SDL_FreeSurface(surface);
    8.20  			surface = NULL;
     9.1 --- a/IMG_tga.c	Sun Nov 08 15:58:44 2009 +0000
     9.2 +++ b/IMG_tga.c	Sun Nov 08 17:13:36 2009 +0000
     9.3 @@ -189,7 +189,7 @@
     9.4          goto unsupported;
     9.5      }
     9.6      
     9.7 -    SDL_RWseek(src, hdr.infolen, SEEK_CUR); /* skip info field */
     9.8 +    SDL_RWseek(src, hdr.infolen, RW_SEEK_CUR); /* skip info field */
     9.9  
    9.10      w = LE16(hdr.width);
    9.11      h = LE16(hdr.height);
    9.12 @@ -235,7 +235,7 @@
    9.13  		SDL_SetColorKey(img, SDL_SRCCOLORKEY, ckey);
    9.14  	} else {
    9.15  	    /* skip unneeded colormap */
    9.16 -	    SDL_RWseek(src, palsiz, SEEK_CUR);
    9.17 +	    SDL_RWseek(src, palsiz, RW_SEEK_CUR);
    9.18  	}
    9.19      }
    9.20  
    9.21 @@ -312,7 +312,7 @@
    9.22      error = "Unsupported TGA format";
    9.23  
    9.24  error:
    9.25 -    SDL_RWseek(src, start, SEEK_SET);
    9.26 +    SDL_RWseek(src, start, RW_SEEK_SET);
    9.27      if ( img ) {
    9.28          SDL_FreeSurface(img);
    9.29      }
    10.1 --- a/IMG_tif.c	Sun Nov 08 15:58:44 2009 +0000
    10.2 +++ b/IMG_tif.c	Sun Nov 08 17:13:36 2009 +0000
    10.3 @@ -168,9 +168,9 @@
    10.4  	toff_t size;
    10.5  
    10.6  	save_pos = SDL_RWtell((SDL_RWops*)fd);
    10.7 -	SDL_RWseek((SDL_RWops*)fd, 0, SEEK_END);
    10.8 +	SDL_RWseek((SDL_RWops*)fd, 0, RW_SEEK_END);
    10.9          size = SDL_RWtell((SDL_RWops*)fd);
   10.10 -	SDL_RWseek((SDL_RWops*)fd, save_pos, SEEK_SET);
   10.11 +	SDL_RWseek((SDL_RWops*)fd, save_pos, RW_SEEK_SET);
   10.12  	return size;
   10.13  }
   10.14  
   10.15 @@ -196,7 +196,7 @@
   10.16  			is_TIF = 1;
   10.17  		}
   10.18  	}
   10.19 -	SDL_RWseek(src, start, SEEK_SET);
   10.20 +	SDL_RWseek(src, start, RW_SEEK_SET);
   10.21  	return(is_TIF);
   10.22  }
   10.23  
   10.24 @@ -261,7 +261,7 @@
   10.25  	return surface;
   10.26  
   10.27  error:
   10.28 -	SDL_RWseek(src, start, SEEK_SET);
   10.29 +	SDL_RWseek(src, start, RW_SEEK_SET);
   10.30  	if ( surface ) {
   10.31  		SDL_FreeSurface(surface);
   10.32  	}
    11.1 --- a/IMG_xcf.c	Sun Nov 08 15:58:44 2009 +0000
    11.2 +++ b/IMG_xcf.c	Sun Nov 08 17:13:36 2009 +0000
    11.3 @@ -222,7 +222,7 @@
    11.4  			is_XCF = 1;
    11.5  		}
    11.6  	}
    11.7 -	SDL_RWseek(src, start, SEEK_SET);
    11.8 +	SDL_RWseek(src, start, RW_SEEK_SET);
    11.9  	return(is_XCF);
   11.10  }
   11.11  
   11.12 @@ -282,7 +282,7 @@
   11.13      break;
   11.14    default:
   11.15      //    SDL_RWread (src, &prop->data, prop->length, 1);
   11.16 -    SDL_RWseek (src, prop->length, SEEK_CUR);
   11.17 +    SDL_RWseek (src, prop->length, RW_SEEK_CUR);
   11.18    }
   11.19  }
   11.20  
   11.21 @@ -553,17 +553,17 @@
   11.22    int x, y, tx, ty, ox, oy, i, j;
   11.23    Uint32 *row;
   11.24  
   11.25 -  SDL_RWseek (src, layer->hierarchy_file_offset, SEEK_SET);
   11.26 +  SDL_RWseek (src, layer->hierarchy_file_offset, RW_SEEK_SET);
   11.27    hierarchy = read_xcf_hierarchy (src);
   11.28  
   11.29    level = NULL;
   11.30    for (i = 0; hierarchy->level_file_offsets [i]; i++) {
   11.31 -    SDL_RWseek (src, hierarchy->level_file_offsets [i], SEEK_SET);
   11.32 +    SDL_RWseek (src, hierarchy->level_file_offsets [i], RW_SEEK_SET);
   11.33      level = read_xcf_level (src);
   11.34  
   11.35      ty = tx = 0;
   11.36      for (j = 0; level->tile_file_offsets [j]; j++) {
   11.37 -      SDL_RWseek (src, level->tile_file_offsets [j], SEEK_SET);
   11.38 +      SDL_RWseek (src, level->tile_file_offsets [j], RW_SEEK_SET);
   11.39        ox = tx+64 > level->width ? level->width % 64 : 64;
   11.40        oy = ty+64 > level->height ? level->height % 64 : 64;
   11.41  
   11.42 @@ -739,7 +739,7 @@
   11.43    // Blit layers backwards, because Gimp saves them highest first
   11.44    for (i = offsets; i > 0; i--) {
   11.45      SDL_Rect rs, rd;
   11.46 -    SDL_RWseek (src, head->layer_file_offsets [i-1], SEEK_SET);
   11.47 +    SDL_RWseek (src, head->layer_file_offsets [i-1], RW_SEEK_SET);
   11.48  
   11.49      layer = read_xcf_layer (src);
   11.50      do_layer_surface (lays, src, head, layer, load_tile);
   11.51 @@ -759,7 +759,7 @@
   11.52  
   11.53    SDL_FreeSurface (lays);
   11.54  
   11.55 -  SDL_RWseek (src, fp, SEEK_SET);
   11.56 +  SDL_RWseek (src, fp, RW_SEEK_SET);
   11.57  
   11.58    // read channels
   11.59    channel = NULL;
   11.60 @@ -767,9 +767,9 @@
   11.61    while ((offset = SDL_ReadBE32 (src))) {
   11.62      channel = (xcf_channel **) realloc (channel, sizeof (xcf_channel *) * (chnls+1));
   11.63      fp = SDL_RWtell (src);
   11.64 -    SDL_RWseek (src, offset, SEEK_SET);
   11.65 +    SDL_RWseek (src, offset, RW_SEEK_SET);
   11.66      channel [chnls++] = (read_xcf_channel (src));
   11.67 -    SDL_RWseek (src, fp, SEEK_SET);    
   11.68 +    SDL_RWseek (src, fp, RW_SEEK_SET);    
   11.69    }
   11.70  
   11.71    if (chnls) {
   11.72 @@ -797,7 +797,7 @@
   11.73  done:
   11.74    free_xcf_header (head);
   11.75    if ( error ) {
   11.76 -    SDL_RWseek(src, start, SEEK_SET);
   11.77 +    SDL_RWseek(src, start, RW_SEEK_SET);
   11.78      if ( surface ) {
   11.79        SDL_FreeSurface(surface);
   11.80        surface = NULL;
    12.1 --- a/IMG_xpm.c	Sun Nov 08 15:58:44 2009 +0000
    12.2 +++ b/IMG_xpm.c	Sun Nov 08 17:13:36 2009 +0000
    12.3 @@ -68,7 +68,7 @@
    12.4  			is_XPM = 1;
    12.5  		}
    12.6  	}
    12.7 -	SDL_RWseek(src, start, SEEK_SET);
    12.8 +	SDL_RWseek(src, start, RW_SEEK_SET);
    12.9  	return(is_XPM);
   12.10  }
   12.11  
   12.12 @@ -457,7 +457,7 @@
   12.13  done:
   12.14  	if(error) {
   12.15  		if ( src )
   12.16 -			SDL_RWseek(src, start, SEEK_SET);
   12.17 +			SDL_RWseek(src, start, RW_SEEK_SET);
   12.18  		if ( image ) {
   12.19  			SDL_FreeSurface(image);
   12.20  			image = NULL;
    13.1 --- a/IMG_xv.c	Sun Nov 08 15:58:44 2009 +0000
    13.2 +++ b/IMG_xv.c	Sun Nov 08 17:13:36 2009 +0000
    13.3 @@ -96,7 +96,7 @@
    13.4  	if ( get_header(src, &w, &h) == 0 ) {
    13.5  		is_XV = 1;
    13.6  	}
    13.7 -	SDL_RWseek(src, start, SEEK_SET);
    13.8 +	SDL_RWseek(src, start, RW_SEEK_SET);
    13.9  	return(is_XV);
   13.10  }
   13.11  
   13.12 @@ -139,7 +139,7 @@
   13.13  
   13.14  done:
   13.15  	if ( error ) {
   13.16 -		SDL_RWseek(src, start, SEEK_SET);
   13.17 +		SDL_RWseek(src, start, RW_SEEK_SET);
   13.18  		if ( surface ) {
   13.19  			SDL_FreeSurface(surface);
   13.20  			surface = NULL;
    14.1 --- a/IMG_xxx.c	Sun Nov 08 15:58:44 2009 +0000
    14.2 +++ b/IMG_xxx.c	Sun Nov 08 17:13:36 2009 +0000
    14.3 @@ -41,7 +41,7 @@
    14.4  
    14.5  	/* Detect the image here */
    14.6  
    14.7 -	SDL_RWseek(src, start, SEEK_SET);
    14.8 +	SDL_RWseek(src, start, RW_SEEK_SET);
    14.9  	return(is_XXX);
   14.10  }
   14.11  
   14.12 @@ -61,7 +61,7 @@
   14.13  	/* Load the image here */
   14.14  
   14.15  	if ( error ) {
   14.16 -		SDL_RWseek(src, start, SEEK_SET);
   14.17 +		SDL_RWseek(src, start, RW_SEEK_SET);
   14.18  		if ( surface ) {
   14.19  			SDL_FreeSurface(surface);
   14.20  			surface = NULL;