This breaks unitsync ABI compatibility: configFile is undefined and may be a dangling pointer if a client expects the old ABI, and since unitsync uses stdcall Init will pop the wrong number of arguments from the stack so the caller will probably crash right after Init returns.r7064 wrote: Modified: trunk/tools/unitsync/unitsync.cpp
===================================================================
--- trunk/tools/unitsync/unitsync.cpp 2008-11-18 18:38:48 UTC (rev 7063)
+++ trunk/tools/unitsync/unitsync.cpp 2008-11-18 18:40:13 UTC (rev 7064)
@@ -282,12 +282,12 @@
* AddAllArchives() you have to call Init when you want to remove the archives
* from the VFS and start with a clean state.
*/
-DLL_EXPORT int __stdcall Init(bool isServer, int id)
+DLL_EXPORT int __stdcall Init(bool isServer, int id, const char* configFile)
{
try {
_UnInit();
- ConfigHandler::Instantiate("");
+ ConfigHandler::Instantiate(configFile);
FileSystemHandler::Initialize(false);
std::vector<string> filesToCheck;
Can't Init take a sane default config file and leave switching of config file to SetSpringConfigFile?
Use GetStr() for returning strings, I'm not sure why this was exactly, but I suposse returning .c_str() caused problems in the past since everywhere in unitsync GetStr() has always been used...+DLL_EXPORT const char* __stdcall GetSpringConfigFile()
+{
+ return configHandler.GetConfigFile().c_str();
+}