First commit. Added header configs for DS as well as a Makefile. Initial work on framebuffer video driver, currently not functioning as desired. gsoc2008_nds
authorDarren Alton <dalton@stevens.edu>
Tue, 10 Jun 2008 06:45:39 +0000
branchgsoc2008_nds
changeset 2669 e27bdcc80744
parent 2668 bb3241de289e
child 2670 6e4669f4db49
First commit. Added header configs for DS as well as a Makefile. Initial work on framebuffer video driver, currently not functioning as desired.
include/SDL_config.h.default
include/SDL_platform.h
include/SDL_stdinc.h
src/audio/SDL_wave.c
src/audio/bsd/SDL_bsdaudio.c
src/audio/dma/SDL_dmaaudio.c
src/audio/esd/SDL_esdaudio.c
src/audio/nto/SDL_nto_audio.c
src/audio/paudio/SDL_paudio.c
src/audio/ums/SDL_umsaudio.c
src/audio/windib/SDL_dibaudio.c
src/cdrom/aix/SDL_syscdrom.c
src/cdrom/beos/SDL_syscdrom.cc
src/cdrom/bsdi/SDL_syscdrom.c
src/cdrom/freebsd/SDL_syscdrom.c
src/cdrom/linux/SDL_syscdrom.c
src/cdrom/macosx/AudioFilePlayer.c
src/cdrom/macosx/CDPlayer.c
src/cdrom/openbsd/SDL_syscdrom.c
src/cdrom/osf/SDL_syscdrom.c
src/cdrom/qnx/SDL_syscdrom.c
src/main/beos/SDL_BeApp.cc
src/thread/SDL_thread_c.h
src/thread/irix/SDL_syssem.c
src/thread/pthread/SDL_syssem.c
src/thread/riscos/SDL_syssem.c
src/timer/riscos/SDL_systimer.c
src/timer/unix/SDL_systimer.c
src/video/SDL_RLEaccel.c
src/video/SDL_sysvideo.h
src/video/SDL_video.c
src/video/fbcon/SDL_fbelo.c
src/video/fbcon/SDL_fbevents.c
src/video/fbcon/SDL_fbvideo.c
src/video/ipod/SDL_ipodvideo.c
src/video/photon/SDL_phyuv.c
src/video/ps2gs/SDL_gsevents.c
src/video/svga/SDL_svgaevents.c
src/video/vgl/SDL_vglevents.c
src/video/wscons/SDL_wsconsevents.c
test/testblitspeed.c
test/testdyngl.c
test/testpalette.c
--- a/include/SDL_config.h.default	Wed Apr 23 06:27:10 2008 +0000
+++ b/include/SDL_config.h.default	Tue Jun 10 06:45:39 2008 +0000
@@ -26,7 +26,9 @@
 #include "SDL_platform.h"
 
 /* Add any platform that doesn't build using the configure system */
-#if defined(__DREAMCAST__)
+#if defined(__NINTENDODS__)
+#include "SDL_config_nintendods.h"
+#elif defined(__DREAMCAST__)
 #include "SDL_config_dreamcast.h"
 #elif defined(__MACOSX__)
 #include "SDL_config_macosx.h"
--- a/include/SDL_platform.h	Wed Apr 23 06:27:10 2008 +0000
+++ b/include/SDL_platform.h	Tue Jun 10 06:45:39 2008 +0000
@@ -97,4 +97,9 @@
 #define __WIN32__	1
 #endif
 
+#if defined(__NDS__)
+#undef __NINTENDODS__
+#define __NINTENDODS__	1
+#endif
+
 #endif /* _SDL_platform_h */
--- a/include/SDL_stdinc.h	Wed Apr 23 06:27:10 2008 +0000
+++ b/include/SDL_stdinc.h	Tue Jun 10 06:45:39 2008 +0000
@@ -147,8 +147,12 @@
 SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
 SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
 SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
+#ifndef __NINTENDODS__ /* TODO: figure out why the following happens:
+include/SDL_stdinc.h:150: error: size of array 'SDL_dummy_uint64' is negative
+include/SDL_stdinc.h:151: error: size of array 'SDL_dummy_sint64' is negative */
 SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
 SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
+#endif
 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
 
 /* Check to make sure enums are the size of ints, for structure packing.
@@ -162,12 +166,14 @@
 #endif
 
 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
+#ifndef __NINTENDODS__  /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
 typedef enum
 {
     DUMMY_ENUM_VALUE
 } SDL_DUMMY_ENUM;
 
 SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
+#endif
 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
 
 #include "begin_code.h"
@@ -425,6 +431,9 @@
 #ifdef HAVE_WCSLEN
 #define SDL_wcslen      wcslen
 #else
+#if !defined(wchar_t) && defined(__NINTENDODS__)
+#define wchar_t short /* TODO: figure out why libnds doesn't have this */
+#endif
 extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t * string);
 #endif
 
--- a/src/audio/SDL_wave.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/audio/SDL_wave.c	Tue Jun 10 06:45:39 2008 +0000
@@ -462,8 +462,7 @@
         }
         /* 2 Uint32's for chunk header+len, plus the lenread */
         headerDiff += lenread + 2 * sizeof(Uint32);
-    }
-    while ((chunk.magic == FACT) || (chunk.magic == LIST));
+    } while ((chunk.magic == FACT) || (chunk.magic == LIST));
 
     /* Decode the audio data format */
     format = (WaveFMT *) chunk.data;
@@ -564,8 +563,7 @@
         *audio_buf = chunk.data;
         if (chunk.magic != DATA)
             headerDiff += lenread + 2 * sizeof(Uint32);
-    }
-    while (chunk.magic != DATA);
+    } while (chunk.magic != DATA);
     headerDiff += 2 * sizeof(Uint32);   /* for the data chunk and len */
 
     if (MS_ADPCM_encoded) {
--- a/src/audio/bsd/SDL_bsdaudio.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/audio/bsd/SDL_bsdaudio.c	Tue Jun 10 06:45:39 2008 +0000
@@ -270,8 +270,7 @@
             || ((written < 0) && ((errno == 0) || (errno == EAGAIN)))) {
             SDL_Delay(1);       /* Let a little CPU time go by */
         }
-    }
-    while (p < written);
+    } while (p < written);
 
     /* If timer synchronization is enabled, set the next write frame */
     if (this->hidden->frame_ticks) {
--- a/src/audio/dma/SDL_dmaaudio.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/audio/dma/SDL_dmaaudio.c	Tue Jun 10 06:45:39 2008 +0000
@@ -498,8 +498,7 @@
             this->enabled = 0;
             return (NULL);
         }
-    }
-    while (frame_ticks && (info.blocks < 1));
+    } while (frame_ticks && (info.blocks < 1));
 #ifdef DEBUG_AUDIO
     if (info.blocks > 1) {
         printf("Warning: audio underflow (%d frags)\n", info.blocks - 1);
--- a/src/audio/esd/SDL_esdaudio.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/audio/esd/SDL_esdaudio.c	Tue Jun 10 06:45:39 2008 +0000
@@ -154,9 +154,8 @@
         if ((written < 0) && ((errno == 0) || (errno == EAGAIN))) {
             SDL_Delay(1);       /* Let a little CPU time go by */
         }
-    }
-    while ((written < 0) &&
-           ((errno == 0) || (errno == EAGAIN) || (errno == EINTR)));
+    } while ((written < 0) &&
+             ((errno == 0) || (errno == EAGAIN) || (errno == EINTR)));
 
     /* Set the next write frame */
     this->hidden->next_frame += this->hidden->frame_ticks;
--- a/src/audio/nto/SDL_nto_audio.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/audio/nto/SDL_nto_audio.c	Tue Jun 10 06:45:39 2008 +0000
@@ -154,8 +154,7 @@
             }
             break;
         }
-    }
-    while (1);
+    } while (1);
 }
 
 static void
@@ -213,8 +212,7 @@
             towrite -= written;
             pcmbuffer += written * this->spec.channels;
         }
-    }
-    while ((towrite > 0) && (this->enabled));
+    } while ((towrite > 0) && (this->enabled));
 
     /* If we couldn't write, assume fatal error for now */
     if (towrite != 0) {
--- a/src/audio/paudio/SDL_paudio.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/audio/paudio/SDL_paudio.c	Tue Jun 10 06:45:39 2008 +0000
@@ -208,9 +208,8 @@
         if ((written < 0) && ((errno == 0) || (errno == EAGAIN))) {
             SDL_Delay(1);       /* Let a little CPU time go by */
         }
-    }
-    while ((written < 0) &&
-           ((errno == 0) || (errno == EAGAIN) || (errno == EINTR)));
+    } while ((written < 0) &&
+             ((errno == 0) || (errno == EAGAIN) || (errno == EINTR)));
 
     /* If timer synchronization is enabled, set the next write frame */
     if (this->hidden->frame_ticks) {
--- a/src/audio/ums/SDL_umsaudio.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/audio/ums/SDL_umsaudio.c	Tue Jun 10 06:45:39 2008 +0000
@@ -218,8 +218,7 @@
 #endif
             return;
         }
-    }
-    while (samplesToWrite > 0);
+    } while (samplesToWrite > 0);
 
     SDL_LockAudio();
     SDL_memcpy(&swpbuf, &this->hidden->playbuf, sizeof(UMSAudioTypes_Buffer));
@@ -326,8 +325,7 @@
         if (!success) {
             test_format = SDL_NextAudioFormat();
         }
-    }
-    while (!success && test_format);
+    } while (!success && test_format);
 
     if (success == 0) {
         SDL_SetError("Couldn't find any hardware audio formats");
--- a/src/audio/windib/SDL_dibaudio.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/audio/windib/SDL_dibaudio.c	Tue Jun 10 06:45:39 2008 +0000
@@ -136,8 +136,7 @@
         if (left > 0) {
             SDL_Delay(100);
         }
-    }
-    while (left > 0);
+    } while (left > 0);
 }
 
 void
--- a/src/cdrom/aix/SDL_syscdrom.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/cdrom/aix/SDL_syscdrom.c	Tue Jun 10 06:45:39 2008 +0000
@@ -181,8 +181,7 @@
 #endif
             return;
         }
-    }
-    while (ret == 0);
+    } while (ret == 0);
 
 #ifdef DEBUG_CDROM
     fprintf(stderr, "Read %d vmount structures\n", ret);
@@ -211,8 +210,7 @@
         }
         ptr = (struct vmount *) ((char *) ptr + ptr->vmt_length);
         ret--;
-    }
-    while (ret > 0);
+    } while (ret > 0);
 
     free(buffer);
 }
@@ -247,8 +245,7 @@
                 }
             }
         }
-    }
-    while (ret == 0);
+    } while (ret == 0);
     ret = endfsent_r(&fsFile);
     if (ret != 0)
         return -1;
@@ -275,8 +272,7 @@
                 }
             }
         }
-    }
-    while (entry != NULL);
+    } while (entry != NULL);
     endfsent();
 #endif
 }
@@ -326,8 +322,7 @@
                 } else {
                     SDLcdrom = NULL;
                 }
-            }
-            while (SDLcdrom);
+            } while (SDLcdrom);
             SDL_stack_free(cdpath);
         }
 
--- a/src/cdrom/beos/SDL_syscdrom.cc	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/cdrom/beos/SDL_syscdrom.cc	Tue Jun 10 06:45:39 2008 +0000
@@ -193,8 +193,7 @@
                 } else {
                     SDLcdrom = NULL;
                 }
-            }
-            while (SDLcdrom);
+            } while (SDLcdrom);
             SDL_stack_free(cdpath);
         }
 
--- a/src/cdrom/bsdi/SDL_syscdrom.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/cdrom/bsdi/SDL_syscdrom.c	Tue Jun 10 06:45:39 2008 +0000
@@ -286,8 +286,7 @@
                 } else {
                     SDLcdrom = NULL;
                 }
-            }
-            while (SDLcdrom);
+            } while (SDLcdrom);
             SDL_stack_free(cdpath);
         }
 
--- a/src/cdrom/freebsd/SDL_syscdrom.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/cdrom/freebsd/SDL_syscdrom.c	Tue Jun 10 06:45:39 2008 +0000
@@ -176,8 +176,7 @@
                 } else {
                     SDLcdrom = NULL;
                 }
-            }
-            while (SDLcdrom);
+            } while (SDLcdrom);
             SDL_stack_free(cdpath);
         }
 
--- a/src/cdrom/linux/SDL_syscdrom.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/cdrom/linux/SDL_syscdrom.c	Tue Jun 10 06:45:39 2008 +0000
@@ -312,8 +312,7 @@
                 } else {
                     SDLcdrom = NULL;
                 }
-            }
-            while (SDLcdrom);
+            } while (SDLcdrom);
             SDL_stack_free(cdpath);
         }
 
--- a/src/cdrom/macosx/AudioFilePlayer.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/cdrom/macosx/AudioFilePlayer.c	Tue Jun 10 06:45:39 2008 +0000
@@ -311,8 +311,7 @@
 
         /* Skip the chunk data */
         offset = chunk.ckSize;
-    }
-    while (chunk.ckID != 'SSND');
+    } while (chunk.ckID != 'SSND');
 
     /* Read the header of the SSND chunk. After this, we are positioned right
        at the start of the audio data. */
--- a/src/cdrom/macosx/CDPlayer.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/cdrom/macosx/CDPlayer.c	Tue Jun 10 06:45:39 2008 +0000
@@ -400,8 +400,7 @@
                 }
                 CFRelease(name);
             }
-        }
-        while (noErr == result);
+        } while (noErr == result);
         FSCloseIterator(iterator);
     }
 
--- a/src/cdrom/openbsd/SDL_syscdrom.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/cdrom/openbsd/SDL_syscdrom.c	Tue Jun 10 06:45:39 2008 +0000
@@ -184,8 +184,7 @@
                 } else {
                     SDLcdrom = NULL;
                 }
-            }
-            while (SDLcdrom);
+            } while (SDLcdrom);
             SDL_stack_free(cdpath);
         }
 
--- a/src/cdrom/osf/SDL_syscdrom.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/cdrom/osf/SDL_syscdrom.c	Tue Jun 10 06:45:39 2008 +0000
@@ -199,8 +199,7 @@
                 } else {
                     SDLcdrom = NULL;
                 }
-            }
-            while (SDLcdrom);
+            } while (SDLcdrom);
             SDL_stack_free(cdpath);
         }
 
--- a/src/cdrom/qnx/SDL_syscdrom.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/cdrom/qnx/SDL_syscdrom.c	Tue Jun 10 06:45:39 2008 +0000
@@ -184,8 +184,7 @@
                 } else {
                     SDLcdrom = NULL;
                 }
-            }
-            while (SDLcdrom);
+            } while (SDLcdrom);
             SDL_stack_free(cdpath);
         }
 
@@ -357,8 +356,7 @@
             devctlret = ENXIO;
             break;
         }
-    }
-    while ((devctlret == EAGAIN) || (devctlret == ESTALE));
+    } while ((devctlret == EAGAIN) || (devctlret == ESTALE));
 
     if (devctlret != 0) {
         if (devctlret == ENXIO) {
--- a/src/main/beos/SDL_BeApp.cc	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/main/beos/SDL_BeApp.cc	Tue Jun 10 06:45:39 2008 +0000
@@ -78,8 +78,7 @@
 
         do {
             SDL_Delay(10);
-        }
-        while ((be_app == NULL) || be_app->IsLaunching());
+        } while ((be_app == NULL) || be_app->IsLaunching());
 
         /* Mark the application active */
         SDL_BeAppActive = 0;
--- a/src/thread/SDL_thread_c.h	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/thread/SDL_thread_c.h	Tue Jun 10 06:45:39 2008 +0000
@@ -43,6 +43,8 @@
 #include "irix/SDL_systhread_c.h"
 #elif SDL_THREAD_WIN32
 #include "win32/SDL_systhread_c.h"
+#elif SDL_THREAD_NDS
+#include "nds/SDL_systhread_c.h"
 #else
 #error Need thread implementation for this platform
 #include "generic/SDL_systhread_c.h"
--- a/src/thread/irix/SDL_syssem.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/thread/irix/SDL_syssem.c	Tue Jun 10 06:45:39 2008 +0000
@@ -170,8 +170,7 @@
             break;
         }
         SDL_Delay(1);
-    }
-    while (SDL_GetTicks() < timeout);
+    } while (SDL_GetTicks() < timeout);
 
     return retval;
 }
--- a/src/thread/pthread/SDL_syssem.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/thread/pthread/SDL_syssem.c	Tue Jun 10 06:45:39 2008 +0000
@@ -125,8 +125,7 @@
             break;
         }
         SDL_Delay(1);
-    }
-    while (SDL_GetTicks() < timeout);
+    } while (SDL_GetTicks() < timeout);
 
     return retval;
 }
--- a/src/thread/riscos/SDL_syssem.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/thread/riscos/SDL_syssem.c	Tue Jun 10 06:45:39 2008 +0000
@@ -177,8 +177,7 @@
             break;
         }
         SDL_Delay(1);
-    }
-    while (SDL_GetTicks() < timeout);
+    } while (SDL_GetTicks() < timeout);
 
     return retval;
 }
--- a/src/timer/riscos/SDL_systimer.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/timer/riscos/SDL_systimer.c	Tue Jun 10 06:45:39 2008 +0000
@@ -130,8 +130,7 @@
             pthread_yield();
 #endif
 
-    }
-    while (1);
+    } while (1);
 }
 
 #if SDL_THREADS_DISABLED
--- a/src/timer/unix/SDL_systimer.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/timer/unix/SDL_systimer.c	Tue Jun 10 06:45:39 2008 +0000
@@ -137,8 +137,7 @@
 
         was_error = select(0, NULL, NULL, NULL, &tv);
 #endif /* HAVE_NANOSLEEP */
-    }
-    while (was_error && (errno == EINTR));
+    } while (was_error && (errno == EINTR));
 #endif /* SDL_THREAD_PTH */
 }
 
--- a/src/video/SDL_RLEaccel.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/video/SDL_RLEaccel.c	Tue Jun 10 06:45:39 2008 +0000
@@ -1154,8 +1154,7 @@
                             ofs += run;
                         } else if (!ofs)
                             goto done;
-                    }
-                    while (ofs < w);
+                    } while (ofs < w);
 
                     /* skip padding */
                     srcbuf += (uintptr_t) srcbuf & 2;
@@ -1168,10 +1167,8 @@
                         run = ((Uint16 *) srcbuf)[1];
                         srcbuf += 4 * (run + 1);
                         ofs += run;
-                    }
-                    while (ofs < w);
-                }
-                while (--vskip);
+                    } while (ofs < w);
+                } while (--vskip);
             } else {
                 /* the 32/32 interleaved format */
                 vskip <<= 1;    /* opaque and translucent have same format */
@@ -1187,10 +1184,8 @@
                             ofs += run;
                         } else if (!ofs)
                             goto done;
-                    }
-                    while (ofs < w);
-                }
-                while (--vskip);
+                    } while (ofs < w);
+                } while (--vskip);
             }
         }
     }
@@ -1567,8 +1562,7 @@
                     runstart += len;
                     run -= len;
                 }
-            }
-            while (x < w);
+            } while (x < w);
 
             /* Make sure the next output address is 32-bit aligned */
             dst += (uintptr_t) dst & 2;
@@ -1604,8 +1598,7 @@
                 }
                 if (!blankline)
                     lastline = dst;
-            }
-            while (x < w);
+            } while (x < w);
 
             src += surface->pitch >> 2;
         }
@@ -1771,8 +1764,7 @@
             }
             if (!blankline)
                 lastline = dst;
-        }
-        while (x < w);
+        } while (x < w);
 
         srcbuf += surface->pitch;
     }
@@ -1911,8 +1903,7 @@
                 ofs += run;
             } else if (!ofs)
                 return (SDL_TRUE);
-        }
-        while (ofs < w);
+        } while (ofs < w);
 
         /* skip padding if needed */
         if (bpp == 2)
@@ -1929,8 +1920,7 @@
                 srcbuf += uncopy_transl(dst + ofs, srcbuf, run, df, sf);
                 ofs += run;
             }
-        }
-        while (ofs < w);
+        } while (ofs < w);
         dst += surface->pitch >> 2;
     }
     /* Make the compiler happy */
--- a/src/video/SDL_sysvideo.h	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/video/SDL_sysvideo.h	Tue Jun 10 06:45:39 2008 +0000
@@ -370,6 +370,9 @@
 #if SDL_VIDEO_DRIVER_DUMMY
 extern VideoBootStrap DUMMY_bootstrap;
 #endif
+#if SDL_VIDEO_DRIVER_NDS
+extern VideoBootStrap NDS_bootstrap;
+#endif
 
 #define SDL_CurrentDisplay	(_this->displays[_this->current_display])
 
--- a/src/video/SDL_video.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/video/SDL_video.c	Tue Jun 10 06:45:39 2008 +0000
@@ -103,6 +103,9 @@
 #if SDL_VIDEO_DRIVER_OS2FS
     &OS2FSLib_bootstrap,
 #endif
+#if SDL_VIDEO_DRIVER_NDS
+    &NDS_bootstrap,
+#endif
 #if SDL_VIDEO_DRIVER_DUMMY
     &DUMMY_bootstrap,
 #endif
--- a/src/video/fbcon/SDL_fbelo.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/video/fbcon/SDL_fbelo.c	Tue Jun 10 06:45:39 2008 +0000
@@ -268,8 +268,7 @@
         if (result == 0) {
             i--;
         }
-    }
-    while (!ok && (i > 0));
+    } while (!ok && (i > 0));
 
     return ok;
 }
--- a/src/video/fbcon/SDL_fbevents.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/video/fbcon/SDL_fbevents.c	Tue Jun 10 06:45:39 2008 +0000
@@ -545,9 +545,8 @@
                 if (select(fd + 1, &fdset, 0, 0, &tv) < 1) {
                     break;
                 }
-            }
-            while ((read(fd, &ch, sizeof(ch)) == sizeof(ch)) &&
-                   ((ch == 0xFA) || (ch == 0xAA)));
+            } while ((read(fd, &ch, sizeof(ch)) == sizeof(ch)) &&
+                     ((ch == 0xFA) || (ch == 0xAA)));
 
             /* Experimental values (Logitech wheelmouse) */
 #ifdef DEBUG_MOUSE
@@ -1113,8 +1112,7 @@
                 }
             }
         }
-    }
-    while (posted);
+    } while (posted);
 }
 
 void
--- a/src/video/fbcon/SDL_fbvideo.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/video/fbcon/SDL_fbvideo.c	Tue Jun 10 06:45:39 2008 +0000
@@ -323,15 +323,13 @@
             blank = 1;
         else
             blank = 0;
-    }
-    while (blank);
+    } while (blank);
     /* remove whitespace at the begining of the string */
     i = 0;
     do {
         line[i] = c[i];
         i++;
-    }
-    while (c[i] != 0);
+    } while (c[i] != 0);
     return 1;
 }
 
@@ -347,8 +345,7 @@
             return 0;
         if (SDL_strncmp(line, "geometry", 8) == 0)
             break;
-    }
-    while (1);
+    } while (1);
 
     SDL_sscanf(line, "geometry %d %d %d %d %d", &vinfo->xres, &vinfo->yres,
                &vinfo->xres_virtual, &vinfo->yres_virtual,
@@ -394,8 +391,7 @@
             if (SDL_strncmp(option, "true", 4) == 0)
                 vinfo->vmode |= FB_VMODE_DOUBLE;
         }
-    }
-    while (SDL_strncmp(line, "endmode", 7) != 0);
+    } while (SDL_strncmp(line, "endmode", 7) != 0);
 
     return 1;
 }
--- a/src/video/ipod/SDL_ipodvideo.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/video/ipod/SDL_ipodvideo.c	Tue Jun 10 06:45:39 2008 +0000
@@ -526,8 +526,7 @@
         }
         if (dbgout)
             fprintf(dbgout, "\n");
-    }
-    while (posted);
+    } while (posted);
 }
 
 // enough space for 160x128x2
@@ -570,8 +569,7 @@
         do {
             if ((inl(lcd_base) & (unsigned int) 0x8000) == 0)
                 break;
-        }
-        while (M_timer_check(start, 1000) == 0);
+        } while (M_timer_check(start, 1000) == 0);
     }
 }
 
@@ -681,8 +679,7 @@
         do {
             if ((inl(0x70008A0C) & 0x80000000) == 0)
                 break;
-        }
-        while (C_timer_check(start, 1000) == 0);
+        } while (C_timer_check(start, 1000) == 0);
     }
 }
 static void
--- a/src/video/photon/SDL_phyuv.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/video/photon/SDL_phyuv.c	Tue Jun 10 06:45:39 2008 +0000
@@ -161,8 +161,7 @@
             break;
         }
         i++;
-    }
-    while (1);
+    } while (1);
 
 
     if (vidport == -1) {
--- a/src/video/ps2gs/SDL_gsevents.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/video/ps2gs/SDL_gsevents.c	Tue Jun 10 06:45:39 2008 +0000
@@ -479,9 +479,8 @@
                 if (select(fd + 1, &fdset, 0, 0, &tv) < 1) {
                     break;
                 }
-            }
-            while ((read(fd, &ch, sizeof(ch)) == sizeof(ch)) &&
-                   ((ch == 0xFA) || (ch == 0xAA)));
+            } while ((read(fd, &ch, sizeof(ch)) == sizeof(ch)) &&
+                     ((ch == 0xFA) || (ch == 0xAA)));
 
             /* Experimental values (Logitech wheelmouse) */
 #ifdef DEBUG_MOUSE
@@ -833,8 +832,7 @@
                 }
             }
         }
-    }
-    while (posted);
+    } while (posted);
 }
 
 void
--- a/src/video/svga/SDL_svgaevents.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/video/svga/SDL_svgaevents.c	Tue Jun 10 06:45:39 2008 +0000
@@ -207,8 +207,7 @@
         posted = 0;
         mouse_update();
         keyboard_update();
-    }
-    while (posted);
+    } while (posted);
 }
 
 void
--- a/src/video/vgl/SDL_vglevents.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/video/vgl/SDL_vglevents.c	Tue Jun 10 06:45:39 2008 +0000
@@ -141,8 +141,7 @@
         posted = 0;
         handle_keyboard(this);
         handle_mouse(this);
-    }
-    while (posted != 0);
+    } while (posted != 0);
 }
 
 void
--- a/src/video/wscons/SDL_wsconsevents.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/src/video/wscons/SDL_wsconsevents.c	Tue Jun 10 06:45:39 2008 +0000
@@ -145,8 +145,7 @@
         posted = 0;
         updateMouse();
         updateKeyboard(this);
-    }
-    while (posted);
+    } while (posted);
 }
 
 void
--- a/test/testblitspeed.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/test/testblitspeed.c	Tue Jun 10 06:45:39 2008 +0000
@@ -397,8 +397,7 @@
         }
 
         now = SDL_GetTicks();
-    }
-    while (now < end);
+    } while (now < end);
 
     printf("Non-blitting crap accounted for %d percent of this run.\n",
            percent(testms - elasped, testms));
--- a/test/testdyngl.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/test/testdyngl.c	Tue Jun 10 06:45:39 2008 +0000
@@ -185,8 +185,7 @@
         }
 
         SDL_Delay(20);
-    }
-    while (!done);
+    } while (!done);
 
     SDL_Quit();
     return 0;
--- a/test/testpalette.c	Wed Apr 23 06:27:10 2008 +0000
+++ b/test/testpalette.c	Tue Jun 10 06:45:39 2008 +0000
@@ -338,8 +338,7 @@
         /* update changed areas of the screen */
         SDL_UpdateRects(screen, NBOATS, updates);
         frames++;
-    }
-    while (fade_level > 0);
+    } while (fade_level > 0);
 
     printf("%d frames, %.2f fps\n",
            frames, 1000.0 * frames / (SDL_GetTicks() - start));