summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--updater/socket.cpp42
-rw-r--r--updater/updater.dsp4
-rw-r--r--updater/updater_9.vcproj7
-rw-r--r--updater/xmldata.cpp2
4 files changed, 20 insertions, 35 deletions
diff --git a/updater/socket.cpp b/updater/socket.cpp
index 0862ad8..52a82bd 100644
--- a/updater/socket.cpp
+++ b/updater/socket.cpp
@@ -281,39 +281,30 @@ char *UpdateRequired(UpdateInternal &update_internal, bool *beta)
{
// determine whether update is required
- const char *ret = NULL;
- char *ret_beta = NULL;
+ char *ret = NULL, *ret_beta = NULL;
if (options.use_xml_backend && update_internal.file_id != -1)
{
- if( update_internal.cat == MC_UNKNOWN)
+ const char * res;
+ if (update_internal.cat == MC_UNKNOWN)
{
if (XMLDataAvailable(MC_PLUGINS) &&
- (ret = FindVersion(update_internal.file_id, update_internal.update.pbVersion, update_internal.update.cpbVersion, MC_PLUGINS)))
+ (res = FindVersion(update_internal.file_id, update_internal.update.pbVersion, update_internal.update.cpbVersion, MC_PLUGINS)))
{
update_internal.cat = MC_PLUGINS;
- if(strcmp(ret, "same") == 0)
- {
- ret = 0;
- }
+ if (strcmp(res, "same")) ret = _strdup(res);
}
else if (XMLDataAvailable(MC_LOCALIZATION) &&
- (ret = FindVersion(update_internal.file_id, update_internal.update.pbVersion, update_internal.update.cpbVersion, MC_LOCALIZATION)))
+ (res = FindVersion(update_internal.file_id, update_internal.update.pbVersion, update_internal.update.cpbVersion, MC_LOCALIZATION)))
{
update_internal.cat = MC_LOCALIZATION;
- if (strcmp(ret, "same") == 0)
- {
- ret = 0;
- }
+ if (strcmp(res, "same")) ret = _strdup(res);
}
}
else
{
- ret = FindVersion(update_internal.file_id, update_internal.update.pbVersion, update_internal.update.cpbVersion, update_internal.cat);
- if(ret && strcmp(ret, "same") == 0)
- {
- ret = 0;
- }
+ res = FindVersion(update_internal.file_id, update_internal.update.pbVersion, update_internal.update.cpbVersion, update_internal.cat);
+ if (res && strcmp(res, "same")) ret = _strdup(res);
}
}
else
@@ -328,14 +319,14 @@ char *UpdateRequired(UpdateInternal &update_internal, bool *beta)
update_internal.update.cpbBetaVersionPrefix, update_internal.update.pbVersion, update_internal.update.cpbVersion);
}
- if(ret && !ret_beta)
+ if (ret && !ret_beta)
{
if(beta) *beta = false;
- return _strdup(ret);
+ return ret;
}
- else if(!ret && ret_beta)
+ else if (!ret && ret_beta)
{
- if(beta) *beta = true;
+ if (beta) *beta = true;
return ret_beta;
}
else if (ret && ret_beta)
@@ -348,14 +339,15 @@ char *UpdateRequired(UpdateInternal &update_internal, bool *beta)
if (vRetBeta > vRet)
{
- if(beta) *beta = true;
+ free(ret);
+ if (beta) *beta = true;
return ret_beta;
}
else
{
free(ret_beta);
- if(beta) *beta = false;
- return _strdup(ret);
+ if (beta) *beta = false;
+ return ret;
}
}
diff --git a/updater/updater.dsp b/updater/updater.dsp
index 40bac6b..6d428e1 100644
--- a/updater/updater.dsp
+++ b/updater/updater.dsp
@@ -99,7 +99,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O1 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "UPDATER_EXPORTS" /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O1 /I "../../include" /I "../../../include" /I "zbin" /I "zbin/minizip" /I "bzip2-1.0.3" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "BZ_NO_STDIO" /D "_UNICODE" /D "UNICODE" /FR /YX /FD /c
+# ADD CPP /nologo /MD /W3 /Zd /O1 /I "../../include" /I "../../../include" /I "zbin" /I "zbin/minizip" /I "bzip2-1.0.3" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "BZ_NO_STDIO" /D "_UNICODE" /D "UNICODE" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0xc09 /d "NDEBUG"
@@ -110,7 +110,7 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib /nologo /base:"0x22000000" /dll /machine:I386 /out:"../../bin/release/plugins/updater.dll"
# SUBTRACT BASE LINK32 /nodefaultlib
-# ADD LINK32 comctl32.lib kernel32.lib user32.lib shell32.lib ole32.lib wsock32.lib zlib.lib /nologo /base:"0x22000000" /dll /machine:I386 /out:"../../bin/Release Unicode/plugins/updater.dll" /libpath:"zbin\x32"
+# ADD LINK32 comctl32.lib kernel32.lib user32.lib shell32.lib ole32.lib wsock32.lib zlib.lib /nologo /base:"0x22000000" /dll /debug /machine:I386 /out:"../../bin/Release Unicode/plugins/updater.dll" /libpath:"zbin\x32"
# SUBTRACT LINK32 /nodefaultlib
!ELSEIF "$(CFG)" == "updater - Win32 Debug Unicode"
diff --git a/updater/updater_9.vcproj b/updater/updater_9.vcproj
index 6091e12..9090f1f 100644
--- a/updater/updater_9.vcproj
+++ b/updater/updater_9.vcproj
@@ -58,7 +58,6 @@
PrecompiledHeaderThrough="common.h"
BrowseInformation="1"
WarningLevel="3"
- SuppressStartupBanner="true"
DebugInformationFormat="4"
CompileAs="0"
DisableSpecificWarnings="4996"
@@ -151,10 +150,8 @@
BasicRuntimeChecks="3"
RuntimeLibrary="3"
PrecompiledHeaderThrough="common.h"
- AssemblerListingLocation=".\updater___Win32_Debug_Unicode/"
BrowseInformation="1"
WarningLevel="3"
- SuppressStartupBanner="true"
DebugInformationFormat="3"
CompileAs="0"
/>
@@ -178,10 +175,6 @@
AdditionalLibraryDirectories="zbin/x64"
ModuleDefinitionFile="updater.def"
GenerateDebugInformation="true"
- ProgramDatabaseFile="$(IntDir)\$(TargetName).pdb"
- GenerateMapFile="true"
- MapFileName="$(IntDir)\$(TargetName).map"
- MapExports="true"
BaseAddress="0x22000000"
RandomizedBaseAddress="1"
ImportLibrary="$(IntDir)\$(TargetName).lib"
diff --git a/updater/xmldata.cpp b/updater/xmldata.cpp
index e8b1f3a..61239b1 100644
--- a/updater/xmldata.cpp
+++ b/updater/xmldata.cpp
@@ -400,7 +400,7 @@ const char *FindVersion(int file_id, BYTE *pbVersionBytes, int cpbVersionBytes,
char version_string[128];
strncpy(version_string, (char *)pbVersionBytes, cpbVersionBytes);
- version_string[cpbVersionBytes] = 0;
+ version_string[sizeof(version_string)-1] = 0;
ezxml_t root = ezxml_get(doc[cat], "channel", 0, "item", -1);
while (root) {