From e194f1aa3d4a3235eb8cf74946664f390b37f778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dtalo=20Mu=C3=B1oz?= Date: Fri, 7 Sep 2018 10:42:44 -0300 Subject: [PATCH 1/3] Fixing #24: Building issue --- external/minizip/zip.c | 2 +- src/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/external/minizip/zip.c b/external/minizip/zip.c index 3c34fc8..dd4f905 100644 --- a/external/minizip/zip.c +++ b/external/minizip/zip.c @@ -1245,7 +1245,7 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, unsigned char bufHead[RAND_HEAD_LEN]; unsigned int sizeHead; zi->ci.encrypt = 1; - zi->ci.pcrc_32_tab = get_crc_table(); + zi->ci.pcrc_32_tab = (const unsigned long*)(get_crc_table()); /*init_keys(password,zi->ci.keys,zi->ci.pcrc_32_tab);*/ sizeHead=crypthead(password,bufHead,RAND_HEAD_LEN,zi->ci.keys,zi->ci.pcrc_32_tab,crcForCrypting); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6a29bfa..1bda56d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,7 +5,7 @@ find_package(Threads REQUIRED) include(GenerateCppResourceFile) if (UNIX) - add_definitions(-Wall -Werror -Wconversion) + add_definitions(-Wall -Werror -Wconversion -std=c++11) endif() if (UNIX AND NOT APPLE) From d31ffc26b4c61065da1e92577088ba952bd896ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dtalo=20Mu=C3=B1oz?= Date: Fri, 7 Sep 2018 11:00:30 -0300 Subject: [PATCH 2/3] Untracking cmake generated makefiles Creating a list of files to ignore --- .gitignore | 25 ++++++++ external/minizip/Makefile | 25 -------- external/tinyxml/Makefile | 130 -------------------------------------- 3 files changed, 25 insertions(+), 155 deletions(-) create mode 100644 .gitignore delete mode 100644 external/minizip/Makefile delete mode 100644 external/tinyxml/Makefile diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e63cd40 --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +# patterns to ignore +*.a +*.cmake +*.i +*.so +*.sw? + +# paths to ignore +CMakeCache.txt +src/tests/???app +src/tests/updater_Test* +src/updater +src/zip-tool + +# Auto generated files to ignore +external/minizip/Makefile +external/AnyOption/Makefile +external/tinyxml/Makefile +external/TinyThread/Makefile +src/tests/Makefile +src/Makefile +Makefile + +# dirs to ignore +**/CMakeFiles/ diff --git a/external/minizip/Makefile b/external/minizip/Makefile deleted file mode 100644 index 84eaad2..0000000 --- a/external/minizip/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -CC=cc -CFLAGS=-O -I../.. - -UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a -ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a - -.c.o: - $(CC) -c $(CFLAGS) $*.c - -all: miniunz minizip - -miniunz: $(UNZ_OBJS) - $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS) - -minizip: $(ZIP_OBJS) - $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) - -test: miniunz minizip - ./minizip test readme.txt - ./miniunz -l test.zip - mv readme.txt readme.old - ./miniunz test.zip - -clean: - /bin/rm -f *.o *~ minizip miniunz diff --git a/external/tinyxml/Makefile b/external/tinyxml/Makefile deleted file mode 100644 index 5ffb952..0000000 --- a/external/tinyxml/Makefile +++ /dev/null @@ -1,130 +0,0 @@ -#**************************************************************************** -# -# Makefile for TinyXml test. -# Lee Thomason -# www.grinninglizard.com -# -# This is a GNU make (gmake) makefile -#**************************************************************************** - -# DEBUG can be set to YES to include debugging info, or NO otherwise -DEBUG := NO - -# PROFILE can be set to YES to include profiling info, or NO otherwise -PROFILE := NO - -# TINYXML_USE_STL can be used to turn on STL support. NO, then STL -# will not be used. YES will include the STL files. -TINYXML_USE_STL := NO - -#**************************************************************************** - -CC := gcc -CXX := g++ -LD := g++ -AR := ar rc -RANLIB := ranlib - -DEBUG_CFLAGS := -Wall -Wno-format -g -DDEBUG -RELEASE_CFLAGS := -Wall -Wno-unknown-pragmas -Wno-format -O3 - -LIBS := - -DEBUG_CXXFLAGS := ${DEBUG_CFLAGS} -RELEASE_CXXFLAGS := ${RELEASE_CFLAGS} - -DEBUG_LDFLAGS := -g -RELEASE_LDFLAGS := - -ifeq (YES, ${DEBUG}) - CFLAGS := ${DEBUG_CFLAGS} - CXXFLAGS := ${DEBUG_CXXFLAGS} - LDFLAGS := ${DEBUG_LDFLAGS} -else - CFLAGS := ${RELEASE_CFLAGS} - CXXFLAGS := ${RELEASE_CXXFLAGS} - LDFLAGS := ${RELEASE_LDFLAGS} -endif - -ifeq (YES, ${PROFILE}) - CFLAGS := ${CFLAGS} -pg -O3 - CXXFLAGS := ${CXXFLAGS} -pg -O3 - LDFLAGS := ${LDFLAGS} -pg -endif - -#**************************************************************************** -# Preprocessor directives -#**************************************************************************** - -ifeq (YES, ${TINYXML_USE_STL}) - DEFS := -DTIXML_USE_STL -else - DEFS := -endif - -#**************************************************************************** -# Include paths -#**************************************************************************** - -#INCS := -I/usr/include/g++-2 -I/usr/local/include -INCS := - - -#**************************************************************************** -# Makefile code common to all platforms -#**************************************************************************** - -CFLAGS := ${CFLAGS} ${DEFS} -CXXFLAGS := ${CXXFLAGS} ${DEFS} - -#**************************************************************************** -# Targets of the build -#**************************************************************************** - -OUTPUT := xmltest - -all: ${OUTPUT} - - -#**************************************************************************** -# Source files -#**************************************************************************** - -SRCS := tinyxml.cpp tinyxmlparser.cpp xmltest.cpp tinyxmlerror.cpp tinystr.cpp - -# Add on the sources for libraries -SRCS := ${SRCS} - -OBJS := $(addsuffix .o,$(basename ${SRCS})) - -#**************************************************************************** -# Output -#**************************************************************************** - -${OUTPUT}: ${OBJS} - ${LD} -o $@ ${LDFLAGS} ${OBJS} ${LIBS} ${EXTRA_LIBS} - -#**************************************************************************** -# common rules -#**************************************************************************** - -# Rules for compiling source files to object files -%.o : %.cpp - ${CXX} -c ${CXXFLAGS} ${INCS} $< -o $@ - -%.o : %.c - ${CC} -c ${CFLAGS} ${INCS} $< -o $@ - -dist: - bash makedistlinux - -clean: - -rm -f core ${OBJS} ${OUTPUT} - -depend: - #makedepend ${INCS} ${SRCS} - -tinyxml.o: tinyxml.h tinystr.h -tinyxmlparser.o: tinyxml.h tinystr.h -xmltest.o: tinyxml.h tinystr.h -tinyxmlerror.o: tinyxml.h tinystr.h From b530c1685c994c08ecc8da3998a6a179ebcc64f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dtalo=20Mu=C3=B1oz?= Date: Fri, 7 Sep 2018 15:43:01 -0300 Subject: [PATCH 3/3] Adding a .gitignore Solving all compilation (not linking) warnings level 3 generated by updater and its dependencies (VS2015 Upd3) Upgrading tinyxml solution from VS 2010 to VS 2015 --- .gitignore | 10 ++++- external/AnyOption/anyoption.cpp | 2 +- external/bzip2/bzlib.c | 6 ++- external/minizip/ioapi.c | 2 +- external/tinyxml/tinyxml.sln | 73 +++++++++++++++++++++----------- src/DirIterator.cpp | 9 ++-- src/ProcessUtils.cpp | 5 ++- 7 files changed, 69 insertions(+), 38 deletions(-) diff --git a/.gitignore b/.gitignore index e63cd40..d348e1c 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,7 @@ src/tests/updater_Test* src/updater src/zip-tool -# Auto generated files to ignore +# Auto generated files external/minizip/Makefile external/AnyOption/Makefile external/tinyxml/Makefile @@ -21,5 +21,13 @@ src/tests/Makefile src/Makefile Makefile +# VS 2015 generated files +*.vcxproj* +**/*.sln +**/Debug +**/Release +Win32/ + # dirs to ignore +.vs/ **/CMakeFiles/ diff --git a/external/AnyOption/anyoption.cpp b/external/AnyOption/anyoption.cpp index 6792fe3..5bd5832 100644 --- a/external/AnyOption/anyoption.cpp +++ b/external/AnyOption/anyoption.cpp @@ -956,7 +956,7 @@ AnyOption::readFile( const char* fname ) return NULL; } is.seekg (0, ios::end); - length = is.tellg(); + length = static_cast(is.tellg()); is.seekg (0, ios::beg); buffer = (char*) malloc(length*sizeof(char)); is.read (buffer,length); diff --git a/external/bzip2/bzlib.c b/external/bzip2/bzlib.c index bd358a7..e5ad391 100644 --- a/external/bzip2/bzlib.c +++ b/external/bzip2/bzlib.c @@ -1375,9 +1375,11 @@ const char * BZ_API(BZ2_bzlibVersion)(void) #if defined(_WIN32) || defined(OS2) || defined(MSDOS) # include # include -# define SET_BINARY_MODE(file) setmode(fileno(file),O_BINARY) +# define SET_BINARY_MODE(file) _setmode(_fileno(file), O_BINARY) +# define FDOPEN(file, mode) _fdopen(file, mode) #else # define SET_BINARY_MODE(file) +# define FDOPEN(file, mode) fdopen(file, mode) #endif static BZFILE * bzopen_or_bzdopen @@ -1428,7 +1430,7 @@ BZFILE * bzopen_or_bzdopen #ifdef BZ_STRICT_ANSI fp = NULL; #else - fp = fdopen(fd,mode2); + fp = FDOPEN(fd,mode2); #endif } if (fp == NULL) return NULL; diff --git a/external/minizip/ioapi.c b/external/minizip/ioapi.c index 49958f6..0ac2d3f 100644 --- a/external/minizip/ioapi.c +++ b/external/minizip/ioapi.c @@ -10,7 +10,7 @@ */ -#if (defined(_WIN32)) +#if defined(_WIN32) && !defined(_CRT_SECURE_NO_WARNINGS) #define _CRT_SECURE_NO_WARNINGS #endif diff --git a/external/tinyxml/tinyxml.sln b/external/tinyxml/tinyxml.sln index 7ae7705..ad27a05 100644 --- a/external/tinyxml/tinyxml.sln +++ b/external/tinyxml/tinyxml.sln @@ -1,38 +1,61 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual C++ Express 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyXmlTest", "tinyXmlTest.vcxproj", "{34719950-09E8-457E-BE23-8F1CE3A1F1F6}" +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ALL_BUILD", "ALL_BUILD.vcxproj", "{D58BEE6F-8AEC-3E00-BBF0-36B4100ECEBE}" + ProjectSection(ProjectDependencies) = postProject + {938D596F-0612-3090-BDD2-49E7938BF7B4} = {938D596F-0612-3090-BDD2-49E7938BF7B4} + {918FC0B1-7495-3F46-A443-3EEF0C232FB2} = {918FC0B1-7495-3F46-A443-3EEF0C232FB2} + EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyXmlTestSTL", "tinyXmlTestSTL.vcxproj", "{53ED5965-5BCA-47B5-9EB0-EDD20882F22F}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RUN_TESTS", "RUN_TESTS.vcxproj", "{ED09D2A4-0002-32F8-A3C0-ADCF989FD249}" + ProjectSection(ProjectDependencies) = postProject + {938D596F-0612-3090-BDD2-49E7938BF7B4} = {938D596F-0612-3090-BDD2-49E7938BF7B4} + EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyxml", "tinyxml_lib.vcxproj", "{C406DAEC-0886-4771-8DEA-9D7329B46CC1}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZERO_CHECK", "..\..\\ZERO_CHECK.vcxproj", "{938D596F-0612-3090-BDD2-49E7938BF7B4}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyxmlSTL", "tinyxmlSTL.vcxproj", "{A3A84737-5017-4577-B8A2-79429A25B8B6}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyxml", "tinyxml.vcxproj", "{918FC0B1-7495-3F46-A443-3EEF0C232FB2}" + ProjectSection(ProjectDependencies) = postProject + {938D596F-0612-3090-BDD2-49E7938BF7B4} = {938D596F-0612-3090-BDD2-49E7938BF7B4} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 + MinSizeRel|Win32 = MinSizeRel|Win32 + RelWithDebInfo|Win32 = RelWithDebInfo|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {34719950-09E8-457E-BE23-8F1CE3A1F1F6}.Debug|Win32.ActiveCfg = Debug|Win32 - {34719950-09E8-457E-BE23-8F1CE3A1F1F6}.Debug|Win32.Build.0 = Debug|Win32 - {34719950-09E8-457E-BE23-8F1CE3A1F1F6}.Release|Win32.ActiveCfg = Release|Win32 - {34719950-09E8-457E-BE23-8F1CE3A1F1F6}.Release|Win32.Build.0 = Release|Win32 - {53ED5965-5BCA-47B5-9EB0-EDD20882F22F}.Debug|Win32.ActiveCfg = Debug|Win32 - {53ED5965-5BCA-47B5-9EB0-EDD20882F22F}.Debug|Win32.Build.0 = Debug|Win32 - {53ED5965-5BCA-47B5-9EB0-EDD20882F22F}.Release|Win32.ActiveCfg = Release|Win32 - {53ED5965-5BCA-47B5-9EB0-EDD20882F22F}.Release|Win32.Build.0 = Release|Win32 - {C406DAEC-0886-4771-8DEA-9D7329B46CC1}.Debug|Win32.ActiveCfg = Debug|Win32 - {C406DAEC-0886-4771-8DEA-9D7329B46CC1}.Debug|Win32.Build.0 = Debug|Win32 - {C406DAEC-0886-4771-8DEA-9D7329B46CC1}.Release|Win32.ActiveCfg = Release|Win32 - {C406DAEC-0886-4771-8DEA-9D7329B46CC1}.Release|Win32.Build.0 = Release|Win32 - {A3A84737-5017-4577-B8A2-79429A25B8B6}.Debug|Win32.ActiveCfg = Debug|Win32 - {A3A84737-5017-4577-B8A2-79429A25B8B6}.Debug|Win32.Build.0 = Debug|Win32 - {A3A84737-5017-4577-B8A2-79429A25B8B6}.Release|Win32.ActiveCfg = Release|Win32 - {A3A84737-5017-4577-B8A2-79429A25B8B6}.Release|Win32.Build.0 = Release|Win32 + {D58BEE6F-8AEC-3E00-BBF0-36B4100ECEBE}.Debug|Win32.ActiveCfg = Debug|Win32 + {D58BEE6F-8AEC-3E00-BBF0-36B4100ECEBE}.Release|Win32.ActiveCfg = Release|Win32 + {D58BEE6F-8AEC-3E00-BBF0-36B4100ECEBE}.MinSizeRel|Win32.ActiveCfg = MinSizeRel|Win32 + {D58BEE6F-8AEC-3E00-BBF0-36B4100ECEBE}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32 + {ED09D2A4-0002-32F8-A3C0-ADCF989FD249}.Debug|Win32.ActiveCfg = Debug|Win32 + {ED09D2A4-0002-32F8-A3C0-ADCF989FD249}.Release|Win32.ActiveCfg = Release|Win32 + {ED09D2A4-0002-32F8-A3C0-ADCF989FD249}.MinSizeRel|Win32.ActiveCfg = MinSizeRel|Win32 + {ED09D2A4-0002-32F8-A3C0-ADCF989FD249}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32 + {938D596F-0612-3090-BDD2-49E7938BF7B4}.Debug|Win32.ActiveCfg = Debug|Win32 + {938D596F-0612-3090-BDD2-49E7938BF7B4}.Debug|Win32.Build.0 = Debug|Win32 + {938D596F-0612-3090-BDD2-49E7938BF7B4}.Release|Win32.ActiveCfg = Release|Win32 + {938D596F-0612-3090-BDD2-49E7938BF7B4}.Release|Win32.Build.0 = Release|Win32 + {938D596F-0612-3090-BDD2-49E7938BF7B4}.MinSizeRel|Win32.ActiveCfg = MinSizeRel|Win32 + {938D596F-0612-3090-BDD2-49E7938BF7B4}.MinSizeRel|Win32.Build.0 = MinSizeRel|Win32 + {938D596F-0612-3090-BDD2-49E7938BF7B4}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32 + {938D596F-0612-3090-BDD2-49E7938BF7B4}.RelWithDebInfo|Win32.Build.0 = RelWithDebInfo|Win32 + {918FC0B1-7495-3F46-A443-3EEF0C232FB2}.Debug|Win32.ActiveCfg = Debug|Win32 + {918FC0B1-7495-3F46-A443-3EEF0C232FB2}.Debug|Win32.Build.0 = Debug|Win32 + {918FC0B1-7495-3F46-A443-3EEF0C232FB2}.Release|Win32.ActiveCfg = Release|Win32 + {918FC0B1-7495-3F46-A443-3EEF0C232FB2}.Release|Win32.Build.0 = Release|Win32 + {918FC0B1-7495-3F46-A443-3EEF0C232FB2}.MinSizeRel|Win32.ActiveCfg = MinSizeRel|Win32 + {918FC0B1-7495-3F46-A443-3EEF0C232FB2}.MinSizeRel|Win32.Build.0 = MinSizeRel|Win32 + {918FC0B1-7495-3F46-A443-3EEF0C232FB2}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32 + {918FC0B1-7495-3F46-A443-3EEF0C232FB2}.RelWithDebInfo|Win32.Build.0 = RelWithDebInfo|Win32 EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {CF27880A-8B79-34D7-AE14-83260953B588} + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution EndGlobalSection EndGlobal diff --git a/src/DirIterator.cpp b/src/DirIterator.cpp index a4604f0..d9fd1d3 100644 --- a/src/DirIterator.cpp +++ b/src/DirIterator.cpp @@ -46,18 +46,15 @@ bool DirIterator::next() m_entry = readdir(m_dir); return m_entry != 0; #else - bool result; if (m_firstEntry) { m_firstEntry = false; return m_findHandle != INVALID_HANDLE_VALUE; } - else - { - result = FindNextFile(m_findHandle,&m_findData); - } - return result; + + return FindNextFile(m_findHandle, &m_findData) != FALSE; // to prevent warning C4800: 'BOOL': forcing value to bool* #endif +// (*) Casting the expression to type bool will not disable the warning: https://msdn.microsoft.com/en-us/library/b6801kcy.aspx } std::string DirIterator::fileName() const diff --git a/src/ProcessUtils.cpp b/src/ProcessUtils.cpp index 3952978..6a4177c 100644 --- a/src/ProcessUtils.cpp +++ b/src/ProcessUtils.cpp @@ -11,6 +11,7 @@ #ifdef PLATFORM_WINDOWS #include +#include #else #include #include @@ -438,8 +439,8 @@ int ProcessUtils::runWindows(const std::string& _executable, PROCESS_INFORMATION processInfo; ZeroMemory(&processInfo,sizeof(processInfo)); - char* commandLineStr = strdup(commandLine.c_str()); - bool result = CreateProcess( + LPSTR commandLineStr = const_cast(std::string(commandLine).c_str()); + BOOL result = CreateProcess( executable.c_str(), commandLineStr, 0 /* process attributes */,