a bunch of warning fixes

This commit is contained in:
sezero
2018-08-19 23:55:10 +03:00
parent ed2350c8f0
commit 1488d68cff
25 changed files with 401 additions and 399 deletions

View File

@@ -50,8 +50,9 @@
else printf("%s\tequ %10d\n",pname,((int)&o)-(int)&p)
#define SIZEOF(p,pname) if (hex) \
printf("SIZEOF_%s\tequ %08lxh\n",pname,sizeof(p)); \
else printf("SIZEOF_%s\tequ %10ld\n",pname,sizeof(p))
printf("SIZEOF_%s\tequ %08lxh\n",pname,(unsigned long)sizeof(p)); \
else printf("SIZEOF_%s\tequ %10lu\n",pname,(unsigned long)sizeof(p))
int
main (int argc, char **argv)
@@ -67,7 +68,7 @@ main (int argc, char **argv)
if (argc > 1) {
if (strcmp("-inline", argv[1]) == 0) {
SstRegs dummyRegs = { 0x00UL };
SstRegs dummyRegs = { 0x00UL }; /* silence VC6 */
printf("#ifndef __FX_INLINE_H__\n");
printf("#define __FX_INLINE_H__\n");
@@ -75,14 +76,14 @@ main (int argc, char **argv)
#if GLIDE_DISPATCH_SETUP
printf("#define kCurGCOffset 0x%lXUL\n",
offsetof(struct _GlideRoot_s, curGC));
(unsigned long)offsetof(struct _GlideRoot_s, curGC));
printf("#define kTriProcOffset 0x%lXUL\n",
offsetof(struct GrGC_s, curArchProcs.triSetupProc));
(unsigned long)offsetof(struct GrGC_s, curArchProcs.triSetupProc));
#endif /* GLIDE_DISPATCH_SETUP */
printf("/* The # of 2-byte entries in the hw fog table */\n");
printf("#define kInternalFogTableEntryCount 0x%lXUL\n",
sizeof(dummyRegs.fogTable) >> 1);
printf("#define kInternalFogTableEntryCount 0x%X\n",
(unsigned int)sizeof(dummyRegs.fogTable) >> 1);
printf("\n");
printf("#endif /* __FX_INLINE_H__ */\n");
@@ -153,8 +154,7 @@ main (int argc, char **argv)
NEWLINE;
HEADER ("GrVertex");
{
GrVertex v;
{ GrVertex v;
OFFSET(v, x, "x");
OFFSET(v, y, "y");

View File

@@ -50,8 +50,9 @@
else printf("%s\tequ %10d\n",pname,((int)&o)-(int)&p)
#define SIZEOF(p,pname) if (hex) \
printf("SIZEOF_%s\tequ %08xh\n",pname,sizeof(p)); \
else printf("SIZEOF_%s\tequ %10d\n",pname,sizeof(p))
printf("SIZEOF_%s\tequ %08lxh\n",pname,(unsigned long)sizeof(p)); \
else printf("SIZEOF_%s\tequ %10lu\n",pname,(unsigned long)sizeof(p))
int
main (int argc, char **argv)
@@ -67,23 +68,23 @@ main (int argc, char **argv)
if (argc > 1) {
if (strcmp("-inline", argv[1]) == 0) {
SstRegs dummyRegs = { 0x00UL };
SstRegs dummyRegs = { 0x00UL }; /* silence VC6 */
printf("#ifndef __FX_INLINE_H__\n");
printf("#define __FX_INLINE_H__\n");
printf("\n");
#if GLIDE_DISPATCH_SETUP
printf("#define kCurGCOffset 0x%XUL\n",
offsetof(struct _GlideRoot_s, curGC));
printf("#define kCurGCOffset 0x%lXUL\n",
(unsigned long)offsetof(struct _GlideRoot_s, curGC));
printf("#define kTriProcOffset 0x%XUL\n",
offsetof(struct GrGC_s, archDispatchProcs.triSetupProc));
printf("#define kTriProcOffset 0x%lXUL\n",
(unsigned long)offsetof(struct GrGC_s, archDispatchProcs.triSetupProc));
#endif /* GLIDE_DISPATCH_SETUP */
printf("/* The # of 2-byte entries in the hw fog table */\n");
printf("#define kInternalFogTableEntryCount 0x%XUL\n",
sizeof(dummyRegs.fogTable) >> 1);
printf("#define kInternalFogTableEntryCount 0x%X\n",
(unsigned int)sizeof(dummyRegs.fogTable) >> 1);
printf("\n");
printf("#endif /* __FX_INLINE_H__ */\n");
@@ -225,8 +226,7 @@ main (int argc, char **argv)
NEWLINE;
HEADER ("GrVertex");
{
GrVertex v;
{ GrVertex v;
OFFSET(v, x, "x");
OFFSET(v, y, "y");

View File

@@ -55,13 +55,14 @@
else printf("%s\tequ %10d\n",pname,((int)&o)-(int)&p)
#define SIZEOF(p,pname) if (hex) \
printf("SIZEOF_%s\tequ %08lxh\n",pname,sizeof(p)); \
else printf("SIZEOF_%s\tequ %10ld\n",pname,sizeof(p))
printf("SIZEOF_%s\tequ %08lxh\n",pname,(unsigned long)sizeof(p)); \
else printf("SIZEOF_%s\tequ %10lu\n",pname,(unsigned long)sizeof(p))
#define CONST(name) if (hex) \
printf(#name " equ 0%xh\n", name); \
else printf(#name " equ %d\n", name)
int
main (int argc, char **argv)
{
@@ -73,15 +74,15 @@ main (int argc, char **argv)
if (argc > 1) {
if (strcmp("-inline", argv[1]) == 0) {
Sstregs dummyRegs = { 0x00UL };
Sstregs dummyRegs = { 0x00UL }; /* silence VC6 */
printf("#ifndef __FX_INLINE_H__\n");
printf("#define __FX_INLINE_H__\n");
printf("\n");
printf("/* The # of 2-byte entries in the hw fog table */\n");
printf("#define kInternalFogTableEntryCount 0x%XUL\n",
sizeof(dummyRegs.fogTable) >> 1);
printf("#define kInternalFogTableEntryCount 0x%X\n",
(unsigned int)sizeof(dummyRegs.fogTable) >> 1);
printf("\n");
printf("#endif /* __FX_INLINE_H__ */\n");

View File

@@ -26,16 +26,16 @@
#include <stdlib.h>
#if defined(__WATCOMC__)
#include <conio.h>
#define _inp inp
#define _outp outp
#define _outpw outpw
#endif
#if defined(__linux__)
#if defined(__linux__)
#define _inp(port) pioInByte(port)
#define _outp(port, data) pioOutByte(port, data)
#define _outpw(port, data) pioOutWord(port, data);
#endif
#include <init96.h>
@@ -66,7 +66,6 @@ static inline void _outp_asm (unsigned short _port, unsigned char _data) {
Module Constants
-------------------------------------------------------------------*/
static InitContext
contexts[NUM_3DFX_PRODUCTS]; /* pool of device contexts */
InitContext
@@ -212,7 +211,6 @@ initEnumHardware( InitHWEnumCallback *cb )
}
}
/* Sanity Check for SLI detection */
for( device = 0; device < numDevicesInSystem; device++ ) {
if ( hwInfo[device].hwClass == INIT_VOODOO &&
@@ -672,7 +670,6 @@ void initIOCtl( FxU32 token, void *argument ) {
-------------------------------------------------------------------*/
FxBool initControl( FxU32 code)
{
FxBool rv;
GDBG_INFO((80, "initControl: code = %d, context=%.08x\n", code, context));

View File

@@ -727,11 +727,11 @@ dxControl(FxU32 code, InitBufDesc_t *pBufDesc, int *width, int *height)
} /* dxControl */
FxBool
dxClose()
dxClose(void)
{
GDBG_INFO((80, "dxClose:\n"));
/*
* fixme! nulling out this code fixes bug 541... why is unclear??? XXX
/* fixme! nulling out this code fixes bug 541... why is unclear??? XXX
* A little more information... the problem is releasing lpDD1, and
* only in fullscreen mode. Temporary refined hack is to not release
* lpDD1 in fullscreen mode. Also rearrange code in dxAllocSurfaces
@@ -746,6 +746,7 @@ dxClose()
}
if( lpAux ) IDirectDrawSurface2_Release( lpAux );
if( lpDD ) IDirectDraw2_Release( lpDD );
if (1 /* !IsFullScreen */) {
if( lpDD1 ) IDirectDraw_Release( lpDD1 );
lpDD1 = NULL;
@@ -757,8 +758,8 @@ dxClose()
lpTriple = NULL;
lpAux = NULL;
lpDD = NULL;
#endif /* 0 */
GDBG_INFO((80, "dxClose: Returning TRUE\n"));
return FXTRUE;
} /* dxClose */
@@ -973,7 +974,7 @@ dxControl(FxU32 code, InitBufDesc_t *pBufDesc, int *width, int *height)
return FXTRUE;
} /* dxControl */
FxBool
dxClose()
dxClose(void)
{
#define FN_NAME "dxClose"
GDBG_INFO((80, "%s: Setting up VESA mode 640*480*\n", FN_NAME));

View File

@@ -19,7 +19,6 @@
**
*/
#ifndef _FXINIT96_H_
#define _FXINIT96_H_
@@ -45,7 +44,7 @@ FxBool dxOpen(
InitSwapType_t *swapType
);
FxBool dxControl(FxU32 control, InitBufDesc_t *pDesc, int *w, int *h);
FxBool dxClose();
FxBool dxClose(void);
void dxSwap(FxU32 code);
#else
@@ -64,7 +63,7 @@ FxBool linOpen(
InitSwapType_t *swapType
);
FxBool linControl(FxU32 control, InitBufDesc_t *pDesc, int *w, int *h);
FxBool linClose();
FxBool linClose(void);
void linSwap(FxU32 code);
void linFlip(FxU32 buffer);
@@ -125,7 +124,6 @@ GDBG_INFO((80, "SET: Register: %s (0x%x) = 0x%x\n",\
#define GET(s) *(GETREADADDR(s))
#endif
#ifdef __cplusplus
}
#endif

View File

@@ -804,10 +804,13 @@ INITVG96ENTRY(init96MapBoard, FxBool , (void *rd, void *info, FxU16 vID, FxU16 d
{
int xres=1, yres=1, fbStride;
GrScreenResolution_t res = GR_RESOLUTION_NONE;
FxBool rv =
init96SetVideo(0, res,
0, 2, 1,
2, 1, regDesc,
&xres, &yres, &fbStride );
if ( !rv )
return FXFALSE;
sst96InitGetTmuInfo((FxU32 *)sstHW, vg96Info);
init96RestoreVideo(regDesc);
}
@@ -2115,16 +2118,21 @@ init96LoadBufRegs(int nBuffers, InitBufDesc_t *pBufDesc, int xRes,
pAux->bufOffset = A;
}
if (pFront)
if (pFront) {
GDBG_INFO((80,"F = %.08x, s= %6d\n", pFront->bufOffset, pFront->bufStride));
if (pBack)
}
if (pBack) {
GDBG_INFO((80,"B = %.08x, s= %6d\n", pBack ->bufOffset, pBack ->bufStride));
if (pTriple)
}
if (pTriple) {
GDBG_INFO((80,"T = %.08x, s= %6d\n", pTriple ->bufOffset, pTriple ->bufStride));
if (pAux)
}
if (pAux) {
GDBG_INFO((80,"A = %.08x, s= %6d\n", pAux ->bufOffset, pAux ->bufStride));
if (pFifo)
}
if (pFifo) {
GDBG_INFO((80,"C = %.08x, s= %6d\n", pFifo ->bufOffset, pFifo ->bufStride));
}
/* Fill the arrays here */
bI[0].dfbBase = pFront->bufOffset;

View File

@@ -83,7 +83,8 @@ static Init96HALData mcrxHALData = {
initMCRXWrapFIFO,
initMCRXUseTiles,
initMCRXGetInfo,
NULL /* initMCRXSwapTiles */
NULL, /* initMCRXSwapTiles */
NULL
};
@@ -162,13 +163,13 @@ INITMCRXENTRY(initMCRXSetVideo, FxBool, (GrScreenResolution_t res, GrScreenRefre
{
#define FN_NAME "initMCRXSetVideo"
FxBool rv = FXTRUE;
#if defined(INIT_ACCESS_DIRECT) && defined( __DOS32__ )
#if defined(INIT_ACCESS_DIRECT) && defined(__DOS32__)
union REGS r0, r1;
#endif
GDBG_INFO((80, "%s: \n", FN_NAME));
#if defined(INIT_ACCESS_DIRECT) && defined( __DOS32__ )
#if defined(INIT_ACCESS_DIRECT) && defined(__DOS32__)
switch( res ) {
case GR_RESOLUTION_320x200:
/* Set up VESA Mode 0x136 - 320x200x16 */

View File

@@ -67,7 +67,7 @@ static Window hWndApp = 0;
static FxU32 Width = 0;
static FxU32 Height = 0;
static FxBool IsFullScreen = 0;
static InitBufDesc_t BufDesc[NUM_BUFS] = {0};
static InitBufDesc_t BufDesc[NUM_BUFS] = { {0,0,0,0,0} };
static XF86VidModeModeInfo **vidModes = 0;
static Pixmap pixBack = 0;
@@ -120,17 +120,19 @@ linFlip(FxU32 buffer)
{}
#else
void linExit(void);
static FxBool
ErrorMessage(Window win, char *err)
ErrorMessage(Window win, const char *err)
{
fprintf(stderr, "Error %s \n", err);
return FXFALSE;
} /* ErrorMessage */
FxBool linSetup() {
FxBool linSetup(void) {
int eventbase, errorbase;
int banksize;
unsigned int baseaddr;
if (dpy!=0) return FXTRUE;
dpy=XOpenDisplay("");
@@ -153,9 +155,10 @@ FxBool linSetup() {
}
}
screenNum=XDefaultScreen(dpy);
XF86DGAGetVideoLL(dpy, screenNum, (int*)&screenPhys, &screenWidth, &banksize,
XF86DGAGetVideoLL(dpy, screenNum, &baseaddr, &screenWidth, &banksize,
&screenMem);
screenMem*=1024;
screenPhys = (void *)baseaddr;
screenMem *= 1024;
return FXTRUE;
}
@@ -223,8 +226,9 @@ cvtXToGlideDesc(InitBufDesc_t *pDesc) {
GDBG_INFO((80, "cvtXToGlideDesc: dBack->bufOffset = 0x%x\n", dBack->bufOffset));
GDBG_INFO((80, "cvtXToGlideDesc: dAux->bufOffset = 0x%x\n", dAux->bufOffset));
GDBG_INFO((80, "cvtXToGlideDesc: dFifo->bufOffset = 0x%x\n", dFifo->bufOffset));
if (tripleBuffering)
if (tripleBuffering) {
GDBG_INFO((80, "cvtXToGlideDesc: dTriple->bufOffset = 0x%x\n", dTriple->bufOffset));
}
GDBG_INFO((80,
"F:%.06x %5d B:%.06x %5d B2:%.06x %5d A:%.06x %5d, C:%.06x %5d\n",
@@ -250,7 +254,8 @@ doReleasePixmaps() {
static void
findWindow(Display *dpy, Window hWndApp, void **addrFront) {
XWindowAttributes attr;
int x=0, y=0, num;
int x=0, y=0;
unsigned int num;
Window root=-1, parent, *children;
do {
@@ -311,7 +316,7 @@ doAllocPixmaps(int xRes, int yRes, int vRefresh,
}
static FxBool
getWindowSize(int *width, int *height) {
getWindowSize(unsigned int *width, unsigned int *height) {
XWindowAttributes attr;
/* Find out how big the window is */
@@ -345,7 +350,7 @@ linOpen(
hWindow, sRes, yOrigin, nColBuffers, nAuxBuffers));
if (!linSetup()) return FXFALSE;
atexit(linClose);
atexit(linExit);
if (sRes == GR_RESOLUTION_NONE ) { /* In a window */
@@ -461,7 +466,7 @@ linOpen(
FxBool
linControl(FxU32 code, InitBufDesc_t *pBufDesc, int *width, int *height)
{
int i, w, h;
unsigned int i, w = 0, h = 0;
GDBG_INFO((80, "linControl: code = %d\n", code));
@@ -516,7 +521,7 @@ linControl(FxU32 code, InitBufDesc_t *pBufDesc, int *width, int *height)
} /* linControl */
FxBool
linClose()
linClose(void)
{
GDBG_INFO((80, "linClose:\n"));
if (!dpy) return FXTRUE;
@@ -538,6 +543,12 @@ linClose()
return FXTRUE;
} /* linClose */
void
linExit(void)
{
linClose();
} /* linExit */
void
linSwap(FxU32 code)
{
@@ -571,5 +582,3 @@ linFlip(FxU32 buffer)
} /* linFlip */
#endif

View File

@@ -44,14 +44,14 @@ static long gdbg_errors = 0;
static FxBool UseDebugString;
static FILE *gdbg_msgfile = NULL; /*stdout;*/ // GDBG info/error file
static FILE *gdbg_msgfile = NULL; /* stdout; */ // GDBG info/error file
//----------------------------------------------------------------------
// initialize gdbg_level from an environment variable
//----------------------------------------------------------------------
static char *setRange(char *buf, int val)
{
int r0,r1,pos;
int r0,r1,pos=0;
sscanf(buf,"%i%n",&r0,&pos); // parse the first integer
if (buf[pos]=='-' || buf[pos]==':') // if there's a second
@@ -91,7 +91,7 @@ static void parse(char *env)
} while (env[0] == ',');
}
void FX_EXPORT FX_CSTYLE
FX_EXPORT void FX_CSTYLE
gdbg_init(void)
{
static int done=0; // only execute once
@@ -113,7 +113,7 @@ gdbg_init(void)
gdbg_info(1,"gdbg_init(): debug level = %s\n",env);
}
void FX_EXPORT FX_CSTYLE
FX_EXPORT void FX_CSTYLE
gdbg_shutdown(void)
{
gdbg_info(1,"gdbg_shutdown()\n");
@@ -126,15 +126,12 @@ gdbg_shutdown(void)
//----------------------------------------------------------------------
// the MAIN message display suboutine - ALL messages come thru here
//----------------------------------------------------------------------
void FX_EXPORT FX_CSTYLE
FX_EXPORT void FX_CSTYLE
gdbg_vprintf (const char *format,va_list args)
{
if (gdbg_msgfile != NULL) {
if (!UseDebugString) {
vfprintf(gdbg_msgfile,format,args);
fflush(gdbg_msgfile);
}
#ifdef __WIN32__
@@ -148,7 +145,7 @@ gdbg_vprintf (const char *format,va_list args)
}
}
void FX_EXPORT FX_CSTYLE
FX_EXPORT void FX_CSTYLE
gdbg_printf (const char *format, ...)
{
va_list args;
@@ -166,7 +163,7 @@ gdbg_printf (const char *format, ...)
// display an INFO message if level <= debug level and return whether
// debug level high enough to allow display
//----------------------------------------------------------------------
int FX_EXPORT FX_CSTYLE
FX_EXPORT int FX_CSTYLE
gdbg_info (const int level, const char *format, ...)
{
va_list args;
@@ -185,7 +182,7 @@ gdbg_info (const int level, const char *format, ...)
//----------------------------------------------------------------------
// same as gdbg_info but does not display INFO header
//----------------------------------------------------------------------
int FX_EXPORT FX_CSTYLE
FX_EXPORT int FX_CSTYLE
gdbg_info_more (const int level, const char *format, ...)
{
va_list args;
@@ -197,12 +194,12 @@ gdbg_info_more (const int level, const char *format, ...)
va_end(args);
return (1);
}
//----------------------------------------------------------------------
// ALL errors must come thru here, this subroutine adds a preamble
// and then displays the message and increments the error counter
//----------------------------------------------------------------------
void FX_EXPORT FX_CSTYLE
FX_EXPORT void FX_CSTYLE
gdbg_error (const char *kind, const char *format, ...)
{
va_list args;
@@ -218,28 +215,28 @@ gdbg_error (const char *kind, const char *format, ...)
}
// return the error counter
int FX_EXPORT FX_CSTYLE
FX_EXPORT int FX_CSTYLE
gdbg_get_errors(void)
{
return gdbg_errors;
}
// return a debuglevel level
int FX_EXPORT FX_CSTYLE
FX_EXPORT int FX_CSTYLE
gdbg_get_debuglevel(const int level)
{
return gdbg_debuglevel[level>=GDBG_MAX_LEVELS ? GDBG_MAX_LEVELS-1 : level];
}
// set a debuglevel level
void FX_EXPORT FX_CSTYLE
FX_EXPORT void FX_CSTYLE
gdbg_set_debuglevel(const int level, const int value)
{
gdbg_debuglevel[level>=GDBG_MAX_LEVELS ? GDBG_MAX_LEVELS-1 : level] = value;
}
// open up a new output file
int FX_EXPORT FX_CSTYLE
FX_EXPORT int FX_CSTYLE
gdbg_set_file(const char *name)
{
FILE *outf;

View File

@@ -186,6 +186,7 @@ getTmuConfigData(FxU32 *sstbase, sst1DeviceInfoStruct *info)
readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum);
if(unDither(r_sum,g_sum,b_sum,&info->tmuConfig) == FXFALSE)
return(FXFALSE);
if(GETENV(("SST_TMUCFG")))
SSCANF(GETENV(("SST_TMUCFG")), "%i", &info->tmuConfig);
@@ -533,11 +534,12 @@ FxBool sst1InitFillDeviceInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info)
info->tmuMemSize[0] = 2;
info->tmuMemSize[1] = info->tmuMemSize[0];
info->tmuMemSize[2] = info->tmuMemSize[0];
} else {
}
else {
int i;
for(i=0; i<5; i++) {
if(i)
for (i=0; i<5; i++) {
if (i)
INIT_PRINTF(("sst1InitFillDeviceInfo(): Retry #%d for chip GetInfo()...\n", i));
/* GetFbiInfo() must be called before GetTmuInfo() */
if(sst1InitGetFbiInfo(sstbase, info) == FXFALSE)
@@ -548,9 +550,10 @@ FxBool sst1InitFillDeviceInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info)
continue;
break;
}
if(i == 5)
if (i == 5)
return(FXFALSE);
}
INIT_PRINTF(("sst1DeviceInfo: Board ID: Obsidian %s\n",
(info->fbiBoardID) ? "PRO" : "GE"));
INIT_PRINTF(("sst1DeviceInfo: FbiConfig:0x%x, TmuConfig:0x%x\n",
@@ -559,18 +562,20 @@ FxBool sst1InitFillDeviceInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info)
info->fbiRevision, info->tmuRevision, info->numberTmus));
INIT_PRINTF(("sst1DeviceInfo: FBI Memory:%d, TMU[0] Memory:%d",
info->fbiMemSize, info->tmuMemSize[0]));
if(info->numberTmus > 1)
if (info->numberTmus > 1)
INIT_PRINTF((", TMU[1] Memory:%d", info->tmuMemSize[1]));
if(info->numberTmus > 2)
if (info->numberTmus > 2)
INIT_PRINTF((", TMU[2] Memory:%d", info->tmuMemSize[2]));
INIT_PRINTF(("\n"));
if(sst1InitUseVoodooFile == FXTRUE) {
if(iniDac == (sst1InitDacStruct *) NULL)
if (sst1InitUseVoodooFile == FXTRUE) {
if(iniDac == NULL)
INIT_PRINTF(("sst1DeviceInfo: Dac Type: Unknown"));
else
INIT_PRINTF(("sst1DeviceInfo: Dac Type: %s %s\n",
iniDac->dacManufacturer, iniDac->dacDevice));
} else {
}
else {
INIT_PRINTF(("sst1DeviceInfo: Dac Type: "));
if(info->fbiDacType == SST_FBI_DACTYPE_ATT)
INIT_PRINTF(("AT&T ATT20C409\n"));

View File

@@ -70,7 +70,7 @@ FX_ENTRY FxBool FX_CALL sst1InitVoodooFile()
#else
char filename[256], fixedFilename[512], *tmpPtr;
char path[512];
FILE *file = (FILE *) NULL;
FILE *file = NULL;
char buffer[1024];
int inCfg, inDac;
int i;
@@ -111,12 +111,12 @@ FX_ENTRY FxBool FX_CALL sst1InitVoodooFile()
break;
}
}
if(file == (FILE *) NULL)
if(file == NULL)
return(FXFALSE);
inCfg = inDac = 0;
while(sst1InitFgets(buffer, file)) {
buffer[strlen(buffer)-1] = (char) NULL;
buffer[strlen(buffer)-1] = 0;
if(!strcmp(buffer, "[CFG]")) {
inCfg = 1; inDac = 0;
continue;
@@ -245,7 +245,7 @@ static void foo(int argc, char **argv)
inCfg = inDac = 0;
while(sst1InitFgets(buffer, file)) {
buffer[strlen(buffer)-1] = (char) NULL;
buffer[strlen(buffer)-1] = 0;
if(!strcmp(buffer, "[CFG]")) {
inCfg = 1; inDac = 0;
continue;
@@ -320,10 +320,9 @@ static void sst1InitFixFilename(char *dst, char *src)
*dst++ = *src;
src++;
}
*dst = (char) NULL;
*dst = 0;
}
static int sst1InitFgets(char *string, FILE *stream)
{
int validChars = 0;
@@ -334,7 +333,7 @@ static int sst1InitFgets(char *string, FILE *stream)
*ptr++ = (char) charRead;
validChars++;
if(charRead == '\n') {
*ptr++ = (char) NULL;
*ptr++ = 0;
break;
}
}
@@ -393,30 +392,28 @@ static int sst1InitParseFieldCfg(char *string)
if((envName = strtok(string, "=")) == NULL)
return(0);
if((envVal = strtok((char *) NULL, "=")) == NULL)
if((envVal = strtok(NULL, "=")) == NULL)
/* Valid environment variable, NULL value */
return(1);
sst1InitToLower(envVal);
if(envVarsBase == (sst1InitEnvVarStruct *) NULL) {
if((envVarsPtr = malloc(sizeof(sst1InitEnvVarStruct))) ==
(sst1InitEnvVarStruct *) NULL)
if(envVarsBase == NULL) {
if((envVarsPtr = malloc(sizeof(sst1InitEnvVarStruct))) == NULL)
return(0);
envVarsBase = envVarsPtr;
} else {
envVarsPtr = envVarsBase;
while(1) {
if(envVarsPtr->nextVar == (sst1InitEnvVarStruct *) NULL)
if(envVarsPtr->nextVar == NULL)
break;
else
envVarsPtr = envVarsPtr->nextVar;
}
if((envVarsPtr->nextVar = malloc(sizeof(sst1InitEnvVarStruct))) ==
(sst1InitEnvVarStruct *) NULL)
if((envVarsPtr->nextVar = malloc(sizeof(sst1InitEnvVarStruct))) == NULL)
return(0);
envVarsPtr = envVarsPtr->nextVar;
}
envVarsPtr->nextVar = (sst1InitEnvVarStruct *) NULL;
envVarsPtr->nextVar = NULL;
strcpy(envVarsPtr->envVariable, envName);
strcpy(envVarsPtr->envValue, envVal);
@@ -426,64 +423,62 @@ static int sst1InitParseFieldCfg(char *string)
static int sst1InitParseFieldDac(char *string)
{
char *dacFieldReference, *dacFieldValue;
static sst1InitDacStruct *dacPtr = (sst1InitDacStruct *) NULL;
static sst1InitDacStruct *dacPtr = NULL;
if((dacFieldReference = strtok(string, "=")) == NULL)
return(0);
if(!strcmp(dacFieldReference, "MANUFACTURER")) {
/* Add new dac device */
if(dacStructBase == (sst1InitDacStruct *) NULL) {
if((dacPtr = malloc(sizeof(sst1InitDacStruct))) ==
(sst1InitDacStruct *) NULL)
if(dacStructBase == NULL) {
if((dacPtr = malloc(sizeof(sst1InitDacStruct))) == NULL)
return(0);
dacStructBase = dacPtr;
} else {
dacPtr = dacStructBase;
while(1) {
if(dacPtr->nextDac == (sst1InitDacStruct *) NULL)
if(dacPtr->nextDac == NULL)
break;
else
dacPtr = dacPtr->nextDac;
}
if((dacPtr->nextDac = malloc(sizeof(sst1InitDacStruct))) ==
(sst1InitDacStruct *) NULL)
if((dacPtr->nextDac = malloc(sizeof(sst1InitDacStruct))) == NULL)
return(0);
dacPtr = dacPtr->nextDac;
}
dacPtr->nextDac = (sst1InitDacStruct *) NULL;
dacPtr->dacManufacturer[0] = (char) NULL;
dacPtr->dacDevice[0] = (char) NULL;
dacPtr->detect = (sst1InitDacRdWrStruct *) NULL;
dacPtr->setVideo = (sst1InitDacSetVideoStruct *) NULL;
dacPtr->setMemClk = (sst1InitDacSetMemClkStruct *) NULL;
dacPtr->setVideoMode = (sst1InitDacSetVideoModeStruct *) NULL;
if((dacFieldValue = strtok((char *) NULL, "=")) == NULL)
dacPtr->nextDac = NULL;
dacPtr->dacManufacturer[0] = 0;
dacPtr->dacDevice[0] = 0;
dacPtr->detect = NULL;
dacPtr->setVideo = NULL;
dacPtr->setMemClk = NULL;
dacPtr->setVideoMode = NULL;
if((dacFieldValue = strtok(NULL, "=")) == NULL)
return(0);
strcpy(dacPtr->dacManufacturer, dacFieldValue);
} else if(!strcmp(dacFieldReference, "DEVICE")) {
if((dacFieldValue = strtok((char *) NULL, "=")) == NULL)
if((dacFieldValue = strtok(NULL, "=")) == NULL)
return(0);
strcpy(dacPtr->dacDevice, dacFieldValue);
} else if(!strcmp(dacFieldReference, "DETECT")) {
if((dacFieldValue = strtok((char *) NULL, "=")) == NULL)
if((dacFieldValue = strtok(NULL, "=")) == NULL)
return(0);
sst1InitToLower(dacFieldValue);
if(!sst1InitParseDacRdWrString(dacFieldValue, dacPtr))
return(0);
} else if(!strcmp(dacFieldReference, "SETVIDEO")) {
if((dacFieldValue = strtok((char *) NULL, "=")) == NULL)
if((dacFieldValue = strtok(NULL, "=")) == NULL)
return(0);
sst1InitToLower(dacFieldValue);
if(!sst1InitParseSetVideoString(dacFieldValue, dacPtr))
return(0);
} else if(!strcmp(dacFieldReference, "SETMEMCLK")) {
if((dacFieldValue = strtok((char *) NULL, "=")) == NULL)
if((dacFieldValue = strtok(NULL, "=")) == NULL)
return(0);
sst1InitToLower(dacFieldValue);
if(!sst1InitParseSetMemClkString(dacFieldValue, dacPtr))
return(0);
} else if(!strcmp(dacFieldReference, "SETVIDEOMODE")) {
if((dacFieldValue = strtok((char *) NULL, "=")) == NULL)
if((dacFieldValue = strtok(NULL, "=")) == NULL)
return(0);
sst1InitToLower(dacFieldValue);
if(!sst1InitParseSetVideoModeString(dacFieldValue, dacPtr))
@@ -523,7 +518,7 @@ static int sst1InitParseDacRdWrString(char *string, sst1InitDacStruct *dacBase)
dacRdWrPtr = dacRdWrPtr->nextRdWr;
}
dacRdWrPtr->nextRdWr = (sst1InitDacRdWrStruct *) NULL;
dacRdWrPtr->nextRdWr = NULL;
if(!sst1InitParseDacRdWr(dacRdWrCmd, dacRdWrPtr))
return(0);
cntr++;
@@ -539,16 +534,16 @@ static int sst1InitParseDacRdWr(char *string, sst1InitDacRdWrStruct *dacRdWrPtr)
strcpy(stringCpy, string);
if(stringCpy[5] == '(') {
stringCpy[5] = (char) NULL;
stringCpy[5] = 0;
addrDataCmd = &stringCpy[6];
} else if(stringCpy[7] == '(') {
stringCpy[7] = (char) NULL;
stringCpy[7] = 0;
addrDataCmd = &stringCpy[8];
} else if(stringCpy[8] == '(') {
stringCpy[8] = (char) NULL;
stringCpy[8] = 0;
addrDataCmd = &stringCpy[9];
} else if(stringCpy[9] == '(') {
stringCpy[9] = (char) NULL;
stringCpy[9] = 0;
addrDataCmd = &stringCpy[10];
} else
return(0);
@@ -560,7 +555,7 @@ static int sst1InitParseDacRdWr(char *string, sst1InitDacRdWrStruct *dacRdWrPtr)
return(0);
if(data[strlen(data)-1] != ')')
return(0);
data[strlen(data)-1] = (char) NULL;
data[strlen(data)-1] = '\0';
dacRdWrPtr->type = DACRDWR_TYPE_WR;
SSCANF(addr, "%i", &dacRdWrPtr->addr);
SSCANF(data, "%i", &dacRdWrPtr->data);
@@ -573,7 +568,7 @@ static int sst1InitParseDacRdWr(char *string, sst1InitDacRdWrStruct *dacRdWrPtr)
return(0);
if(data[strlen(data)-1] != ')')
return(0);
data[strlen(data)-1] = (char) NULL;
data[strlen(data)-1] = 0;
dacRdWrPtr->type = DACRDWR_TYPE_WRMOD_POP;
SSCANF(addr, "%i", &dacRdWrPtr->addr);
SSCANF(mask, "%i", &dacRdWrPtr->mask);
@@ -587,7 +582,7 @@ static int sst1InitParseDacRdWr(char *string, sst1InitDacRdWrStruct *dacRdWrPtr)
return(0);
if(data[strlen(data)-1] != ')')
return(0);
data[strlen(data)-1] = (char) NULL;
data[strlen(data)-1] = 0;
dacRdWrPtr->type = DACRDWR_TYPE_RDMODWR;
SSCANF(addr, "%i", &dacRdWrPtr->addr);
SSCANF(mask, "%i", &dacRdWrPtr->mask);
@@ -679,7 +674,7 @@ static int sst1InitParseSetVideoString(char *string, sst1InitDacStruct *dacBase)
return(0);
dacSetVideoPtr = dacSetVideoPtr->nextSetVideo;
}
dacSetVideoPtr->nextSetVideo = (sst1InitDacSetVideoStruct *) NULL;
dacSetVideoPtr->nextSetVideo = NULL;
/* Width */
SSCANF(dacRdWrCmd, "%i", &dacSetVideoPtr->width);
/* Height */
@@ -713,7 +708,7 @@ static int sst1InitParseSetVideoString(char *string, sst1InitDacStruct *dacBase)
return(0);
dacRdWrPtr = dacRdWrPtr->nextRdWr;
}
dacRdWrPtr->nextRdWr = (sst1InitDacRdWrStruct *) NULL;
dacRdWrPtr->nextRdWr = NULL;
if(!sst1InitParseDacRdWr(dacRdWrCmd, dacRdWrPtr))
return(0);
cntr++;
@@ -753,8 +748,7 @@ static int sst1InitParseSetMemClkString(char *string,
return(0);
dacSetMemClkPtr = dacSetMemClkPtr->nextSetMemClk;
}
dacSetMemClkPtr->nextSetMemClk = (sst1InitDacSetMemClkStruct *)
NULL;
dacSetMemClkPtr->nextSetMemClk = NULL;
/* Frequency */
SSCANF(dacRdWrCmd, "%i", &dacSetMemClkPtr->frequency);
@@ -777,7 +771,7 @@ static int sst1InitParseSetMemClkString(char *string,
return(0);
dacRdWrPtr = dacRdWrPtr->nextRdWr;
}
dacRdWrPtr->nextRdWr = (sst1InitDacRdWrStruct *) NULL;
dacRdWrPtr->nextRdWr = NULL;
if(!sst1InitParseDacRdWr(dacRdWrCmd, dacRdWrPtr))
return(0);
cntr++;
@@ -817,8 +811,7 @@ static int sst1InitParseSetVideoModeString(char *string,
return(0);
dacSetVideoModePtr = dacSetVideoModePtr->nextSetVideoMode;
}
dacSetVideoModePtr->nextSetVideoMode =
(sst1InitDacSetVideoModeStruct *) NULL;
dacSetVideoModePtr->nextSetVideoMode = NULL;
/* video16BPP */
SSCANF(dacRdWrCmd, "%i", &dacSetVideoModePtr->video16BPP);
@@ -841,7 +834,7 @@ static int sst1InitParseSetVideoModeString(char *string,
return(0);
dacRdWrPtr = dacRdWrPtr->nextRdWr;
}
dacRdWrPtr->nextRdWr = (sst1InitDacRdWrStruct *) NULL;
dacRdWrPtr->nextRdWr = NULL;
if(!sst1InitParseDacRdWr(dacRdWrCmd, dacRdWrPtr))
return(0);
cntr++;
@@ -873,7 +866,7 @@ static void sst1InitToLower(char *string)
FX_ENTRY char * FX_CALL sst1InitGetenv(char *string)
{
sst1InitEnvVarStruct *envVarsPtr;
char *retVal = (char *) NULL;
char *retVal = NULL;
/* Does the real environment variable exist? */
if(myGetenv(string))

View File

@@ -79,3 +79,4 @@ FX_ENTRY void FX_CALL sst1InitVPrintf(const char *format, va_list args)
#ifdef _MSC_VER
#pragma optimize ("",on)
#endif

View File

@@ -440,7 +440,6 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitShutdownSli(FxU32 *sstbase)
PCICFG_RD(SST1_PCI_INIT_ENABLE, j); /* delay */
sst1InitIdle((FxU32 *) sstSlave);
if(IGET(sstSlave->fbiInit1) & SST_EN_SCANLINE_INTERLEAVE) {
if(++cntr < 10)
continue;

View File

@@ -706,7 +706,7 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitShutdown(FxU32 *sstbase)
#endif
if(GETENV(("SST_NOSHUTDOWN")))
INIT_PRINTF(("sst1InitShutdown(): Bypassing shutdown with SST_NOSHUTDOWN\n", n));
INIT_PRINTF(("sst1InitShutdown(): Bypassing shutdown with SST_NOSHUTDOWN\n"));
n = 0;
while(!GETENV(("SST_NOSHUTDOWN"))) {

View File

@@ -103,7 +103,7 @@
#define IGET(A) A
#define ISET(A,D) A = (D)
#else
#define IGET(A) sst1InitRead32((FxU32 *) &(A))
#define IGET(A) sst1InitRead32 ((FxU32 *) &(A))
#define ISET(A,D) sst1InitWrite32((FxU32 *) &(A), D)
#endif
@@ -136,14 +136,16 @@ p6Fence(void);
#define P6FENCE {_asm xchg eax, p6FenceVar}
#elif defined(__GNUC__)
#if defined(__i386__)
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
#define P6FENCE asm("xchg %%eax,%0" \
: /* no outputs */ \
: "m" (p6FenceVar) \
: "eax" \
);
#endif
#elif defined(__GNUC__) && defined(__ia64__)
# define P6FENCE asm volatile ("mf.a" ::: "memory");
#elif defined(__GNUC__) && defined(__alpha__)
# define P6FENCE asm volatile("mb" ::: "memory");
#else
#error "P6 Fencing in-line assembler code needs to be added for this compiler"
#endif

View File

@@ -19,7 +19,6 @@
**
*/
#include "init.h"
#include "fxinit.h"
@@ -32,13 +31,13 @@
#define _outp outp
#define _outpw outpw
#endif
#if defined(__linux__)
#if defined(__linux__)
#define _inp(port) pioInByte(port)
#define _outp(port, data) pioOutByte(port, data)
#define _outpw(port, data) pioOutWord(port, data);
#endif
#ifdef __DJGPP__
#include <fxdpmi.h>
#endif
@@ -67,12 +66,10 @@ static inline void _outp_asm (unsigned short _port, unsigned char _data) {
#include <gdebug.h>
/*-------------------------------------------------------------------
Module Constants
-------------------------------------------------------------------*/
static InitContext
contexts[NUM_3DFX_PRODUCTS]; /* pool of device contexts */
InitContext
@@ -218,7 +215,6 @@ initEnumHardware( InitHWEnumCallback *cb )
}
}
/* Sanity Check for SLI detection */
for( device = 0; device < numDevicesInSystem; device++ ) {
if ( hwInfo[device].hwClass == INIT_VOODOO &&
@@ -678,7 +674,6 @@ void initIOCtl( FxU32 token, void *argument ) {
-------------------------------------------------------------------*/
FxBool initControl( FxU32 code)
{
FxBool rv;
GDBG_INFO((80, "initControl: code = %d, context=%.08x\n", code, context));

View File

@@ -495,8 +495,8 @@ get96(FxU32 *addr)
const char *envVal;\
unsigned int u; \
val = constant;\
if ( (envVal = myGetenv(envStr)) && \
(sscanf(envVal, "%x", &u) == 1) ) { \
if (((envVal = myGetenv(envStr)) != NULL) && \
(sscanf(envVal, "%x", &u) == 1)) { \
val = u; \
GDBG_INFO((80,\
"%s: The environment variable %s == 0x%x overloaded a register value\n", \
@@ -715,7 +715,6 @@ INITVG96ENTRY(init96MapBoard, FxBool , (void *rd, void *info, FxU16 vID, FxU16 d
break;
}
GDBG_INFO((80, "init96MapBoard: Mapping card into linear memory\n"));
regDesc->hwDep.VG96RegDesc.baseAddress =
@@ -815,8 +814,8 @@ INITVG96ENTRY(init96MapBoard, FxBool , (void *rd, void *info, FxU16 vID, FxU16 d
{
int xres=1, yres=1, fbStride;
GrScreenResolution_t res = GR_RESOLUTION_NONE;
FxBool rv = FXTRUE;
rv = init96SetVideo(0, res,
FxBool rv =
init96SetVideo(0, res,
0, 2, 1,
2, 1, regDesc,
&xres, &yres, &fbStride );

View File

@@ -532,11 +532,12 @@ FxBool sst1InitFillDeviceInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info)
info->tmuMemSize[0] = 2;
info->tmuMemSize[1] = info->tmuMemSize[0];
info->tmuMemSize[2] = info->tmuMemSize[0];
} else {
}
else {
int i;
for(i=0; i<5; i++) {
if(i)
for (i=0; i<5; i++) {
if (i)
INIT_PRINTF(("sst1InitFillDeviceInfo(): Retry #%d for chip GetInfo()...\n", i));
/* GetFbiInfo() must be called before GetTmuInfo() */
if(sst1InitGetFbiInfo(sstbase, info) == FXFALSE)
@@ -547,9 +548,10 @@ FxBool sst1InitFillDeviceInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info)
continue;
break;
}
if(i == 5)
if (i == 5)
return(FXFALSE);
}
INIT_PRINTF(("sst1DeviceInfo: Board ID: Obsidian %s\n",
(info->fbiBoardID) ? "PRO" : "GE"));
INIT_PRINTF(("sst1DeviceInfo: FbiConfig:0x%x, TmuConfig:0x%x\n",
@@ -558,18 +560,20 @@ FxBool sst1InitFillDeviceInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info)
info->fbiRevision, info->tmuRevision, info->numberTmus));
INIT_PRINTF(("sst1DeviceInfo: FBI Memory:%d, TMU[0] Memory:%d",
info->fbiMemSize, info->tmuMemSize[0]));
if(info->numberTmus > 1)
if (info->numberTmus > 1)
INIT_PRINTF((", TMU[1] Memory:%d", info->tmuMemSize[1]));
if(info->numberTmus > 2)
if (info->numberTmus > 2)
INIT_PRINTF((", TMU[2] Memory:%d", info->tmuMemSize[2]));
INIT_PRINTF(("\n"));
if(sst1InitUseVoodooFile == FXTRUE) {
if(iniDac == (sst1InitDacStruct *) NULL)
if (sst1InitUseVoodooFile == FXTRUE) {
if(iniDac == NULL)
INIT_PRINTF(("sst1DeviceInfo: Dac Type: Unknown"));
else
INIT_PRINTF(("sst1DeviceInfo: Dac Type: %s %s\n",
iniDac->dacManufacturer, iniDac->dacDevice));
} else {
}
else {
INIT_PRINTF(("sst1DeviceInfo: Dac Type: "));
if(info->fbiDacType == SST_FBI_DACTYPE_ATT)
INIT_PRINTF(("AT&T ATT20C409\n"));

View File

@@ -16,13 +16,6 @@
** THE UNITED STATES.
**
** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
**
** Revision 1.1.2.1 2004/03/02 07:56:05 dborca
** Bastardised Glide3x for SST1
**
** Revision 1.1.1.1 1999/12/07 21:49:06 joseph
** Initial checkin into SourceForge.
**
*/
#define OFFICIAL 1

View File

@@ -448,7 +448,6 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitShutdownSli(FxU32 *sstbase)
PCICFG_RD(SST1_PCI_INIT_ENABLE, j); /* delay */
sst1InitIdle((FxU32 *) sstSlave);
if(IGET(sstSlave->fbiInit1) & SST_EN_SCANLINE_INTERLEAVE) {
if(++cntr < 10)
continue;

View File

@@ -103,7 +103,7 @@
#define IGET(A) A
#define ISET(A,D) A = (D)
#else
#define IGET(A) sst1InitRead32((FxU32 *)(void *)&(A))
#define IGET(A) sst1InitRead32 ((FxU32 *)(void *)&(A))
#define ISET(A,D) sst1InitWrite32((FxU32 *)(void *)&(A), D)
#endif