- bugfixes for coverity reported issues
- new bash parameters for build-mg.sh (in prep for coverity automation) - updated travis build to use new bash param
This commit is contained in:
parent
d8160c1065
commit
e3996ceb92
|
@ -9,7 +9,7 @@ before_install:
|
||||||
- sudo mk/linux/setupBuildDeps.sh --quiet # INSTALL DEPENDENCIES HERE
|
- sudo mk/linux/setupBuildDeps.sh --quiet # INSTALL DEPENDENCIES HERE
|
||||||
script:
|
script:
|
||||||
# ALL THE BUILD COMMANDS HERE
|
# ALL THE BUILD COMMANDS HERE
|
||||||
- ./build-mg.sh 4
|
- ./build-mg.sh -c 4
|
||||||
#- dmesg
|
#- dmesg
|
||||||
notifications:
|
notifications:
|
||||||
irc:
|
irc:
|
||||||
|
|
85
build-mg.sh
85
build-mg.sh
|
@ -13,15 +13,47 @@
|
||||||
# Default to English language output so we can understand your bug reports
|
# Default to English language output so we can understand your bug reports
|
||||||
export LANG=C
|
export LANG=C
|
||||||
|
|
||||||
|
CPU_COUNT=-1
|
||||||
|
CMAKE_ONLY=0
|
||||||
|
MAKE_ONLY=0
|
||||||
|
CLANG_FORCED=0
|
||||||
|
|
||||||
|
while getopts "c:m:n:f:" option; do
|
||||||
|
case "${option}" in
|
||||||
|
c)
|
||||||
|
CPU_COUNT=${OPTARG}
|
||||||
|
# echo "${option} value: ${OPTARG}"
|
||||||
|
;;
|
||||||
|
m)
|
||||||
|
CMAKE_ONLY=${OPTARG}
|
||||||
|
# echo "${option} value: ${OPTARG}"
|
||||||
|
;;
|
||||||
|
n)
|
||||||
|
MAKE_ONLY=${OPTARG}
|
||||||
|
# echo "${option} value: ${OPTARG}"
|
||||||
|
;;
|
||||||
|
|
||||||
|
f)
|
||||||
|
CLANG_FORCED=${OPTARG}
|
||||||
|
# echo "${option} value: ${OPTARG}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
#echo "CPU_COUNT = ${CPU_COUNT} CMAKE_ONLY = ${CMAKE_ONLY} CLANG_FORCED = ${CLANG_FORCED}"
|
||||||
|
#exit;
|
||||||
|
|
||||||
# Compiler selection
|
# Compiler selection
|
||||||
# Unless both the CC and CXX environment variables point to clang and clang++
|
# Unless both the CC and CXX environment variables point to clang and clang++
|
||||||
# respectively, we use GCC. To enforce clang compilation:
|
# respectively, we use GCC. To enforce clang compilation:
|
||||||
# 1. Install clang (sudo apt-get install clang)
|
# 1. Install clang (sudo apt-get install clang)
|
||||||
# 2. Set the two vars below:
|
# 2. Set the two vars below:
|
||||||
# WANT_CLANG=YES and CLANG_BIN_PATH=<path_to_the_clang_binary>
|
# WANT_CLANG=YES and CLANG_BIN_PATH=<path_to_the_clang_binary>
|
||||||
WANT_CLANG=NO
|
|
||||||
CLANG_BIN_PATH=/usr/bin/
|
CLANG_BIN_PATH=/usr/bin/
|
||||||
|
|
||||||
|
SCRIPTDIR="$(dirname $(readlink -f $0))"
|
||||||
|
cd ${SCRIPTDIR}
|
||||||
|
|
||||||
# Google breakpad integration (cross platform memory dumps) - OPTIONAL
|
# Google breakpad integration (cross platform memory dumps) - OPTIONAL
|
||||||
# Set this to the root path of your Google breakpad subversion working copy.
|
# Set this to the root path of your Google breakpad subversion working copy.
|
||||||
# By default, this script looks for a "google-breakpad" sub-directory within
|
# By default, this script looks for a "google-breakpad" sub-directory within
|
||||||
|
@ -44,17 +76,21 @@ EXTRA_CMAKE_OPTIONS=
|
||||||
NUMCORES=`lscpu -p | grep -cv '^#'`
|
NUMCORES=`lscpu -p | grep -cv '^#'`
|
||||||
echo "CPU cores detected: $NUMCORES"
|
echo "CPU cores detected: $NUMCORES"
|
||||||
if [ "$NUMCORES" = '' ]; then NUMCORES=1; fi
|
if [ "$NUMCORES" = '' ]; then NUMCORES=1; fi
|
||||||
if [ "$1." != '.' ]; then NUMCORES=$1; fi
|
if [ $CPU_COUNT != -1 ]; then NUMCORES=$CPU_COUNT; fi
|
||||||
echo "CPU cores to be used: $NUMCORES"
|
echo "CPU cores to be used: $NUMCORES"
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
mkdir -p build
|
if [ $MAKE_ONLY = 0 ]; then
|
||||||
|
mkdir -p build
|
||||||
|
fi
|
||||||
|
|
||||||
cd build
|
cd build
|
||||||
CURRENTDIR="$(dirname $(readlink -f $0))"
|
CURRENTDIR="$(dirname $(readlink -f $0))"
|
||||||
|
|
||||||
if [ -f 'CMakeCache.txt' ]; then rm -f 'CMakeCache.txt'; fi
|
if [ $MAKE_ONLY = 0 ]; then
|
||||||
|
if [ -f 'CMakeCache.txt' ]; then rm -f 'CMakeCache.txt'; fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Get distribution and architecture details
|
# Get distribution and architecture details
|
||||||
if [ `which lsb_release`'x' = 'x' ]
|
if [ `which lsb_release`'x' = 'x' ]
|
||||||
|
@ -144,7 +180,7 @@ esac
|
||||||
|
|
||||||
# If, in the configuration section on top of this script, the user has
|
# If, in the configuration section on top of this script, the user has
|
||||||
# indicated they want to use clang in favor of the default of GCC, use clang.
|
# indicated they want to use clang in favor of the default of GCC, use clang.
|
||||||
if [ "$WANT_CLANG" = 'YES' ]; then
|
if [ $CLANG_FORCED = 1 ]; then
|
||||||
EXTRA_CMAKE_OPTIONS="${EXTRA_CMAKE_OPTIONS} -DCMAKE_C_COMPILER=${CLANG_BIN_PATH}clang -DCMAKE_CXX_COMPILER=${CLANG_BIN_PATH}clang++"
|
EXTRA_CMAKE_OPTIONS="${EXTRA_CMAKE_OPTIONS} -DCMAKE_C_COMPILER=${CLANG_BIN_PATH}clang -DCMAKE_CXX_COMPILER=${CLANG_BIN_PATH}clang++"
|
||||||
echo "USER WANTS to use CLANG / LLVM compiler! EXTRA_CMAKE_OPTIONS = ${EXTRA_CMAKE_OPTIONS}"
|
echo "USER WANTS to use CLANG / LLVM compiler! EXTRA_CMAKE_OPTIONS = ${EXTRA_CMAKE_OPTIONS}"
|
||||||
#exit 1;
|
#exit 1;
|
||||||
|
@ -166,24 +202,29 @@ elif [ "`echo $CC | grep -Fq 'clang'`" = 'clang' -a "`echo $CXX | grep -Fq 'clan
|
||||||
#exit 1;
|
#exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Calling cmake with EXTRA_CMAKE_OPTIONS = ${EXTRA_CMAKE_OPTIONS}"
|
if [ $MAKE_ONLY = 0 ]; then
|
||||||
cmake -DCMAKE_INSTALL_PREFIX='' -DWANT_DEV_OUTPATH=ON -DWANT_STATIC_LIBS=ON -DBUILD_MEGAGLEST_TESTS=ON -DBREAKPAD_ROOT=$BREAKPAD_ROOT $EXTRA_CMAKE_OPTIONS ..
|
echo "Calling cmake with EXTRA_CMAKE_OPTIONS = ${EXTRA_CMAKE_OPTIONS}"
|
||||||
if [ $? -ne 0 ]; then
|
cmake -DCMAKE_INSTALL_PREFIX='' -DWANT_DEV_OUTPATH=ON -DWANT_STATIC_LIBS=ON -DBUILD_MEGAGLEST_TESTS=ON -DBREAKPAD_ROOT=$BREAKPAD_ROOT $EXTRA_CMAKE_OPTIONS ..
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
echo 'ERROR: CMAKE failed.' >&2; exit 1
|
echo 'ERROR: CMAKE failed.' >&2; exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "==================> About to call make with $NUMCORES cores... <=================="
|
if [ $CMAKE_ONLY = 1 ]; then
|
||||||
make -j$NUMCORES
|
echo "==================> You may now call make with $NUMCORES cores... <=================="
|
||||||
if [ $? -ne 0 ]; then
|
else
|
||||||
|
echo "==================> About to call make with $NUMCORES cores... <=================="
|
||||||
|
make -j$NUMCORES
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
echo 'ERROR: MAKE failed.' >&2; exit 2
|
echo 'ERROR: MAKE failed.' >&2; exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
echo ''
|
||||||
|
echo 'BUILD COMPLETE.'
|
||||||
|
echo ''
|
||||||
|
echo 'To launch MegaGlest from the current directory, use:'
|
||||||
|
echo ' mk/linux/megaglest --ini-path=mk/linux/ --data-path=mk/linux/'
|
||||||
|
echo 'Or change into mk/linux and run it from there:'
|
||||||
|
echo ' ./megaglest --ini-path=./ --data-path=./'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd ..
|
|
||||||
echo ''
|
|
||||||
echo 'BUILD COMPLETE.'
|
|
||||||
echo ''
|
|
||||||
echo 'To launch MegaGlest from the current directory, use:'
|
|
||||||
echo ' mk/linux/megaglest --ini-path=mk/linux/ --data-path=mk/linux/'
|
|
||||||
echo 'Or change into mk/linux and run it from there:'
|
|
||||||
echo ' ./megaglest --ini-path=./ --data-path=./'
|
|
||||||
|
|
||||||
|
|
|
@ -1012,7 +1012,10 @@ void ScriptManager::destroyUnit(int unitId){
|
||||||
Unit *unit = world->findUnitById(unitId);
|
Unit *unit = world->findUnitById(unitId);
|
||||||
if(unit != NULL) {
|
if(unit != NULL) {
|
||||||
// Make sure they die
|
// Make sure they die
|
||||||
unit->decHp(unit->getHp() * unit->getHp());
|
bool unit_dead = unit->decHp(unit->getHp() * unit->getHp());
|
||||||
|
if(unit_dead == false) {
|
||||||
|
throw megaglest_runtime_error("unit_dead == false");
|
||||||
|
}
|
||||||
unit->kill();
|
unit->kill();
|
||||||
// If called from an existing die event we get a stack overflow
|
// If called from an existing die event we get a stack overflow
|
||||||
//onUnitDied(unit);
|
//onUnitDied(unit);
|
||||||
|
|
|
@ -3201,7 +3201,14 @@ void CheckForDuplicateData() {
|
||||||
oldFile = newFile + "/" + tilesetName + ".xml";
|
oldFile = newFile + "/" + tilesetName + ".xml";
|
||||||
newFile = newFile + "/" + tilesetName + "_custom.xml";
|
newFile = newFile + "/" + tilesetName + "_custom.xml";
|
||||||
|
|
||||||
rename(oldFile.c_str(),newFile.c_str());
|
result = rename(oldFile.c_str(),newFile.c_str());
|
||||||
|
|
||||||
|
if(result != 0) {
|
||||||
|
char *errmsg = strerror(errno);
|
||||||
|
snprintf(szBuf,8096,"Error [%s]\nCould not rename [%s] to [%s]!",errmsg,oldFile.c_str(),newFile.c_str());
|
||||||
|
throw megaglest_runtime_error(szBuf,true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
errorMsg += szBuf;
|
errorMsg += szBuf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1743,15 +1743,15 @@ void MenuStateCustomGame::PlayNow(bool saveGame) {
|
||||||
mainMessageBoxState=1;
|
mainMessageBoxState=1;
|
||||||
|
|
||||||
Lang &lang= Lang::getInstance();
|
Lang &lang= Lang::getInstance();
|
||||||
char szMsg[8096]="";
|
string sMsg = "";
|
||||||
if(lang.hasString("NetworkSlotUnassignedErrorUI") == true) {
|
if(lang.hasString("NetworkSlotUnassignedErrorUI") == true) {
|
||||||
strcpy(szMsg,lang.getString("NetworkSlotUnassignedErrorUI").c_str());
|
sMsg = lang.getString("NetworkSlotUnassignedErrorUI");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
strcpy(szMsg,"Cannot start game.\nSome player(s) are not in a network game slot!");
|
sMsg = "Cannot start game.\nSome player(s) are not in a network game slot!";
|
||||||
}
|
}
|
||||||
|
|
||||||
showMessageBox(szMsg, "", false);
|
showMessageBox(sMsg, "", false);
|
||||||
|
|
||||||
const vector<string> languageList = serverInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
const vector<string> languageList = serverInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||||
for(unsigned int j = 0; j < languageList.size(); ++j) {
|
for(unsigned int j = 0; j < languageList.size(); ++j) {
|
||||||
|
|
|
@ -175,8 +175,6 @@ inline static void get_random_info(char seed[16]) {
|
||||||
seed[i++] = myrand & 0xff;
|
seed[i++] = myrand & 0xff;
|
||||||
seed[i++] = myrand >> 8;
|
seed[i++] = myrand >> 8;
|
||||||
} while (i < 14);
|
} while (i < 14);
|
||||||
|
|
||||||
if(fp != NULL) fclose(fp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -151,6 +151,7 @@ int zipfile_tool(int argc, const char *argv[]) {
|
||||||
|
|
||||||
if (deflateInit(&stream, level) != Z_OK) {
|
if (deflateInit(&stream, level) != Z_OK) {
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("deflateInit() failed!\n");
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("deflateInit() failed!\n");
|
||||||
|
if(pInfile) fclose(pInfile);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,6 +218,7 @@ int zipfile_tool(int argc, const char *argv[]) {
|
||||||
|
|
||||||
if (fread(s_inbuf, 1, n, pInfile) != n) {
|
if (fread(s_inbuf, 1, n, pInfile) != n) {
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Failed reading from input file!\n");
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Failed reading from input file!\n");
|
||||||
|
if(pOutfile) fclose(pOutfile);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -272,6 +272,7 @@ socket_t ftpEstablishDataConnection(int passive, ip_t *ip, port_t *port, int ses
|
||||||
myAddr.sin_family = AF_INET;
|
myAddr.sin_family = AF_INET;
|
||||||
myAddr.sin_addr.s_addr = INADDR_ANY;
|
myAddr.sin_addr.s_addr = INADDR_ANY;
|
||||||
myAddr.sin_port = htons(20);
|
myAddr.sin_port = htons(20);
|
||||||
|
myAddr.sin_zero[0] = 0;
|
||||||
if(bind(dataSocket, (struct sockaddr *)&myAddr, sizeof(myAddr)))
|
if(bind(dataSocket, (struct sockaddr *)&myAddr, sizeof(myAddr)))
|
||||||
{
|
{
|
||||||
if(VERBOSE_MODE_ENABLED) printf("In ftpEstablishDataConnection #2 about to Close socket = %d, for sessionId = %d\n",dataSocket, sessionId);
|
if(VERBOSE_MODE_ENABLED) printf("In ftpEstablishDataConnection #2 about to Close socket = %d, for sessionId = %d\n",dataSocket, sessionId);
|
||||||
|
@ -283,6 +284,8 @@ socket_t ftpEstablishDataConnection(int passive, ip_t *ip, port_t *port, int ses
|
||||||
clientAddr.sin_family = AF_INET;
|
clientAddr.sin_family = AF_INET;
|
||||||
clientAddr.sin_addr.s_addr = htonl(*ip);
|
clientAddr.sin_addr.s_addr = htonl(*ip);
|
||||||
clientAddr.sin_port = htons(*port);
|
clientAddr.sin_port = htons(*port);
|
||||||
|
clientAddr.sin_zero[0] = 0;
|
||||||
|
|
||||||
if(connect(dataSocket, (struct sockaddr *)&clientAddr, sizeof(clientAddr)))
|
if(connect(dataSocket, (struct sockaddr *)&clientAddr, sizeof(clientAddr)))
|
||||||
{
|
{
|
||||||
if(VERBOSE_MODE_ENABLED) printf("In ftpEstablishDataConnection #3 about to Close socket = %d, for sessionId = %d\n",dataSocket, sessionId);
|
if(VERBOSE_MODE_ENABLED) printf("In ftpEstablishDataConnection #3 about to Close socket = %d, for sessionId = %d\n",dataSocket, sessionId);
|
||||||
|
|
|
@ -800,8 +800,10 @@ void Mesh::load(int meshIndex, const string &dir, FILE *f, TextureManager *textu
|
||||||
uint32 flag= 1;
|
uint32 flag= 1;
|
||||||
for(int i = 0; i < meshTextureCount; ++i) {
|
for(int i = 0; i < meshTextureCount; ++i) {
|
||||||
if(meshHeader.textures & flag) {
|
if(meshHeader.textures & flag) {
|
||||||
uint8 cMapPath[mapPathSize];
|
uint8 cMapPath[mapPathSize+1];
|
||||||
|
memset(&cMapPath[0],0,mapPathSize+1);
|
||||||
readBytes = fread(cMapPath, mapPathSize, 1, f);
|
readBytes = fread(cMapPath, mapPathSize, 1, f);
|
||||||
|
cMapPath[mapPathSize] = 0;
|
||||||
if(readBytes != 1 && mapPathSize != 0) {
|
if(readBytes != 1 && mapPathSize != 0) {
|
||||||
char szBuf[8096]="";
|
char szBuf[8096]="";
|
||||||
snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u] on line: %d.",readBytes,mapPathSize,__LINE__);
|
snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u] on line: %d.",readBytes,mapPathSize,__LINE__);
|
||||||
|
@ -810,7 +812,7 @@ void Mesh::load(int meshIndex, const string &dir, FILE *f, TextureManager *textu
|
||||||
Shared::PlatformByteOrder::fromEndianTypeArray<uint8>(cMapPath, mapPathSize);
|
Shared::PlatformByteOrder::fromEndianTypeArray<uint8>(cMapPath, mapPathSize);
|
||||||
|
|
||||||
char mapPathString[mapPathSize+1]="";
|
char mapPathString[mapPathSize+1]="";
|
||||||
memset(&mapPathString[0],0,mapPathSize);
|
memset(&mapPathString[0],0,mapPathSize+1);
|
||||||
memcpy(&mapPathString[0],reinterpret_cast<char*>(cMapPath),mapPathSize);
|
memcpy(&mapPathString[0],reinterpret_cast<char*>(cMapPath),mapPathSize);
|
||||||
string mapPath= toLower(mapPathString);
|
string mapPath= toLower(mapPathString);
|
||||||
|
|
||||||
|
@ -1211,13 +1213,14 @@ void Model::loadG3d(const string &path, bool deletePixMapAfterLoad,
|
||||||
}
|
}
|
||||||
fromEndianFileHeader(fileHeader);
|
fromEndianFileHeader(fileHeader);
|
||||||
|
|
||||||
if(strncmp(reinterpret_cast<char*>(fileHeader.id), "G3D", 3) != 0) {
|
char fileId[4] = "";
|
||||||
|
memset(&fileId[0],0,4);
|
||||||
|
memcpy(&fileId[0],reinterpret_cast<char*>(fileHeader.id),3);
|
||||||
|
|
||||||
|
if(strncmp(fileId, "G3D", 3) != 0) {
|
||||||
fclose(f);
|
fclose(f);
|
||||||
f = NULL;
|
f = NULL;
|
||||||
char fileType[4]="";
|
printf("In [%s::%s] file = [%s] fileheader.id = [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,path.c_str(),fileId);
|
||||||
memset(&fileType[0],0,4);
|
|
||||||
memcpy(&fileType[0],fileHeader.id,3);
|
|
||||||
printf("In [%s::%s] file = [%s] fileheader.id = [%s][%c]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,path.c_str(),fileType,fileHeader.id[0]);
|
|
||||||
throw megaglest_runtime_error("Not a valid G3D model",true);
|
throw megaglest_runtime_error("Not a valid G3D model",true);
|
||||||
}
|
}
|
||||||
fileVersion= fileHeader.version;
|
fileVersion= fileHeader.version;
|
||||||
|
|
|
@ -114,6 +114,10 @@ std::pair<SDL_Surface*,unsigned char*> Texture2D::CreateSDLSurface(bool newPixel
|
||||||
/* Use the surface width and height expanded to powers of 2 */
|
/* Use the surface width and height expanded to powers of 2 */
|
||||||
//int w = powerOfTwo(surface->w);
|
//int w = powerOfTwo(surface->w);
|
||||||
//int h = powerOfTwo(surface->h);
|
//int h = powerOfTwo(surface->h);
|
||||||
|
if(result.first == NULL) {
|
||||||
|
throw megaglest_runtime_error("result.first == NULL");
|
||||||
|
}
|
||||||
|
|
||||||
int w = result.first->w;
|
int w = result.first->w;
|
||||||
int h = result.first->h;
|
int h = result.first->h;
|
||||||
|
|
||||||
|
|
|
@ -920,7 +920,9 @@ void MapPreview::saveToFile(const string &path) {
|
||||||
header.heightFactor = heightFactor;
|
header.heightFactor = heightFactor;
|
||||||
header.waterLevel = waterLevel;
|
header.waterLevel = waterLevel;
|
||||||
strncpy(header.title, title.c_str(), MAX_TITLE_LENGTH);
|
strncpy(header.title, title.c_str(), MAX_TITLE_LENGTH);
|
||||||
|
header.title[MAX_TITLE_LENGTH-1] = 0;
|
||||||
strncpy(header.author, author.c_str(), MAX_AUTHOR_LENGTH);
|
strncpy(header.author, author.c_str(), MAX_AUTHOR_LENGTH);
|
||||||
|
header.author[MAX_AUTHOR_LENGTH-1] = 0;
|
||||||
strncpy(header.version2.short_desc, desc.c_str(), MAX_DESCRIPTION_LENGTH_VERSION2);
|
strncpy(header.version2.short_desc, desc.c_str(), MAX_DESCRIPTION_LENGTH_VERSION2);
|
||||||
header.version2.short_desc[MAX_DESCRIPTION_LENGTH_VERSION2-1] = 0;
|
header.version2.short_desc[MAX_DESCRIPTION_LENGTH_VERSION2-1] = 0;
|
||||||
header.version2.magic= 0x01020304;
|
header.version2.magic= 0x01020304;
|
||||||
|
|
|
@ -4185,7 +4185,7 @@ mz_bool mz_zip_writer_add_mem_ex(mz_zip_archive *pZip, const char *pArchive_name
|
||||||
{
|
{
|
||||||
mz_uint16 method = 0, dos_time = 0, dos_date = 0;
|
mz_uint16 method = 0, dos_time = 0, dos_date = 0;
|
||||||
mz_uint level, ext_attributes = 0, num_alignment_padding_bytes;
|
mz_uint level, ext_attributes = 0, num_alignment_padding_bytes;
|
||||||
mz_uint64 local_dir_header_ofs = pZip->m_archive_size, cur_archive_file_ofs = pZip->m_archive_size, comp_size = 0;
|
mz_uint64 local_dir_header_ofs = 0, cur_archive_file_ofs = 0, comp_size = 0;
|
||||||
size_t archive_name_size;
|
size_t archive_name_size;
|
||||||
mz_uint8 local_dir_header[MZ_ZIP_LOCAL_DIR_HEADER_SIZE];
|
mz_uint8 local_dir_header[MZ_ZIP_LOCAL_DIR_HEADER_SIZE];
|
||||||
tdefl_compressor *pComp = NULL;
|
tdefl_compressor *pComp = NULL;
|
||||||
|
@ -4200,6 +4200,9 @@ mz_bool mz_zip_writer_add_mem_ex(mz_zip_archive *pZip, const char *pArchive_name
|
||||||
if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING) || ((buf_size) && (!pBuf)) || (!pArchive_name) || ((comment_size) && (!pComment)) || (pZip->m_total_files == 0xFFFF) || (level > MZ_UBER_COMPRESSION))
|
if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING) || ((buf_size) && (!pBuf)) || (!pArchive_name) || ((comment_size) && (!pComment)) || (pZip->m_total_files == 0xFFFF) || (level > MZ_UBER_COMPRESSION))
|
||||||
return MZ_FALSE;
|
return MZ_FALSE;
|
||||||
|
|
||||||
|
local_dir_header_ofs = pZip->m_archive_size;
|
||||||
|
cur_archive_file_ofs = pZip->m_archive_size;
|
||||||
|
|
||||||
pState = pZip->m_pState;
|
pState = pZip->m_pState;
|
||||||
|
|
||||||
if ((!(level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) && (uncomp_size))
|
if ((!(level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) && (uncomp_size))
|
||||||
|
@ -4336,7 +4339,7 @@ mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name,
|
||||||
{
|
{
|
||||||
mz_uint uncomp_crc32 = MZ_CRC32_INIT, level, num_alignment_padding_bytes;
|
mz_uint uncomp_crc32 = MZ_CRC32_INIT, level, num_alignment_padding_bytes;
|
||||||
mz_uint16 method = 0, dos_time = 0, dos_date = 0, ext_attributes = 0;
|
mz_uint16 method = 0, dos_time = 0, dos_date = 0, ext_attributes = 0;
|
||||||
mz_uint64 local_dir_header_ofs = pZip->m_archive_size, cur_archive_file_ofs = pZip->m_archive_size, uncomp_size = 0, comp_size = 0;
|
mz_uint64 local_dir_header_ofs = 0, cur_archive_file_ofs = 0, uncomp_size = 0, comp_size = 0;
|
||||||
size_t archive_name_size;
|
size_t archive_name_size;
|
||||||
mz_uint8 local_dir_header[MZ_ZIP_LOCAL_DIR_HEADER_SIZE];
|
mz_uint8 local_dir_header[MZ_ZIP_LOCAL_DIR_HEADER_SIZE];
|
||||||
MZ_FILE *pSrc_file = NULL;
|
MZ_FILE *pSrc_file = NULL;
|
||||||
|
@ -4352,6 +4355,9 @@ mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name,
|
||||||
if (!mz_zip_writer_validate_archive_name(pArchive_name))
|
if (!mz_zip_writer_validate_archive_name(pArchive_name))
|
||||||
return MZ_FALSE;
|
return MZ_FALSE;
|
||||||
|
|
||||||
|
local_dir_header_ofs = pZip->m_archive_size;
|
||||||
|
cur_archive_file_ofs = pZip->m_archive_size;
|
||||||
|
|
||||||
archive_name_size = strlen(pArchive_name);
|
archive_name_size = strlen(pArchive_name);
|
||||||
if (archive_name_size > 0xFFFF)
|
if (archive_name_size > 0xFFFF)
|
||||||
return MZ_FALSE;
|
return MZ_FALSE;
|
||||||
|
|
|
@ -2144,6 +2144,7 @@ void BroadCastClientSocketThread::execute() {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] unknown error\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] unknown error\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
::close(bcfd);
|
::close(bcfd);
|
||||||
|
@ -2153,8 +2154,6 @@ void BroadCastClientSocketThread::execute() {
|
||||||
bcfd = INVALID_SOCKET;
|
bcfd = INVALID_SOCKET;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
// Here we callback into the implementer class
|
// Here we callback into the implementer class
|
||||||
|
@ -2866,6 +2865,15 @@ void BroadCastSocketThread::execute() {
|
||||||
//char subnetmask[MAX_NIC_COUNT][100]; // Subnet mask to broadcast to
|
//char subnetmask[MAX_NIC_COUNT][100]; // Subnet mask to broadcast to
|
||||||
//struct hostent* myhostent=NULL;
|
//struct hostent* myhostent=NULL;
|
||||||
|
|
||||||
|
for(unsigned int idx = 0; idx < (unsigned int)MAX_NIC_COUNT; idx++) {
|
||||||
|
memset( &bcLocal[idx], 0, sizeof( struct sockaddr_in));
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
bcfd[idx] = INVALID_SOCKET;
|
||||||
|
#else
|
||||||
|
bcfd[idx] = INVALID_SOCKET;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
/* get my host name */
|
/* get my host name */
|
||||||
gethostname(myhostname,100);
|
gethostname(myhostname,100);
|
||||||
//struct hostent*myhostent = gethostbyname(myhostname);
|
//struct hostent*myhostent = gethostbyname(myhostname);
|
||||||
|
@ -2926,15 +2934,16 @@ void BroadCastSocketThread::execute() {
|
||||||
// Send this machine's host name and address in hostname:n.n.n.n format
|
// Send this machine's host name and address in hostname:n.n.n.n format
|
||||||
snprintf(buff,1024,"%s",myhostname);
|
snprintf(buff,1024,"%s",myhostname);
|
||||||
for(unsigned int idx1 = 0; idx1 < ipList.size(); idx1++) {
|
for(unsigned int idx1 = 0; idx1 < ipList.size(); idx1++) {
|
||||||
strcat(buff,":");
|
// strcat(buff,":");
|
||||||
strcat(buff,ipList[idx1].c_str());
|
// strcat(buff,ipList[idx1].c_str());
|
||||||
strcat(buff,":");
|
// strcat(buff,":");
|
||||||
string port_string = intToStr(this->boundPort);
|
// string port_string = intToStr(this->boundPort);
|
||||||
#ifdef WIN32
|
//#ifdef WIN32
|
||||||
strncat(buff,port_string.c_str(),min((int)port_string.length(),100));
|
// strncat(buff,port_string.c_str(),min((int)port_string.length(),100));
|
||||||
#else
|
//#else
|
||||||
strncat(buff,port_string.c_str(),std::min((int)port_string.length(),100));
|
// strncat(buff,port_string.c_str(),std::min((int)port_string.length(),100));
|
||||||
#endif
|
//#endif
|
||||||
|
snprintf(buff,1024,"%s:%s:%d",buff,ipList[idx1].c_str(),this->boundPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(difftime((long int)time(NULL),elapsed) >= 1 && getQuitStatus() == false) {
|
if(difftime((long int)time(NULL),elapsed) >= 1 && getQuitStatus() == false) {
|
||||||
|
|
|
@ -506,6 +506,16 @@ void SystemFlags::logDebugEntry(DebugType type, string debugEntry, time_t debugT
|
||||||
int idx = 1;
|
int idx = 1;
|
||||||
for(idx = 1; idx <= 100; ++idx) {
|
for(idx = 1; idx <= 100; ++idx) {
|
||||||
newlockfile = lockfile + intToStr(idx);
|
newlockfile = lockfile + intToStr(idx);
|
||||||
|
|
||||||
|
if(SystemFlags::lockFile != -1) {
|
||||||
|
#ifndef WIN32
|
||||||
|
close(SystemFlags::lockFile);
|
||||||
|
#else
|
||||||
|
_close(SystemFlags::lockFile);
|
||||||
|
#endif
|
||||||
|
SystemFlags::lockFile = -1;
|
||||||
|
SystemFlags::lockFileCountIndex = -1;
|
||||||
|
}
|
||||||
//SystemFlags::lockFile = open(newlockfile.c_str(), O_WRONLY | O_CREAT | O_EXCL, S_IRUSR|S_IWUSR);
|
//SystemFlags::lockFile = open(newlockfile.c_str(), O_WRONLY | O_CREAT | O_EXCL, S_IRUSR|S_IWUSR);
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
SystemFlags::lockFile = open(newlockfile.c_str(), O_WRONLY | O_CREAT, S_IREAD | S_IWRITE);
|
SystemFlags::lockFile = open(newlockfile.c_str(), O_WRONLY | O_CREAT, S_IREAD | S_IWRITE);
|
||||||
|
|
|
@ -228,11 +228,11 @@ int g3d2xml(FILE *infile, FILE *outfile)
|
||||||
{
|
{
|
||||||
memset(&textureName[0],0,NAMESIZE+1);
|
memset(&textureName[0],0,NAMESIZE+1);
|
||||||
nBytes = NAMESIZE;
|
nBytes = NAMESIZE;
|
||||||
if (fread(&textureName, nBytes, 1, infile) != 1)
|
if (fread(&textureName, nBytes, 1, infile) != 1) {
|
||||||
{
|
|
||||||
printf("Could not read texture name!\n");
|
printf("Could not read texture name!\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
textureName[NAMESIZE] = 0;
|
||||||
fprintf(outfile, "\t\t<Texture name=\"%s\"/>\n",
|
fprintf(outfile, "\t\t<Texture name=\"%s\"/>\n",
|
||||||
textureName);
|
textureName);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue