From 9906f0187e33f3d2f6980e2128cba19ae2a355fb Mon Sep 17 00:00:00 2001 From: Dagen Brock Date: Fri, 20 Jan 2017 14:19:07 -0600 Subject: [PATCH] remove extra newlines from switch to glogf() --- src/adb.c | 24 ++++++++++-------------- src/clock.c | 4 ++-- src/config.c | 16 ++++++++-------- src/debug.c | 2 +- src/joystick_driver.c | 4 ++-- src/sdl2_driver.c | 4 ++-- src/sdl2snd_driver.c | 23 +++++++++++------------ src/sim65816.c | 9 ++++----- 8 files changed, 40 insertions(+), 46 deletions(-) diff --git a/src/adb.c b/src/adb.c index 74fc3c5..763e2c8 100644 --- a/src/adb.c +++ b/src/adb.c @@ -181,7 +181,7 @@ adb_init() for(i = 0; i < 128; i++) { keycode = a2_key_to_ascii[i][0]; if(keycode != i) { - glogf("ADB keycode lost/skipped: i=%x: keycode=%x\n", i, keycode); + glogf("ADB keycode lost/skipped: i=%x: keycode=%x", i, keycode); my_exit(1); } } @@ -496,12 +496,12 @@ adb_set_config(word32 val0, word32 val1, word32 val2) new_mouse = val0 >> 4; new_kbd = val0 & 0xf; if(new_mouse != g_mouse_ctl_addr) { - glogf("ADB config: mouse from %x to %x!\n", g_mouse_ctl_addr, new_mouse); + glogf("ADB config: mouse from %x to %x!", g_mouse_ctl_addr, new_mouse); adb_error(); g_mouse_ctl_addr = new_mouse; } if(new_kbd != g_kbd_ctl_addr) { - glogf("ADB config: kbd from %x to %x!\n", g_kbd_ctl_addr, new_kbd); + glogf("ADB config: kbd from %x to %x!", g_kbd_ctl_addr, new_kbd); adb_error(); g_kbd_ctl_addr = new_kbd; } @@ -564,7 +564,7 @@ void adb_set_new_mode(word32 val) { if(val & 0x03) { - glogf("Disabling keyboard/mouse:%02x!\n", val); + glogf("Disabling keyboard/mouse:%02x!", val); } if(val & 0xa2) { @@ -1576,8 +1576,7 @@ adb_read_c000() /* got one */ if((g_kbd_read_no_update++ > 5) && (g_kbd_chars_buffered > 1)) { /* read 5 times, keys pending, let's move it along */ - glogf("Read %02x %d times, tossing\n", g_kbd_buf[0], - g_kbd_read_no_update); + glogf("Read %02x %d times, tossing", g_kbd_buf[0], g_kbd_read_no_update); adb_access_c010(); } } else { @@ -1663,7 +1662,7 @@ adb_increment_speed() str = "... 8.0MHz"; break; } - glogf("Setting g_limit_speed = %d %s\n", g_limit_speed, str); + glogf("Setting g_limit_speed = %d %s", g_limit_speed, str); } void @@ -1729,7 +1728,7 @@ adb_physical_key_update(int a2code, int is_up) /* Only process reset requests here */ if(is_up == 0 && a2code == 0x7f && CTRL_DOWN) { /* Reset pressed! */ - glogf("Reset pressed since CTRL_DOWN: %d\n", CTRL_DOWN); + glogf("Reset pressed since CTRL_DOWN: %d", CTRL_DOWN); do_reset(); return; } @@ -1763,8 +1762,7 @@ adb_physical_key_update(int a2code, int is_up) break; case 0x07: /* F7 - fast disk emul */ g_fast_disk_emul = !g_fast_disk_emul; - glogf("g_fast_disk_emul is now %d\n", - g_fast_disk_emul); + glogf("g_fast_disk_emul is now %d", g_fast_disk_emul); break; case 0x08: /* F8 - warp pointer */ g_warp_pointer = !g_warp_pointer; @@ -1776,12 +1774,10 @@ adb_physical_key_update(int a2code, int is_up) case 0x09: /* F9 - swap paddles */ if(SHIFT_DOWN) { g_swap_paddles = !g_swap_paddles; - glogf("Swap paddles is now: %d\n", - g_swap_paddles); + glogf("Swap paddles is now: %d", g_swap_paddles); } else { g_invert_paddles = !g_invert_paddles; - glogf("Invert paddles is now: %d\n", - g_invert_paddles); + glogf("Invert paddles is now: %d", g_invert_paddles); } break; case 0x0a: /* F10 - change a2vid paletter */ diff --git a/src/clock.c b/src/clock.c index e3c3b12..dbd7ed0 100644 --- a/src/clock.c +++ b/src/clock.c @@ -23,6 +23,7 @@ #include "defc.h" #include +#include "glog.h" #ifdef _WIN32 # include # include @@ -115,8 +116,7 @@ micro_sleep(double dtime) Timer.tv_sec = 0; Timer.tv_usec = (dtime * 1000000.0); if( (ret = select(0, 0, 0, 0, &Timer)) < 0) { - fprintf(stderr, "micro_sleep (select) ret: %d, errno: %d\n", - ret, errno); + glogf("micro_sleep (select) ret: %d, errno: %d", ret, errno); return -1; } #endif diff --git a/src/config.c b/src/config.c index 7f901a1..163d713 100644 --- a/src/config.c +++ b/src/config.c @@ -725,7 +725,7 @@ config_parse_option(char *buf, int pos, int len, int line) } // find "name" as first contiguous string - glogf("...parse_option: line %d, len:%d \"%s\"\n", line, len, &buf[pos]); + glogf("...parse_option: line %d, len:%d \"%s\"", line, len, &buf[pos]); // printf("...parse_option: line %d, %p,%p = %s (%s) len:%d\n", line, &buf[pos], buf, &buf[pos], buf, len); @@ -889,7 +889,7 @@ config_load_roms() return; } - glogf("Read: %d bytes of ROM\n", ret); + glogf("Read: %d bytes of ROM", ret); if(ret != len) { fatal_printf("errno: %d\n", errno); g_config_control_panel = 1; @@ -1274,7 +1274,7 @@ config_write_config_gsplus_file() int slot, drive; int i; - glogf("Writing configuration file to %s\n", g_config_gsplus_name); + glogf("Writing configuration file to %s", g_config_gsplus_name); fconf = fopen(g_config_gsplus_name, "w+"); if(fconf == 0) { @@ -1540,7 +1540,7 @@ insert_disk(int slot, int drive, const char *name, int ejected, int force_size, if(buf_2img[0] == '2' && buf_2img[1] == 'I' && buf_2img[2] == 'M' && buf_2img[3] == 'G') { /* It's a 2IMG disk */ - glogf("Image named %s is in 2IMG format\n", dsk->name_ptr); + glogf("Image named %s is in 2IMG format", dsk->name_ptr); image_identified = 1; if(buf_2img[12] == 0) { @@ -1555,7 +1555,7 @@ insert_disk(int slot, int drive, const char *name, int ejected, int force_size, } if((buf_2img[17] & 1) && (dsk->image_type == DSK_TYPE_DOS33)) { dsk->vol_num = buf_2img[16]; - glogf("Setting DOS 3.3 vol num to %d\n", dsk->vol_num); + glogf("Setting DOS 3.3 vol num to %d", dsk->vol_num); } // Some 2IMG archives have the size byte reversed size = (buf_2img[31] << 24) + (buf_2img[30] << 16) + @@ -1579,7 +1579,7 @@ insert_disk(int slot, int drive, const char *name, int ejected, int force_size, (buf_2img[0x42] << 8) + buf_2img[0x43]; if((size >= (exp_size + 0x54)) && (tmp == exp_size)) { /* It's diskcopy since data size field matches */ - glogf("Image named %s is in Mac diskcopy format\n", dsk->name_ptr); + glogf("Image named %s is in Mac diskcopy format", dsk->name_ptr); image_identified = 1; dsk->image_start += 0x54; dsk->image_size = exp_size; @@ -1652,7 +1652,7 @@ insert_disk(int slot, int drive, const char *name, int ejected, int force_size, nibs = len; } if(size != 35*len) { - glogf("Disk 5.25 error: size is %d, not 140K. Will try to mount anyway\n", size, 35*len); + glogf("Disk 5.25 error: size is %d, not 140K. Will try to mount anyway", size, 35*len); } for(i = 0; i < 35; i++) { iwm_move_to_track(dsk, 4*i); @@ -1740,7 +1740,7 @@ eject_disk(Disk *dsk) iwm_flush_disk_to_unix(dsk); - glogf("Ejecting disk: %s\n", dsk->name_ptr); + glogf("Ejecting disk: %s", dsk->name_ptr); /* Free all memory, close file */ diff --git a/src/debug.c b/src/debug.c index f60e062..d2bce73 100644 --- a/src/debug.c +++ b/src/debug.c @@ -757,7 +757,7 @@ void debug_init() { if (g_dbg_enable_port > 0) { // g_dbg_enable_port should be enabled by - glogf("Debug port enabled on: %d\n", g_dbg_enable_port); + glogf("Debug port enabled on: %d", g_dbg_enable_port); debug_setup_socket(); debug_server_poll(); debug_wait_hello(); diff --git a/src/joystick_driver.c b/src/joystick_driver.c index e0d19da..84f2391 100644 --- a/src/joystick_driver.c +++ b/src/joystick_driver.c @@ -266,7 +266,7 @@ joystick_init() { int i; if( SDL_Init( SDL_INIT_JOYSTICK ) < 0 ) { - glogf( "SDL could not initialize joystick! SDL Error: %s\n", SDL_GetError() ); + glogf( "SDL could not initialize joystick! SDL Error: %s", SDL_GetError() ); } else { glog("SDL2 joystick initialized"); } @@ -278,7 +278,7 @@ joystick_init() // @todo: add multiple controller support gGameController = SDL_JoystickOpen( 0 ); if( gGameController == NULL ) { - glogf( "Warning: Unable to open game controller! SDL Error: %s\n", SDL_GetError() ); + glogf( "Warning: Unable to open game controller! SDL Error: %s", SDL_GetError() ); } } g_joystick_native_type = 2; diff --git a/src/sdl2_driver.c b/src/sdl2_driver.c index e85e307..e49b9c8 100644 --- a/src/sdl2_driver.c +++ b/src/sdl2_driver.c @@ -300,7 +300,7 @@ dev_video_init_sdl() // Check that the window was successfully created if (window == NULL) { // In the case that the window could not be made... - glogf("Could not create window: %s\n", SDL_GetError()); + glogf("Could not create window: %s", SDL_GetError()); //@todo die, i guess } else { glog("SDL2 graphics initialized"); @@ -633,7 +633,7 @@ void make_next_screenshot_filename() // workaround is this horrible hack of saving the bmp -> load bmp -> save png void x_take_screenshot() { make_next_screenshot_filename(); - glogf("Taking screenshot - %s\n", screenshot_filename); + glogf("Taking screenshot - %s", screenshot_filename); SDL_Surface *sshot = SDL_CreateRGBSurface(0, BASE_WINDOW_WIDTH, X_A2_WINDOW_HEIGHT, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000); SDL_LockSurface(sshot); int read = SDL_RenderReadPixels(renderer, NULL, SDL_PIXELFORMAT_ARGB8888, sshot->pixels, sshot->pitch); diff --git a/src/sdl2snd_driver.c b/src/sdl2snd_driver.c index 05be131..a34823c 100644 --- a/src/sdl2snd_driver.c +++ b/src/sdl2snd_driver.c @@ -1,19 +1,19 @@ /* GSPLUS - Advanced Apple IIGS Emulator Environment Copyright (C) 2016 - Dagen Brock - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -85,7 +85,7 @@ sound_write_sdl(int real_samps, int size) SDL_UnlockAudio(); } if(g_sound_paused && (g_playbuf_buffered > 0)) { - glogf("Unpausing sound, %d buffered\n",g_playbuf_buffered); + glogf("Unpausing sound, %d buffered",g_playbuf_buffered); g_sound_paused = 0; SDL_PauseAudio(0); } @@ -178,8 +178,7 @@ sound_init_device_sdl() goto snd_error; g_playbuf_buffered = 0; - glogf("Sound shared memory size=%d\n", - SOUND_SHM_SAMP_SIZE * SAMPLE_CHAN_SIZE); + glogf("Sound shared memory size=%d", SOUND_SHM_SAMP_SIZE * SAMPLE_CHAN_SIZE); g_sound_shm_addr = malloc(SOUND_SHM_SAMP_SIZE * SAMPLE_CHAN_SIZE); memset(g_sound_shm_addr,0,SOUND_SHM_SAMP_SIZE * SAMPLE_CHAN_SIZE); diff --git a/src/sim65816.c b/src/sim65816.c index c42dca9..e579217 100644 --- a/src/sim65816.c +++ b/src/sim65816.c @@ -746,7 +746,7 @@ void my_exit(int ret) end_screen(); imagewriter_close(); printer_close(); - glogf("exiting (ret=%d)\n",ret); + glogf("exiting (ret=%d)",ret); fatalExit(ret); } @@ -894,8 +894,7 @@ memory_ptr_init() */ g_memory_ptr = memalloc_align(mem_size, 256, &g_memory_alloc_ptr); - glogf("RAM size is 0 - %06x (%.2fMB)\n", mem_size, - (double)mem_size/(1024.0*1024.0)); + glogf("RAM size is 0 - %06x (%.2fMB)", mem_size, (double)mem_size/(1024.0*1024.0)); } // OG Added memory_ptr_shut @@ -1331,7 +1330,7 @@ void setup_gsplus_file(char *outname, int maxlen, int ok_if_missing, int can_cre strcpy(outname, &(local_path[0])); strncat(outname, *cur_name_ptr, 255-strlen(outname)); if(!ok_if_missing) { // ?? - glogf("Trying '%s'\n", outname); + glogf("Trying '%s'", outname); } ret = stat(outname, &stat_buf); if(ret == 0) { @@ -1357,7 +1356,7 @@ void setup_gsplus_file(char *outname, int maxlen, int ok_if_missing, int can_cre fatal_printf(" %s\n", *path_ptr++); } */ - glogf("Could not find required file \"%s\" !!!\n", *name_ptr); + glogf("Could not find required file \"%s\" !!!", *name_ptr); if (strcmp(*name_ptr, "ROM")) { glog(" IIgs will likely hang now!"); glog(" Get an Apple IIgs firmware ROM image from somewhere like:");