Merged pull request #6873

This commit is contained in:
Shauren
2012-07-04 18:26:54 +02:00
parent 7bd0540ca4
commit 138375c045
4 changed files with 9 additions and 72 deletions
+1 -19
View File
@@ -1,6 +1,3 @@
project(StormLib)
cmake_minimum_required(VERSION 2.6)
set(SRC_FILES
src/adpcm/adpcm.cpp
src/huffman/huff.cpp
@@ -241,23 +238,18 @@ add_definitions(-D_7ZIP_ST -DBZ_STRICT_ANSI)
if(WIN32)
if(MSVC)
message(STATUS "Using MSVC")
add_definitions(-D_7ZIP_ST -DWIN32)
else()
message(STATUS "Using mingw")
endif()
set(SRC_ADDITIONAL_FILES ${ZLIB_BZIP2_FILES} ${TOMCRYPT_FILES} ${TOMMATH_FILES})
set(LINK_LIBS wininet)
endif()
if(APPLE)
message(STATUS "Using Mac OS X port")
set(LINK_LIBS z bz2)
set(SRC_ADDITIONAL_FILES ${TOMCRYPT_FILES} ${TOMMATH_FILES})
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL Linux)
message(STATUS "Using Linux port")
option(WITH_LIBTOMCRYPT "Use system LibTomCrypt library" OFF)
if(WITH_LIBTOMCRYPT)
set(LINK_LIBS z bz2 tomcrypt)
@@ -267,15 +259,9 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL Linux)
endif()
endif()
add_library(storm SHARED ${SRC_FILES} ${SRC_ADDITIONAL_FILES})
add_library(storm STATIC ${SRC_FILES} ${SRC_ADDITIONAL_FILES})
target_link_libraries(storm ${LINK_LIBS})
option(WITH_TEST "Compile Test application" OFF)
if(WITH_TEST)
add_executable(storm_test ${TEST_SRC_FILES})
target_link_libraries(storm_test storm)
endif()
if(APPLE)
set_target_properties(storm PROPERTIES FRAMEWORK true)
set_target_properties(storm PROPERTIES PUBLIC_HEADER "src/StormLib.h src/StormPort.h")
@@ -290,7 +276,3 @@ endif()
if(WIN32)
set_target_properties(storm PROPERTIES OUTPUT_NAME StormLib)
endif()
install(TARGETS storm RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib FRAMEWORK DESTINATION /Library/Frameworks)
install(FILES src/StormLib.h src/StormPort.h DESTINATION include)
-49
View File
@@ -1,49 +0,0 @@
diff --git a/dep/StormLib/src/SFileFindFile.cpp b/dep/StormLib/src/SFileFindFile.cpp
index aa065d2..542637b 100644
--- a/dep/StormLib/src/SFileFindFile.cpp
+++ b/dep/StormLib/src/SFileFindFile.cpp
@@ -31,7 +31,7 @@ struct TMPQSearch
DWORD dwSearchTableItems; // Number of items in the search table
DWORD dwNextIndex; // Next file index to be checked
DWORD dwFlagMask; // For checking flag mask
- char szSearchMask[1]; // Search mask (variable length)
+ char * szSearchMask; // Search mask (variable length)
};
//-----------------------------------------------------------------------------
@@ -69,7 +69,7 @@ bool CheckWildCard(const char * szString, const char * szWildCard)
szString++;
}
- // If there is '*', means zero or more chars. We have to
+ // If there is '*', means zero or more chars. We have to
// find the sequence after '*'
if(*szWildCard == '*')
{
@@ -337,6 +337,8 @@ static void FreeMPQSearch(TMPQSearch *& hs)
{
if(hs->pSearchTable != NULL)
STORM_FREE(hs->pSearchTable);
+ if(hs->szSearchMask != NULL)
+ free(hs->szSearchMask); // allocated with strdup
STORM_FREE(hs);
hs = NULL;
}
@@ -376,7 +378,7 @@ HANDLE WINAPI SFileFindFirstFile(HANDLE hMpq, const char * szMask, SFILE_FIND_DA
if(nError == ERROR_SUCCESS)
{
memset(hs, 0, sizeof(TMPQSearch));
- strcpy(hs->szSearchMask, szMask);
+ hs->szSearchMask = strdup(szMask);
hs->dwFlagMask = MPQ_FILE_EXISTS;
hs->ha = ha;
@@ -406,7 +408,7 @@ HANDLE WINAPI SFileFindFirstFile(HANDLE hMpq, const char * szMask, SFILE_FIND_DA
FreeMPQSearch(hs);
SetLastError(nError);
}
-
+
// Return the result value
return (HANDLE)hs;
}
+5 -2
View File
@@ -1019,7 +1019,9 @@ void ExtractDBCFiles(int l, bool basicLocale)
uint32 count = 0;
if (listFile)
{
std::string outputPath = "./dbc/";
std::string outputPath = output_path;
outputPath += "/dbc/";
CreateDir(outputPath);
if (!basicLocale)
{
@@ -1063,7 +1065,8 @@ void ExtractDB2Files(int l, bool basicLocale)
uint32 count = 0;
if (listFile)
{
std::string outputPath = "./dbc/";
std::string outputPath = output_path;
outputPath += "/dbc/";
if (!basicLocale)
{
outputPath += Locales[l];
+3 -2
View File
@@ -59,7 +59,7 @@
HANDLE WorldMpq = NULL;
HANDLE LocaleMpq = NULL;
uint32 CONF_TargetBuild = 15595; // 4.3.4.15595
uint32 CONF_TargetBuild = 14545; // 4.2.2.14545
// List MPQ for extract maps from
char const* CONF_mpq_list[]=
@@ -517,6 +517,7 @@ bool processArgv(int argc, char ** argv, const char *versionString)
break;
}
}
if(!result)
{
printf("Extract %s.\n",versionString);
@@ -524,6 +525,7 @@ bool processArgv(int argc, char ** argv, const char *versionString)
printf(" -s : (default) small size (data size optimization), ~500MB less vmap data.\n");
printf(" -l : large size, ~500MB more vmap data. (might contain more details)\n");
printf(" -d <path>: Path to the vector data source folder.\n");
printf(" -b : target build (default 14545)");
printf(" -? : This message.\n");
}
@@ -545,7 +547,6 @@ bool processArgv(int argc, char ** argv, const char *versionString)
int main(int argc, char ** argv)
{
getc(stdin);
bool success=true;
const char *versionString = "V4.00 2012_02";