From 3abc11611e1d1d93f1cf794df28879de3571bd01 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 18 Sep 2007 20:16:33 +0000 Subject: Code formatting fixes svn-id: r28945 --- backends/fs/dc/dc-fs.cpp | 4 +- backends/fs/gp32/gp32-fs.cpp | 2 +- backends/fs/palmos/palmos-fs.cpp | 2 +- backends/fs/posix/posix-fs.cpp | 2 +- backends/fs/symbian/symbian-fs.cpp | 10 +- backends/platform/PalmOS/Src/args.cpp | 10 +- backends/platform/PalmOS/Src/base_event.cpp | 2 +- backends/platform/PalmOS/Src/base_gfx.cpp | 2 +- backends/platform/PalmOS/Src/extend.cpp | 8 +- backends/platform/PalmOS/Src/init_sony.cpp | 2 +- backends/platform/PalmOS/Src/os5_mouse.cpp | 2 +- backends/platform/PalmOS/Src/snd_pa1.cpp | 2 +- backends/platform/dc/audio.cpp | 12 +-- backends/platform/dc/dcloader.cpp | 80 +++++++------- backends/platform/dc/dcmain.cpp | 26 ++--- backends/platform/dc/display.cpp | 84 +++++++-------- backends/platform/dc/icon.cpp | 60 +++++------ backends/platform/dc/input.cpp | 118 ++++++++++----------- backends/platform/dc/label.cpp | 22 ++-- backends/platform/dc/selector.cpp | 80 +++++++------- backends/platform/dc/softkbd.cpp | 42 ++++---- backends/platform/dc/time.cpp | 4 +- backends/platform/dc/vmsave.cpp | 66 ++++++------ backends/platform/ds/arm7/source/main.cpp | 12 +-- backends/platform/ds/arm9/source/blitters.cpp | 18 ++-- backends/platform/ds/arm9/source/compressor/lz.cpp | 80 +++++++------- backends/platform/ds/arm9/source/dsmain.cpp | 4 +- backends/platform/gp2x/events.cpp | 20 ++-- backends/platform/gp2x/gp2x-hw.cpp | 12 +-- backends/platform/gp32/debug-gdbstub-usb.cpp | 24 ++--- backends/platform/gp32/gp32std_input.cpp | 2 +- backends/platform/gp32/gp32std_memory.cpp | 6 +- backends/platform/psp/osys_psp.cpp | 10 +- backends/platform/psp/osys_psp_gu.cpp | 32 +++--- backends/platform/psp/trace.cpp | 4 +- backends/platform/symbian/src/ScummVMApp.cpp | 12 +-- backends/platform/symbian/src/SymbianOS.cpp | 4 +- backends/platform/wince/missing/missing.cpp | 60 +++++------ backends/platform/wince/wince-sdl.cpp | 4 +- backends/saves/compressed/compressed-saves.cpp | 2 +- 40 files changed, 474 insertions(+), 474 deletions(-) (limited to 'backends') diff --git a/backends/fs/dc/dc-fs.cpp b/backends/fs/dc/dc-fs.cpp index 6554544c7f..bae13d37e7 100644 --- a/backends/fs/dc/dc-fs.cpp +++ b/backends/fs/dc/dc-fs.cpp @@ -111,11 +111,11 @@ RoninCDFilesystemNode::RoninCDFilesystemNode(const String &p, bool verify) { if (verify) { int fd; - if((fd = open(_path.c_str(), O_RDONLY)) >= 0) { + if ((fd = open(_path.c_str(), O_RDONLY)) >= 0) { close(fd); _isDirectory = false; } - else if((fd = open(_path.c_str(), O_DIR|O_RDONLY)) >= 0) { + else if ((fd = open(_path.c_str(), O_DIR|O_RDONLY)) >= 0) { close(fd); } else { diff --git a/backends/fs/gp32/gp32-fs.cpp b/backends/fs/gp32/gp32-fs.cpp index 9b839867bc..a4af5d4fbe 100644 --- a/backends/fs/gp32/gp32-fs.cpp +++ b/backends/fs/gp32/gp32-fs.cpp @@ -241,7 +241,7 @@ bool GP32FilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool } AbstractFilesystemNode *GP32FilesystemNode::getParent() const { - if(_isRoot) + if (_isRoot) return 0; const char *start = _path.c_str(); diff --git a/backends/fs/palmos/palmos-fs.cpp b/backends/fs/palmos/palmos-fs.cpp index 1e954be2f6..508dff428b 100644 --- a/backends/fs/palmos/palmos-fs.cpp +++ b/backends/fs/palmos/palmos-fs.cpp @@ -197,7 +197,7 @@ bool PalmOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bo if (error) return false; - while(dirIterator != expIteratorStop) { + while (dirIterator != expIteratorStop) { error = VFSDirEntryEnumerate(handle, &dirIterator, &desc); if (!error) { addFile(myList, mode, _path.c_str(), &desc); diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp index 3708acd2a8..2e01c551d9 100644 --- a/backends/fs/posix/posix-fs.cpp +++ b/backends/fs/posix/posix-fs.cpp @@ -178,7 +178,7 @@ bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, boo continue; } // Skip '.' and '..' to avoid cycles - if((dp->d_name[0] == '.' && dp->d_name[1] == 0) || (dp->d_name[0] == '.' && dp->d_name[1] == '.')) { + if ((dp->d_name[0] == '.' && dp->d_name[1] == 0) || (dp->d_name[0] == '.' && dp->d_name[1] == '.')) { continue; } diff --git a/backends/fs/symbian/symbian-fs.cpp b/backends/fs/symbian/symbian-fs.cpp index 60693eefb5..d3b39f192c 100644 --- a/backends/fs/symbian/symbian-fs.cpp +++ b/backends/fs/symbian/symbian-fs.cpp @@ -157,7 +157,7 @@ AbstractFilesystemNode *SymbianFilesystemNode::getChild(const String &n) const { fname.Copy(ptr); TBool isFolder = EFalse; BaflUtils::IsFolder(CEikonEnv::Static()->FsSession(), fname, isFolder); - if(!isFolder) + if (!isFolder) return 0; return new SymbianFilesystemNode(newPath); @@ -182,12 +182,12 @@ bool SymbianFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b TInt err = fs.Volume(volumeInfo, driveNumber); if (err != KErrNone) continue; - if(fs.DriveToChar(driveNumber,driveLetter) != KErrNone) + if (fs.DriveToChar(driveNumber,driveLetter) != KErrNone) continue; driveLetterValue = driveLetter; - if(volumeInfo.iName.Length() > 0) { + if (volumeInfo.iName.Length() > 0) { driveLabel8.Copy(volumeInfo.iName); // 16 to 8bit des // enabling this line alone gives KERN-EXEC 3 with non-optimized GCC? WHY? grrr driveString8.Format(_L8("Drive %c: (%S)"), driveLetterValue, &driveLabel8); } else { @@ -211,10 +211,10 @@ bool SymbianFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b fname.Copy(ptr); TBuf8<256>nameBuf; CDir* dirPtr; - if(CEikonEnv::Static()->FsSession().GetDir(fname,KEntryAttNormal|KEntryAttDir,0,dirPtr)==KErrNone) { + if (CEikonEnv::Static()->FsSession().GetDir(fname,KEntryAttNormal|KEntryAttDir,0,dirPtr)==KErrNone) { CleanupStack::PushL(dirPtr); TInt cnt=dirPtr->Count(); - for(TInt loop=0;loopscreenPitch + 1; - for(y=0; y < 4; y++) { - for(x=0; x < 4; x++) + for (y=0; y < 4; y++) { + for (x=0; x < 4; x++) src[x] = color; src += gVars->screenPitch; @@ -62,8 +62,8 @@ void DrawStatus(Boolean show) { } else if (depth == 16) { Int16 *src = (Int16 *)BmpGetBits(WinGetBitmap(WinGetDisplayWindow())); src += gVars->screenPitch + 1; - for(y=0; y < 4; y++) { - for(x=0; x < 4; x++) + for (y=0; y < 4; y++) { + for (x=0; x < 4; x++) src[x] = color; src += gVars->screenPitch; diff --git a/backends/platform/PalmOS/Src/init_sony.cpp b/backends/platform/PalmOS/Src/init_sony.cpp index 8840f1a073..915b3ec56f 100644 --- a/backends/platform/PalmOS/Src/init_sony.cpp +++ b/backends/platform/PalmOS/Src/init_sony.cpp @@ -46,7 +46,7 @@ UInt16 SilkInit(UInt32 *retVersion) { if (e) { // v1 = NR e = SilkLibOpen(slkRefNum); - if(!e) version = vskVersionNum1; + if (!e) version = vskVersionNum1; } else { // v2 = NX/NZ diff --git a/backends/platform/PalmOS/Src/os5_mouse.cpp b/backends/platform/PalmOS/Src/os5_mouse.cpp index fa6a14c5a0..3b2c7840e6 100644 --- a/backends/platform/PalmOS/Src/os5_mouse.cpp +++ b/backends/platform/PalmOS/Src/os5_mouse.cpp @@ -26,7 +26,7 @@ #include "be_os5.h" void OSystem_PalmOS5::setCursorPalette(const byte *colors, uint start, uint num) { - for(uint i = 0; i < num; i++) { + for (uint i = 0; i < num; i++) { _mousePal[i + start] = gfxMakeDisplayRGB(colors[0], colors[1], colors[2]); colors += 4; } diff --git a/backends/platform/PalmOS/Src/snd_pa1.cpp b/backends/platform/PalmOS/Src/snd_pa1.cpp index ca64825fe6..ddaf6495f6 100644 --- a/backends/platform/PalmOS/Src/snd_pa1.cpp +++ b/backends/platform/PalmOS/Src/snd_pa1.cpp @@ -108,6 +108,6 @@ void pcm2adpcm(Int16 *src, UInt8 *dst, UInt32 length) { *dst++ = (UInt8)data; - } while(--length); + } while (--length); } diff --git a/backends/platform/dc/audio.cpp b/backends/platform/dc/audio.cpp index 42201d2dd3..7364b170e6 100644 --- a/backends/platform/dc/audio.cpp +++ b/backends/platform/dc/audio.cpp @@ -44,28 +44,28 @@ void OSystem_Dreamcast::checkSound() int n; int curr_ring_buffer_samples; - if(!_mixer) + if (!_mixer) return; - if(read_sound_int(&SOUNDSTATUS->mode) != MODE_PLAY) + if (read_sound_int(&SOUNDSTATUS->mode) != MODE_PLAY) start_sound(); curr_ring_buffer_samples = read_sound_int(&SOUNDSTATUS->ring_length); n = read_sound_int(&SOUNDSTATUS->samplepos); - if((n-=fillpos)<0) + if ((n-=fillpos)<0) n += curr_ring_buffer_samples; n = ADJUST_BUFFER_SIZE(n-10); - if(n<100) + if (n<100) return; Audio::Mixer::mixCallback(_mixer, (byte*)temp_sound_buffer, 2*SAMPLES_TO_BYTES(n)); - if(fillpos+n > curr_ring_buffer_samples) { + if (fillpos+n > curr_ring_buffer_samples) { int r = curr_ring_buffer_samples - fillpos; memcpy4s(RING_BUF+fillpos, temp_sound_buffer, SAMPLES_TO_BYTES(r)); fillpos = 0; @@ -74,7 +74,7 @@ void OSystem_Dreamcast::checkSound() } else { memcpy4s(RING_BUF+fillpos, temp_sound_buffer, SAMPLES_TO_BYTES(n)); } - if((fillpos += n) >= curr_ring_buffer_samples) + if ((fillpos += n) >= curr_ring_buffer_samples) fillpos = 0; } diff --git a/backends/platform/dc/dcloader.cpp b/backends/platform/dc/dcloader.cpp index 7254d48415..7e5a068780 100644 --- a/backends/platform/dc/dcloader.cpp +++ b/backends/platform/dc/dcloader.cpp @@ -116,14 +116,14 @@ extern "C" void flush_instruction_cache(); static void purge_copyback() { int i; - for(i=0; i!=(1<<14); i+=(1<<5)) + for (i=0; i!=(1<<14); i+=(1<<5)) *(volatile unsigned int *)(0xf4000000+i) &= ~3; } void DLObject::seterror(const char *fmt, ...) { - if(errbuf) { + if (errbuf) { va_list va; va_start(va, fmt); vsnprintf(errbuf, MAXDLERRLEN, fmt, va); @@ -151,12 +151,12 @@ bool DLObject::relocate(int fd, unsigned long offset, unsigned long size) { Elf32_Rela *rela; - if(!(rela = (Elf32_Rela *)malloc(size))) { + if (!(rela = (Elf32_Rela *)malloc(size))) { seterror("Out of memory."); return false; } - if(lseek(fd, offset, SEEK_SET)<0 || + if (lseek(fd, offset, SEEK_SET)<0 || read(fd, rela, size) != size) { seterror("Relocation table load failed."); free(rela); @@ -164,7 +164,7 @@ bool DLObject::relocate(int fd, unsigned long offset, unsigned long size) } int cnt = size / sizeof(*rela); - for(int i=0; i>4)); @@ -172,7 +172,7 @@ bool DLObject::relocate(int fd, unsigned long offset, unsigned long size) switch(rela[i].r_info & 0xf) { case 1: /* DIR32 */ - if(sym->st_shndx < 0xff00) + if (sym->st_shndx < 0xff00) *(unsigned long *)target += (unsigned long)segment; break; default: @@ -195,7 +195,7 @@ bool DLObject::load(int fd) Elf32_Shdr *shdr; int symtab_sect = -1; - if(read(fd, &ehdr, sizeof(ehdr)) != sizeof(ehdr) || + if (read(fd, &ehdr, sizeof(ehdr)) != sizeof(ehdr) || memcmp(ehdr.e_ident, ELFMAG, SELFMAG) || ehdr.e_type != 2 || ehdr.e_machine != 42 || ehdr.e_phentsize < sizeof(phdr) || ehdr.e_shentsize != sizeof(*shdr) || @@ -207,13 +207,13 @@ bool DLObject::load(int fd) DBG("phoff = %d, phentsz = %d, phnum = %d\n", ehdr.e_phoff, ehdr.e_phentsize, ehdr.e_phnum); - if(lseek(fd, ehdr.e_phoff, SEEK_SET)<0 || + if (lseek(fd, ehdr.e_phoff, SEEK_SET)<0 || read(fd, &phdr, sizeof(phdr)) != sizeof(phdr)) { seterror("Program header load failed."); return false; } - if(phdr.p_type != 1 || phdr.p_vaddr != 0 || phdr.p_paddr != 0 || + if (phdr.p_type != 1 || phdr.p_vaddr != 0 || phdr.p_paddr != 0 || phdr.p_filesz > phdr.p_memsz) { seterror("Invalid program header."); return false; @@ -222,17 +222,17 @@ bool DLObject::load(int fd) DBG("offs = %d, filesz = %d, memsz = %d, align = %d\n", phdr.p_offset, phdr.p_filesz, phdr.p_memsz, phdr.p_align); - if(!(segment = memalign(phdr.p_align, phdr.p_memsz))) { + if (!(segment = memalign(phdr.p_align, phdr.p_memsz))) { seterror("Out of memory."); return false; } DBG("segment @ %p\n", segment); - if(phdr.p_memsz > phdr.p_filesz) + if (phdr.p_memsz > phdr.p_filesz) memset(((char *)segment) + phdr.p_filesz, 0, phdr.p_memsz - phdr.p_filesz); - if(lseek(fd, phdr.p_offset, SEEK_SET)<0 || + if (lseek(fd, phdr.p_offset, SEEK_SET)<0 || read(fd, segment, phdr.p_filesz) != phdr.p_filesz) { seterror("Segment load failed."); return false; @@ -241,12 +241,12 @@ bool DLObject::load(int fd) DBG("shoff = %d, shentsz = %d, shnum = %d\n", ehdr.e_shoff, ehdr.e_shentsize, ehdr.e_shnum); - if(!(shdr = (Elf32_Shdr *)malloc(ehdr.e_shnum * sizeof(*shdr)))) { + if (!(shdr = (Elf32_Shdr *)malloc(ehdr.e_shnum * sizeof(*shdr)))) { seterror("Out of memory."); return false; } - if(lseek(fd, ehdr.e_shoff, SEEK_SET)<0 || + if (lseek(fd, ehdr.e_shoff, SEEK_SET)<0 || read(fd, shdr, ehdr.e_shnum * sizeof(*shdr)) != ehdr.e_shnum * sizeof(*shdr)) { seterror("Section headers load failed."); @@ -254,41 +254,41 @@ bool DLObject::load(int fd) return false; } - for(int i=0; ist_shndx < 0xff00) + for (int c = symbol_cnt; c--; s++) + if (s->st_shndx < 0xff00) s->st_value += (Elf32_Addr)segment; - for(int i=0; ist_info>>4 == 1 || s->st_info>>4 == 2) && + for (int c = symbol_cnt; c--; s++) + if ((s->st_info>>4 == 1 || s->st_info>>4 == 2) && strtab[s->st_name] == '_' && !strcmp(name, strtab+s->st_name+1)) { DBG("=> %p\n", (void*)s->st_value); return (void*)s->st_value; @@ -402,7 +402,7 @@ static char dlerr[MAXDLERRLEN]; void *dlopen(const char *filename, int flags) { DLObject *obj = new DLObject(dlerr); - if(obj->open(filename)) + if (obj->open(filename)) return (void *)obj; delete obj; return NULL; @@ -411,11 +411,11 @@ void *dlopen(const char *filename, int flags) int dlclose(void *handle) { DLObject *obj = (DLObject *)handle; - if(obj == NULL) { + if (obj == NULL) { strcpy(dlerr, "Handle is NULL."); return -1; } - if(obj->close()) { + if (obj->close()) { delete obj; return 0; } @@ -424,7 +424,7 @@ int dlclose(void *handle) void *dlsym(void *handle, const char *symbol) { - if(handle == NULL) { + if (handle == NULL) { strcpy(dlerr, "Handle is NULL."); return NULL; } @@ -438,6 +438,6 @@ const char *dlerror() void dlforgetsyms(void *handle) { - if(handle != NULL) + if (handle != NULL) ((DLObject *)handle)->discard_symtab(); } diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp index df729f85f8..9c11d0f9da 100644 --- a/backends/platform/dc/dcmain.cpp +++ b/backends/platform/dc/dcmain.cpp @@ -64,16 +64,16 @@ void OSystem_Dreamcast::initBackend() static bool find_track(int track, int &first_sec, int &last_sec) { struct TOC *toc = cdfs_gettoc(); - if(!toc) + if (!toc) return false; int i, first, last; first = TOC_TRACK(toc->first); last = TOC_TRACK(toc->last); - if(first < 1 || last > 99 || first > last) + if (first < 1 || last > 99 || first > last) return false; - for(i=first; i<=last; i++) - if(!(TOC_CTRL(toc->entry[i-1])&4)) - if(track==1) { + for (i=first; i<=last; i++) + if (!(TOC_CTRL(toc->entry[i-1])&4)) + if (track==1) { first_sec = TOC_LBA(toc->entry[i-1]); last_sec = TOC_LBA(toc->entry[i]); return true; @@ -86,14 +86,14 @@ void OSystem_Dreamcast::playCD(int track, int num_loops, int start_frame, int du { int first_sec, last_sec; #if 1 - if(num_loops) + if (num_loops) --num_loops; #endif - if(num_loops>14) num_loops=14; - else if(num_loops<0) num_loops=15; // infinity - if(!find_track(track, first_sec, last_sec)) + if (num_loops>14) num_loops=14; + else if (num_loops<0) num_loops=15; // infinity + if (!find_track(track, first_sec, last_sec)) return; - if(duration) + if (duration) last_sec = first_sec + start_frame + duration; first_sec += start_frame; play_cdda_sectors(first_sec, last_sec, num_loops); @@ -168,7 +168,7 @@ void OSystem_Dreamcast::setFeatureState(Feature f, bool enable) switch(f) { case kFeatureAspectRatioCorrection: _aspect_stretch = enable; - if(screen) + if (screen) setScaling(); break; case kFeatureVirtualKeyboard: @@ -230,12 +230,12 @@ int DCLauncherDialog::runModal() { char *base = NULL, *dir = NULL; - if(!selectGame(base, dir, icon)) + if (!selectGame(base, dir, icon)) exit(0); // Set the game path. ConfMan.addGameDomain(base); - if(dir != NULL) + if (dir != NULL) ConfMan.set("path", dir, base); // Set the target. diff --git a/backends/platform/dc/display.cpp b/backends/platform/dc/display.cpp index 1790785b67..9d095e389d 100644 --- a/backends/platform/dc/display.cpp +++ b/backends/platform/dc/display.cpp @@ -49,7 +49,7 @@ #define COPYPIXEL(n) do { \ unsigned short _tmp = pal[*s++]; \ d[n] = _tmp|(pal[*s++]<<16); \ -} while(0) +} while (0) static void texture_memcpy64_pal(void *dest, void *src, int cnt, unsigned short *pal) { @@ -58,7 +58,7 @@ static void texture_memcpy64_pal(void *dest, void *src, int cnt, unsigned short (0xe0000000 | (((unsigned long)dest) & 0x03ffffc0)); QACR0 = ((0xa4000000>>26)<<2)&0x1c; QACR1 = ((0xa4000000>>26)<<2)&0x1c; - while(cnt--) { + while (cnt--) { COPYPIXEL(0); COPYPIXEL(1); COPYPIXEL(2); @@ -91,7 +91,7 @@ static void texture_memcpy64(void *dest, void *src, int cnt) (0xe0000000 | (((unsigned long)dest) & 0x03ffffc0)); QACR0 = ((0xa4000000>>26)<<2)&0x1c; QACR1 = ((0xa4000000>>26)<<2)&0x1c; - while(cnt--) { + while (cnt--) { d[0] = *s++; d[1] = *s++; d[2] = *s++; @@ -137,8 +137,8 @@ void commit_dummy_transpoly() void OSystem_Dreamcast::setPalette(const byte *colors, uint start, uint num) { unsigned short *dst = palette + start; - if(num>0) - while( num-- ) { + if (num>0) + while ( num-- ) { *dst++ = ((colors[0]<<7)&0x7c00)| ((colors[1]<<2)&0x03e0)| ((colors[2]>>3)&0x001f); @@ -150,8 +150,8 @@ void OSystem_Dreamcast::setPalette(const byte *colors, uint start, uint num) void OSystem_Dreamcast::setCursorPalette(const byte *colors, uint start, uint num) { unsigned short *dst = cursor_palette + start; - if(num>0) - while( num-- ) { + if (num>0) + while ( num-- ) { *dst++ = ((colors[0]<<7)&0x7c00)| ((colors[1]<<2)&0x03e0)| ((colors[2]>>3)&0x001f); @@ -168,8 +168,8 @@ void OSystem_Dreamcast::disableCursorPalette(bool disable) void OSystem_Dreamcast::grabPalette(byte *colors, uint start, uint num) { const unsigned short *src = palette + start; - if(num>0) - while( num-- ) { + if (num>0) + while ( num-- ) { unsigned short p = *src++; colors[0] = ((p&0x7c00)>>7)|((p&0x7000)>>12); colors[1] = ((p&0x03e0)>>2)|((p&0x0380)>>7); @@ -181,10 +181,10 @@ void OSystem_Dreamcast::grabPalette(byte *colors, uint start, uint num) void OSystem_Dreamcast::setScaling() { - if(_screen_w > 400) { + if (_screen_w > 400) { _xscale = _yscale = 1.0; _top_offset = (SCREEN_H-_screen_h)>>1; - } else if(_aspect_stretch && _screen_w == 320 && _screen_h == 200) { + } else if (_aspect_stretch && _screen_w == 320 && _screen_h == 200) { _xscale = SCREEN_W/320.0; _yscale = SCREEN_H/200.0; _top_offset = 0; @@ -206,22 +206,22 @@ void OSystem_Dreamcast::initSize(uint w, uint h) _screen_h = h; _overlay_x = (w-OVL_W)/2; _overlay_y = (h-OVL_H)/2; - if(_overlay_x<0) _overlay_x = 0; - if(_overlay_y<0) _overlay_y = 0; + if (_overlay_x<0) _overlay_x = 0; + if (_overlay_y<0) _overlay_y = 0; setScaling(); ta_sync(); - if(!screen) + if (!screen) screen = new unsigned char[SCREEN_W*SCREEN_H]; - if(!overlay) + if (!overlay) overlay = new unsigned short[OVL_W*OVL_H]; - for(int i=0; i>5, palette ); src += SCREEN_W; @@ -314,7 +314,7 @@ void OSystem_Dreamcast::updateScreen(void) _screen_dirty = false; } - if( _overlay_visible && _overlay_dirty ) { + if ( _overlay_visible && _overlay_dirty ) { _overlay_buffer++; _overlay_buffer &= NUM_BUFFERS-1; @@ -322,7 +322,7 @@ void OSystem_Dreamcast::updateScreen(void) unsigned short *dst = (unsigned short *)ovl_tx[_overlay_buffer]; unsigned short *src = overlay; - for( int y = 0; y>5 ); src += OVL_W; @@ -378,15 +378,15 @@ void OSystem_Dreamcast::updateScreen(void) ta_commit_end(); - if(_overlay_visible) { - if(_overlay_fade < 1.0) + if (_overlay_visible) { + if (_overlay_fade < 1.0) _overlay_fade += 0.125; } else { - if(_overlay_fade > 0) + if (_overlay_fade > 0) _overlay_fade -= 0.125; } - if(_overlay_fade > 0.0) { + if (_overlay_fade > 0.0) { mypoly.cmd = TA_CMD_POLYGON|TA_CMD_POLYGON_TYPE_TRANSPARENT|TA_CMD_POLYGON_SUBLIST| @@ -432,16 +432,16 @@ void OSystem_Dreamcast::updateScreen(void) ta_commit_list(&myvertex); } - if(_softkbd_on) - if(_softkbd_motion < 120) + if (_softkbd_on) + if (_softkbd_motion < 120) _softkbd_motion += 10; else ; else - if(_softkbd_motion > 0) + if (_softkbd_motion > 0) _softkbd_motion -= 10; - if(_softkbd_motion) + if (_softkbd_motion) _softkbd.draw(330.0*sin(0.013*_softkbd_motion) - 320.0, 200.0, 120-_softkbd_motion); @@ -467,11 +467,11 @@ void OSystem_Dreamcast::drawMouse(int xdraw, int ydraw, int w, int h, unsigned short *dst = (unsigned short *)mouse_tx[_mouse_buffer]; int y=0; - if(visible && w && h && w<=MOUSE_W && h<=MOUSE_H) - for(int y=0; y>16)&0xf000)| @@ -42,7 +42,7 @@ void Icon::create_vmicon(void *buffer) ((p>> 4)&0x000f); } - for(int line = 0; line < 32; line++) { + for (int line = 0; line < 32; line++) { memcpy(pix, &bitmap[32/2*(31-line)], 32/2); pix += 32/2; } @@ -55,9 +55,9 @@ void Icon::create_texture() unsigned short *tex = (unsigned short *)ta_txalloc(512); unsigned short *linebase; unsigned char *src = bitmap+sizeof(bitmap)-17; - for(int y=0; y<16; y++) { + for (int y=0; y<16; y++) { linebase = tex + (tt[y]<<1); - for(int x=0; x<16; x++, --src) + for (int x=0; x<16; x++, --src) linebase[tt[x]] = src[16]|(src[0]<<8); src -= 16; } @@ -67,7 +67,7 @@ void Icon::create_texture() void Icon::setPalette(int pal) { unsigned int (*hwpal)[64][16] = (unsigned int (*)[64][16])0xa05f9000; - for(int n = 0; n<16; n++) + for (int n = 0; n<16; n++) (*hwpal)[pal][n] = palette[n]; } @@ -124,13 +124,13 @@ int Icon::find_unused_pixel() { int use[16]; memset(use, 0, sizeof(use)); - for(int n=0; n<32*32/2; n++) { + for (int n=0; n<32*32/2; n++) { unsigned char pix = bitmap[n]; use[pix&0xf]++; use[pix>>4]++; } - for(int i=0; i<16; i++) - if(!use[i]) + for (int i=0; i<16; i++) + if (!use[i]) return i; return -1; } @@ -142,41 +142,41 @@ bool Icon::load_image2(const void *data, int len) short pla, bitcnt; int comp, sizeimg, xres, yres, used, imp; } hdr; - if(len < 40) + if (len < 40) return false; memcpy(&hdr, data, 40); - if(hdr.size != 40 || /* hdr.sizeimg<=0 || */ hdr.w<0 || hdr.h<0 || + if (hdr.size != 40 || /* hdr.sizeimg<=0 || */ hdr.w<0 || hdr.h<0 || hdr.bitcnt<0 || hdr.used<0) return false; - if(!hdr.used) + if (!hdr.used) hdr.used = 1<>= 1; /* Fix incorrect sizeimg (The Dig) */ - if(hdr.sizeimg < ((hdr.w*hdr.h*(1+hdr.bitcnt)+7)>>3)) + if (hdr.sizeimg < ((hdr.w*hdr.h*(1+hdr.bitcnt)+7)>>3)) hdr.sizeimg = ((hdr.w*hdr.h*(1+hdr.bitcnt)+7)>>3); - if(hdr.size + (hdr.used<<2) + hdr.sizeimg > len /* || + if (hdr.size + (hdr.used<<2) + hdr.sizeimg > len /* || hdr.sizeimg < ((hdr.w*hdr.h*(1+hdr.bitcnt)+7)>>3) */) return false; - if(hdr.w != 32 || hdr.h != 32 || hdr.bitcnt != 4 || hdr.used > 16) + if (hdr.w != 32 || hdr.h != 32 || hdr.bitcnt != 4 || hdr.used > 16) return false; memcpy(palette, ((const char *)data)+hdr.size, hdr.used<<2); memcpy(bitmap, ((const char *)data)+hdr.size+(hdr.used<<2), 32*32/2); - for(int i=0; i<16; i++) + for (int i=0; i<16; i++) palette[i] |= 0xff000000; - for(int i=hdr.used; i<16; i++) + for (int i=hdr.used; i<16; i++) palette[i] = 0; int unused = find_unused_pixel(); - if(unused >= 0) { + if (unused >= 0) { const unsigned char *mask = ((const unsigned char *)data)+hdr.size+(hdr.used<<2)+32*32/2; unsigned char *pix = bitmap; - for(int y=0; y<32; y++) - for(int x=0; x<32/8; x++) { + for (int y=0; y<32; y++) + for (int x=0; x<32/8; x++) { unsigned char mbits = *mask++; - for(int z=0; z<4; z++) { + for (int z=0; z<4; z++) { unsigned char pbits = *pix; - if(mbits & 64) pbits = (pbits & ~0xf) | unused; - if(mbits & 128) pbits = (pbits & 0xf) | (unused << 4); + if (mbits & 64) pbits = (pbits & ~0xf) | unused; + if (mbits & 128) pbits = (pbits & 0xf) | (unused << 4); *pix++ = pbits; mbits <<= 2; } @@ -193,10 +193,10 @@ bool Icon::load_image1(const void *data, int len, int offs) short pla, bitcnt; int bytes, offs; } hdr; - if(len < offs+16) + if (len < offs+16) return false; memcpy(&hdr, ((const char *)data)+offs, 16); - if(hdr.bytes > 0 && hdr.offs >= 0 && hdr.offs+hdr.bytes <= len) + if (hdr.bytes > 0 && hdr.offs >= 0 && hdr.offs+hdr.bytes <= len) return load_image2(((const char *)data)+hdr.offs, hdr.bytes); else return false; @@ -208,13 +208,13 @@ bool Icon::load(const void *data, int len, int offs) memset(bitmap, 0, sizeof(bitmap)); memset(palette, 0, sizeof(palette)); texture = NULL; - if(len < offs+6) + if (len < offs+6) return false; memcpy(&hdr, ((const char *)data)+offs, 6); - if(hdr.type != 1 || hdr.cnt < 1 || offs+6+(hdr.cnt<<4) > len) + if (hdr.type != 1 || hdr.cnt < 1 || offs+6+(hdr.cnt<<4) > len) return false; - for(int i=0; i=0) { + if ((fd = open(filename, O_RDONLY))>=0) { int sz; sz = read(fd, buf, sizeof(buf)); close(fd); - if(sz>0) + if (sz>0) return load(buf, sz); } return false; diff --git a/backends/platform/dc/input.cpp b/backends/platform/dc/input.cpp index aa0d9efa21..6d7178fc97 100644 --- a/backends/platform/dc/input.cpp +++ b/backends/platform/dc/input.cpp @@ -39,70 +39,70 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y, static byte lastlmb = 0, lastrmb = 0; static int8 mouse_wheel = 0, lastwheel = 0; shiftFlags = 0; - for(int i=0; i<4; i++, pad++) - if(pad->func & MAPLE_FUNC_CONTROLLER) { + for (int i=0; i<4; i++, pad++) + if (pad->func & MAPLE_FUNC_CONTROLLER) { int buttons = pad->cond.controller.buttons; - if(!(buttons & 0x060e)) exit(0); + if (!(buttons & 0x060e)) exit(0); - if(!(buttons & 4)) lmb++; - if(!(buttons & 2)) rmb++; + if (!(buttons & 4)) lmb++; + if (!(buttons & 2)) rmb++; - if(!(buttons & 8)) newkey = Common::KEYCODE_F5; - else if(!(buttons & 512)) newkey = ' '; - else if(!(buttons & 1024)) newkey = numpadmap[(buttons>>4)&15]; + if (!(buttons & 8)) newkey = Common::KEYCODE_F5; + else if (!(buttons & 512)) newkey = ' '; + else if (!(buttons & 1024)) newkey = numpadmap[(buttons>>4)&15]; - if(!(buttons & 128)) if(inter) newkey = 1001; else mouse_x++; - if(!(buttons & 64)) if(inter) newkey = 1002; else mouse_x--; - if(!(buttons & 32)) if(inter) newkey = 1003; else mouse_y++; - if(!(buttons & 16)) if(inter) newkey = 1004; else mouse_y--; + if (!(buttons & 128)) if (inter) newkey = 1001; else mouse_x++; + if (!(buttons & 64)) if (inter) newkey = 1002; else mouse_x--; + if (!(buttons & 32)) if (inter) newkey = 1003; else mouse_y++; + if (!(buttons & 16)) if (inter) newkey = 1004; else mouse_y--; mouse_x += ((int)pad->cond.controller.joyx-128)>>4; mouse_y += ((int)pad->cond.controller.joyy-128)>>4; - if(pad->cond.controller.ltrigger > 200) newkey = 1005; - else if(pad->cond.controller.rtrigger > 200) newkey = 1006; + if (pad->cond.controller.ltrigger > 200) newkey = 1005; + else if (pad->cond.controller.rtrigger > 200) newkey = 1006; - } else if(pad->func & MAPLE_FUNC_MOUSE) { + } else if (pad->func & MAPLE_FUNC_MOUSE) { int buttons = pad->cond.mouse.buttons; - if(!(buttons & 4)) lmb++; - if(!(buttons & 2)) rmb++; + if (!(buttons & 4)) lmb++; + if (!(buttons & 2)) rmb++; - if(!(buttons & 8)) newkey = Common::KEYCODE_F5; + if (!(buttons & 8)) newkey = Common::KEYCODE_F5; mouse_x += pad->cond.mouse.axis1; mouse_y += pad->cond.mouse.axis2; mouse_wheel += pad->cond.mouse.axis3; - if(inter) + if (inter) inter->mouse(mouse_x, mouse_y); pad->cond.mouse.axis1 = 0; pad->cond.mouse.axis2 = 0; pad->cond.mouse.axis3 = 0; - } else if(pad->func & MAPLE_FUNC_KEYBOARD) { - for(int p=0; p<6; p++) { + } else if (pad->func & MAPLE_FUNC_KEYBOARD) { + for (int p=0; p<6; p++) { int shift = pad->cond.kbd.shift; int key = pad->cond.kbd.key[p]; - if(shift & 0x08) lmb++; - if(shift & 0x80) rmb++; - if(shift & 0x11) shiftFlags |= Common::KBD_CTRL; - if(shift & 0x44) shiftFlags |= Common::KBD_ALT; - if(shift & 0x22) shiftFlags |= Common::KBD_SHIFT; - if(key >= 4 && key <= 0x1d) + if (shift & 0x08) lmb++; + if (shift & 0x80) rmb++; + if (shift & 0x11) shiftFlags |= Common::KBD_CTRL; + if (shift & 0x44) shiftFlags |= Common::KBD_ALT; + if (shift & 0x22) shiftFlags |= Common::KBD_SHIFT; + if (key >= 4 && key <= 0x1d) newkey = key+('a'-4); - else if(key >= 0x1e && key <= 0x26) + else if (key >= 0x1e && key <= 0x26) newkey = key+((shift & 0x22)? ('!'-0x1e) : ('1'-0x1e)); - else if(key >= 0x59 && key <= 0x61) + else if (key >= 0x59 && key <= 0x61) newkey = key+('1'-0x59); - else if(key >= 0x2d && key <= 0x38 && key != 0x31) + else if (key >= 0x2d && key <= 0x38 && key != 0x31) newkey = ((shift & 0x22)? "=?`{ }+*?<>?" : "-^@[ ];:?,./")[key - 0x2d]; - else if(key >= 0x3a && key <= 0x43) + else if (key >= 0x3a && key <= 0x43) newkey = key+(Common::KEYCODE_F1-0x3a); - else if(key >= 0x54 && key <= 0x57) + else if (key >= 0x54 && key <= 0x57) newkey = "/*-+"[key-0x54]; else switch(key) { case 0x27: case 0x62: @@ -118,17 +118,17 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y, case 0x2c: newkey = Common::KEYCODE_SPACE; break; case 0x4c: - if((shift & 0x11) && (shift & 0x44)) + if ((shift & 0x11) && (shift & 0x44)) exit(0); break; case 0x4f: - if(inter) newkey = 1001; else mouse_x++; break; + if (inter) newkey = 1001; else mouse_x++; break; case 0x50: - if(inter) newkey = 1002; else mouse_x--; break; + if (inter) newkey = 1002; else mouse_x--; break; case 0x51: - if(inter) newkey = 1003; else mouse_y++; break; + if (inter) newkey = 1003; else mouse_y++; break; case 0x52: - if(inter) newkey = 1004; else mouse_y--; break; + if (inter) newkey = 1004; else mouse_y--; break; case 0x63: newkey = '.'; break; case 0x64: case 0x87: @@ -139,28 +139,28 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y, } } - if(lmb && inter && !lastlmb) { + if (lmb && inter && !lastlmb) { newkey = 1000; lmb = 0; } - if(lmb && !lastlmb) { + if (lmb && !lastlmb) { lastlmb = 1; return -Common::EVENT_LBUTTONDOWN; - } else if(lastlmb && !lmb) { + } else if (lastlmb && !lmb) { lastlmb = 0; return -Common::EVENT_LBUTTONUP; } - if(rmb && !lastrmb) { + if (rmb && !lastrmb) { lastrmb = 1; return -Common::EVENT_RBUTTONDOWN; - } else if(lastrmb && !rmb) { + } else if (lastrmb && !rmb) { lastrmb = 0; return -Common::EVENT_RBUTTONUP; } - if(mouse_wheel != lastwheel) - if(((int8)(mouse_wheel - lastwheel)) > 0) { + if (mouse_wheel != lastwheel) + if (((int8)(mouse_wheel - lastwheel)) > 0) { lastwheel++; return -Common::EVENT_WHEELDOWN; } else { @@ -168,22 +168,22 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y, return -Common::EVENT_WHEELUP; } - if(newkey && inter && newkey != lastkey) { + if (newkey && inter && newkey != lastkey) { int transkey = inter->key(newkey, shiftFlags); - if(transkey) { + if (transkey) { newkey = transkey; inter = NULL; } } - if(!newkey || (lastkey && newkey != lastkey)) { + if (!newkey || (lastkey && newkey != lastkey)) { int upkey = lastkey; lastkey = 0; - if(upkey) + if (upkey) return upkey | (1<<30); - } else if(!lastkey) { + } else if (!lastkey) { lastkey = newkey; - if(newkey >= 1000 || !inter) + if (newkey >= 1000 || !inter) return newkey; } @@ -194,13 +194,13 @@ bool OSystem_Dreamcast::pollEvent(Common::Event &event) { unsigned int t = Timer(); - if(_timer != NULL) + if (_timer != NULL) _timer->handler(); - if(((int)(t-_devpoll))<0) + if (((int)(t-_devpoll))<0) return false; _devpoll += USEC_TO_TIMER(17000); - if(((int)(t-_devpoll))>=0) + if (((int)(t-_devpoll))>=0) _devpoll = t + USEC_TO_TIMER(17000); int mask = getimask(); @@ -220,25 +220,25 @@ bool OSystem_Dreamcast::pollEvent(Common::Event &event) event.mouse.y -= _overlay_y; } event.kbd.ascii = event.kbd.keycode = 0; - if(e<0) { + if (e<0) { event.type = (Common::EventType)-e; return true; - } else if(e>0) { + } else if (e>0) { bool processed = false, down = !(e&(1<<30)); e &= ~(1<<30); - if(e < 1000) { + if (e < 1000) { event.type = (down? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP); event.kbd.keycode = e; event.kbd.ascii = (e>='a' && e<='z' && (event.kbd.flags & Common::KBD_SHIFT)? e &~ 0x20 : e); processed = true; - } else if(down) { - if(e == 1005) + } else if (down) { + if (e == 1005) setFeatureState(kFeatureVirtualKeyboard, !getFeatureState(kFeatureVirtualKeyboard)); } return processed; - } else if(_ms_cur_x != _ms_old_x || _ms_cur_y != _ms_old_y) { + } else if (_ms_cur_x != _ms_old_x || _ms_cur_y != _ms_old_y) { event.type = Common::EVENT_MOUSEMOVE; _ms_old_x = _ms_cur_x; _ms_old_y = _ms_cur_y; diff --git a/backends/platform/dc/label.cpp b/backends/platform/dc/label.cpp index cba5553dd3..44e4701a43 100644 --- a/backends/platform/dc/label.cpp +++ b/backends/platform/dc/label.cpp @@ -47,13 +47,13 @@ static void draw_char(unsigned short *dst, int mod, int c, void *font_base) { unsigned char *src; int i, j; - if(c<=32 || c>255 || (c>=127 && c<160)) c=160; - if(c<128) c -= 32; else c -= 64; + if (c<=32 || c>255 || (c>=127 && c<160)) c=160; + if (c<128) c -= 32; else c -= 64; src = c*36 + (unsigned char *)font_base; - for(i=0; i<12; i++) { + for (i=0; i<12; i++) { int n = (src[0]<<16)|(src[1]<<8)|src[2]; - for(j=0; j<12; j++, n<<=1) - if(n & (1<<23)) { + for (j=0; j<12; j++, n<<=1) + if (n & (1<<23)) { dst[j] = 0xffff; dst[j+1] = 0xffff; dst[j+2] = 0xa108; @@ -61,8 +61,8 @@ static void draw_char(unsigned short *dst, int mod, int c, void *font_base) dst[j+mod+1] = 0xa108; } dst += mod; - for(j=0; j<12; j++, n<<=1) - if(n & (1<<23)) { + for (j=0; j<12; j++, n<<=1) + if (n & (1<<23)) { dst[j] = 0xffff; dst[j+1] = 0xffff; dst[j+2] = 0xa108; @@ -78,15 +78,15 @@ void Label::create_texture(const char *text) { void *font = get_romfont_address(); int l = strlen(text); - if(l>64) l=64; + if (l>64) l=64; int w = 14*l; - for(tex_u=TA_POLYMODE2_U_SIZE_8, u=8; u0) + while (l>0) draw_char(tex+(p-=14), u, text[--l], font); texture = tex; } diff --git a/backends/platform/dc/selector.cpp b/backends/platform/dc/selector.cpp index b082afabf5..7c472ccf24 100644 --- a/backends/platform/dc/selector.cpp +++ b/backends/platform/dc/selector.cpp @@ -162,7 +162,7 @@ static void detectGames(FSList &files, GameList &candidates) static bool isIcon(const FilesystemNode &entry) { int l = entry.displayName().size(); - if(l>4 && !strcasecmp(entry.displayName().c_str()+l-4, ".ICO")) + if (l>4 && !strcasecmp(entry.displayName().c_str()+l-4, ".ICO")) return true; else return false; @@ -172,13 +172,13 @@ static bool loadIcon(Game &game, Dir *dirs, int num_dirs) { char icofn[520]; sprintf(icofn, "%s%s.ICO", game.dir, game.filename_base); - if(game.icon.load(icofn)) + if (game.icon.load(icofn)) return true; - for(int i=0; idir) && + while (cnt--) + if (!strcmp(dir, games->dir) && !stricmp(base, games->filename_base)) return false; else @@ -207,7 +207,7 @@ static int findGames(Game *games, int max) Dir *dirs = new Dir[MAX_DIR]; int curr_game = 0, curr_dir = 0, num_dirs = 1; dirs[0].node = FilesystemNode(""); - while(curr_game < max && curr_dir < num_dirs) { + while (curr_game < max && curr_dir < num_dirs) { strncpy(dirs[curr_dir].name, dirs[curr_dir].node.path().c_str(), 252); dirs[curr_dir].name[251] = '\0'; dirs[curr_dir].deficon[0] = '\0'; @@ -216,13 +216,13 @@ static int findGames(Game *games, int max) for (FSList::const_iterator entry = fslist.begin(); entry != fslist.end(); ++entry) { if (entry->isDirectory()) { - if(num_dirs < MAX_DIR && strcasecmp(entry->displayName().c_str(), + if (num_dirs < MAX_DIR && strcasecmp(entry->displayName().c_str(), "install")) { dirs[num_dirs].node = *entry; num_dirs++; } } else - if(isIcon(*entry)) + if (isIcon(*entry)) strcpy(dirs[curr_dir-1].deficon, entry->displayName().c_str()); else files.push_back(*entry); @@ -231,12 +231,12 @@ static int findGames(Game *games, int max) GameList candidates; detectGames(files, candidates); - for(GameList::const_iterator ge = candidates.begin(); + for (GameList::const_iterator ge = candidates.begin(); ge != candidates.end(); ++ge) - if(curr_game < max) { + if (curr_game < max) { strcpy(games[curr_game].filename_base, ge->gameid().c_str()); strcpy(games[curr_game].dir, dirs[curr_dir-1].name); - if(uniqueGame(games[curr_game].filename_base, + if (uniqueGame(games[curr_game].filename_base, games[curr_game].dir, games, curr_game)) { strcpy(games[curr_game].text, ge->description().c_str()); @@ -251,8 +251,8 @@ static int findGames(Game *games, int max) } } - for(int i=0; i= 6) + if (s >= 6) wasopen = 1; - if(s > 0 && s < 6 && wasopen) { + if (s > 0 && s < 6 && wasopen) { cdfs_reinit(); chdir("/"); chdir("/"); @@ -326,12 +326,12 @@ int gameMenu(Game *games, int num_games) int top_game = 0, selector_pos = 0; int mousex = 0, mousey = 0; - if(!num_games) + if (!num_games) return -1; - for(;;) { + for (;;) { - if(getCdState()>=6) + if (getCdState()>=6) return -1; ta_begin_frame(); @@ -341,10 +341,10 @@ int gameMenu(Game *games, int num_games) ta_commit_end(); float y = 40.0; - for(int i=top_game, cnt=0; cnt<10 && i=16) { - if(selector_pos + top_game + 1 < num_games) - if(++selector_pos >= 10) { + if (mousey>=16) { + if (selector_pos + top_game + 1 < num_games) + if (++selector_pos >= 10) { --selector_pos; ++top_game; } mousey -= 16; - } else if(mousey<=-16) { - if(selector_pos + top_game > 0) - if(--selector_pos < 0) { + } else if (mousey<=-16) { + if (selector_pos + top_game > 0) + if (--selector_pos < 0) { ++selector_pos; --top_game; } @@ -423,10 +423,10 @@ bool selectGame(char *&ret, char *&dir_ret, Icon &icon) ta_sync(); void *mark = ta_txmark(); - for(;;) { + for (;;) { num_games = findGames(games, MAX_GAMES); - for(int i=0; i= num_games) + if (selected >= num_games) selected = -1; - if(selected >= 0) + if (selected >= 0) the_game = games[selected]; delete games; - if(selected>=0) { + if (selected>=0) { #if 0 chdir(the_game.dir); #else diff --git a/backends/platform/dc/softkbd.cpp b/backends/platform/dc/softkbd.cpp index 79363713a5..1f2bd619e1 100644 --- a/backends/platform/dc/softkbd.cpp +++ b/backends/platform/dc/softkbd.cpp @@ -70,10 +70,10 @@ SoftKeyboard::SoftKeyboard(const OSystem_Dreamcast *_os) assert((sizeof(key_codes)/sizeof(key_codes[0])) == SK_NUM_KEYS); const char *np = key_names; - for(int i=0; i8192) { + if (key_codes[i]>8192) { labels[1][i].create_texture(np); np += strlen(np)+1; } @@ -92,19 +92,19 @@ void SoftKeyboard::draw(float x, float y, int transp) bg_alpha_mask|0x8080ff, bg_alpha_mask|0x8080ff); x0 = x += 4.0; y += 4.0; - for(int i=0; i8192 && (shiftState & Common::KBD_SHIFT)) + else if (key_codes[i]>8192 && (shiftState & Common::KBD_SHIFT)) labels[1][i].draw(x+2, y+5, txt_alpha_mask|0x000000, 0.5); else labels[0][i].draw(x+2, y+5, txt_alpha_mask|0x000000, 0.5); x += w+4.0; - if(++c == 11) { + if (++c == 11) { c = 0; x = x0; y += 28.0; @@ -116,41 +116,41 @@ int SoftKeyboard::key(int k, byte &shiftFlags) { switch(k) { case 1001: - if(++keySel == SK_NUM_KEYS) + if (++keySel == SK_NUM_KEYS) keySel = 0; break; case 1002: - if(--keySel < 0) + if (--keySel < 0) keySel = SK_NUM_KEYS - 1; break; case 1003: - if(keySel >= 55) { - if(keySel > 58) + if (keySel >= 55) { + if (keySel > 58) keySel += 5; keySel -= 55; - } else if(keySel > 47) { - if((keySel += 6) < 59) + } else if (keySel > 47) { + if ((keySel += 6) < 59) keySel = 59; } else keySel += 11; break; case 1004: - if(keySel > 58) + if (keySel > 58) keySel -= 6; - else if((keySel -= 11) < 0) - if((keySel += 66) > 58) - if((keySel -= 5) < 59) + else if ((keySel -= 11) < 0) + if ((keySel += 66) > 58) + if ((keySel -= 5) < 59) keySel = 59; break; case 1000: case 13: case 32: case 319: - if(key_codes[keySel]<0) + if (key_codes[keySel]<0) shiftState ^= ~key_codes[keySel]; else { shiftFlags = shiftState; - if(key_codes[keySel] > 8192) + if (key_codes[keySel] > 8192) return ((shiftState & Common::KBD_SHIFT)? (key_codes[keySel]>>8): key_codes[keySel]) & 0xff; else @@ -164,9 +164,9 @@ int SoftKeyboard::key(int k, byte &shiftFlags) void SoftKeyboard::mouse(int x, int y) { os->mouseToSoftKbd(x, y, x, y); - if(x >= 0 && x < 11*28 && y >= 0 && y < 6*28 && + if (x >= 0 && x < 11*28 && y >= 0 && y < 6*28 && x%28 >= 4 && y%28 >= 4) - if((keySel = 11*(y/28)+(x/28)) > 58) - if((keySel -= 5) < 59) + if ((keySel = 11*(y/28)+(x/28)) > 58) + if ((keySel -= 5) < 59) keySel = 58; } diff --git a/backends/platform/dc/time.cpp b/backends/platform/dc/time.cpp index 06bb931717..890e98f6b4 100644 --- a/backends/platform/dc/time.cpp +++ b/backends/platform/dc/time.cpp @@ -51,8 +51,8 @@ void OSystem_Dreamcast::delayMillis(uint msecs) getMillis(); unsigned int t, start = Timer(); int time = (((unsigned int)msecs)*3125U)>>6; - while(((int)((t = Timer())-start))handler(); checkSound(); } diff --git a/backends/platform/dc/vmsave.cpp b/backends/platform/dc/vmsave.cpp index 7b3ca835d2..5b7eaf5f46 100644 --- a/backends/platform/dc/vmsave.cpp +++ b/backends/platform/dc/vmsave.cpp @@ -87,14 +87,14 @@ static vmsaveResult trySave(const char *gamename, const char *data, int size, time_t t; unsigned char iconbuffer[512+32]; - if(!vmsfs_check_unit(vm, 0, &info)) + if (!vmsfs_check_unit(vm, 0, &info)) return VMSAVE_NOVM; - if(!vmsfs_get_superblock(&info, &super)) + if (!vmsfs_get_superblock(&info, &super)) return VMSAVE_NOVM; int free_cnt = vmsfs_count_free(&super); - if(vmsfs_open_file(&super, filename, &file)) + if (vmsfs_open_file(&super, filename, &file)) free_cnt += file.blks; - if(((128+512+size+511)>>9) > free_cnt) + if (((128+512+size+511)>>9) > free_cnt) return VMSAVE_NOSPACE; memset(&header, 0, sizeof(header)); @@ -117,7 +117,7 @@ static vmsaveResult trySave(const char *gamename, const char *data, int size, vmsfs_beep(&info, 1); vmsfs_errno = 0; - if(!vmsfs_create_file(&super, filename, &header, + if (!vmsfs_create_file(&super, filename, &header, iconbuffer+sizeof(header.palette), NULL, data, size, &tstamp)) { fprintf(stderr, "%s\n", vmsfs_describe_error()); @@ -140,16 +140,16 @@ static bool tryLoad(char *&buffer, int &size, const char *filename, int vm) time_t t; unsigned char iconbuffer[512+32]; - if(!vmsfs_check_unit(vm, 0, &info)) + if (!vmsfs_check_unit(vm, 0, &info)) return false; - if(!vmsfs_get_superblock(&info, &super)) + if (!vmsfs_get_superblock(&info, &super)) return false; - if(!vmsfs_open_file(&super, filename, &file)) + if (!vmsfs_open_file(&super, filename, &file)) return false; buffer = new char[size = file.size]; - if(vmsfs_read_file(&file, (unsigned char *)buffer, size)) + if (vmsfs_read_file(&file, (unsigned char *)buffer, size)) return true; delete[] buffer; @@ -165,19 +165,19 @@ static void tryList(const char *prefix, bool *marks, int num, int vm) struct dir_entry de; int pl = strlen(prefix); - if(!vmsfs_check_unit(vm, 0, &info)) + if (!vmsfs_check_unit(vm, 0, &info)) return; - if(!vmsfs_get_superblock(&info, &super)) + if (!vmsfs_get_superblock(&info, &super)) return; vmsfs_open_dir(&super, &iter); - while(vmsfs_next_dir_entry(&iter, &de)) - if(de.entry[0]) { + while (vmsfs_next_dir_entry(&iter, &de)) + if (de.entry[0]) { char buf[16], *endp = NULL; strncpy(buf, (char *)de.entry+4, 12); buf[12] = 0; int l = strlen(buf); long i = 42; - if(l > pl && !strncmp(buf, prefix, pl) && + if (l > pl && !strncmp(buf, prefix, pl) && (i = strtol(buf+pl, &endp, 10))>=0 && i= 0 && + if (lastvm >= 0 && (res = trySave(gamename, data, size, filename, icon, lastvm)) == VMSAVE_OK) return res; - for(int i=0; i<24; i++) - if((r = trySave(gamename, data, size, filename, icon, i)) == VMSAVE_OK) { + for (int i=0; i<24; i++) + if ((r = trySave(gamename, data, size, filename, icon, i)) == VMSAVE_OK) { lastvm = i; return r; - } else if(r > res) + } else if (r > res) res = r; return res; @@ -205,12 +205,12 @@ vmsaveResult writeSaveGame(const char *gamename, const char *data, int size, bool readSaveGame(char *&buffer, int &size, const char *filename) { - if(lastvm >= 0 && + if (lastvm >= 0 && tryLoad(buffer, size, filename, lastvm)) return true; - for(int i=0; i<24; i++) - if(tryLoad(buffer, size, filename, i)) { + for (int i=0; i<24; i++) + if (tryLoad(buffer, size, filename, i)) { lastvm = i; return true; } @@ -235,7 +235,7 @@ public: ~InVMSave() { - if(buffer != NULL) + if (buffer != NULL) delete[] buffer; } @@ -248,11 +248,11 @@ public: void tryUncompress() { - if(_size > 0 && buffer[0] != 'S') { + if (_size > 0 && buffer[0] != 'S') { // Data does not start with "SCVM". Maybe compressed? char *expbuf = new char[MAX_SAVE_SIZE]; unsigned long destlen = MAX_SAVE_SIZE; - if(!uncompress((Bytef*)expbuf, &destlen, (Bytef*)buffer, _size)) { + if (!uncompress((Bytef*)expbuf, &destlen, (Bytef*)buffer, _size)) { delete[] buffer; buffer = expbuf; _size = destlen; @@ -294,7 +294,7 @@ public: virtual Common::InSaveFile *openForLoading(const char *filename) { InVMSave *s = new InVMSave(); - if(s->readSaveGame(filename)) { + if (s->readSaveGame(filename)) { s->tryUncompress(); return s; } else { @@ -311,26 +311,26 @@ void OutVMSave::finalize() extern const char *gGameName; extern Icon icon; - if(committed >= pos) + if (committed >= pos) return; char *data = buffer, *compbuf = NULL; int len = pos; - if(pos) { + if (pos) { // Try compression compbuf = new char[pos]; unsigned long destlen = pos; - if(!compress((Bytef*)compbuf, &destlen, (Bytef*)buffer, pos)) { + if (!compress((Bytef*)compbuf, &destlen, (Bytef*)buffer, pos)) { data = compbuf; len = destlen; } } vmsaveResult r = writeSaveGame(gGameName, data, len, filename, icon); committed = pos; - if(compbuf != NULL) + if (compbuf != NULL) delete[] compbuf; - if(r != VMSAVE_OK) + if (r != VMSAVE_OK) iofailed = true; displaySaveResult(r); } @@ -375,9 +375,9 @@ void InVMSave::seek(int32 offs, int whence) _pos = _size + offs; break; } - if(_pos < 0) + if (_pos < 0) _pos = 0; - else if(_pos > _size) + else if (_pos > _size) _pos = _size; } @@ -399,7 +399,7 @@ void VMSaveManager::listSavefiles(const char *prefix, bool *marks, int num) { memset(marks, false, num*sizeof(bool)); - for(int i=0; i<24; i++) + for (int i=0; i<24; i++) tryList(prefix, marks, num, i); } diff --git a/backends/platform/ds/arm7/source/main.cpp b/backends/platform/ds/arm7/source/main.cpp index f32baa5ab6..b7d9445e6e 100644 --- a/backends/platform/ds/arm7/source/main.cpp +++ b/backends/platform/ds/arm7/source/main.cpp @@ -483,7 +483,7 @@ void InterruptTimer3() { IPC->battery = batt; IPC->aux = aux; - for(u32 i=0; icurtime[i] = ct[i]; } @@ -527,7 +527,7 @@ void arm7_synctoarm9() { // send fifo message // interrupt handler to allow incoming notifications from arm9 void arm7_fifo() { // check incoming fifo messages u32 msg = REG_IPC_FIFO_RX; - if(msg==0x87654321) Wifi_Sync(); + if (msg==0x87654321) Wifi_Sync(); } @@ -543,13 +543,13 @@ void initDebugger() { // sync with arm9 and init wifi u32 fifo_temp; - while(1) { // wait for magic number - while(REG_IPC_FIFO_CR&IPC_FIFO_RECV_EMPTY) swiWaitForVBlank(); + while (1) { // wait for magic number + while (REG_IPC_FIFO_CR&IPC_FIFO_RECV_EMPTY) swiWaitForVBlank(); fifo_temp=REG_IPC_FIFO_RX; - if(fifo_temp==0x12345678) break; + if (fifo_temp==0x12345678) break; } - while(REG_IPC_FIFO_CR&IPC_FIFO_RECV_EMPTY) swiWaitForVBlank(); + while (REG_IPC_FIFO_CR&IPC_FIFO_RECV_EMPTY) swiWaitForVBlank(); fifo_temp=REG_IPC_FIFO_RX; // give next value to wifi_init Wifi_Init(fifo_temp); diff --git a/backends/platform/ds/arm9/source/blitters.cpp b/backends/platform/ds/arm9/source/blitters.cpp index 9af3c5d611..1ce8429a4d 100644 --- a/backends/platform/ds/arm9/source/blitters.cpp +++ b/backends/platform/ds/arm9/source/blitters.cpp @@ -148,7 +148,7 @@ void ComputeDivBy5TableIFN() return; isDivBy5Ready = true; - for(int i=0; i<160; ++i) + for (int i=0; i<160; ++i) { DIV_BY_5[i] = (2*i+5)/10; } @@ -311,7 +311,7 @@ static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16* dest, const { ComputeDivBy5TableIFN(); - for(size_t i=0; i<64; ++i) + for (size_t i=0; i<64; ++i) { u32 s0 = palette[src[5*i+0]]; u32 s1 = palette[src[5*i+1]]; @@ -325,7 +325,7 @@ static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16* dest, const #else static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16* dest, const u8* src, const u16* palette) { - for(size_t i=0; i<64; ++i) + for (size_t i=0; i<64; ++i) { u16 s0 = palette[src[5*i+0]]; u16 s1 = palette[src[5*i+1]]; @@ -344,7 +344,7 @@ static inline void Rescale_320x1555Scanline_To_256x1555Scanline(u16* dest, const { ComputeDivBy5TableIFN(); - for(size_t i=0; i<64; ++i) + for (size_t i=0; i<64; ++i) { u16 s0 = src[5*i+0]; u16 s1 = src[5*i+1]; @@ -362,7 +362,7 @@ void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, const u16* p u32 fastRam[768]; // Palette lookup -> 0_888 - for(size_t i=0; i<256; ++i) + for (size_t i=0; i<256; ++i) { u32 col = palette[i]; u32 result = col & 0x0000001F; @@ -372,7 +372,7 @@ void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, const u16* p fastRam[i] = result; } - for(size_t i=0; i<200; ++i) + for (size_t i=0; i<200; ++i) { Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam); } @@ -381,10 +381,10 @@ void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, const u16* p void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, const u16* palette, int destStride, int srcStride) { u16 fastRam[256]; - for(size_t i=0; i<128; ++i) + for (size_t i=0; i<128; ++i) ((u32*)fastRam)[i] = ((const u32*)palette)[i]; - for(size_t i=0; i<200; ++i) + for (size_t i=0; i<200; ++i) { Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam); } @@ -393,7 +393,7 @@ void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, const u16* p void Rescale_320x256x1555_To_256x256x1555(u16* dest, const u16* src, int destStride, int srcStride) { - for(size_t i=0; i<200; ++i) + for (size_t i=0; i<200; ++i) { Rescale_320x1555Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride); } diff --git a/backends/platform/ds/arm9/source/compressor/lz.cpp b/backends/platform/ds/arm9/source/compressor/lz.cpp index 1234bf7b3b..47a36646c6 100644 --- a/backends/platform/ds/arm9/source/compressor/lz.cpp +++ b/backends/platform/ds/arm9/source/compressor/lz.cpp @@ -105,7 +105,7 @@ inline static unsigned int _LZ_StringCompare( unsigned char * str1, { unsigned int len; - for( len = minlen; (len < maxlen) && (str1[len] == str2[len]); ++ len ); + for ( len = minlen; (len < maxlen) && (str1[len] == str2[len]); ++ len ); return len; } @@ -123,18 +123,18 @@ inline static int _LZ_WriteVarSize( unsigned int x, unsigned char * buf ) /* Determine number of bytes needed to store the number x */ y = x >> 3; - for( num_bytes = 5; num_bytes >= 2; -- num_bytes ) + for ( num_bytes = 5; num_bytes >= 2; -- num_bytes ) { - if( y & 0xfe000000 ) break; + if ( y & 0xfe000000 ) break; y <<= 7; } /* Write all bytes, seven bits in each, with 8:th bit set for all */ /* but the last byte. */ - for( i = num_bytes-1; i >= 0; -- i ) + for ( i = num_bytes-1; i >= 0; -- i ) { b = (x >> (i*7)) & 0x0000007f; - if( i > 0 ) + if ( i > 0 ) { b |= 0x00000080; } @@ -164,7 +164,7 @@ inline static int _LZ_ReadVarSize( unsigned int * x, unsigned char * buf ) y = (y << 7) | (b & 0x0000007f); ++ num_bytes; } - while( b & 0x00000080 ); + while ( b & 0x00000080 ); /* Store value in x */ *x = y; @@ -200,26 +200,26 @@ int LZ_Compress( unsigned char *in, unsigned char *out, unsigned char *ptr1, *ptr2; /* Do we have anything to compress? */ - if( insize < 1 ) + if ( insize < 1 ) { return 0; } /* Create histogram */ - for( i = 0; i < 256; ++ i ) + for ( i = 0; i < 256; ++ i ) { histogram[ i ] = 0; } - for( i = 0; i < insize; ++ i ) + for ( i = 0; i < insize; ++ i ) { ++ histogram[ in[ i ] ]; } /* Find the least common byte, and use it as the code marker */ marker = 0; - for( i = 1; i < 256; ++ i ) + for ( i = 1; i < 256; ++ i ) { - if( histogram[ i ] < histogram[ marker ] ) + if ( histogram[ i ] < histogram[ marker ] ) { marker = i; } @@ -237,7 +237,7 @@ int LZ_Compress( unsigned char *in, unsigned char *out, do { /* Determine most distant position */ - if( inpos > LZ_MAX_OFFSET ) maxoffset = LZ_MAX_OFFSET; + if ( inpos > LZ_MAX_OFFSET ) maxoffset = LZ_MAX_OFFSET; else maxoffset = inpos; /* Get pointer to current position */ @@ -246,13 +246,13 @@ int LZ_Compress( unsigned char *in, unsigned char *out, /* Search history window for maximum length string match */ bestlength = 3; bestoffset = 0; - for( offset = 3; offset <= maxoffset; ++ offset ) + for ( offset = 3; offset <= maxoffset; ++ offset ) { /* Get pointer to candidate string */ ptr2 = &ptr1[ -offset ]; /* Quickly determine if this is a candidate (for speed) */ - if( (ptr1[ 0 ] == ptr2[ 0 ]) && + if ( (ptr1[ 0 ] == ptr2[ 0 ]) && (ptr1[ bestlength ] == ptr2[ bestlength ]) ) { /* Determine maximum length for this offset */ @@ -262,7 +262,7 @@ int LZ_Compress( unsigned char *in, unsigned char *out, length = _LZ_StringCompare( ptr1, ptr2, 0, maxlength ); /* Better match than any previous match? */ - if( length > bestlength ) + if ( length > bestlength ) { bestlength = length; bestoffset = offset; @@ -271,7 +271,7 @@ int LZ_Compress( unsigned char *in, unsigned char *out, } /* Was there a good enough match? */ - if( (bestlength >= 8) || + if ( (bestlength >= 8) || ((bestlength == 4) && (bestoffset <= 0x0000007f)) || ((bestlength == 5) && (bestoffset <= 0x00003fff)) || ((bestlength == 6) && (bestoffset <= 0x001fffff)) || @@ -288,19 +288,19 @@ int LZ_Compress( unsigned char *in, unsigned char *out, /* Output single byte (or two bytes if marker byte) */ symbol = in[ inpos ++ ]; out[ outpos ++ ] = symbol; - if( symbol == marker ) + if ( symbol == marker ) { out[ outpos ++ ] = 0; } -- bytesleft; } } - while( bytesleft > 3 ); + while ( bytesleft > 3 ); /* Dump remaining bytes, if any */ - while( inpos < insize ) + while ( inpos < insize ) { - if( in[ inpos ] == marker ) + if ( in[ inpos ] == marker ) { out[ outpos ++ ] = marker; out[ outpos ++ ] = 0; @@ -338,7 +338,7 @@ int LZ_CompressFast( unsigned char *in, unsigned char *out, unsigned char *ptr1, *ptr2; /* Do we have anything to compress? */ - if( insize < 1 ) + if ( insize < 1 ) { return 0; } @@ -353,11 +353,11 @@ int LZ_CompressFast( unsigned char *in, unsigned char *out, in[i+1] == in[jumptable[i]+1]. Following the jump table gives a dramatic boost for the string search'n'match loop compared to doing a brute force search. */ - for( i = 0; i < 65536; ++ i ) + for ( i = 0; i < 65536; ++ i ) { lastindex[ i ] = 0xffffffff; } - for( i = 0; i < insize-1; ++ i ) + for ( i = 0; i < insize-1; ++ i ) { symbols = (((unsigned int)in[i]) << 8) | ((unsigned int)in[i+1]); index = lastindex[ symbols ]; @@ -367,20 +367,20 @@ int LZ_CompressFast( unsigned char *in, unsigned char *out, jumptable[ insize-1 ] = 0xffffffff; /* Create histogram */ - for( i = 0; i < 256; ++ i ) + for ( i = 0; i < 256; ++ i ) { histogram[ i ] = 0; } - for( i = 0; i < insize; ++ i ) + for ( i = 0; i < insize; ++ i ) { ++ histogram[ in[ i ] ]; } /* Find the least common byte, and use it as the code marker */ marker = 0; - for( i = 1; i < 256; ++ i ) + for ( i = 1; i < 256; ++ i ) { - if( histogram[ i ] < histogram[ marker ] ) + if ( histogram[ i ] < histogram[ marker ] ) { marker = i; } @@ -404,13 +404,13 @@ int LZ_CompressFast( unsigned char *in, unsigned char *out, bestlength = 3; bestoffset = 0; index = jumptable[ inpos ]; - while( index != 0xffffffff ) + while ( index != 0xffffffff ) { /* Get pointer to candidate string */ ptr2 = &in[ index ]; /* Quickly determine if this is a candidate (for speed) */ - if( ptr2[ bestlength ] == ptr1[ bestlength ] ) + if ( ptr2[ bestlength ] == ptr1[ bestlength ] ) { /* Determine maximum length for this offset */ offset = inpos - index; @@ -420,7 +420,7 @@ int LZ_CompressFast( unsigned char *in, unsigned char *out, length = _LZ_StringCompare( ptr1, ptr2, 2, maxlength ); /* Better match than any previous match? */ - if( length > bestlength ) + if ( length > bestlength ) { bestlength = length; bestoffset = offset; @@ -432,7 +432,7 @@ int LZ_CompressFast( unsigned char *in, unsigned char *out, } /* Was there a good enough match? */ - if( (bestlength >= 8) || + if ( (bestlength >= 8) || ((bestlength == 4) && (bestoffset <= 0x0000007f)) || ((bestlength == 5) && (bestoffset <= 0x00003fff)) || ((bestlength == 6) && (bestoffset <= 0x001fffff)) || @@ -449,19 +449,19 @@ int LZ_CompressFast( unsigned char *in, unsigned char *out, /* Output single byte (or two bytes if marker byte) */ symbol = in[ inpos ++ ]; out[ outpos ++ ] = symbol; - if( symbol == marker ) + if ( symbol == marker ) { out[ outpos ++ ] = 0; } -- bytesleft; } } - while( bytesleft > 3 ); + while ( bytesleft > 3 ); /* Dump remaining bytes, if any */ - while( inpos < insize ) + while ( inpos < insize ) { - if( in[ inpos ] == marker ) + if ( in[ inpos ] == marker ) { out[ outpos ++ ] = marker; out[ outpos ++ ] = 0; @@ -492,7 +492,7 @@ void LZ_Uncompress( unsigned char *in, unsigned char *out, unsigned int i, inpos, outpos, length, offset; /* Do we have anything to compress? */ - if( insize < 1 ) + if ( insize < 1 ) { return; } @@ -506,10 +506,10 @@ void LZ_Uncompress( unsigned char *in, unsigned char *out, do { symbol = in[ inpos ++ ]; - if( symbol == marker ) + if ( symbol == marker ) { /* We had a marker byte */ - if( in[ inpos ] == 0 ) + if ( in[ inpos ] == 0 ) { /* It was a single occurrence of the marker byte */ out[ outpos ++ ] = marker; @@ -522,7 +522,7 @@ void LZ_Uncompress( unsigned char *in, unsigned char *out, inpos += _LZ_ReadVarSize( &offset, &in[ inpos ] ); /* Copy corresponding data from history window */ - for( i = 0; i < length; ++ i ) + for ( i = 0; i < length; ++ i ) { out[ outpos ] = out[ outpos - offset ]; ++ outpos; @@ -535,5 +535,5 @@ void LZ_Uncompress( unsigned char *in, unsigned char *out, out[ outpos ++ ] = symbol; } } - while( inpos < insize ); + while ( inpos < insize ); } diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index 43008a1770..1689a3f5f9 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -305,14 +305,14 @@ int getGameHeight() { } void initSprites() { - for(int i = 0; i < 128; i++) { + for (int i = 0; i < 128; i++) { sprites[i].attribute[0] = ATTR0_DISABLED; sprites[i].attribute[1] = 0; sprites[i].attribute[2] = 0; sprites[i].attribute[3] = 0; } - for(int i = 0; i < 128; i++) { + for (int i = 0; i < 128; i++) { spritesMain[i].attribute[0] = ATTR0_DISABLED; spritesMain[i].attribute[1] = 0; spritesMain[i].attribute[2] = 0; diff --git a/backends/platform/gp2x/events.cpp b/backends/platform/gp2x/events.cpp index ef39ab333e..d9ff45130a 100644 --- a/backends/platform/gp2x/events.cpp +++ b/backends/platform/gp2x/events.cpp @@ -183,17 +183,17 @@ void OSystem_GP2X::moveStick() { memcpy(stickBtn, _stickBtn, sizeof(stickBtn)); - if((stickBtn[0])||(stickBtn[2])||(stickBtn[4])||(stickBtn[6])) + if ((stickBtn[0])||(stickBtn[2])||(stickBtn[4])||(stickBtn[6])) stickBtn[1] = stickBtn[3] = stickBtn[5] = stickBtn[7] = 0; - if((stickBtn[1])||(stickBtn[2])||(stickBtn[3])){ - if(_km.x_down_count!=2){ + if ((stickBtn[1])||(stickBtn[2])||(stickBtn[3])){ + if (_km.x_down_count!=2){ _km.x_vel = -1; _km.x_down_count = 1; }else _km.x_vel = -4; - } else if((stickBtn[5])||(stickBtn[6])||(stickBtn[7])){ - if(_km.x_down_count!=2){ + } else if ((stickBtn[5])||(stickBtn[6])||(stickBtn[7])){ + if (_km.x_down_count!=2){ _km.x_vel = 1; _km.x_down_count = 1; }else @@ -205,14 +205,14 @@ void OSystem_GP2X::moveStick() { } - if((stickBtn[0])||(stickBtn[1])||(stickBtn[7])){ - if(_km.y_down_count!=2){ + if ((stickBtn[0])||(stickBtn[1])||(stickBtn[7])){ + if (_km.y_down_count!=2){ _km.y_vel = -1; _km.y_down_count = 1; }else _km.y_vel = -4; - } else if((stickBtn[3])||(stickBtn[4])||(stickBtn[5])){ - if(_km.y_down_count!=2){ + } else if ((stickBtn[3])||(stickBtn[4])||(stickBtn[5])){ + if (_km.y_down_count!=2){ _km.y_vel = 1; _km.y_down_count = 1; }else @@ -302,7 +302,7 @@ bool OSystem_GP2X::pollEvent(Common::Event &event) { GP2X_BUTTON_L & GP2X_BUTTON_A Common::EVENT_PREDICTIVE_DIALOG for predictive text entry box (AGI games) */ - while(SDL_PollEvent(&ev)) { + while (SDL_PollEvent(&ev)) { switch(ev.type) { case SDL_KEYDOWN:{ diff --git a/backends/platform/gp2x/gp2x-hw.cpp b/backends/platform/gp2x/gp2x-hw.cpp index d322aa5d08..6e0e5215ef 100644 --- a/backends/platform/gp2x/gp2x-hw.cpp +++ b/backends/platform/gp2x/gp2x-hw.cpp @@ -63,18 +63,18 @@ static volatile unsigned short *MEM_REG; void GP2X_device_init() { // Open devices - if(!gp2x_dev[0]) gp2x_dev[0] = open("/dev/mixer", O_RDWR); - if(!gp2x_dev[1]) gp2x_dev[1] = open("/dev/batt", O_RDONLY); - if(!gp2x_dev[2]) gp2x_dev[2] = open("/dev/mem", O_RDWR); + if (!gp2x_dev[0]) gp2x_dev[0] = open("/dev/mixer", O_RDWR); + if (!gp2x_dev[1]) gp2x_dev[1] = open("/dev/batt", O_RDONLY); + if (!gp2x_dev[2]) gp2x_dev[2] = open("/dev/mem", O_RDWR); } void GP2X_device_deinit() { // Close devices { int i; - for(i=0;i<8;i++) + for (i=0;i<8;i++) { - if(gp2x_dev[i]) + if (gp2x_dev[i]) { close(gp2x_dev[i]); } @@ -211,7 +211,7 @@ void Disable_940(void) void gp2x_video_wait_vsync(void) { MEM_REG[0x2846>>1]=(MEM_REG[0x2846>>1] | 0x20) & ~2; - while(!(MEM_REG[0x2846>>1] & 2)); + while (!(MEM_REG[0x2846>>1] & 2)); } //char GP2X_get_battery_level() { diff --git a/backends/platform/gp32/debug-gdbstub-usb.cpp b/backends/platform/gp32/debug-gdbstub-usb.cpp index d18a1990b5..9899ae47ec 100644 --- a/backends/platform/gp32/debug-gdbstub-usb.cpp +++ b/backends/platform/gp32/debug-gdbstub-usb.cpp @@ -215,7 +215,7 @@ void WaitACK() bool bBreak = false; int iResult; - while(!bBreak) { + while (!bBreak) { iResult = g_Comm.comm_recv((unsigned char *)g_SendBuffer, 0x100); if (iResult > 0) { bBreak = true; @@ -234,7 +234,7 @@ void SendCommand(unsigned char *pCommand) g_SendBuffer[iOffset++] = '$'; iCheckSum = 0; - while(*pCommand != 0) { + while (*pCommand != 0) { g_SendBuffer[iOffset++] = *pCommand; iCheckSum += *pCommand++; } @@ -285,7 +285,7 @@ void SendCommandSize(unsigned char *pCommand, int iSize) g_SendBuffer[iOffset++] = '$'; iCheckSum = 0; - while(*pCommand != 0) { + while (*pCommand != 0) { g_SendBuffer[iOffset++] = *pCommand; iCheckSum += *pCommand++; } @@ -340,7 +340,7 @@ void HexToStringBW(char *pString, int iNumber) // equiv to strcat i imagine void PrintToString(char *pString, char *pOtherString) { - while(*pOtherString != 0) { + while (*pOtherString != 0) { *pString = *pOtherString; *pString++; *pOtherString++; @@ -644,7 +644,7 @@ void WriteMemory(void *pAddr, unsigned int uiBytes, char *pHexString) uiOffset += 2; } /* - while(1); + while (1); unsigned int *piData = (unsigned int *)pAddr; *piData = 0xe7ffdefe;//0xfedeffe7; */ @@ -696,7 +696,7 @@ int FindChar(char *pBuffer, char sign) { int iRetVal = 0; - while(*pBuffer != sign) { + while (*pBuffer != sign) { iRetVal++; *pBuffer++; } @@ -830,7 +830,7 @@ void ISR() break; case MODE_DUNNO: default: - while(1); + while (1); } */ SendBreakPoint(); @@ -928,7 +928,7 @@ void ISR() case MODE_DUNNO: default: //Printf("Dunno!!\n"); - while(1); + while (1); } @@ -1035,13 +1035,13 @@ void BreakPoint() Printf("Restore: 0x%x", g_SavedStepInstruction); #endif } else { - while(1); + while (1); } g_LastWasStep = false; } - while(!bBreakLoop) { + while (!bBreakLoop) { iResult = RecvUSB(g_ReadBuffer, 0x100); //Printf("%d\n", iResult); @@ -1061,7 +1061,7 @@ void BreakPoint() // I can see that i get a bunch of '+' and '-' in the messages.. lets remove them. iOffsetAdd = 4; - while((g_ReadBuffer[iOffsetAdd] == '+') || (g_ReadBuffer[iOffsetAdd] == '-')) iOffsetAdd++; + while ((g_ReadBuffer[iOffsetAdd] == '+') || (g_ReadBuffer[iOffsetAdd] == '-')) iOffsetAdd++; // Check whether it's legimit command if (g_ReadBuffer[iOffsetAdd] == '$') { @@ -1608,7 +1608,7 @@ unsigned int ROR(unsigned int uiValue, unsigned int uiSteps) { unsigned int uiRetval; - while(uiSteps-- > 0) { + while (uiSteps-- > 0) { if (uiValue & 0x01) { uiValue = (uiValue >> 1) | 0x80000000; } else { diff --git a/backends/platform/gp32/gp32std_input.cpp b/backends/platform/gp32/gp32std_input.cpp index b36535dbc6..de82f8b0bc 100644 --- a/backends/platform/gp32/gp32std_input.cpp +++ b/backends/platform/gp32/gp32std_input.cpp @@ -195,7 +195,7 @@ bool gp_pumpButtonEvent() { bool gp_pollButtonEvent(GP32BtnEvent *ev) { gp_pumpButtonEvent(); - if(eventQueue.isEmpty()) { + if (eventQueue.isEmpty()) { return false; } diff --git a/backends/platform/gp32/gp32std_memory.cpp b/backends/platform/gp32/gp32std_memory.cpp index 17569e4917..449fec9f95 100644 --- a/backends/platform/gp32/gp32std_memory.cpp +++ b/backends/platform/gp32/gp32std_memory.cpp @@ -114,7 +114,7 @@ void *MemBlock::addBlock(size_t size) } blk++; } - if(i == NUM_BLOCK) { + if (i == NUM_BLOCK) { blk = &block[0]; for (i = 0; i < prevBlock; i++) { if (!blk->used) { @@ -122,7 +122,7 @@ void *MemBlock::addBlock(size_t size) } blk++; } - if(i == prevBlock) { + if (i == prevBlock) { prevBlock = 0; return gm_malloc(size); } @@ -289,7 +289,7 @@ void *operator new(size_t size) { void *ptr = gp_malloc(size); #if defined(CLEAN_MEMORY_WITH_0xE7) - if(ptr != NULL) { + if (ptr != NULL) { gp_memset(ptr, 0xE7, size); } #endif diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index 20a50c1b47..5144f5a401 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -235,13 +235,13 @@ void OSystem_PSP::updateScreen() { } } - if(_overlayVisible) { + if (_overlayVisible) { for (int i = 0; i < _screenHeight; ++i) { for (int j = 0; j < _screenWidth; ++j) { OverlayColor pixel = _overlayBuffer[(i * _overlayWidth +j)]; - if(pixel & 0x8000) + if (pixel & 0x8000) putPixel(xStart + j, yStart + i, pixel); } } @@ -362,7 +362,7 @@ void OSystem_PSP::colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) { OverlayColor OSystem_PSP::ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b) { OverlayColor color = RGBToColor(r, g, b); - if(a == 255) + if (a == 255) color |= 0x8000; return color; @@ -370,7 +370,7 @@ OverlayColor OSystem_PSP::ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b) { void OSystem_PSP::colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) { colorToRGB(color, r, g, b); - if(color & 0x8000) + if (color & 0x8000) a = 255; else a = 0; @@ -530,7 +530,7 @@ bool OSystem_PSP::pollEvent(Common::Event &event) { if (newX < 0) newX = 0; if (newY < 0) newY = 0; - if(_overlayVisible) + if (_overlayVisible) { if (newX >= _overlayWidth) newX = _overlayWidth - 1; if (newY >= _overlayHeight) newY = _overlayHeight - 1; diff --git a/backends/platform/psp/osys_psp_gu.cpp b/backends/platform/psp/osys_psp_gu.cpp index a939229c84..bb14d07033 100644 --- a/backends/platform/psp/osys_psp_gu.cpp +++ b/backends/platform/psp/osys_psp_gu.cpp @@ -149,7 +149,7 @@ void OSystem_PSP_GU::initSize(uint width, uint height) { _kbdClut[0] = 0xffff; _kbdClut[246] = 0x4ccc; _kbdClut[247] = 0x0000; - for(int i=1;i<31;i++) + for (int i=1;i<31;i++) _kbdClut[i] = 0xf888; _mouseVisible = false; sceKernelDcacheWritebackAll(); @@ -167,8 +167,8 @@ bool OSystem_PSP_GU::setGraphicsMode(int mode) { bool OSystem_PSP_GU::setGraphicsMode(const char *name) { int i = 0; - while(s_supportedGraphicsModes[i].name) { - if(!strcmpi(s_supportedGraphicsModes[i].name, name)) { + while (s_supportedGraphicsModes[i].name) { + if (!strcmpi(s_supportedGraphicsModes[i].name, name)) { _graphicMode = s_supportedGraphicsModes[i].id; return true; } @@ -196,7 +196,7 @@ void OSystem_PSP_GU::setMouseCursor(const byte *buf, uint w, uint h, int hotspot mouseClut[_mouseKeyColour] = 0; sceKernelDcacheWritebackAll(); - for(unsigned int i=0;i 512 - if( _overlayWidth > 512) { + if ( _overlayWidth > 512) { sceGuTexImage(0, 512, 512, _overlayWidth, _overlayBuffer + 512); vertices[0].u = 512 + 0.5; vertices[1].v = _overlayHeight - 0.5; vertices[0].x = PSP_SCREEN_WIDTH * 512 / 640; vertices[0].y = 0; vertices[0].z = 0; @@ -365,7 +365,7 @@ void OSystem_PSP_GU::updateScreen() { int mX = _mouseX - _mouseHotspotX; int mY = _mouseY - _mouseHotspotY; - if(_overlayVisible) { + if (_overlayVisible) { float scalex, scaley; scalex = (float)PSP_SCREEN_WIDTH /_overlayWidth; @@ -417,7 +417,7 @@ void OSystem_PSP_GU::updateScreen() { sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices); } - if(_keyboardVisible) { + if (_keyboardVisible) { sceGuTexMode(GU_PSM_T8, 0, 0, 0); // 8-bit image sceGuClutMode(GU_PSM_4444, 0, 0xff, 0); sceGuClutLoad(32, kbClut); // upload 32*8 entries (256) @@ -469,13 +469,13 @@ bool OSystem_PSP_GU::pollEvent(Common::Event &event) { uint32 buttonsChanged = pad.Buttons ^ _prevButtons; if ((buttonsChanged & PSP_CTRL_SELECT) || (pad.Buttons & PSP_CTRL_SELECT)) { - if( !(pad.Buttons & PSP_CTRL_SELECT) ) + if ( !(pad.Buttons & PSP_CTRL_SELECT) ) _keyboardVisible = !_keyboardVisible; _prevButtons = pad.Buttons; return false; } - if(!_keyboardVisible) + if (!_keyboardVisible) return OSystem_PSP::pollEvent(event); if ( (buttonsChanged & PSP_CTRL_RTRIGGER) && !(pad.Buttons & PSP_CTRL_RTRIGGER)) @@ -520,17 +520,17 @@ bool OSystem_PSP_GU::pollEvent(Common::Event &event) { x = pad.Lx-128; y = pad.Ly-128; _kbdClut[_keySelected] = 0xf888; - if(x*x + y*y > 10000) { + if (x*x + y*y > 10000) { nub_angle = atan2(y, x); _keySelected = (int)(1 + (M_PI + nub_angle) * 30 / (2 * M_PI)); _keySelected -= 2; - if(_keySelected < 1) + if (_keySelected < 1) _keySelected += 30; _kbdClut[_keySelected] = 0xffff; if (buttonsChanged & PSP_CTRL_CROSS) { event.type = (pad.Buttons & PSP_CTRL_CROSS) ? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP; - if(_keySelected > 26) { + if (_keySelected > 26) { event.kbd.flags = 0; switch(_keySelected) { case 27: @@ -570,7 +570,7 @@ bool OSystem_PSP_GU::pollEvent(Common::Event &event) { } break; case (SYMBOLS|CAPS_LOCK): - if(_keySelected < 21) { + if (_keySelected < 21) { event.kbd.flags = 0; event.kbd.ascii = kbd_ascii_cl[_keySelected-1]; event.kbd.keycode = kbd_code_cl[ _keySelected-1]; diff --git a/backends/platform/psp/trace.cpp b/backends/platform/psp/trace.cpp index 3fe796dd26..80ea98f8b6 100644 --- a/backends/platform/psp/trace.cpp +++ b/backends/platform/psp/trace.cpp @@ -41,7 +41,7 @@ void PSPDebugTrace (const char *format, ...) { fd = sceIoOpen("MS0:/DTRACE.TXT", PSP_O_RDWR | PSP_O_CREAT | PSP_O_APPEND, 0777); - if(fd <= 0) + if (fd <= 0) { return; } @@ -63,7 +63,7 @@ void PSPDebugTrace (const char * filename, const char *format, ...) { fd = sceIoOpen(filename, PSP_O_RDWR | PSP_O_CREAT | PSP_O_APPEND, 0777); - if(fd <= 0) + if (fd <= 0) { return; } diff --git a/backends/platform/symbian/src/ScummVMApp.cpp b/backends/platform/symbian/src/ScummVMApp.cpp index daa0e75744..741f93cfd1 100644 --- a/backends/platform/symbian/src/ScummVMApp.cpp +++ b/backends/platform/symbian/src/ScummVMApp.cpp @@ -55,7 +55,7 @@ CEikAppUi *CScummVMDoc::CreateAppUiL() { } void CScummVMUi::HandleForegroundEventL(TBool aForeground) { - if(aForeground) { + if (aForeground) { BringUpEmulatorL(); } } @@ -64,7 +64,7 @@ CScummVMUi::CScummVMUi() { } CScummVMUi::~CScummVMUi() { - if(iWatcher) { + if (iWatcher) { iThreadWatch.LogonCancel(iWatcher->iStatus); iWatcher->Cancel(); } @@ -109,10 +109,10 @@ void CScummVMUi::ConstructL() { iExeWgId=exeTask.WgId(); exeTask.BringToForeground(); - if(iExeWgId == myTask.WgId()) { // Should n't be the same + if (iExeWgId == myTask.WgId()) { // Should n't be the same Exit(); } - if(iThreadWatch.Open(iThreadId) == KErrNone) { + if (iThreadWatch.Open(iThreadId) == KErrNone) { iWatcher = new (ELeave)CScummWatcher; iWatcher->iAppUi = this; iThreadWatch.Logon(iWatcher->iStatus); @@ -139,7 +139,7 @@ void CScummWatcher::RunL() { void CScummVMUi::BringUpEmulatorL() { RThread thread; - if(thread.Open(iThreadId) == KErrNone) { + if (thread.Open(iThreadId) == KErrNone) { thread.Close(); TApaTask apaTask(iEikonEnv->WsSession()); apaTask.SetWgId(iExeWgId); @@ -155,7 +155,7 @@ void CScummVMUi::HandleCommandL(TInt aCommand) { case EEikCmdExit: { RThread thread; - if(thread.Open(iThreadId) == KErrNone) { + if (thread.Open(iThreadId) == KErrNone) { thread.Terminate(0); thread.Close(); } diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp index c992c97316..d8cd5b5091 100644 --- a/backends/platform/symbian/src/SymbianOS.cpp +++ b/backends/platform/symbian/src/SymbianOS.cpp @@ -351,7 +351,7 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Common::Event &event) { case GUI::ACTION_MULTI: { GUI::Key &key = GUI::Actions::Instance()->getKeyAction(loop); // if key code is pause, then change event to interactive or just fall through - if(key.keycode() == SDLK_PAUSE) { + if (key.keycode() == SDLK_PAUSE) { event.type = Common::EVENT_PREDICTIVE_DIALOG; return true; } @@ -371,7 +371,7 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Common::Event &event) { // Translate from SDL keymod event to Scummvm Key Mod Common::Event. // This codes is also present in GP32 backend and in SDL backend as a static function // Perhaps it should be shared. - if(key.flags() != 0) { + if (key.flags() != 0) { event.kbd.flags = 0; if (ev.key.keysym.mod & KMOD_SHIFT) diff --git a/backends/platform/wince/missing/missing.cpp b/backends/platform/wince/missing/missing.cpp index 8c7240ce29..b00c98db59 100644 --- a/backends/platform/wince/missing/missing.cpp +++ b/backends/platform/wince/missing/missing.cpp @@ -57,12 +57,12 @@ int stat(const char *fname, struct stat *ss) HANDLE handle; int len; - if(fname == NULL || ss == NULL) + if (fname == NULL || ss == NULL) return -1; /* Special case (dummy on WinCE) */ len = strlen(fname); - if(len >= 2 && fname[len-1] == '.' && fname[len-2] == '.' && + if (len >= 2 && fname[len-1] == '.' && fname[len-2] == '.' && (len == 2 || fname[len-3] == '\\')) { /* That's everything implemented so far */ @@ -74,14 +74,14 @@ int stat(const char *fname, struct stat *ss) MultiByteToWideChar(CP_ACP, 0, fname, -1, fnameUnc, MAX_PATH); handle = FindFirstFile(fnameUnc, &wfd); - if(handle == INVALID_HANDLE_VALUE) + if (handle == INVALID_HANDLE_VALUE) return -1; else { /* That's everything implemented so far */ memset(ss, 0, sizeof(struct stat)); ss->st_size = wfd.nFileSizeLow; - if(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ss->st_mode |= S_IFDIR; FindClose(handle); @@ -98,7 +98,7 @@ EXT_C time_t time(time_t* res) t = (time_t)(((((((st.wYear-1970)*12+st.wMonth)*31+st.wDay)*7+st.wDayOfWeek)*24+st.wHour)*60+st.wMinute)*60+st.wSecond); - if(res) + if (res) *res = t; return t; } @@ -131,18 +131,18 @@ EXT_C char *getcwd(char *buffer, int maxlen) TCHAR fileUnc[MAX_PATH+1]; char* plast; - if(cwd[0] == 0) + if (cwd[0] == 0) { GetModuleFileName(NULL, fileUnc, MAX_PATH); WideCharToMultiByte(CP_ACP, 0, fileUnc, -1, cwd, MAX_PATH, NULL, NULL); plast = strrchr(cwd, '\\'); - if(plast) + if (plast) *plast = 0; /* Special trick to keep start menu clean... */ - if(_stricmp(cwd, "\\windows\\start menu") == 0) + if (_stricmp(cwd, "\\windows\\start menu") == 0) strcpy(cwd, "\\Apps"); } - if(buffer) + if (buffer) strncpy(buffer, cwd, maxlen); return cwd; } @@ -165,9 +165,9 @@ EXT_C FILE *wce_fopen(const char* fname, const char* fmode) { char fullname[MAX_PATH+1]; - if(!fname || fname[0] == '\0') + if (!fname || fname[0] == '\0') return NULL; - if(fname[0] != '\\' && fname[0] != '/') + if (fname[0] != '\\' && fname[0] != '/') { getcwd(fullname, MAX_PATH); strncat(fullname, "\\", MAX_PATH-strlen(fullname)-1); @@ -190,11 +190,11 @@ DIR* opendir(const char* fname) TCHAR fnameUnc[MAX_PATH+1]; char nameFound[MAX_PATH+1]; - if(fname == NULL) + if (fname == NULL) return NULL; strcpy(fnameMask, fname); - if(!strlen(fnameMask) || fnameMask[strlen(fnameMask)-1] != '\\') + if (!strlen(fnameMask) || fnameMask[strlen(fnameMask)-1] != '\\') strncat(fnameMask, "\\", MAX_PATH-strlen(fnameMask)-1); strncat(fnameMask, "*.*", MAX_PATH-strlen(fnameMask)-4); @@ -209,7 +209,7 @@ DIR* opendir(const char* fname) strcpy(pdir->dd_name, fname); /* it has exactly enough space for fname and nul char */ MultiByteToWideChar(CP_ACP, 0, fnameMask, -1, fnameUnc, MAX_PATH); - if((pdir->dd_handle = (long)FindFirstFile(fnameUnc, &wfd)) == (long)INVALID_HANDLE_VALUE) + if ((pdir->dd_handle = (long)FindFirstFile(fnameUnc, &wfd)) == (long)INVALID_HANDLE_VALUE) { free(pdir); return NULL; @@ -229,35 +229,35 @@ struct dirent* readdir(DIR* dir) char nameFound[MAX_PATH+1]; static struct dirent dummy; - if(dir->dd_stat == 0) + if (dir->dd_stat == 0) { dummy.d_name = "."; dummy.d_namlen = 1; dir->dd_stat ++; return &dummy; } - else if(dir->dd_stat == 1) + else if (dir->dd_stat == 1) { dummy.d_name = ".."; dummy.d_namlen = 2; dir->dd_stat ++; return &dummy; } - else if(dir->dd_stat == 2) + else if (dir->dd_stat == 2) { dir->dd_stat++; return &dir->dd_dir; } else { - if(FindNextFile((HANDLE)dir->dd_handle, &wfd) == 0) + if (FindNextFile((HANDLE)dir->dd_handle, &wfd) == 0) { dir->dd_stat = -1; return NULL; } WideCharToMultiByte(CP_ACP, 0, wfd.cFileName, -1, nameFound, MAX_PATH, NULL, NULL); - if(dir->dd_dir.d_name) + if (dir->dd_dir.d_name) free(dir->dd_dir.d_name); dir->dd_dir.d_name = strdup(nameFound); @@ -271,13 +271,13 @@ struct dirent* readdir(DIR* dir) int closedir(DIR* dir) { - if(dir == NULL) + if (dir == NULL) return 0; - if(dir->dd_handle) + if (dir->dd_handle) FindClose((HANDLE)dir->dd_handle); - if(dir->dd_dir.d_name) + if (dir->dd_dir.d_name) free(dir->dd_dir.d_name); free(dir); return 1; @@ -304,12 +304,12 @@ void mkdir(char* dirname, int mode) TCHAR pathUnc[MAX_PATH+1]; char* ptr; strncpy(path, dirname, MAX_PATH); - if(*path == '/') + if (*path == '/') *path = '\\'; /* Run through the string and attempt creating all subdirs on the path */ - for(ptr = path+1; *ptr; ptr ++) + for (ptr = path+1; *ptr; ptr ++) { - if(*ptr == '\\' || *ptr == '/') + if (*ptr == '\\' || *ptr == '/') { *ptr = 0; MultiByteToWideChar(CP_ACP, 0, path, -1, pathUnc, MAX_PATH); @@ -333,7 +333,7 @@ char *tmpnam(char *string) GetTempFileName(TEXT("."), TEXT("A8_"), 0, pTemp); WideCharToMultiByte(CP_ACP, 0, pTemp, -1, buffer, MAX_PATH, NULL, NULL); - if(string) + if (string) { strcpy(string, buffer); return string; @@ -345,7 +345,7 @@ char *tmpnam(char *string) FILE *tmpfile() { TCHAR pTemp[MAX_PATH+1]; - if(!GetTempFileName(TEXT("."), TEXT("A8_"), 0, pTemp)) + if (!GetTempFileName(TEXT("."), TEXT("A8_"), 0, pTemp)) return _wfopen(pTemp, TEXT("w+b")); else return 0; @@ -374,7 +374,7 @@ char *strdup(const char *strSource) { char* buffer; buffer = (char*)malloc(strlen(strSource)+1); - if(buffer) + if (buffer) strcpy(buffer, strSource); return buffer; } @@ -390,7 +390,7 @@ void gettimeofday(struct timeval* tp, void* dummy) void usleep(long usec) { long msec = usec/1000; - if(msec <= 0) + if (msec <= 0) Sleep(0); else Sleep(msec); @@ -417,7 +417,7 @@ at least allows some projects to work. char* getenv(char* name) { static char buffer[MAX_PATH+1]; - if(strcmp(name, "HOME") == 0 || strcmp(name, "HOMEDIR") == 0) + if (strcmp(name, "HOME") == 0 || strcmp(name, "HOMEDIR") == 0) { getcwd(buffer, MAX_PATH); return buffer; diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index 3487b1a649..c19ac3d898 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -172,7 +172,7 @@ int SDL_main(int argc, char **argv) { extern void (*__CTOR_LIST__)() ; void (**constructor)() = &__CTOR_LIST__ ; constructor++ ; - while(*constructor) { + while (*constructor) { (*constructor)() ; constructor++ ; } @@ -2141,7 +2141,7 @@ bool OSystem_WINCE3::pollEvent(Common::Event &event) { currentTime = GetTickCount(); - while(SDL_PollEvent(&ev)) { + while (SDL_PollEvent(&ev)) { switch(ev.type) { case SDL_KEYDOWN: debug(1, "Key down %X %s", ev.key.keysym.sym, SDL_GetKeyName((SDLKey)ev.key.keysym.sym)); diff --git a/backends/saves/compressed/compressed-saves.cpp b/backends/saves/compressed/compressed-saves.cpp index 03fc28cafe..dae2c707ef 100644 --- a/backends/saves/compressed/compressed-saves.cpp +++ b/backends/saves/compressed/compressed-saves.cpp @@ -69,7 +69,7 @@ public: assert(header == 0x1F8B || ((header & 0x0F00) == 0x0800 && header % 31 == 0)); - if(header == 0x1F8B) { + if (header == 0x1F8B) { // Retrieve the original file size w->seek(-4, SEEK_END); _origSize = w->readUint32LE(); -- cgit v1.2.3