DEADSOFTWARE

portability: avoid errors on some compilers
[flatwaifu.git] / src / stubsys / main.c
index 75ddd86ab9df9c323397df5feea91f3367a35635..c3e1b40eb9f6f21b7398b3f3c628ecdb6db15af2 100644 (file)
@@ -93,18 +93,30 @@ static const cfg_t cfg[] = {
 };
 
 static void CFG_args (int argc, char **argv) {
-  const cfg_t *list[] = { arg, R_args(), S_args(), MUS_args() };
+  const cfg_t *list[4];
+  list[0] = arg;
+  list[1] = R_args();
+  list[2] = S_args();
+  list[3] = MUS_args();
   ARG_parse(argc, argv, 4, list);
 }
 
 static void CFG_load (void) {
-  const cfg_t *list[] = { cfg, R_conf(), S_conf(), MUS_conf() };
+  const cfg_t *list[4];
+  list[0] = cfg;
+  list[1] = R_conf();
+  list[2] = S_conf();
+  list[3] = MUS_conf();
   CFG_read_config("default.cfg", 4, list);
   CFG_read_config("doom2d.cfg", 4, list);
 }
 
 static void CFG_save (void) {
-  const cfg_t *list[] = { cfg, R_conf(), S_conf(), MUS_conf() };
+  const cfg_t *list[4];
+  list[0] = cfg;
+  list[1] = R_conf();
+  list[2] = S_conf();
+  list[3] = MUS_conf();
   CFG_update_config("doom2d.cfg", "doom2d.cfg", 4, list, "generated by doom2d, do not modify");
 }
 
@@ -160,9 +172,10 @@ int Y_set_videomode_opengl (int w, int h, int fullscreen) {
 }
 
 int Y_set_videomode_software (int w, int h, int fullscreen) {
+  void *buf;
   assert(w > 0);
   assert(h > 0);
-  void *buf = softbuffer ? realloc(softbuffer, w * h) : malloc(w * h);
+  buf = softbuffer ? realloc(softbuffer, w * h) : malloc(w * h);
   if (buf) {
     mode = MODE_SOFTWARE;
     softbuffer = buf;
@@ -214,8 +227,7 @@ void Y_swap_buffers (void) {
 
 void Y_get_buffer (byte **buf, int *w, int *h, int *pitch) {
   assert(mode == MODE_SOFTWARE);
-  // *buf = surf->pixels;
-  *buf = NULL; // fix this
+  *buf = softbuffer;
   *w = width;
   *h = height;
   *pitch = width;
@@ -223,7 +235,7 @@ void Y_get_buffer (byte **buf, int *w, int *h, int *pitch) {
 
 void Y_set_vga_palette (byte *vgapal) {
   int i;
-  byte *p = vgapal;
+  //byte *p = vgapal;
   assert(vgapal != NULL);
   assert(mode == MODE_SOFTWARE);
 }
@@ -251,9 +263,10 @@ static void poll_events (void) {
 }
 
 static void step (void) {
+  clock_t t;
   poll_events();
   MUS_update();
-  clock_t t = clock();
+  t = clock();
   if ((t - ticks) * 1000 / CLOCKS_PER_SEC > DELAY) {
     ticks = t;
     G_act();