From c9465696ce0cf19714751bc156f5895f4e8502bc Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 9 Mar 2006 06:33:21 +0000 Subject: [PATCH] Cleaning up warnings on MacOS X --- include/SDL_syswm.h | 4 +- src/SDL.c | 20 +-- src/audio/SDL_audio.c | 6 +- src/audio/SDL_mixer_MMX.h | 3 +- src/audio/SDL_mixer_MMX_VC.h | 16 +- src/audio/SDL_wave.c | 8 +- src/audio/macosx/SDL_coreaudio.c | 4 +- src/cdrom/macosx/AudioFilePlayer.c | 71 ++++----- src/cdrom/macosx/AudioFilePlayer.h | 38 ++--- src/cdrom/macosx/AudioFileReaderThread.c | 96 ++++++------ src/cdrom/macosx/CDPlayer.c | 186 +++++++++-------------- src/cdrom/macosx/CDPlayer.h | 2 +- src/cdrom/macosx/SDLOSXCAGuard.c | 31 ++-- src/cdrom/macosx/SDLOSXCAGuard.h | 42 ++--- src/cdrom/macosx/SDL_syscdrom.c | 2 +- src/cpuinfo/SDL_cpuinfo.c | 10 +- src/joystick/darwin/SDL_sysjoystick.c | 88 +++++------ src/thread/pthread/SDL_syssem.c | 1 + src/video/SDL_blit_A.c | 6 +- src/video/SDL_blit_N.c | 7 +- src/video/quartz/SDL_QuartzEvents.m | 19 +-- src/video/quartz/SDL_QuartzVideo.m | 10 +- src/video/quartz/SDL_QuartzWindow.m | 4 +- 23 files changed, 317 insertions(+), 357 deletions(-) diff --git a/include/SDL_syswm.h b/include/SDL_syswm.h index 4d66a67e6..5fcba4662 100644 --- a/include/SDL_syswm.h +++ b/include/SDL_syswm.h @@ -48,7 +48,7 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo; /* This is the structure for custom window manager events */ #if SDL_VIDEO_DRIVER_X11 #if defined(__APPLE__) && defined(__MACH__) -// conflicts with Quickdraw.h +/* conflicts with Quickdraw.h */ #define Cursor X11Cursor #endif @@ -56,7 +56,7 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo; #include #if defined(__APPLE__) && defined(__MACH__) -// matches the re-define above +/* matches the re-define above */ #undef Cursor #endif diff --git a/src/SDL.c b/src/SDL.c index f170ef149..64a3e93dc 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -253,14 +253,14 @@ const SDL_version * SDL_Linked_Version(void) } #if defined(__OS2__) -// Building for OS/2 +/* Building for OS/2 */ #ifdef __WATCOMC__ #define INCL_DOSERRORS #define INCL_DOSEXCEPTIONS #include -// Exception handler to prevent the Audio thread hanging, making a zombie process! +/* Exception handler to prevent the Audio thread hanging, making a zombie process! */ ULONG _System SDL_Main_ExceptionHandler(PEXCEPTIONREPORTRECORD pERepRec, PEXCEPTIONREGISTRATIONRECORD pERegRec, PCONTEXTRECORD pCtxRec, @@ -273,7 +273,7 @@ ULONG _System SDL_Main_ExceptionHandler(PEXCEPTIONREPORTRECORD pERepRec, if (pERepRec->fHandlerFlags & EH_NESTED_CALL) return XCPT_CONTINUE_SEARCH; - // Do cleanup at every fatal exception! + /* Do cleanup at every fatal exception! */ if (((pERepRec->ExceptionNum & XCPT_SEVERITY_CODE) == XCPT_FATAL_EXCEPTION) && (pERepRec->ExceptionNum != XCPT_BREAKPOINT) && (pERepRec->ExceptionNum != XCPT_SINGLE_STEP) @@ -281,7 +281,7 @@ ULONG _System SDL_Main_ExceptionHandler(PEXCEPTIONREPORTRECORD pERepRec, { if (SDL_initialized & SDL_INIT_AUDIO) { - // This removes the zombie audio thread in case of emergency. + /* This removes the zombie audio thread in case of emergency. */ #ifdef DEBUG_BUILD printf("[SDL_Main_ExceptionHandler] : Calling SDL_CloseAudio()!\n"); #endif @@ -294,28 +294,28 @@ ULONG _System SDL_Main_ExceptionHandler(PEXCEPTIONREPORTRECORD pERepRec, EXCEPTIONREGISTRATIONRECORD SDL_Main_xcpthand = {0, SDL_Main_ExceptionHandler}; -// The main DLL entry for DLL Initialization and Uninitialization: +/* The main DLL entry for DLL Initialization and Uninitialization: */ unsigned _System LibMain(unsigned hmod, unsigned termination) { if (termination) { #ifdef DEBUG_BUILD -// printf("[SDL DLL Unintialization] : Removing exception handler\n"); +/* printf("[SDL DLL Unintialization] : Removing exception handler\n"); */ #endif DosUnsetExceptionHandler(&SDL_Main_xcpthand); return 1; } else { #ifdef DEBUG_BUILD - // Make stdout and stderr unbuffered! + /* Make stdout and stderr unbuffered! */ setbuf(stdout, NULL); setbuf(stderr, NULL); #endif - // Fire up exception handler + /* Fire up exception handler */ #ifdef DEBUG_BUILD -// printf("[SDL DLL Initialization] : Setting exception handler\n"); +/* printf("[SDL DLL Initialization] : Setting exception handler\n"); */ #endif - // Set exception handler + /* Set exception handler */ DosSetExceptionHandler(&SDL_Main_xcpthand); return 1; diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index 754baa10d..57c947cf0 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -29,7 +29,7 @@ #include "SDL_sysaudio.h" #ifdef __OS2__ -// We'll need the DosSetPriority() API! +/* We'll need the DosSetPriority() API! */ #define INCL_DOSPROCESS #include #endif @@ -178,8 +178,8 @@ int SDL_RunAudio(void *audiop) #endif #ifdef __OS2__ - // Increase the priority of this thread to make sure that - // the audio will be continuous all the time! + /* Increase the priority of this thread to make sure that + the audio will be continuous all the time! */ #ifdef USE_DOSSETPRIORITY if (SDL_getenv("SDL_USE_TIMECRITICAL_AUDIO")) { diff --git a/src/audio/SDL_mixer_MMX.h b/src/audio/SDL_mixer_MMX.h index 9bd956119..5a62683b2 100644 --- a/src/audio/SDL_mixer_MMX.h +++ b/src/audio/SDL_mixer_MMX.h @@ -8,8 +8,7 @@ */ #include "SDL_config.h" - -#if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT) +#if defined(__GNUC__) && defined(__i386__) && defined(SDL_ASSEMBLY_ROUTINES) void SDL_MixAudio_MMX_S16(char* ,char* ,unsigned int ,int ); void SDL_MixAudio_MMX_S8(char* ,char* ,unsigned int ,int ); #endif diff --git a/src/audio/SDL_mixer_MMX_VC.h b/src/audio/SDL_mixer_MMX_VC.h index 770e7f9f6..bfe02a988 100644 --- a/src/audio/SDL_mixer_MMX_VC.h +++ b/src/audio/SDL_mixer_MMX_VC.h @@ -23,14 +23,14 @@ #if ((defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)) && defined(SDL_ASSEMBLY_ROUTINES) -// headers for MMX assembler version of SDL_MixAudio -// Copyright 2002 Stephane Marchesin (stephane.marchesin@wanadoo.fr) -// Converted to Intel ASM notation by Cth -// This code is licensed under the LGPL (see COPYING for details) -// -// Assumes buffer size in bytes is a multiple of 16 -// Assumes SDL_MIX_MAXVOLUME = 128 - +/* headers for MMX assembler version of SDL_MixAudio + Copyright 2002 Stephane Marchesin (stephane.marchesin@wanadoo.fr) + Converted to Intel ASM notation by Cth + This code is licensed under the LGPL (see COPYING for details) + + Assumes buffer size in bytes is a multiple of 16 + Assumes SDL_MIX_MAXVOLUME = 128 +*/ void SDL_MixAudio_MMX_S16_VC(char* ,char* ,unsigned int ,int ); void SDL_MixAudio_MMX_S8_VC(char* ,char* ,unsigned int ,int ); #endif diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c index b2399bd96..b55f4727c 100644 --- a/src/audio/SDL_wave.c +++ b/src/audio/SDL_wave.c @@ -433,7 +433,7 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc, was_error = 1; goto done; } - headerDiff += sizeof(Uint32); // for WAVE + headerDiff += sizeof(Uint32); /* for WAVE */ /* Read the audio data format chunk */ chunk.data = NULL; @@ -446,7 +446,7 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc, was_error = 1; goto done; } - // 2 Uint32's for chunk header+len, plus the lenread + /* 2 Uint32's for chunk header+len, plus the lenread */ headerDiff += lenread + 2 * sizeof(Uint32); } while ( (chunk.magic == FACT) || (chunk.magic == LIST) ); @@ -527,7 +527,7 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc, *audio_buf = chunk.data; if(chunk.magic != DATA) headerDiff += lenread + 2 * sizeof(Uint32); } while ( chunk.magic != DATA ); - headerDiff += 2 * sizeof(Uint32); // for the data chunk and len + headerDiff += 2 * sizeof(Uint32); /* for the data chunk and len */ if ( MS_ADPCM_encoded ) { if ( MS_ADPCM_decode(audio_buf, audio_len) < 0 ) { @@ -554,7 +554,7 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc, if ( freesrc ) { SDL_RWclose(src); } else { - // seek to the end of the file (given by the RIFF chunk) + /* seek to the end of the file (given by the RIFF chunk) */ SDL_RWseek(src, wavelen - chunk.length - headerDiff, RW_SEEK_CUR); } } diff --git a/src/audio/macosx/SDL_coreaudio.c b/src/audio/macosx/SDL_coreaudio.c index 7755d133c..2cae95813 100644 --- a/src/audio/macosx/SDL_coreaudio.c +++ b/src/audio/macosx/SDL_coreaudio.c @@ -128,8 +128,8 @@ static OSStatus audioCallback (void *inRefCon, len = bufferSize - bufferOffset; if (len > remaining) len = remaining; - SDL_memcpy(ptr, buffer + bufferOffset, len); - ptr += len; + SDL_memcpy(ptr, (char *)buffer + bufferOffset, len); + ptr = (char *)ptr + len; remaining -= len; bufferOffset += len; } diff --git a/src/cdrom/macosx/AudioFilePlayer.c b/src/cdrom/macosx/AudioFilePlayer.c index 9f4f72e9a..37a443524 100644 --- a/src/cdrom/macosx/AudioFilePlayer.c +++ b/src/cdrom/macosx/AudioFilePlayer.c @@ -24,9 +24,9 @@ */ #include "SDL_config.h" -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// AudioFilePlayer.cpp -// +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + AudioFilePlayer.cpp +*/ #include "AudioFilePlayer.h" /* @@ -61,7 +61,7 @@ static void PrintStreamDesc (AudioStreamBasicDescription *inDesc) static int AudioFilePlayer_SetDestination (AudioFilePlayer *afp, AudioUnit *inDestUnit) { - //if (afp->mConnected) throw static_cast(-1); //can't set dest if already engaged + /*if (afp->mConnected) throw static_cast(-1);*/ /* can't set dest if already engaged */ if (afp->mConnected) return 0 ; @@ -70,17 +70,17 @@ static int AudioFilePlayer_SetDestination (AudioFilePlayer *afp, AudioUnit *inD OSStatus result = noErr; - //we can "down" cast a component instance to a component + /* we can "down" cast a component instance to a component */ ComponentDescription desc; result = GetComponentInfo ((Component)*inDestUnit, &desc, 0, 0, 0); - if (result) return 0; //THROW_RESULT("GetComponentInfo") + if (result) return 0; /*THROW_RESULT("GetComponentInfo")*/ - // we're going to use this to know which convert routine to call - // a v1 audio unit will have a type of 'aunt' - // a v2 audio unit will have one of several different types. + /* we're going to use this to know which convert routine to call + a v1 audio unit will have a type of 'aunt' + a v2 audio unit will have one of several different types. */ if (desc.componentType != kAudioUnitComponentType) { result = badComponentInstance; - //THROW_RESULT("BAD COMPONENT") + /*THROW_RESULT("BAD COMPONENT")*/ if (result) return 0; } @@ -91,7 +91,7 @@ static int AudioFilePlayer_SetDestination (AudioFilePlayer *afp, AudioUnit *inD 0, &afp->mFileDescription, sizeof (afp->mFileDescription)); - //THROW_RESULT("AudioUnitSetProperty") + /*THROW_RESULT("AudioUnitSetProperty")*/ if (result) return 0; return 1; } @@ -170,7 +170,7 @@ static int AudioFilePlayer_Connect(AudioFilePlayer *afp) if (!afp->mAudioFileManager->DoConnect(afp->mAudioFileManager)) return 0; - // set the render callback for the file data to be supplied to the sound converter AU + /* set the render callback for the file data to be supplied to the sound converter AU */ afp->mInputCallback.inputProc = afp->mAudioFileManager->FileInputProc; afp->mInputCallback.inputProcRefCon = afp->mAudioFileManager; @@ -180,15 +180,15 @@ static int AudioFilePlayer_Connect(AudioFilePlayer *afp) 0, &afp->mInputCallback, sizeof(afp->mInputCallback)); - if (result) return 0; //THROW_RESULT("AudioUnitSetProperty") + if (result) return 0; /*THROW_RESULT("AudioUnitSetProperty")*/ afp->mConnected = 1; } return 1; } -// warning noted, now please go away ;-) -// #warning This should redirect the calling of notification code to some other thread +/* warning noted, now please go away ;-) */ +/* #warning This should redirect the calling of notification code to some other thread */ static void AudioFilePlayer_DoNotification (AudioFilePlayer *afp, OSStatus inStatus) { if (afp->mNotifier) { @@ -243,52 +243,53 @@ static int AudioFilePlayer_OpenFile (AudioFilePlayer *afp, const FSRef *inRef ByteCount actual; SInt64 offset; - // Open the data fork of the input file + /* Open the data fork of the input file */ result = FSGetDataForkName(&dfName); - if (result) return 0; //THROW_RESULT("AudioFilePlayer::OpenFile(): FSGetDataForkName") + if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): FSGetDataForkName")*/ result = FSOpenFork(inRef, dfName.length, dfName.unicode, fsRdPerm, &afp->mForkRefNum); - if (result) return 0; //THROW_RESULT("AudioFilePlayer::OpenFile(): FSOpenFork") + if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): FSOpenFork")*/ - // Read the file header, and check if it's indeed an AIFC file + /* Read the file header, and check if it's indeed an AIFC file */ result = FSReadFork(afp->mForkRefNum, fsAtMark, 0, sizeof(chunkHeader), &chunkHeader, &actual); - if (result) return 0; //THROW_RESULT("AudioFilePlayer::OpenFile(): FSReadFork") + if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): FSReadFork")*/ if (chunkHeader.ckID != 'FORM') { result = -1; - if (result) return 0; //THROW_RESULT("AudioFilePlayer::OpenFile(): chunk id is not 'FORM'"); + if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): chunk id is not 'FORM'");*/ } if (chunkHeader.formType != 'AIFC') { result = -1; - if (result) return 0; //THROW_RESULT("AudioFilePlayer::OpenFile(): file format is not 'AIFC'"); + if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): file format is not 'AIFC'");*/ } - // Search for the SSND chunk. We ignore all compression etc. information - // in other chunks. Of course that is kind of evil, but for now we are lazy - // and rely on the cdfs to always give us the same fixed format. - // TODO: Parse the COMM chunk we currently skip to fill in mFileDescription. + /* Search for the SSND chunk. We ignore all compression etc. information + in other chunks. Of course that is kind of evil, but for now we are lazy + and rely on the cdfs to always give us the same fixed format. + TODO: Parse the COMM chunk we currently skip to fill in mFileDescription. + */ offset = 0; do { result = FSReadFork(afp->mForkRefNum, fsFromMark, offset, sizeof(chunk), &chunk, &actual); - if (result) return 0; //THROW_RESULT("AudioFilePlayer::OpenFile(): FSReadFork") + if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): FSReadFork")*/ - // Skip the chunk data + /* Skip the chunk data */ offset = chunk.ckSize; } while (chunk.ckID != 'SSND'); - // Read the header of the SSND chunk. After this, we are positioned right - // at the start of the audio data. + /* Read the header of the SSND chunk. After this, we are positioned right + at the start of the audio data. */ result = FSReadFork(afp->mForkRefNum, fsAtMark, 0, sizeof(ssndData), &ssndData, &actual); - if (result) return 0; //THROW_RESULT("AudioFilePlayer::OpenFile(): FSReadFork") + if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): FSReadFork")*/ result = FSSetForkPosition(afp->mForkRefNum, fsFromMark, ssndData.offset); - if (result) return 0; //THROW_RESULT("AudioFilePlayer::OpenFile(): FSSetForkPosition") + if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): FSSetForkPosition")*/ - // Data size + /* Data size */ *outFileDataSize = chunk.ckSize - ssndData.offset - 8; - // File format + /* File format */ afp->mFileDescription.mSampleRate = 44100; afp->mFileDescription.mFormatID = kAudioFormatLinearPCM; afp->mFileDescription.mFormatFlags = kLinearPCMFormatFlagIsPacked | kLinearPCMFormatFlagIsSignedInteger; @@ -331,7 +332,7 @@ AudioFilePlayer *new_AudioFilePlayer (const FSRef *inFileRef) return NULL; } - // we want about 4 seconds worth of data for the buffer + /* we want about 4 seconds worth of data for the buffer */ int bytesPerSecond = (UInt32) (4 * afp->mFileDescription.mSampleRate * afp->mFileDescription.mBytesPerFrame); #if DEBUG diff --git a/src/cdrom/macosx/AudioFilePlayer.h b/src/cdrom/macosx/AudioFilePlayer.h index 8b45b2d2e..1d7eb19d4 100644 --- a/src/cdrom/macosx/AudioFilePlayer.h +++ b/src/cdrom/macosx/AudioFilePlayer.h @@ -24,9 +24,9 @@ */ #include "SDL_config.h" -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// AudioFilePlayer.h -// +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + AudioFilePlayer.h +*/ #ifndef __AudioFilePlayer_H__ #define __AudioFilePlayer_H__ @@ -62,12 +62,12 @@ struct S_AudioFileManager; #pragma mark __________ AudioFilePlayer typedef struct S_AudioFilePlayer { -//public: +/*public:*/ int (*SetDestination)(struct S_AudioFilePlayer *afp, AudioUnit *inDestUnit); void (*SetNotifier)(struct S_AudioFilePlayer *afp, AudioFilePlayNotifier inNotifier, void *inRefCon); - void (*SetStartFrame)(struct S_AudioFilePlayer *afp, int frame); // seek in the file - int (*GetCurrentFrame)(struct S_AudioFilePlayer *afp); // get the current frame position - void (*SetStopFrame)(struct S_AudioFilePlayer *afp, int frame); // set limit in the file + void (*SetStartFrame)(struct S_AudioFilePlayer *afp, int frame); /* seek in the file */ + int (*GetCurrentFrame)(struct S_AudioFilePlayer *afp); /* get the current frame position */ + void (*SetStopFrame)(struct S_AudioFilePlayer *afp, int frame); /* set limit in the file */ int (*Connect)(struct S_AudioFilePlayer *afp); void (*Disconnect)(struct S_AudioFilePlayer *afp); void (*DoNotification)(struct S_AudioFilePlayer *afp, OSStatus inError); @@ -75,7 +75,7 @@ typedef struct S_AudioFilePlayer AudioUnit (*GetDestUnit)(struct S_AudioFilePlayer *afp); void (*Print)(struct S_AudioFilePlayer *afp); -//private: +/*private:*/ AudioUnit mPlayUnit; SInt16 mForkRefNum; @@ -106,19 +106,19 @@ void delete_AudioFilePlayer(AudioFilePlayer *afp); #pragma mark __________ AudioFileManager typedef struct S_AudioFileManager { -//public: - // this method should NOT be called by an object of this class - // as it is called by the parent's Disconnect() method +/*public:*/ + /* this method should NOT be called by an object of this class + as it is called by the parent's Disconnect() method */ void (*Disconnect)(struct S_AudioFileManager *afm); int (*DoConnect)(struct S_AudioFileManager *afm); OSStatus (*Read)(struct S_AudioFileManager *afm, char *buffer, UInt32 *len); const char* (*GetFileBuffer)(struct S_AudioFileManager *afm); const AudioFilePlayer *(*GetParent)(struct S_AudioFileManager *afm); - void (*SetPosition)(struct S_AudioFileManager *afm, SInt64 pos); // seek/rewind in the file - int (*GetByteCounter)(struct S_AudioFileManager *afm); // return actual bytes streamed to audio hardware - void (*SetEndOfFile)(struct S_AudioFileManager *afm, SInt64 pos); // set the "EOF" (will behave just like it reached eof) + void (*SetPosition)(struct S_AudioFileManager *afm, SInt64 pos); /* seek/rewind in the file */ + int (*GetByteCounter)(struct S_AudioFileManager *afm); /* return actual bytes streamed to audio hardware */ + void (*SetEndOfFile)(struct S_AudioFileManager *afm, SInt64 pos); /* set the "EOF" (will behave just like it reached eof) */ -//protected: +/*protected:*/ AudioFilePlayer* mParent; SInt16 mForkRefNum; SInt64 mAudioDataOffset; @@ -137,20 +137,20 @@ typedef struct S_AudioFileManager void* mTmpBuffer; UInt32 mBufferSize; UInt32 mBufferOffset; -//public: +/*public:*/ UInt32 mChunkSize; SInt64 mFileLength; SInt64 mReadFilePosition; int mWriteToFirstBuffer; int mFinishedReadingData; -//protected: +/*protected:*/ OSStatus (*Render)(struct S_AudioFileManager *afm, AudioBuffer *ioData); OSStatus (*GetFileData)(struct S_AudioFileManager *afm, void** inOutData, UInt32 *inOutDataSize); void (*AfterRender)(struct S_AudioFileManager *afm); -//public: - //static +/*public:*/ + /*static*/ OSStatus (*FileInputProc)(void *inRefCon, AudioUnitRenderActionFlags inActionFlags, const AudioTimeStamp *inTimeStamp, diff --git a/src/cdrom/macosx/AudioFileReaderThread.c b/src/cdrom/macosx/AudioFileReaderThread.c index d7d659f07..db7fe9b22 100644 --- a/src/cdrom/macosx/AudioFileReaderThread.c +++ b/src/cdrom/macosx/AudioFileReaderThread.c @@ -24,17 +24,17 @@ */ #include "SDL_config.h" -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// AudioFileManager.cpp -// +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + AudioFileManager.cpp +*/ #include "AudioFilePlayer.h" -#include //used for setting policy of thread +#include /* used for setting policy of thread */ #include "SDLOSXCAGuard.h" #include -//#include +/*#include */ -//typedef void *FileData; +/*typedef void *FileData;*/ typedef struct S_FileData { AudioFileManager *obj; @@ -43,7 +43,7 @@ typedef struct S_FileData typedef struct S_FileReaderThread { -//public: +/*public:*/ SDLOSXCAGuard* (*GetGuard)(struct S_FileReaderThread *frt); void (*AddReader)(struct S_FileReaderThread *frt); void (*RemoveReader)(struct S_FileReaderThread *frt, AudioFileManager* inItem); @@ -51,8 +51,8 @@ typedef struct S_FileReaderThread { int mThreadShouldDie; -//private: - //typedef std::list FileData; +/*private:*/ + /*typedef std::list FileData;*/ SDLOSXCAGuard *mGuard; UInt32 mThreadPriority; @@ -63,9 +63,9 @@ typedef struct S_FileReaderThread { void (*ReadNextChunk)(struct S_FileReaderThread *frt); int (*StartFixedPriorityThread)(struct S_FileReaderThread *frt); - //static + /*static*/ UInt32 (*GetThreadBasePriority)(pthread_t inThread); - //static + /*static*/ void* (*DiskReaderEntry)(void *inRefCon); } FileReaderThread; @@ -75,15 +75,15 @@ static SDLOSXCAGuard* FileReaderThread_GetGuard(FileReaderThread *frt) return frt->mGuard; } -// returns 1 if succeeded +/* returns 1 if succeeded */ static int FileReaderThread_TryNextRead (FileReaderThread *frt, AudioFileManager* inItem) { int didLock = 0; int succeeded = 0; if (frt->mGuard->Try(frt->mGuard, &didLock)) { - //frt->mFileData.push_back (inItem); - // !!! FIXME: this could be faster with a "tail" member. --ryan. + /*frt->mFileData.push_back (inItem);*/ + /* !!! FIXME: this could be faster with a "tail" member. --ryan. */ FileData *i = frt->mFileData; FileData *prev = NULL; @@ -123,7 +123,7 @@ static void FileReaderThread_RemoveReader (FileReaderThread *frt, AudioFileMa { int bNeedsRelease = frt->mGuard->Lock(frt->mGuard); - //frt->mFileData.remove (inItem); + /*frt->mFileData.remove (inItem);*/ FileData *i = frt->mFileData; FileData *prev = NULL; while (i != NULL) @@ -144,8 +144,8 @@ static void FileReaderThread_RemoveReader (FileReaderThread *frt, AudioFileMa if (--frt->mNumReaders == 0) { frt->mThreadShouldDie = 1; - frt->mGuard->Notify(frt->mGuard); // wake up thread so it will quit - frt->mGuard->Wait(frt->mGuard); // wait for thread to die + frt->mGuard->Notify(frt->mGuard); /* wake up thread so it will quit */ + frt->mGuard->Wait(frt->mGuard); /* wait for thread to die */ } if (bNeedsRelease) frt->mGuard->Unlock(frt->mGuard); @@ -158,34 +158,34 @@ static int FileReaderThread_StartFixedPriorityThread (FileReaderThread *frt) pthread_t pThread; OSStatus result = pthread_attr_init(&theThreadAttrs); - if (result) return 0; //THROW_RESULT("pthread_attr_init - Thread attributes could not be created.") + if (result) return 0; /*THROW_RESULT("pthread_attr_init - Thread attributes could not be created.")*/ result = pthread_attr_setdetachstate(&theThreadAttrs, PTHREAD_CREATE_DETACHED); - if (result) return 0; //THROW_RESULT("pthread_attr_setdetachstate - Thread attributes could not be detached.") + if (result) return 0; /*THROW_RESULT("pthread_attr_setdetachstate - Thread attributes could not be detached.")*/ result = pthread_create (&pThread, &theThreadAttrs, frt->DiskReaderEntry, frt); - if (result) return 0; //THROW_RESULT("pthread_create - Create and start the thread.") + if (result) return 0; /*THROW_RESULT("pthread_create - Create and start the thread.")*/ pthread_attr_destroy(&theThreadAttrs); - // we've now created the thread and started it - // we'll now set the priority of the thread to the nominated priority - // and we'll also make the thread fixed + /* we've now created the thread and started it + we'll now set the priority of the thread to the nominated priority + and we'll also make the thread fixed */ thread_extended_policy_data_t theFixedPolicy; thread_precedence_policy_data_t thePrecedencePolicy; SInt32 relativePriority; - // make thread fixed - theFixedPolicy.timeshare = 0; // set to 1 for a non-fixed thread + /* make thread fixed */ + theFixedPolicy.timeshare = 0; /* set to 1 for a non-fixed thread */ result = thread_policy_set (pthread_mach_thread_np(pThread), THREAD_EXTENDED_POLICY, (thread_policy_t)&theFixedPolicy, THREAD_EXTENDED_POLICY_COUNT); - if (result) return 0; //THROW_RESULT("thread_policy - Couldn't set thread as fixed priority.") - // set priority - // precedency policy's "importance" value is relative to spawning thread's priority + if (result) return 0; /*THROW_RESULT("thread_policy - Couldn't set thread as fixed priority.")*/ + /* set priority */ + /* precedency policy's "importance" value is relative to spawning thread's priority */ relativePriority = frt->mThreadPriority - frt->GetThreadBasePriority(pthread_self()); thePrecedencePolicy.importance = relativePriority; result = thread_policy_set (pthread_mach_thread_np(pThread), THREAD_PRECEDENCE_POLICY, (thread_policy_t)&thePrecedencePolicy, THREAD_PRECEDENCE_POLICY_COUNT); - if (result) return 0; //THROW_RESULT("thread_policy - Couldn't set thread priority.") + if (result) return 0; /*THROW_RESULT("thread_policy - Couldn't set thread priority.")*/ return 1; } @@ -196,7 +196,7 @@ static UInt32 FileReaderThread_GetThreadBasePriority (pthread_t inThread) policy_info_data_t thePolicyInfo; unsigned int count; - // get basic info + /* get basic info */ count = THREAD_BASIC_INFO_COUNT; thread_info (pthread_mach_thread_np (inThread), THREAD_BASIC_INFO, (integer_t*)&threadInfo, &count); @@ -250,7 +250,7 @@ static void FileReaderThread_ReadNextChunk (FileReaderThread *frt) for (;;) { - { // this is a scoped based lock + { /* this is a scoped based lock */ int bNeedsRelease = frt->mGuard->Lock(frt->mGuard); if (frt->mThreadShouldDie) { @@ -259,13 +259,13 @@ static void FileReaderThread_ReadNextChunk (FileReaderThread *frt) return; } - //if (frt->mFileData.empty()) + /*if (frt->mFileData.empty())*/ if (frt->mFileData == NULL) { frt->mGuard->Wait(frt->mGuard); } - // kill thread + /* kill thread */ if (frt->mThreadShouldDie) { frt->mGuard->Notify(frt->mGuard); @@ -273,8 +273,8 @@ static void FileReaderThread_ReadNextChunk (FileReaderThread *frt) return; } - //theItem = frt->mFileData.front(); - //frt->mFileData.pop_front(); + /*theItem = frt->mFileData.front();*/ + /*frt->mFileData.pop_front();*/ theItem = NULL; if (frt->mFileData != NULL) { @@ -292,16 +292,16 @@ static void FileReaderThread_ReadNextChunk (FileReaderThread *frt) else dataChunkSize = theItem->mChunkSize; - // this is the exit condition for the thread + /* this is the exit condition for the thread */ if (dataChunkSize <= 0) { theItem->mFinishedReadingData = 1; continue; } - // construct pointer + /* construct pointer */ char* writePtr = (char *) (theItem->GetFileBuffer(theItem) + (theItem->mWriteToFirstBuffer ? 0 : theItem->mChunkSize)); - // read data + /* read data */ result = theItem->Read(theItem, writePtr, &dataChunkSize); if (result != noErr && result != eofErr) { AudioFilePlayer *afp = (AudioFilePlayer *) theItem->GetParent(theItem); @@ -313,16 +313,16 @@ static void FileReaderThread_ReadNextChunk (FileReaderThread *frt) { writePtr += dataChunkSize; - // can't exit yet.. we still have to pass the partial buffer back - memset (writePtr, 0, (theItem->mChunkSize - dataChunkSize)); + /* can't exit yet.. we still have to pass the partial buffer back */ + SDL_memset(writePtr, 0, (theItem->mChunkSize - dataChunkSize)); } - theItem->mWriteToFirstBuffer = !theItem->mWriteToFirstBuffer; // switch buffers + theItem->mWriteToFirstBuffer = !theItem->mWriteToFirstBuffer; /* switch buffers */ if (result == eofErr) theItem->mReadFilePosition = theItem->mFileLength; else - theItem->mReadFilePosition += dataChunkSize; // increment count + theItem->mReadFilePosition += dataChunkSize; /* increment count */ } } @@ -372,13 +372,14 @@ static int AudioFileManager_DoConnect (AudioFileManager *afm) { if (!afm->mIsEngaged) { - //afm->mReadFilePosition = 0; + OSStatus result; + + /*afm->mReadFilePosition = 0;*/ afm->mFinishedReadingData = 0; afm->mNumTimesAskedSinceFinished = 0; afm->mLockUnsuccessful = 0; - OSStatus result; UInt32 dataChunkSize; if ((afm->mFileLength - afm->mReadFilePosition) < afm->mChunkSize) @@ -387,7 +388,7 @@ static int AudioFileManager_DoConnect (AudioFileManager *afm) dataChunkSize = afm->mChunkSize; result = afm->Read(afm, afm->mFileBuffer, &dataChunkSize); - if (result) return 0; //THROW_RESULT("AudioFileManager::DoConnect(): Read") + if (result) return 0; /*THROW_RESULT("AudioFileManager::DoConnect(): Read")*/ afm->mReadFilePosition += dataChunkSize; @@ -398,8 +399,9 @@ static int AudioFileManager_DoConnect (AudioFileManager *afm) afm->mIsEngaged = 1; } - //else - // throw static_cast(-1); //thread has already been started + /* + else + throw static_cast(-1); */ /* thread has already been started */ return 1; } diff --git a/src/cdrom/macosx/CDPlayer.c b/src/cdrom/macosx/CDPlayer.c index 9d40cad4a..16dc21397 100644 --- a/src/cdrom/macosx/CDPlayer.c +++ b/src/cdrom/macosx/CDPlayer.c @@ -25,16 +25,16 @@ #include "AudioFilePlayer.h" #include "SDLOSXCAGuard.h" -// we're exporting these functions into C land for SDL_syscdrom.c -//extern "C" { +/* we're exporting these functions into C land for SDL_syscdrom.c */ +/*extern "C" {*/ -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ -// Constants -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ +/*/////////////////////////////////////////////////////////////////////////// + Constants + //////////////////////////////////////////////////////////////////////////*/ -#define kAudioCDFilesystemID (UInt16)(('J' << 8) | 'H') // 'JH'; this avoids compiler warning +#define kAudioCDFilesystemID (UInt16)(('J' << 8) | 'H') /* 'JH'; this avoids compiler warning */ -// XML PList keys +/* XML PList keys */ #define kRawTOCDataString "Format 0x02 TOC Data" #define kSessionsString "Sessions" #define kSessionTypeString "Session Type" @@ -47,9 +47,9 @@ #define kSessionNumberKeyString "Session Number" #define kStartBlockKeyString "Start Block" -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ -// Globals -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ +/*/////////////////////////////////////////////////////////////////////////// + Globals + //////////////////////////////////////////////////////////////////////////*/ #pragma mark -- Globals -- @@ -61,9 +61,9 @@ static SDL_mutex *apiMutex = NULL; static SDL_sem *callbackSem; static SDL_CD* theCDROM; -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ -// Prototypes -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ +/*/////////////////////////////////////////////////////////////////////////// + Prototypes + //////////////////////////////////////////////////////////////////////////*/ #pragma mark -- Prototypes -- @@ -89,10 +89,6 @@ void Unlock () SDL_mutexV(apiMutex); } -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ -// DetectAudioCDVolumes -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ - int DetectAudioCDVolumes(FSVolumeRefNum *volumes, int numVolumes) { int volumeIndex; @@ -116,7 +112,7 @@ int DetectAudioCDVolumes(FSVolumeRefNum *volumes, int numVolumes) if (result == noErr) { - if (volumeInfo.filesystemID == kAudioCDFilesystemID) // It's an audio CD + if (volumeInfo.filesystemID == kAudioCDFilesystemID) /* It's an audio CD */ { if (volumes != NULL && cdVolumeCount < numVolumes) volumes[cdVolumeCount] = actualVolume; @@ -126,18 +122,14 @@ int DetectAudioCDVolumes(FSVolumeRefNum *volumes, int numVolumes) } else { - // I'm commenting this out because it seems to be harmless - //SDL_SetError ("DetectAudioCDVolumes: FSGetVolumeInfo returned %d", result); + /* I'm commenting this out because it seems to be harmless */ + /*SDL_SetError ("DetectAudioCDVolumes: FSGetVolumeInfo returned %d", result);*/ } } return cdVolumeCount; } -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ -// ReadTOCData -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ - int ReadTOCData (FSVolumeRefNum theVolume, SDL_CD *theCD) { HFSUniStr255 dataForkName; @@ -154,7 +146,7 @@ int ReadTOCData (FSVolumeRefNum theVolume, SDL_CD *theCD) const char* error = "Unspecified Error"; - // get stuff from .TOC.plist + /* get stuff from .TOC.plist */ fsRefPB.ioCompletion = NULL; fsRefPB.ioNamePtr = "\p.TOC.plist"; fsRefPB.ioVRefNum = theVolume; @@ -167,7 +159,7 @@ int ReadTOCData (FSVolumeRefNum theVolume, SDL_CD *theCD) goto bail; } - // Load and parse the TOC XML data + /* Load and parse the TOC XML data */ theErr = FSGetDataForkName (&dataForkName); if (theErr != noErr) { @@ -187,7 +179,7 @@ int ReadTOCData (FSVolumeRefNum theVolume, SDL_CD *theCD) goto bail; } - // Allocate some memory for the XML data + /* Allocate some memory for the XML data */ forkData = NewPtr (forkSize); if(forkData == NULL) { error = "NewPtr"; @@ -215,9 +207,9 @@ int ReadTOCData (FSVolumeRefNum theVolume, SDL_CD *theCD) goto bail; } - // Now we got the Property List in memory. Parse it. + /* Now we got the Property List in memory. Parse it. */ - // First, make sure the root item is a CFDictionary. If not, release and bail. + /* First, make sure the root item is a CFDictionary. If not, release and bail. */ if(CFGetTypeID(propertyListRef)== CFDictionaryGetTypeID()) { CFDictionaryRef dictRef = (CFDictionaryRef)propertyListRef; @@ -227,19 +219,19 @@ int ReadTOCData (FSVolumeRefNum theVolume, SDL_CD *theCD) CFIndex numSessions; CFIndex index; - // This is how we get the Raw TOC Data + /* This is how we get the Raw TOC Data */ theRawTOCDataRef = (CFDataRef)CFDictionaryGetValue (dictRef, CFSTR(kRawTOCDataString)); - // Get the session array info. + /* Get the session array info. */ theSessionArrayRef = (CFArrayRef)CFDictionaryGetValue (dictRef, CFSTR(kSessionsString)); - // Find out how many sessions there are. + /* Find out how many sessions there are. */ numSessions = CFArrayGetCount (theSessionArrayRef); - // Initialize the total number of tracks to 0 + /* Initialize the total number of tracks to 0 */ theCD->numtracks = 0; - // Iterate over all sessions, collecting the track data + /* Iterate over all sessions, collecting the track data */ for(index = 0; index < numSessions; index++) { CFDictionaryRef theSessionDict; @@ -272,7 +264,7 @@ int ReadTOCData (FSVolumeRefNum theVolume, SDL_CD *theCD) startBlock = (CFNumberRef) CFDictionaryGetValue (theTrackDict, CFSTR(kStartBlockKeyString)); isDataTrack = (CFBooleanRef) CFDictionaryGetValue (theTrackDict, CFSTR(kDataKeyString)); - // Fill in the SDL_CD struct + /* Fill in the SDL_CD struct */ int idx = theCD->numtracks++; CFNumberGetValue (trackNumber, kCFNumberSInt32Type, &value); @@ -283,19 +275,19 @@ int ReadTOCData (FSVolumeRefNum theVolume, SDL_CD *theCD) theCD->track[idx].type = (isDataTrack == kCFBooleanTrue) ? SDL_DATA_TRACK : SDL_AUDIO_TRACK; - // Since the track lengths are not stored in .TOC.plist we compute them. + /* Since the track lengths are not stored in .TOC.plist we compute them. */ if (trackIndex > 0) { theCD->track[idx-1].length = theCD->track[idx].offset - theCD->track[idx-1].offset; } } - // Compute the length of the last track + /* Compute the length of the last track */ CFNumberGetValue (leadoutBlock, kCFNumberSInt32Type, &value); theCD->track[theCD->numtracks-1].length = value - theCD->track[theCD->numtracks-1].offset; - // Set offset to leadout track + /* Set offset to leadout track */ theCD->track[theCD->numtracks].offset = value; } @@ -320,10 +312,6 @@ int ReadTOCData (FSVolumeRefNum theVolume, SDL_CD *theCD) return theErr; } -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ -// ListTrackFiles -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ - int ListTrackFiles (FSVolumeRefNum theVolume, FSRef *trackFiles, int numTracks) { OSStatus result = -1; @@ -357,11 +345,11 @@ int ListTrackFiles (FSVolumeRefNum theVolume, FSRef *trackFiles, int numTracks) CFStringRef name; name = CFStringCreateWithCharacters (NULL, nameStr.unicode, nameStr.length); - // Look for .aiff extension + /* Look for .aiff extension */ if (CFStringHasSuffix (name, CFSTR(".aiff")) || CFStringHasSuffix (name, CFSTR(".cdda"))) { - // Extract the track id from the filename + /* Extract the track id from the filename */ int trackID = 0, i = 0; while (i < nameStr.length && !isdigit(nameStr.unicode[i])) { ++i; @@ -376,7 +364,7 @@ int ListTrackFiles (FSVolumeRefNum theVolume, FSRef *trackFiles, int numTracks) CFStringGetCStringPtr (name, CFStringGetSystemEncoding())); #endif - // Track ID's start at 1, but we want to start at 0 + /* Track ID's start at 1, but we want to start at 0 */ trackID--; assert(0 <= trackID && trackID <= SDL_MAX_TRACKS); @@ -393,10 +381,6 @@ int ListTrackFiles (FSVolumeRefNum theVolume, FSRef *trackFiles, int numTracks) return 0; } -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ -// LoadFile -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ - int LoadFile (const FSRef *ref, int startFrame, int stopFrame) { int error = -1; @@ -404,7 +388,7 @@ int LoadFile (const FSRef *ref, int startFrame, int stopFrame) if (CheckInit () < 0) goto bail; - // release any currently playing file + /* release any currently playing file */ if (ReleaseFile () < 0) goto bail; @@ -412,14 +396,14 @@ int LoadFile (const FSRef *ref, int startFrame, int stopFrame) printf ("LoadFile: %d %d\n", startFrame, stopFrame); #endif - //try { + /*try {*/ - // create a new player, and attach to the audio unit + /* create a new player, and attach to the audio unit */ thePlayer = new_AudioFilePlayer(ref); if (thePlayer == NULL) { SDL_SetError ("LoadFile: Could not create player"); - return -3; //throw (-3); + return -3; /*throw (-3);*/ } if (!thePlayer->SetDestination(thePlayer, &theUnit)) @@ -431,8 +415,8 @@ int LoadFile (const FSRef *ref, int startFrame, int stopFrame) if (stopFrame >= 0 && stopFrame > startFrame) thePlayer->SetStopFrame (thePlayer, stopFrame); - // we set the notifier later - //thePlayer->SetNotifier(thePlayer, FilePlayNotificationHandler, NULL); + /* we set the notifier later */ + /*thePlayer->SetNotifier(thePlayer, FilePlayNotificationHandler, NULL);*/ if (!thePlayer->Connect(thePlayer)) goto bail; @@ -441,11 +425,11 @@ int LoadFile (const FSRef *ref, int startFrame, int stopFrame) thePlayer->Print(thePlayer); fflush (stdout); #endif - //} - //catch (...) - //{ - // goto bail; - //} + /*} + catch (...) + { + goto bail; + }*/ error = 0; @@ -453,16 +437,12 @@ int LoadFile (const FSRef *ref, int startFrame, int stopFrame) return error; } -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ -// ReleaseFile -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ - int ReleaseFile () { int error = -1; - // (Don't see any way that the original C++ code could throw here.) --ryan. - //try { + /* (Don't see any way that the original C++ code could throw here.) --ryan. */ + /*try {*/ if (thePlayer != NULL) { thePlayer->Disconnect(thePlayer); @@ -471,22 +451,18 @@ int ReleaseFile () thePlayer = NULL; } - //} - //catch (...) - //{ - // goto bail; - //} + /*} + catch (...) + { + goto bail; + }*/ error = 0; -// bail: +/* bail: */ return error; } -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ -// PlayFile -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ - int PlayFile () { OSStatus result = -1; @@ -494,17 +470,17 @@ int PlayFile () if (CheckInit () < 0) goto bail; -// try { + /*try {*/ // start processing of the audio unit result = AudioOutputUnitStart (theUnit); if (result) goto bail; //THROW_RESULT("PlayFile: AudioOutputUnitStart") -// } -// catch (...) -// { -// goto bail; -// } + /*} + catch (...) + { + goto bail; + }*/ result = 0; @@ -512,10 +488,6 @@ int PlayFile () return result; } -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ -// PauseFile -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ - int PauseFile () { OSStatus result = -1; @@ -523,26 +495,22 @@ int PauseFile () if (CheckInit () < 0) goto bail; - //try { + /*try {*/ - // stop processing the audio unit + /* stop processing the audio unit */ result = AudioOutputUnitStop (theUnit); - if (result) goto bail; //THROW_RESULT("PauseFile: AudioOutputUnitStop") - //} - //catch (...) - //{ - // goto bail; - //} + if (result) goto bail; /*THROW_RESULT("PauseFile: AudioOutputUnitStop")*/ + /*} + catch (...) + { + goto bail; + }*/ result = 0; bail: return result; } -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ -// SetCompletionProc -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ - void SetCompletionProc (CDPlayerCompletionProc proc, SDL_CD *cdrom) { assert(thePlayer != NULL); @@ -552,10 +520,6 @@ void SetCompletionProc (CDPlayerCompletionProc proc, SDL_CD *cdrom) thePlayer->SetNotifier (thePlayer, FilePlayNotificationHandler, cdrom); } -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ -// GetCurrentFrame -//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ - int GetCurrentFrame () { int frame; @@ -578,13 +542,13 @@ static OSStatus CheckInit () OSStatus result = noErr; - // Create the callback semaphore + /* Create the callback semaphore */ callbackSem = SDL_CreateSemaphore(0); - // Start callback thread + /* Start callback thread */ SDL_CreateThread(RunCallBackThread, NULL); - { //try { + { /*try {*/ ComponentDescription desc; desc.componentType = kAudioUnitComponentType; @@ -609,10 +573,10 @@ static OSStatus CheckInit () playBackWasInit = true; } - //catch (...) - //{ - // return -1; - //} + /*catch (...) + { + return -1; + }*/ return 0; } @@ -621,7 +585,7 @@ static void FilePlayNotificationHandler(void * inRefCon, OSStatus inStatus) { if (inStatus == kAudioFilePlay_FileIsFinished) { - // notify non-CA thread to perform the callback + /* notify non-CA thread to perform the callback */ SDL_SemPost(callbackSem); } else if (inStatus == kAudioFilePlayErr_FilePlayUnderrun) { @@ -661,4 +625,4 @@ static int RunCallBackThread (void *param) return 0; } -//}; // extern "C" +/*}; // extern "C" */ diff --git a/src/cdrom/macosx/CDPlayer.h b/src/cdrom/macosx/CDPlayer.h index 0e00a0ae9..5b41128dd 100644 --- a/src/cdrom/macosx/CDPlayer.h +++ b/src/cdrom/macosx/CDPlayer.h @@ -44,7 +44,7 @@ void Lock (); void Unlock(); -int LoadFile (const FSRef *ref, int startFrame, int endFrame); // pass -1 to do nothing +int LoadFile (const FSRef *ref, int startFrame, int endFrame); /* pass -1 to do nothing */ int ReleaseFile (); diff --git a/src/cdrom/macosx/SDLOSXCAGuard.c b/src/cdrom/macosx/SDLOSXCAGuard.c index 099821537..7689c4ed9 100644 --- a/src/cdrom/macosx/SDLOSXCAGuard.c +++ b/src/cdrom/macosx/SDLOSXCAGuard.c @@ -66,9 +66,9 @@ =============================================================================*/ -//============================================================================= -// Includes -//============================================================================= +/*============================================================================= + Includes + =============================================================================*/ /* #include @@ -77,7 +77,7 @@ */ #include "SDL_stdinc.h" -//#define NDEBUG 1 +/*#define NDEBUG 1*/ /* #include */ @@ -86,10 +86,10 @@ #include "SDLOSXCAGuard.h" -//#warning Need a try-based Locker too -//============================================================================= -// SDLOSXCAGuard -//============================================================================= +/*#warning Need a try-based Locker too*/ +/*============================================================================= + SDLOSXCAGuard + =============================================================================*/ static int SDLOSXCAGuard_Lock(SDLOSXCAGuard *cag) { @@ -98,6 +98,7 @@ static int SDLOSXCAGuard_Lock(SDLOSXCAGuard *cag) if(pthread_self() != cag->mOwner) { OSStatus theError = pthread_mutex_lock(&cag->mMutex); + (void)theError; assert(theError == 0); cag->mOwner = pthread_self(); theAnswer = 1; @@ -108,10 +109,12 @@ static int SDLOSXCAGuard_Lock(SDLOSXCAGuard *cag) static void SDLOSXCAGuard_Unlock(SDLOSXCAGuard *cag) { + OSStatus theError; assert(pthread_self() == cag->mOwner); cag->mOwner = 0; - OSStatus theError = pthread_mutex_unlock(&cag->mMutex); + theError = pthread_mutex_unlock(&cag->mMutex); + (void)theError; assert(theError == 0); } @@ -137,11 +140,13 @@ static int SDLOSXCAGuard_Try (SDLOSXCAGuard *cag, int *outWasLocked) static void SDLOSXCAGuard_Wait(SDLOSXCAGuard *cag) { + OSStatus theError; assert(pthread_self() == cag->mOwner); cag->mOwner = 0; - OSStatus theError = pthread_cond_wait(&cag->mCondVar, &cag->mMutex); + theError = pthread_cond_wait(&cag->mCondVar, &cag->mMutex); + (void)theError; assert(theError == 0); cag->mOwner = pthread_self(); } @@ -149,12 +154,14 @@ static void SDLOSXCAGuard_Wait(SDLOSXCAGuard *cag) static void SDLOSXCAGuard_Notify(SDLOSXCAGuard *cag) { OSStatus theError = pthread_cond_signal(&cag->mCondVar); + (void)theError; assert(theError == 0); } SDLOSXCAGuard *new_SDLOSXCAGuard(void) { + OSStatus theError; SDLOSXCAGuard *cag = (SDLOSXCAGuard *) SDL_malloc(sizeof (SDLOSXCAGuard)); if (cag == NULL) return NULL; @@ -168,10 +175,12 @@ SDLOSXCAGuard *new_SDLOSXCAGuard(void) SET_SDLOSXCAGUARD_METHOD(Notify); #undef SET_SDLOSXCAGUARD_METHOD - OSStatus theError = pthread_mutex_init(&cag->mMutex, NULL); + theError = pthread_mutex_init(&cag->mMutex, NULL); + (void)theError; assert(theError == 0); theError = pthread_cond_init(&cag->mCondVar, NULL); + (void)theError; assert(theError == 0); cag->mOwner = 0; diff --git a/src/cdrom/macosx/SDLOSXCAGuard.h b/src/cdrom/macosx/SDLOSXCAGuard.h index 3108ca748..520387a5f 100644 --- a/src/cdrom/macosx/SDLOSXCAGuard.h +++ b/src/cdrom/macosx/SDLOSXCAGuard.h @@ -69,41 +69,41 @@ #if !defined(__CAGuard_h__) #define __CAGuard_h__ -//============================================================================= -// Includes -//============================================================================= +/*============================================================================= + Includes + =============================================================================*/ #include #include -//============================================================================= -// CAGuard -// -// This is your typical mutex with signalling implemented via pthreads. -// Lock() will return true if and only if the guard is locked on that call. -// A thread that already has the guard will receive 'false' if it locks it -// again. Use of the stack-based CAGuard::Locker class is highly recommended -// to properly manage the recursive nesting. The Wait calls with timeouts -// will return true if and only if the timeout period expired. They will -// return false if they receive notification any other way. -//============================================================================= +/*============================================================================= + CAGuard + + This is your typical mutex with signalling implemented via pthreads. + Lock() will return true if and only if the guard is locked on that call. + A thread that already has the guard will receive 'false' if it locks it + again. Use of the stack-based CAGuard::Locker class is highly recommended + to properly manage the recursive nesting. The Wait calls with timeouts + will return true if and only if the timeout period expired. They will + return false if they receive notification any other way. + =============================================================================*/ typedef struct S_SDLOSXCAGuard { -// Construction/Destruction -//public: -// Actions -//public: +/* Construction/Destruction */ +/*public:*/ +/* Actions */ +/*public:*/ int (*Lock)(struct S_SDLOSXCAGuard *cag); void (*Unlock)(struct S_SDLOSXCAGuard *cag); - int (*Try)(struct S_SDLOSXCAGuard *cag, int *outWasLocked); // returns true if lock is free, false if not + int (*Try)(struct S_SDLOSXCAGuard *cag, int *outWasLocked); /* returns true if lock is free, false if not */ void (*Wait)(struct S_SDLOSXCAGuard *cag); void (*Notify)(struct S_SDLOSXCAGuard *cag); -// Implementation -//protected: +/* Implementation */ +/*protected:*/ pthread_mutex_t mMutex; pthread_cond_t mCondVar; pthread_t mOwner; diff --git a/src/cdrom/macosx/SDL_syscdrom.c b/src/cdrom/macosx/SDL_syscdrom.c index 2bb6636f3..4fc8e4687 100644 --- a/src/cdrom/macosx/SDL_syscdrom.c +++ b/src/cdrom/macosx/SDL_syscdrom.c @@ -472,7 +472,7 @@ static int SDL_SYS_CDEject(SDL_CD *cdrom) status = CD_STOPPED; - // Eject the volume + /* Eject the volume */ pb.ioParam.ioNamePtr = NULL; pb.ioParam.ioVRefNum = volumes[cdrom->id]; err = PBUnmountVol((ParamBlockRec *) &pb); diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index 0e2fcda7b..44acb124f 100644 --- a/src/cpuinfo/SDL_cpuinfo.c +++ b/src/cpuinfo/SDL_cpuinfo.c @@ -26,13 +26,11 @@ #include "SDL.h" #include "SDL_cpuinfo.h" -#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP -#include -#include -#endif - #ifdef __MACOSX__ #include /* For AltiVec check */ +#elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP +#include +#include #endif #define CPU_HAS_RDTSC 0x00000001 @@ -44,7 +42,7 @@ #define CPU_HAS_SSE2 0x00000080 #define CPU_HAS_ALTIVEC 0x00000100 -#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP +#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__ /* This is the brute force way of detecting instruction sets... the idea is borrowed from the libmpeg2 library - thanks! */ diff --git a/src/joystick/darwin/SDL_sysjoystick.c b/src/joystick/darwin/SDL_sysjoystick.c index d8cbb257d..1d273117c 100644 --- a/src/joystick/darwin/SDL_sysjoystick.c +++ b/src/joystick/darwin/SDL_sysjoystick.c @@ -48,42 +48,42 @@ struct recElement { - IOHIDElementCookie cookie; // unique value which identifies element, will NOT change - long min; // reported min value possible - long max; // reported max value possible -/* - TODO: maybe should handle the following stuff somehow? - - long scaledMin; // reported scaled min value possible - long scaledMax; // reported scaled max value possible - long size; // size in bits of data return from element - Boolean relative; // are reports relative to last report (deltas) - Boolean wrapping; // does element wrap around (one value higher than max is min) - Boolean nonLinear; // are the values reported non-linear relative to element movement - Boolean preferredState; // does element have a preferred state (such as a button) - Boolean nullState; // does element have null state -*/ + IOHIDElementCookie cookie; /* unique value which identifies element, will NOT change */ + long min; /* reported min value possible */ + long max; /* reported max value possible */ +#if 0 + /* TODO: maybe should handle the following stuff somehow? */ + + long scaledMin; /* reported scaled min value possible */ + long scaledMax; /* reported scaled max value possible */ + long size; /* size in bits of data return from element */ + Boolean relative; /* are reports relative to last report (deltas) */ + Boolean wrapping; /* does element wrap around (one value higher than max is min) */ + Boolean nonLinear; /* are the values reported non-linear relative to element movement */ + Boolean preferredState; /* does element have a preferred state (such as a button) */ + Boolean nullState; /* does element have null state */ +#endif /* 0 */ /* runtime variables used for auto-calibration */ - long minReport; // min returned value - long maxReport; // max returned value + long minReport; /* min returned value */ + long maxReport; /* max returned value */ - struct recElement * pNext; // next element in list + struct recElement * pNext; /* next element in list */ }; typedef struct recElement recElement; struct joystick_hwdata { - IOHIDDeviceInterface ** interface; // interface to device, NULL = no interface + IOHIDDeviceInterface ** interface; /* interface to device, NULL = no interface */ - char product[256]; // name of product - long usage; // usage page from IOUSBHID Parser.h which defines general usage - long usagePage; // usage within above page from IOUSBHID Parser.h which defines specific usage + char product[256]; /* name of product */ + long usage; /* usage page from IOUSBHID Parser.h which defines general usage */ + long usagePage; /* usage within above page from IOUSBHID Parser.h which defines specific usage */ - long axes; // number of axis (calculated, not reported by device) - long buttons; // number of buttons (calculated, not reported by device) - long hats; // number of hat switches (calculated, not reported by device) - long elements; // number of total elements (shouldbe total of above) (calculated, not reported by device) + long axes; /* number of axis (calculated, not reported by device) */ + long buttons; /* number of buttons (calculated, not reported by device) */ + long hats; /* number of hat switches (calculated, not reported by device) */ + long elements; /* number of total elements (shouldbe total of above) (calculated, not reported by device) */ recElement* firstAxis; recElement* firstButton; @@ -92,7 +92,7 @@ struct joystick_hwdata int removed; int uncentered; - struct joystick_hwdata* pNext; // next device + struct joystick_hwdata* pNext; /* next device */ }; typedef struct joystick_hwdata recDevice; @@ -131,32 +131,17 @@ static SInt32 HIDGetElementValue (recDevice *pDevice, recElement *pElement) } } - // auto user scale + /* auto user scale */ return hidEvent.value; } -/* similiar to HIDGetElementValue, but auto-calibrates the value before returning it */ - -static SInt32 HIDCalibratedValue (recDevice *pDevice, recElement *pElement) -{ - float deviceScale = pElement->max - pElement->min; - float readScale = pElement->maxReport - pElement->minReport; - SInt32 value = HIDGetElementValue(pDevice, pElement); - if (readScale == 0) - return value; // no scaling at all - else - return ((value - pElement->minReport) * deviceScale / readScale) + pElement->min; -} - -/* similiar to HIDCalibratedValue but calibrates to an arbitrary scale instead of the elements default scale */ - static SInt32 HIDScaledCalibratedValue (recDevice *pDevice, recElement *pElement, long min, long max) { float deviceScale = max - min; float readScale = pElement->maxReport - pElement->minReport; SInt32 value = HIDGetElementValue(pDevice, pElement); if (readScale == 0) - return value; // no scaling at all + return value; /* no scaling at all */ else return ((value - pElement->minReport) * deviceScale / readScale) + min; } @@ -191,7 +176,7 @@ static IOReturn HIDCreateOpenDeviceInterface (io_object_t hidDevice, recDevice * kIOCFPlugInInterfaceID, &ppPlugInInterface, &score); if (kIOReturnSuccess == result) { - // Call a method of the intermediate plug-in to create the device interface + /* Call a method of the intermediate plug-in to create the device interface */ plugInResult = (*ppPlugInInterface)->QueryInterface (ppPlugInInterface, CFUUIDGetUUIDBytes (kIOHIDDeviceInterfaceID), (void *) &(pDevice->interface)); if (S_OK != plugInResult) @@ -225,15 +210,15 @@ static IOReturn HIDCloseReleaseInterface (recDevice *pDevice) if ((NULL != pDevice) && (NULL != pDevice->interface)) { - // close the interface + /* close the interface */ result = (*(pDevice->interface))->close (pDevice->interface); if (kIOReturnNotOpen == result) { - // do nothing as device was not opened, thus can't be closed + /* do nothing as device was not opened, thus can't be closed */ } else if (kIOReturnSuccess != result) HIDReportErrorNum ("Failed to close IOHIDDeviceInterface.", result); - //release the interface + /* release the interface */ result = (*(pDevice->interface))->Release (pDevice->interface); if (kIOReturnSuccess != result) HIDReportErrorNum ("Failed to release IOHIDDeviceInterface.", result); @@ -559,7 +544,7 @@ static recDevice *HIDDisposeDevice (recDevice **ppDevice) recDevice *pDeviceNext = NULL; if (*ppDevice) { - // save next device prior to disposing of this device + /* save next device prior to disposing of this device */ pDeviceNext = (*ppDevice)->pNext; /* free element lists */ @@ -658,8 +643,9 @@ int SDL_SYS_JoystickInit(void) /* dump device object, it is no longer needed */ result = IOObjectRelease (ioHIDDeviceObject); -// if (KERN_SUCCESS != result) -// HIDReportErrorNum ("IOObjectRelease error with ioHIDDeviceObject.", result); +/* if (KERN_SUCCESS != result) + HIDReportErrorNum ("IOObjectRelease error with ioHIDDeviceObject.", result); +*/ /* Filter device list to non-keyboard/mouse stuff */ if ( (device->usagePage != kHIDPage_GenericDesktop) || diff --git a/src/thread/pthread/SDL_syssem.c b/src/thread/pthread/SDL_syssem.c index a48a63419..a995b3e99 100644 --- a/src/thread/pthread/SDL_syssem.c +++ b/src/thread/pthread/SDL_syssem.c @@ -31,6 +31,7 @@ #ifdef __MACOSX__ #define USE_NAMED_SEMAPHORES 1 +#include #endif struct SDL_semaphore { diff --git a/src/video/SDL_blit_A.c b/src/video/SDL_blit_A.c index e66836bbc..28bb39aad 100644 --- a/src/video/SDL_blit_A.c +++ b/src/video/SDL_blit_A.c @@ -502,7 +502,7 @@ static vector unsigned char calc_swizzle32(const SDL_PixelFormat *srcfmt, if (!dstfmt) { dstfmt = &default_pixel_format; } - vector unsigned char plus = VECUINT8_LITERAL + const vector unsigned char plus = VECUINT8_LITERAL ( 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, 0x08, @@ -863,8 +863,8 @@ static void Blit32to32PixelAlphaAltivec(SDL_BlitInfo *info) } ONE_PIXEL_BLEND((UNALIGNED_PTR(dstp)) && (width), width); if (width > 0) { - // vsrcPermute - // vdstPermute + /* vsrcPermute */ + /* vdstPermute */ int extrawidth = (width % 4); vector unsigned char valigner = VEC_ALIGNER(srcp); vector unsigned char vs = (vector unsigned char)vec_ld(0, srcp); diff --git a/src/video/SDL_blit_N.c b/src/video/SDL_blit_N.c index 53587de70..99aa72e33 100644 --- a/src/video/SDL_blit_N.c +++ b/src/video/SDL_blit_N.c @@ -119,7 +119,7 @@ static vector unsigned char calc_swizzle32(const SDL_PixelFormat *srcfmt, if (!dstfmt) { dstfmt = &default_pixel_format; } - vector unsigned char plus = VECUINT8_LITERAL( + const vector unsigned char plus = VECUINT8_LITERAL( 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, 0x08, @@ -559,10 +559,11 @@ static void Blit32to32KeyAltivec(SDL_BlitInfo *info) vpermute = calc_swizzle32(srcfmt, dstfmt); if (info->d_width < 16) { if(copy_alpha) { - return BlitNtoNKeyCopyAlpha(info); + BlitNtoNKeyCopyAlpha(info); } else { - return BlitNtoNKey(info); + BlitNtoNKey(info); } + return; } vzero = vec_splat_u8(0); if (alpha) { diff --git a/src/video/quartz/SDL_QuartzEvents.m b/src/video/quartz/SDL_QuartzEvents.m index 4f12b9118..b5b210647 100644 --- a/src/video/quartz/SDL_QuartzEvents.m +++ b/src/video/quartz/SDL_QuartzEvents.m @@ -23,8 +23,8 @@ #include "SDL_QuartzVideo.h" -#include // For wake from sleep detection -#include // For wake from sleep detection +#include /* For wake from sleep detection */ +#include /* For wake from sleep detection */ #include "SDL_QuartzKeys.h" /* @@ -681,26 +681,28 @@ void QZ_RegisterForSleepNotifications (_THIS) } -// Try to map Quartz mouse buttons to SDL's lingo... +/* Try to map Quartz mouse buttons to SDL's lingo... */ static int QZ_OtherMouseButtonToSDL(int button) { switch (button) { case 0: - return(SDL_BUTTON_LEFT); // 1 + return(SDL_BUTTON_LEFT); /* 1 */ case 1: - return(SDL_BUTTON_RIGHT); // 3 + return(SDL_BUTTON_RIGHT); /* 3 */ case 2: - return(SDL_BUTTON_MIDDLE); // 2 + return(SDL_BUTTON_MIDDLE); /* 2 */ } - // >= 3: skip 4 & 5, since those are the SDL mousewheel buttons. + /* >= 3: skip 4 & 5, since those are the SDL mousewheel buttons. */ return(button + 3); } void QZ_PumpEvents (_THIS) { + static Uint32 screensaverTicks = 0; + Uint32 nowTicks; int firstMouseEvent; CGMouseDelta dx, dy; @@ -713,8 +715,7 @@ void QZ_PumpEvents (_THIS) return; /* don't do anything if there's no screen surface. */ /* Update activity every five seconds to prevent screensaver. --ryan. */ - static Uint32 screensaverTicks = 0; - Uint32 nowTicks = SDL_GetTicks(); + nowTicks = SDL_GetTicks(); if ((nowTicks - screensaverTicks) > 5000) { UpdateSystemActivity(UsrActivity); diff --git a/src/video/quartz/SDL_QuartzVideo.m b/src/video/quartz/SDL_QuartzVideo.m index ebc2f1e5c..1d926fc73 100644 --- a/src/video/quartz/SDL_QuartzVideo.m +++ b/src/video/quartz/SDL_QuartzVideo.m @@ -682,7 +682,7 @@ other blitting while waiting on the VBL (and hence results in higher framerates) return NULL; } - //[ qz_window setReleasedWhenClosed:YES ]; + /*[ qz_window setReleasedWhenClosed:YES ];*/ QZ_SetCaption(this, this->wm_title, this->wm_icon); [ qz_window setAcceptsMouseMovedEvents:YES ]; [ qz_window setViewsNeedDisplay:NO ]; @@ -759,7 +759,7 @@ other blitting while waiting on the VBL (and hence results in higher framerates) int hOffset = [ window_view frame ].origin.x; - current->pixels += (vOffset * current->pitch) + hOffset * (qdbpp/8); + current->pixels = (Uint8 *)current->pixels + (vOffset * current->pitch) + hOffset * (qdbpp/8); } this->UpdateRects = QZ_UpdateRects; this->LockHWSurface = QZ_LockWindow; @@ -921,7 +921,7 @@ static int QZ_ThreadFlip (_THIS) { * a fullscreen resolution smaller than the hardware could supply * so SDL is centering it in a bigger resolution)... */ - dst = CGDisplayBaseAddress (display_id) + SDL_VideoSurface->offset; + dst = (Uint8 *)CGDisplayBaseAddress (display_id) + SDL_VideoSurface->offset; src = current_buffer + SDL_VideoSurface->offset; len = SDL_VideoSurface->w * SDL_VideoSurface->format->BytesPerPixel; h = SDL_VideoSurface->h; @@ -1025,7 +1025,7 @@ static void QZ_DirectUpdate (_THIS, int num_rects, SDL_Rect *rects) { who supplied sample code for Carbon. */ -//#define TEST_OBSCURED 1 +/*#define TEST_OBSCURED 1*/ #if TEST_OBSCURED #include "CGS.h" @@ -1075,7 +1075,6 @@ window shadows (slight inaccuraccy) CGSRect contentRect; int windowNumber; - //int isMainWindow; int firstDockIcon; int dockIconCacheMiss; int windowContentOffset; @@ -1106,7 +1105,6 @@ Should probably be moved out into SetVideoMode() or InitVideo() windowContentOffset = 0; windowNumber = [ window windowNumber ]; - //isMainWindow = [ window isMainWindow ]; /* The window list is sorted according to order on the screen */ count = 0; diff --git a/src/video/quartz/SDL_QuartzWindow.m b/src/video/quartz/SDL_QuartzWindow.m index 1d5fd32a4..5b29f1ce8 100644 --- a/src/video/quartz/SDL_QuartzWindow.m +++ b/src/video/quartz/SDL_QuartzWindow.m @@ -144,7 +144,7 @@ - (void)setFrame:(NSRect)frameRect display:(BOOL)flag int hOffset = newViewFrame.origin.x; - SDL_VideoSurface->pixels += (vOffset * SDL_VideoSurface->pitch) + hOffset * (device_bpp/8); + SDL_VideoSurface->pixels = (Uint8 *)SDL_VideoSurface->pixels + (vOffset * SDL_VideoSurface->pitch) + hOffset * (device_bpp/8); } UnlockPortBits ( thePort ); @@ -177,7 +177,7 @@ - (void)appDidUnhide:(NSNotification*)note /* restore cached image, since it may not be current, post expose event too */ [ self restoreCachedImage ]; - //SDL_PrivateExpose (); + /*SDL_PrivateExpose ();*/ SDL_PrivateAppActive (1, SDL_APPACTIVE); }