From 51aa03ce041b8b492164aaa1cabc40a4371913e3 Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Mon, 8 Feb 2010 18:24:00 +0000 Subject: [PATCH] Fix warnings and remove SAM --- Makefile.host | 2 +- Src/IEC.cpp | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Makefile.host b/Makefile.host index 1af5041..48a2662 100644 --- a/Makefile.host +++ b/Makefile.host @@ -32,7 +32,7 @@ LDFLAGS ?= $(GCOV) `sdl-config --libs` -lSDL_ttf -lSDL_image CPP_SRCS=Src/C64_SC.cpp Src/main.cpp Src/Display.cpp Src/Prefs.cpp Src/SID.cpp \ Src/REU.cpp Src/IEC.cpp Src/1541fs.cpp Src/1541d64.cpp Src/1541t64.cpp \ - Src/1541job.cpp Src/SAM.cpp Src/CPUC64_SC.cpp Src/VIC_SC.cpp \ + Src/1541job.cpp Src/CPUC64_SC.cpp Src/VIC_SC.cpp \ Src/CIA_SC.cpp Src/CPU1541_SC.cpp Src/CPU_common.cpp Src/Network.cpp \ Src/gui/menu_messages.cpp Src/gui/dialogue_box.cpp Src/gui/widget.cpp \ Src/gui/game_info.cpp Src/gui/status_bar.cpp Src/gui/gui.cpp Src/gui/listener.cpp \ diff --git a/Src/IEC.cpp b/Src/IEC.cpp index 733a23f..f56ac16 100644 --- a/Src/IEC.cpp +++ b/Src/IEC.cpp @@ -93,6 +93,8 @@ Drive *IEC::create_drive(const char *path) // print error? } } + + return NULL; } IEC::IEC(C64Display *display) : the_display(display) @@ -880,7 +882,7 @@ void Drive::unsupp_cmd(void) uint8 ascii2petscii(char c) { - if ((c >= 'A') && (c <= 'Z') || (c >= 'a') && (c <= 'z')) + if (((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'))) return c ^ 0x20; return c; } @@ -892,7 +894,7 @@ void ascii2petscii(uint8 *dest, const char *src, int n) char petscii2ascii(uint8 c) { - if ((c >= 'A') && (c <= 'Z') || (c >= 'a') && (c <= 'z')) + if (((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'))) return c ^ 0x20; if ((c >= 0xc1) && (c <= 0xda)) return c ^ 0x80; @@ -911,6 +913,9 @@ void petscii2ascii(char *dest, const uint8 *src, int n) bool IsMountableFile(const char *path, int &type) { + size_t n; + bool out = true; + // Read header and determine file size uint8 header[64]; memset(header, 0, sizeof(header)); @@ -920,17 +925,19 @@ bool IsMountableFile(const char *path, int &type) fseek(f, 0, SEEK_END); long size = ftell(f); fseek(f, 0, SEEK_SET); - fread(header, 1, sizeof(header), f); + n = fread(header, 1, sizeof(header), f); + if (n != 1) + out = false; fclose(f); - if (IsImageFile(path, header, size)) { + if (IsImageFile(path, header, size)) type = FILE_IMAGE; - return true; - } else if (IsArchFile(path, header, size)) { + else if (IsArchFile(path, header, size)) type = FILE_ARCH; - return true; - } else - return false; + else + out = false; + + return out; }