Fix warnings on Windows and support the treat warnings as errors option.

This commit is contained in:
Pavel Krajcevski 2013-01-29 13:39:45 -05:00
parent fa5d5e865c
commit 0afff4188e
7 changed files with 16 additions and 10 deletions

View File

@ -605,7 +605,7 @@ static inline float frand() {
uint32 fltAsInt;
float flt;
} fltUnion = { (127 << 23) | m };
return fltUnion.flt - 1.0;
return fltUnion.flt - 1.0f;
}
bool BC7CompressionMode::AcceptNewEndpointError(double newError, double oldError, float temp) const {

View File

@ -54,11 +54,11 @@ ADD_EXECUTABLE(
${SOURCES}
)
# Make sure that if we're using boost libraries for threading then we add this linker path.
# Personally, I believe this is a bug in CMAKE but I'm not exactly sure.
#IF( THREAD_API MATCHES "Boost" )
# SET_TARGET_PROPERTIES(tc PROPERTIES LINK_FLAGS "/LIBPATH:\"${Boost_LIBRARY_DIRS}\"")
#ENDIF()
# Add flag for link time code generation. This was used to build the libpng libraries, so we should
# probably also include it for this project as well...
IF( MSVC )
SET_TARGET_PROPERTIES(tc PROPERTIES LINK_FLAGS "/LTCG")
ENDIF()
TARGET_LINK_LIBRARIES( tc BPTCEncoder )
TARGET_LINK_LIBRARIES( tc TexCompIO )

View File

@ -68,9 +68,15 @@ IF(MSVC)
SET(MSVC_LIB_DIR "${MSVC_INSTALL_PATH}/lib/${MSVC_ARCHITECTURE_STRING}/${MSVC_VERSION_STRING}")
SET(CMAKE_LIBRARY_PATH "${CMAKE_LIBRARY_PATH};${MSVC_LIB_DIR}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
ELSEIF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fms-extensions")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fms-extensions")
ENDIF(MSVC)
IF(TREAT_WARNINGS_AS_ERRORS)

View File

@ -79,7 +79,7 @@ class FileStream {
int32 Write(const uint8 *buf, uint32 bufSz);
// Returns where in the filestream we are. Returns -1 on error.
int64 Tell();
int32 Tell();
enum ESeekPosition {
eSeekPosition_Beginning,

View File

@ -197,7 +197,7 @@ int32 FileStream::Write(const uint8 *buf, uint32 bufSz) {
return amtWritten;
}
int64 FileStream::Tell() {
int32 FileStream::Tell() {
HANDLE fp = m_Impl->GetFileHandle();
if(NULL == fp) {
return -1;

View File

@ -231,7 +231,7 @@ unsigned char *ImageFile::ReadFileData(const CHAR *filename) {
// Figure out the filesize.
fstr.Seek(0, FileStream::eSeekPosition_End);
uint64 fileSize = fstr.Tell();
uint32 fileSize = fstr.Tell();
// Allocate data for file contents
unsigned char *rawData = new unsigned char[fileSize];

View File

@ -55,7 +55,7 @@ class ImageWriterPNG : public ImageWriter {
virtual bool WriteImage();
private:
uint64 m_StreamPosition;
uint32 m_StreamPosition;
uint32 m_TotalBytesWritten;
friend class PNGStreamWriter;
};