003-clean_up_swlibs-000, swlibs tree cleanup.

This commit is contained in:
mercury
2000-10-03 18:31:53 +00:00
parent fba7cae79d
commit 098165b921
9 changed files with 38 additions and 35 deletions

View File

@@ -197,7 +197,7 @@ FxBool _imgGuessType( FILE *stream, ImgType *type )
case 0xDA01:
*type = IMG_RGT;
break;
case 'EL':
case (('E' << 8) | 'L'):
cookie = 0;
if ( ( c = fgetc( stream ) ) == EOF )
{
@@ -211,7 +211,7 @@ FxBool _imgGuessType( FILE *stream, ImgType *type )
return FXFALSE;
}
cookie = (cookie << 8) | c;
if (cookie == 'RS')
if (cookie == (('R' << 8) | 'S'))
*type = IMG_SRLE;
break;
default: // Might Be TGA
@@ -1409,7 +1409,7 @@ FxBool _imgReadSRLEData( FILE *stream, const SrleInfo *info, ImgData *data )
{
int numPixels;
FxU16 color;
FxU8 r,g,b,a;
FxU8 r = 0, g = 0, b = 0, a = 0;
FxU8 ctl, repeat, run;
FxBool flag;
@@ -1470,9 +1470,9 @@ FxBool _imgWriteP6Header( FILE *stream, const P6Info *info )
{
imgErrorString = "Image write error.";
if ( 0 > fprintf( stream, "P6\n" ) ) return FXFALSE;
if ( 0 > fprintf( stream, "# PPM Comment\n", info->width ) ) return FXFALSE;
if ( 0 > fprintf( stream, "%d ", info->width ) ) return FXFALSE;
if ( 0 > fprintf( stream, "%d\n", info->height ) ) return FXFALSE;
if ( 0 > fprintf( stream, "# PPM Comment\n" ) ) return FXFALSE;
if ( 0 > fprintf( stream, "%ld ", info->width ) ) return FXFALSE;
if ( 0 > fprintf( stream, "%ld\n", info->height ) ) return FXFALSE;
if ( 0 > fprintf( stream, "255\n" ) ) return FXFALSE;
imgErrorString = "No error.";
return FXTRUE;
@@ -1487,11 +1487,11 @@ FxBool _imgWriteSbiHeader( FILE *stream, const SbiInfo *info )
imgErrorString = "Image write error.";
if ( 0 > fprintf( stream, "P9\n" ) ) return FXFALSE;
if ( 0 > !fprintf( stream, "Y%c\n", info->yOrigin? '+' : '-' ) ) return FXFALSE;
if ( 0 > !fprintf( stream, "%d ", info->width ) ) return FXFALSE;
if ( 0 > !fprintf( stream, "%d\n", info->height ) ) return FXFALSE;
if ( 0 > !fprintf( stream, "R %d ", info->redBits ) ) return FXFALSE;
if ( 0 > !fprintf( stream, "G %d ", info->greenBits ) ) return FXFALSE;
if ( 0 > !fprintf( stream, "B %d\n", info->blueBits ) ) return FXFALSE;
if ( 0 > !fprintf( stream, "%ld ", info->width ) ) return FXFALSE;
if ( 0 > !fprintf( stream, "%ld\n", info->height ) ) return FXFALSE;
if ( 0 > !fprintf( stream, "R %ld ", info->redBits ) ) return FXFALSE;
if ( 0 > !fprintf( stream, "G %ld ", info->greenBits ) ) return FXFALSE;
if ( 0 > !fprintf( stream, "B %ld\n", info->blueBits ) ) return FXFALSE;
imgErrorString = "No Error.";
return FXTRUE;
}
@@ -1948,11 +1948,11 @@ FxBool imgReadFile(const char *filename, ImgInfo *info)
if (prefix) { // if there's a path prefix
char buf[1024], *p;
strcpy(buf,prefix); // copy and replace semicolon
if (p = strchr(buf,';')) *p = '\0';
if ((p = strchr(buf,';'))) *p = '\0';
fprintf(stderr,buf);
fprintf(stderr,"/");
}
fprintf (stderr,"%s (%dx%d) ...", filename, info->any.width,info->any.height);
fprintf (stderr,"%s (%ldx%ld) ...", filename, info->any.width,info->any.height);
fflush(stderr);
if ( imgReadData( file, info ) == FXFALSE ) {
@@ -1981,7 +1981,7 @@ FxBool imgWriteFile(const char *filename, const ImgInfo *info, const ImgType typ
exit(2);
}
tempInfo.any.type = type; // set the new type
fprintf(stderr,"Storing %s image file %s (%dx%d) ...",
fprintf(stderr,"Storing %s image file %s (%ldx%ld) ...",
imgTypeName(&tempInfo), filename, info->any.width,info->any.height);
fflush(stderr);

View File

@@ -98,7 +98,7 @@ FILE *fxFopenPath(const char *filename, const char *mode, const char *path, cons
// first try and open up the file in the current directory
if (pprefix) *pprefix = NULL;
if (file = fopen(filename,mode))
if ((file = fopen(filename,mode)))
return file;
if (path == NULL)
return NULL;
@@ -115,7 +115,7 @@ FILE *fxFopenPath(const char *filename, const char *mode, const char *path, cons
strcat(nameWithPath,"/"); // add directory separator
strcat(nameWithPath,filename); // add filename
if (pprefix) *pprefix = path; // save the prefix
if (file = fopen(nameWithPath,mode))
if ((file = fopen(nameWithPath,mode)))
return file;
path = psemi; // advance to next path element
if (path)

View File

@@ -27,7 +27,7 @@
#include <stdlib.h>
#include "linutil.h"
static init_done=0;
static int init_done=0;
static struct termios save_termdata;
static void reset_term() {

View File

@@ -108,7 +108,7 @@ static PCIErr pciError[] = {
FX_ENTRY FxU8 FX_CALL
pioInByte ( unsigned short port )
{
FxU8 data;
FxU8 data = 0;
if (pciHwcCallbacks.pioInByte)
data = pciHwcCallbacks.pioInByte(port);
@@ -120,7 +120,7 @@ pioInByte ( unsigned short port )
FX_ENTRY FxU16 FX_CALL
pioInWord ( unsigned short port )
{
FxU16 data;
FxU16 data = 0;
if (pciHwcCallbacks.pioInWord)
data = pciHwcCallbacks.pioInWord(port);
@@ -132,7 +132,7 @@ pioInWord ( unsigned short port )
FX_ENTRY FxU32 FX_CALL
pioInLong ( unsigned short port )
{
FxU32 data;
FxU32 data = 0;
if (pciHwcCallbacks.pioInLong)
data = pciHwcCallbacks.pioInLong(port);
@@ -245,14 +245,14 @@ static void printDeviceList(pciDeviceNode *head)
while(head)
{
printf("bus %d slot %d function %d vendorID 0x%x deviceID 0x%x\n",
printf("bus %ld slot %ld function %ld vendorID 0x%lx deviceID 0x%lx\n",
head->bus, head->slot, head->function, head->vendorID,
head->deviceID);
for(index=0; index<MAX_PCI_BASEADDRESSES; index++)
{
if(head->addresses[index].mapped)
printf(" %s virtual address: 0x%x\n", baseName[index],
printf(" %s virtual address: 0x%lx\n", baseName[index],
head->addresses[index].virtualAddress);
}
@@ -479,7 +479,7 @@ pciGetErrorString( void )
{
static char vxdErrString[120];
if (pciErrorCode == PCI_ERR_WRONGVXD) {
sprintf(vxdErrString, "Expected VXD version V%d.%d, got V%d.%d\n",
sprintf(vxdErrString, "Expected VXD version V%d.%d, got V%ld.%ld\n",
FX_MAJOR_VER, FX_MINOR_VER,
BYTE1(pciVxdVer), BYTE0(pciVxdVer));
return vxdErrString;

View File

@@ -29,10 +29,10 @@
#include "texusint.h"
static int
dithmat[4][4] = { 0, 8, 2, 10,
12, 4, 14, 6,
3, 11, 1, 9,
15, 7, 13, 5 };
dithmat[4][4] = { { 0, 8, 2, 10 },
{ 12, 4, 14, 6 },
{ 3, 11, 1, 9 },
{ 15, 7, 13, 5 }};
static struct {
int yhist[256], ihist[256], qhist[256];

View File

@@ -412,7 +412,7 @@ txMipNccNNet(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 comp)
txMapPal256toYAB((FxU32 *)yabTable, (FxU8 *)map, ncolors, (FxU32 *)pxMip->pal);
if( txVerbose )
{
printf("eMax=(%3d%3d%3d)...eAvg=(%3d%3d%3d)\n",
printf("eMax=(%3ld%3ld%3ld)...eAvg=(%3ld%3ld%3ld)\n",
errG, errR, errB,
totG/ncolors, totR/ncolors, totB/ncolors
);

View File

@@ -52,9 +52,12 @@
unsigned char inverse_pal[1<<INVERSE_PAL_TOTAL_BITS];
#endif
/* At least the GNU libc declares these.. */
#ifndef __GNUC__
typedef unsigned long ulong;
typedef unsigned char uchar;
typedef unsigned short ushort;
#endif
typedef unsigned char uchar;
#ifdef HUGE
#undef HUGE

View File

@@ -30,10 +30,10 @@
#include "texusint.h"
static int
dithmat[4][4] = { 0, 8, 2, 10,
12, 4, 14, 6,
3, 11, 1, 9,
15, 7, 13, 5 };
dithmat[4][4] = { { 0, 8, 2, 10 },
{ 12, 4, 14, 6 },
{ 3, 11, 1, 9 },
{ 15, 7, 13, 5 }};
// for error diffusion.
static int errR[MAX_TEXWIDTH], errG[MAX_TEXWIDTH], errB[MAX_TEXWIDTH];
@@ -498,7 +498,7 @@ _txPixQuantize_AI88( unsigned long argb, int x, int y, int w)
static void
_txImgQuantize(char *dst, char *src, int w, int h, FxU32 format, FxU32 dither)
{
int (*quantizer)(unsigned long argb, int x, int y, int w);
int (*quantizer)(unsigned long argb, int x, int y, int w) = NULL;
int x, y;
dither &= TX_DITHER_MASK;

View File

@@ -43,7 +43,7 @@ _txReadHeader( FILE *stream, TxMip *info )
FxU32 cookie;
int c;
int fformat; // format of the image file.
int status;
int status = 0;
if ( stream == NULL ) {
txError("Bad file handle.");