From 41e63805080267e9dbd100d30deac6ba0b34678e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 13 Sep 2004 18:39:10 +0000 Subject: [PATCH] more updates from John Fay git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@515 7f0cb862-5218-0410-a997-914c9d46530a --- src/freeglut_callbacks.c | 4 ++-- src/freeglut_cursor.c | 2 +- src/freeglut_gamemode.c | 3 ++- src/freeglut_init.c | 4 ++-- src/freeglut_internal.h | 1 - src/freeglut_joystick.c | 38 ++++++++++++++++++-------------------- src/freeglut_main.c | 6 +++--- src/freeglut_state.c | 8 ++++---- src/freeglut_window.c | 2 +- 9 files changed, 33 insertions(+), 35 deletions(-) diff --git a/src/freeglut_callbacks.c b/src/freeglut_callbacks.c index 3e19c3e..94c4dbd 100644 --- a/src/freeglut_callbacks.c +++ b/src/freeglut_callbacks.c @@ -50,7 +50,7 @@ void FGAPIENTRY glutDisplayFunc( void (* callback)( void ) ) { if( !callback ) fgError( "Fatal error in program. NULL display callback not " - "permitted in GLUT 3.0+ or freeglut 2.0.1+\n" ); + "permitted in GLUT 3.0+ or freeglut 2.0.1+" ); SET_CALLBACK( Display ); } @@ -106,7 +106,7 @@ void FGAPIENTRY glutTimerFunc( unsigned int timeOut, void (* callback)( int ), { if( ! (timer = malloc(sizeof(SFG_Timer))) ) fgError( "Fatal error: " - "Memory allocation failure in glutTimerFunc()\n" ); + "Memory allocation failure in glutTimerFunc()" ); } timer->Callback = callback; diff --git a/src/freeglut_cursor.c b/src/freeglut_cursor.c index bf5d2eb..20ec0d8 100644 --- a/src/freeglut_cursor.c +++ b/src/freeglut_cursor.c @@ -167,7 +167,7 @@ void FGAPIENTRY glutSetCursor( int cursorID ) break; default: - fgWarning( "Unknown cursor type: %d\n", cursorID ); + fgWarning( "Unknown cursor type: %d", cursorID ); return; } diff --git a/src/freeglut_gamemode.c b/src/freeglut_gamemode.c index db70942..c1764b8 100644 --- a/src/freeglut_gamemode.c +++ b/src/freeglut_gamemode.c @@ -96,7 +96,7 @@ static void fghRememberState( void ) ); if( !fgDisplay.DisplayModeValid ) - fgWarning( "Runtime use of XF86VidModeGetModeLine failed.\n" ); + fgWarning( "Runtime use of XF86VidModeGetModeLine failed." ); # else /* @@ -559,6 +559,7 @@ int FGAPIENTRY glutGameModeGet( GLenum eWhat ) return !!fgStructure.GameMode; } + fgWarning( "Unknown gamemode get: %d", eWhat ); return -1; } diff --git a/src/freeglut_init.c b/src/freeglut_init.c index 0853d35..311526e 100644 --- a/src/freeglut_init.c +++ b/src/freeglut_init.c @@ -864,8 +864,8 @@ void FGAPIENTRY glutInitDisplayString( const char* displayMode ) break ; case 28 : /* Unrecognized */ - printf ( "WARNING - Display string token not recognized: %s\n", - token ); + fgWarning ( "WARNING - Display string token not recognized: %s", + token ); break ; } diff --git a/src/freeglut_internal.h b/src/freeglut_internal.h index adfcb1b..56f8f24 100644 --- a/src/freeglut_internal.h +++ b/src/freeglut_internal.h @@ -698,7 +698,6 @@ void fgCloseWindow( SFG_Window* window ); void fgAddToWindowDestroyList ( SFG_Window* window ); void fgCloseWindows (); void fgDestroyWindow( SFG_Window* window ); -void fgClearCallBacks( SFG_Window *window ); /* Menu creation and destruction. Defined in freeglut_structure.c */ SFG_Menu* fgCreateMenu( FGCBMenu menuCallback ); diff --git a/src/freeglut_joystick.c b/src/freeglut_joystick.c index 1115076..a61a708 100644 --- a/src/freeglut_joystick.c +++ b/src/freeglut_joystick.c @@ -241,8 +241,7 @@ static int fghJoystickFindUSBdev(char *name, char *out, int outlen) return 1; } else if (errno == EACCES) { if (!protection_warned) { - fprintf(stderr, "Can't open %s for read!\n", - buf); + fgWarning ( "Can't open %s for read!", buf ); protection_warned = 1; } } @@ -263,7 +262,7 @@ static int fghJoystickInitializeHID(struct os_specific_s *os, if ( ( rd = hid_get_report_desc( os->fd ) ) == 0 ) { - fprintf( stderr, "error: %s: %s", os->fname, strerror( errno ) ); + fgWarning ( "error: %s: %s", os->fname, strerror( errno ) ); return FALSE; } @@ -273,8 +272,7 @@ static int fghJoystickInitializeHID(struct os_specific_s *os, if( ioctl( os->fd, USB_GET_REPORT_ID, &report_id ) < 0) { /*** XXX {report_id} may not be the right variable? ***/ - fprintf( stderr, "error: %s%d: %s", - UHIDDEV, report_id, strerror( errno ) ); + fgWarning ( "error: %s%d: %s", UHIDDEV, report_id, strerror( errno ) ); return FALSE; } @@ -724,7 +722,7 @@ static void fghJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes ) break; default: - fgWarning ( "%s", "PLIB_JS: Unrecognised /dev/js return!?!" ); + fgWarning ( "PLIB_JS: Unrecognised /dev/js return!?!" ); /* use the old values */ @@ -851,7 +849,7 @@ static int fghJoystickFindDevices ( SFG_Joystick *joy, mach_port_t masterPort ) rv = IOServiceGetMatchingServices(masterPort, hidMatch, &hidIterator); if (rv != kIOReturnSuccess || !hidIterator) { - fgWarning( "%s", "no joystick (HID) devices found" ); + fgWarning( "no joystick (HID) devices found" ); return; } @@ -894,13 +892,13 @@ static CFDictionaryRef fghJoystickGetCFProperties ( SFG_Joystick *joy, io_object rv = IORegistryEntryGetParentEntry (ioDev, kIOServicePlane, &parent1); if (rv != kIOReturnSuccess) { - fgWarning ( "%s", "error getting device entry parent"); + fgWarning ( "error getting device entry parent"); return NULL; } rv = IORegistryEntryGetParentEntry (parent1, kIOServicePlane, &parent2); if (rv != kIOReturnSuccess) { - fgWarning ( "%s", "error getting device entry parent 2"); + fgWarning ( "error getting device entry parent 2"); return NULL; } #endif @@ -908,7 +906,7 @@ static CFDictionaryRef fghJoystickGetCFProperties ( SFG_Joystick *joy, io_object rv = IORegistryEntryCreateCFProperties( ioDev /*parent2*/, &cfProperties, kCFAllocatorDefault, kNilOptions); if (rv != kIOReturnSuccess || !cfProperties) { - fgWarning ( "%s", "error getting device properties"); + fgWarning ( "error getting device properties"); return NULL; } @@ -974,14 +972,14 @@ static void fghJoystickParseElement ( SFG_Joystick *joy, CFDictionaryRef element break; default: - printf("input type element has weird usage (%x)\n", usage); + fgWarning ( "input type element has weird usage (%x)", usage); break; } } else if (page == kHIDPage_Button) { printf(" button\n"); fghJoystickAddButtonElement((CFDictionaryRef) element); } else - printf("input type element has weird page (%x)\n", page); + fgWarning ( "input type element has weird page (%x)", page); break; case kIOHIDElementTypeCollection: @@ -1239,7 +1237,7 @@ static void fghJoystickOpen( SFG_Joystick* joy ) #if TARGET_HOST_MAC_OSX if( joy->id >= numDevices ) { - fgWarning( "%s", "device index out of range in fgJoystickOpen()" ); + fgWarning( "device index out of range in fgJoystickOpen()" ); return; } @@ -1251,7 +1249,7 @@ static void fghJoystickOpen( SFG_Joystick* joy ) if( rv != kIOReturnSuccess ) { - fgWarning( "%s", "error creating plugin for io device" ); + fgWarning( "error creating plugin for io device" ); return; } @@ -1262,7 +1260,7 @@ static void fghJoystickOpen( SFG_Joystick* joy ) ); if( pluginResult != S_OK ) - fgWarning ( "%s", "QI-ing IO plugin to HID Device interface failed" ); + fgWarning ( "QI-ing IO plugin to HID Device interface failed" ); ( *plugin )->Release( plugin ); /* don't leak a ref */ if( joy->hidDev == NULL ) @@ -1358,7 +1356,7 @@ static void fghJoystickOpen( SFG_Joystick* joy ) joy->os->fd = open( joy->os->fname, O_RDONLY | O_NONBLOCK); if( joy->os->fd < 0 && errno == EACCES ) - fgWarning ( "%s exists but is not readable by you\n", joy->os->fname ); + fgWarning ( "%s exists but is not readable by you", joy->os->fname ); joy->error =( joy->os->fd < 0 ); @@ -1533,10 +1531,10 @@ static void fghJoystickOpen( SFG_Joystick* joy ) void fgJoystickInit( int ident ) { if( ident >= MAX_NUM_JOYSTICKS ) - fgError( "Too large a joystick number" ); + fgError( "Too large a joystick number: %d", ident ); if( fgJoystick[ ident ] ) - fgError( "illegal attempt to initialize joystick device" ); + fgError( "illegal attempt to initialize joystick device again" ); fgJoystick[ ident ] = ( SFG_Joystick * )calloc( sizeof( SFG_Joystick ), 1 ); @@ -1566,7 +1564,7 @@ void fgJoystickInit( int ident ) IOReturn rv = IOMasterPort( bootstrap_port, &masterPort ); if( rv != kIOReturnSuccess ) { - fgWarning( "%s", "error getting master Mach port" ); + fgWarning( "error getting master Mach port" ); return; } fghJoystickFindDevices( masterPort ); @@ -1589,7 +1587,7 @@ void fgJoystickInit( int ident ) !CFStringGetCString( ( CFStringRef )ref, name, 128, CFStringGetSystemEncoding( ) ) ) { - fgWarning( "%s", "error getting device name" ); + fgWarning( "error getting device name" ); name[ 0 ] = '\0'; } #endif diff --git a/src/freeglut_main.c b/src/freeglut_main.c index 529e9e1..c853969 100644 --- a/src/freeglut_main.c +++ b/src/freeglut_main.c @@ -502,7 +502,7 @@ static void fghSleepForEvents( void ) err = select( socket+1, &fdset, NULL, NULL, &wait ); if( -1 == err ) - fgWarning ( "freeglut select() error: %d\n", errno ); + fgWarning ( "freeglut select() error: %d", errno ); } #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE MsgWaitForMultipleObjects( 0, NULL, FALSE, msec, QS_ALLEVENTS ); @@ -696,7 +696,7 @@ void FGAPIENTRY glutMainLoopEvent( void ) break; default: - fgWarning( "Uknown X visibility state: %d", + fgWarning( "Unknown X visibility state: %d", event.xvisibility.state ); break; } @@ -1953,7 +1953,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, default: #if _DEBUG - fgWarning( "Unknown wParam type 0x%x\n", wParam ); + fgWarning( "Unknown wParam type 0x%x", wParam ); #endif break; } diff --git a/src/freeglut_state.c b/src/freeglut_state.c index 325609b..f8b70e9 100644 --- a/src/freeglut_state.c +++ b/src/freeglut_state.c @@ -118,7 +118,7 @@ void FGAPIENTRY glutSetOption( GLenum eWhat, int value ) break; default: - fgWarning( "glutSetOption(): missing enum handle %i\n", eWhat ); + fgWarning( "glutSetOption(): missing enum handle %d", eWhat ); break; } } @@ -454,7 +454,7 @@ int FGAPIENTRY glutGet( GLenum eWhat ) break; default: - fgWarning( "glutGet(): missing enum handle %i\n", eWhat ); + fgWarning( "glutGet(): missing enum handle %d", eWhat ); break; } return -1; @@ -555,7 +555,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat ) return GLUT_KEY_REPEAT_DEFAULT; default: - fgWarning( "glutDeviceGet(): missing enum handle %i\n", eWhat ); + fgWarning( "glutDeviceGet(): missing enum handle %d", eWhat ); break; } @@ -649,7 +649,7 @@ int FGAPIENTRY glutLayerGet( GLenum eWhat ) #endif default: - fgWarning( "glutLayerGet(): missing enum handle %i\n", eWhat ); + fgWarning( "glutLayerGet(): missing enum handle %d", eWhat ); break; } diff --git a/src/freeglut_window.c b/src/freeglut_window.c index c0714aa..a92eafd 100644 --- a/src/freeglut_window.c +++ b/src/freeglut_window.c @@ -725,7 +725,7 @@ void FGAPIENTRY glutSetWindow( int ID ) window = fgWindowByID( ID ); if( window == NULL ) { - fgWarning( "glutSetWindow(): window ID %i not found!", ID ); + fgWarning( "glutSetWindow(): window ID %d not found!", ID ); return; } -- 1.7.10.4