From a74b4e68627bdbc12f248aa139caf6eff04783b4 Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Fri, 24 Oct 2014 09:10:29 -0400 Subject: [PATCH 1/4] Add proper include to support min and max --- CLTool/src/tc.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/CLTool/src/tc.cpp b/CLTool/src/tc.cpp index bff90f2..158ef5d 100644 --- a/CLTool/src/tc.cpp +++ b/CLTool/src/tc.cpp @@ -53,6 +53,7 @@ #define _CRT_SECURE_NO_WARNINGS #define WIN32_LEAN_AND_MEAN +#include #include #include #include From fd2699302d72d90d3b909c55dae933a6a4495c24 Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Fri, 24 Oct 2014 10:27:01 -0400 Subject: [PATCH 2/4] Update to support VS2013 --- CMakeLists.txt | 2 ++ Windows | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d8beeae..b8865ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,6 +62,8 @@ IF(MSVC) SET(MSVC_VERSION_STRING vc100) ELSEIF(MSVC11) SET(MSVC_VERSION_STRING vc110) + ELSEIF(MSVC12) + SET(MSVC_VERSION_STRING vc120) ELSEIF(MSVC90) SET(MSVC_VERSION_STRING vc90) ELSEIF(MSVC80) diff --git a/Windows b/Windows index 4feeeb6..6d9f6ba 160000 --- a/Windows +++ b/Windows @@ -1 +1 @@ -Subproject commit 4feeeb6550851ba3541c3f9505c76018e665667e +Subproject commit 6d9f6ba0f9ebec0f6735b1f29527ea5835ef3572 From e4919e75e6840f2ee946c7db480857cb201c0a3d Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Fri, 31 Oct 2014 17:38:04 -0400 Subject: [PATCH 3/4] Add bracket guards around ifs --- IO/src/ImageLoader.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/IO/src/ImageLoader.cpp b/IO/src/ImageLoader.cpp index 9250116..cbc9a23 100644 --- a/IO/src/ImageLoader.cpp +++ b/IO/src/ImageLoader.cpp @@ -209,29 +209,33 @@ FasTC::Image<> *ImageLoader::LoadImage() { for(uint32 i = 0; i < aw; i++) { unsigned int redVal = GetChannelForPixel(i, j, 0); - if(redVal == INT_MAX) + if(redVal == INT_MAX) { return NULL; + } unsigned int greenVal = redVal; unsigned int blueVal = redVal; if(GetGreenChannelPrecision() > 0) { greenVal = GetChannelForPixel(i, j, 1); - if(greenVal == INT_MAX) + if(greenVal == INT_MAX) { return NULL; + } } if(GetBlueChannelPrecision() > 0) { blueVal = GetChannelForPixel(i, j, 2); - if(blueVal == INT_MAX) + if(blueVal == INT_MAX) { return NULL; + } } unsigned int alphaVal = 0xFF; if(GetAlphaChannelPrecision() > 0) { alphaVal = GetChannelForPixel(i, j, 3); - if(alphaVal == INT_MAX) + if(alphaVal == INT_MAX) { return NULL; + } } // Red channel From 6f82ab8941344d59e655a0976a61003db9d3aba6 Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Mon, 3 Nov 2014 15:57:34 -0500 Subject: [PATCH 4/4] Don't crash when you can't open a file that doesn't exist --- CLTool/src/decomp.cpp | 1 - IO/src/FileStreamUnix.cpp | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CLTool/src/decomp.cpp b/CLTool/src/decomp.cpp index ba8d9e2..e808acf 100644 --- a/CLTool/src/decomp.cpp +++ b/CLTool/src/decomp.cpp @@ -71,7 +71,6 @@ int main(int argc, char **argv) { ImageFile imgf (argv[1]); if(!imgf.Load()) { - fprintf(stderr, "Error loading file: %s\n", argv[1]); return 1; } diff --git a/IO/src/FileStreamUnix.cpp b/IO/src/FileStreamUnix.cpp index 0124050..775175a 100644 --- a/IO/src/FileStreamUnix.cpp +++ b/IO/src/FileStreamUnix.cpp @@ -95,7 +95,9 @@ public: } ~FileStreamImpl() { - fclose(m_FilePtr); + if (0 != m_FilePtr) { + fclose(m_FilePtr); + } } void IncreaseReferenceCount() { m_ReferenceCount++; }