[ctrtool] Fix compile errors

And comparisons which would have always returned false.
This commit is contained in:
jakcron
2016-01-08 20:45:14 +08:00
parent b1725fda79
commit 9b4415a7a0
3 changed files with 23 additions and 6 deletions
+18 -3
View File
@@ -3,12 +3,27 @@ SRC_DIR = . polarssl tinyxml
OBJS = $(foreach dir,$(SRC_DIR),$(subst .c,.o,$(wildcard $(dir)/*.c))) $(foreach dir,$(SRC_DIR),$(subst .cpp,.o,$(wildcard $(dir)/*.cpp)))
# Compiler Settings
LIBS = -static-libgcc -static-libstdc++
CXXFLAGS = -I.
CFLAGS = -O2 -flto -Wall -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-result -I.
OUTPUT = ctrtool
CXXFLAGS = -I.
CFLAGS = -O2 -flto -Wall -Wno-unused-variable -Wno-unused-result -I.
CC = gcc
CXX = g++
ifeq ($(OS),Windows_NT)
#Windows Build CFG
CFLAGS += -Wno-unused-but-set-variable
LIBS += -static-libgcc -static-libstdc++
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
# OS X
CFLAGS += -Wno-unused-local-typedef
LIBS += -liconv
else
# Linux
CFLAGS += -Wno-unused-but-set-variable
LIBS +=
endif
endif
main: $(OBJS)
$(CXX) -o $(OUTPUT) $(LIBS) $(OBJS)
+1 -1
View File
@@ -119,7 +119,7 @@ int stream_out_flush(stream_out_context* ctx)
if (ctx->outbufferpos > 0)
{
size_t writtenbytes = fwrite(ctx->outbuffer, 1, ctx->outbufferpos, ctx->outfile);
if (writtenbytes < 0)
if (writtenbytes == 0) // will be zero if nothing is written
return 0;
+4 -2
View File
@@ -46,8 +46,10 @@ inline int fseeko64(FILE *__stream, long long __off, int __whence)
{
return _fseeki64(__stream, __off, __whence);
}
#else
extern int fseeko64 (FILE *__stream, off64_t __off, int __whence);
#elif __APPLE__
#define fseeko64 fseek // OS X file I/O is 64bit
#elif __linux__
extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
#endif
#ifdef __cplusplus