From f2c2f7c9af7bfcd69756f54eea2ca5eeb4571223 Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Mon, 27 Aug 2012 22:47:20 -0400 Subject: [PATCH] Move file format to a separate header in order to better obfuscate the image loaders within the io library. --- IO/config/ImageLoader.h.in | 6 +----- IO/include/ImageFile.h | 2 +- IO/include/ImageFileFormat.h | 10 ++++++++++ IO/src/ImageFile.cpp | 4 ++++ 4 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 IO/include/ImageFileFormat.h diff --git a/IO/config/ImageLoader.h.in b/IO/config/ImageLoader.h.in index d76731a..cf447cf 100644 --- a/IO/config/ImageLoader.h.in +++ b/IO/config/ImageLoader.h.in @@ -1,11 +1,7 @@ #ifndef _IMAGE_LOADER_H_ #define _IMAGE_LOADER_H_ -enum EImageFileFormat { - eFileFormat_PNG, - - kNumImageFileFormats -}; +#include "ImageFileFormat.h" class ImageLoader { diff --git a/IO/include/ImageFile.h b/IO/include/ImageFile.h index 34d6593..ea10efe 100644 --- a/IO/include/ImageFile.h +++ b/IO/include/ImageFile.h @@ -1,7 +1,7 @@ #ifndef _IMAGE_FILE_H_ #define _IMAGE_FILE_H_ -#include "ImageLoader.h" +#include "ImageFileFormat.h" class ImageFile { diff --git a/IO/include/ImageFileFormat.h b/IO/include/ImageFileFormat.h new file mode 100644 index 0000000..ab9a9ca --- /dev/null +++ b/IO/include/ImageFileFormat.h @@ -0,0 +1,10 @@ +#ifndef _IMAGE_FILE_FORMAT_H_ +#define _IMAGE_FILE_FORMAT_H_ + +enum EImageFileFormat { + eFileFormat_PNG, + + kNumImageFileFormats +}; + +#endif // _IMAGE_FILE_FORMAT_H_ diff --git a/IO/src/ImageFile.cpp b/IO/src/ImageFile.cpp index ab5e623..24bcca8 100644 --- a/IO/src/ImageFile.cpp +++ b/IO/src/ImageFile.cpp @@ -5,6 +5,7 @@ #include #include "ImageFile.h" +#include "ImageLoader.h" #ifdef PNG_FOUND # include "ImageLoaderPNG.h" @@ -149,6 +150,9 @@ EImageFileFormat ImageFile::DetectFileFormat(const char *filename) { // !FIXME! Report Error..... return kNumImageFileFormats; } + + // consume the last character... + dotPos++; const char *ext = &filename[dotPos];