diff --git a/code/ryzom/common/src/game_share/bnp_patch.cpp b/code/ryzom/common/src/game_share/bnp_patch.cpp index fe5bdbc2b..baac733e8 100644 --- a/code/ryzom/common/src/game_share/bnp_patch.cpp +++ b/code/ryzom/common/src/game_share/bnp_patch.cpp @@ -766,7 +766,7 @@ bool CProductDescriptionForClient::load(const std::string& filePath) clear(); static CPersistentDataRecord pdr; pdr.clear(); - pdr.readFromBinFile(filePath.c_str()); + pdr.readFromBinFile(filePath); apply(pdr); return true; diff --git a/code/ryzom/common/src/game_share/persistent_data.cpp b/code/ryzom/common/src/game_share/persistent_data.cpp index 8b99692ca..b11fcf0b9 100644 --- a/code/ryzom/common/src/game_share/persistent_data.cpp +++ b/code/ryzom/common/src/game_share/persistent_data.cpp @@ -737,7 +737,7 @@ bool CPersistentDataRecord::toLines(std::string& result) return pdt.readFromPdr(*this) && pdt.writeToBuffer(reinterpret_cast(result)); } -bool CPersistentDataRecord::writeToBinFile(const char* fileName) +bool CPersistentDataRecord::writeToBinFile(const std::string &fileName) { H_AUTO(CPersistentDataRecordWriteToBinFile); @@ -750,7 +750,7 @@ bool CPersistentDataRecord::writeToBinFile(const char* fileName) // write the buffer to a file COFile f; bool open = f.open(fileName); - DROP_IF(!open,NLMISC::toString("Failed to open output file %s",fileName).c_str(),return false); + DROP_IF(!open, NLMISC::toString("Failed to open output file %s", fileName.c_str()).c_str(),return false); // write the binary data to file try @@ -759,7 +759,7 @@ bool CPersistentDataRecord::writeToBinFile(const char* fileName) } catch(...) { - DROP(NLMISC::toString("Failed to write output file: %s",fileName),return false); + DROP(NLMISC::toString("Failed to write output file: %s", fileName.c_str()),return false); } // rewind the read pointer 'cos it's at the end of file @@ -768,7 +768,7 @@ bool CPersistentDataRecord::writeToBinFile(const char* fileName) return true; } -bool CPersistentDataRecord::writeToTxtFile(const char* fileName,TStringFormat stringFormat) +bool CPersistentDataRecord::writeToTxtFile(const std::string &fileName,TStringFormat stringFormat) { H_AUTO(CPersistentDataRecordWriteToTxtFile); @@ -779,7 +779,7 @@ bool CPersistentDataRecord::writeToTxtFile(const char* fileName,TStringFormat st // write the text buffer to a file COFile f; bool open = f.open(fileName); - DROP_IF(!open,NLMISC::toString("Failed to open output file %s",fileName).c_str(),return false); + DROP_IF(!open,NLMISC::toString("Failed to open output file %s", fileName.c_str()).c_str(), return false); // write the binary data to file try @@ -788,7 +788,7 @@ bool CPersistentDataRecord::writeToTxtFile(const char* fileName,TStringFormat st } catch(...) { - DROP(NLMISC::toString("Failed to write output file: %s",fileName),return false); + DROP(NLMISC::toString("Failed to write output file: %s", fileName.c_str()), return false); } // rewind the read pointer 'cos it's at the end of file @@ -797,7 +797,7 @@ bool CPersistentDataRecord::writeToTxtFile(const char* fileName,TStringFormat st return true; } -bool CPersistentDataRecord::writeToFile(const char* fileName,TFileFormat fileFormat) +bool CPersistentDataRecord::writeToFile(const std::string &fileName, TFileFormat fileFormat) { H_AUTO(CPersistentDataRecordWriteToFile); @@ -805,18 +805,18 @@ bool CPersistentDataRecord::writeToFile(const char* fileName,TFileFormat fileFor { case BINARY_FILE: binary_file: - nlinfo("saving binary file: %s",fileName); + nlinfo("saving binary file: %s", fileName.c_str()); return writeToBinFile(fileName); case XML_FILE: xml_file: - nlinfo("saving xml file: %s",fileName); - return writeToTxtFile(fileName,XML_STRING); + nlinfo("saving xml file: %s", fileName.c_str()); + return writeToTxtFile(fileName, XML_STRING); case LINES_FILE: lines_file: - nlinfo("saving line-based txt file: %s",fileName); - return writeToTxtFile(fileName,LINES_STRING); + nlinfo("saving line-based txt file: %s", fileName.c_str()); + return writeToTxtFile(fileName, LINES_STRING); case ANY_FILE: { @@ -1113,15 +1113,15 @@ bool CPersistentDataRecord::fromBuffer(NLMISC::IStream& stream) } -bool CPersistentDataRecord::readFromFile(const char* fileName) +bool CPersistentDataRecord::readFromFile(const std::string &fileName) { H_AUTO(pdrReadFromFile) #ifdef NL_OS_WINDOWS // open the file - FILE* inf= fopen(fileName,"rb"); - DROP_IF( inf==NULL, "Failed to open input file "<Pdrs[first].writeToTxtFile( tmp.c_str() ); + animSession->Pdrs[first].writeToTxtFile( tmp ); } } diff --git a/code/ryzom/server/src/ai_share/ai_actions_dr.cpp b/code/ryzom/server/src/ai_share/ai_actions_dr.cpp index da668a725..1fa9cf40c 100644 --- a/code/ryzom/server/src/ai_share/ai_actions_dr.cpp +++ b/code/ryzom/server/src/ai_share/ai_actions_dr.cpp @@ -52,12 +52,12 @@ void CAIActionsDataRecordPtr::clear() void CAIActionsDataRecordPtr::readFile(const std::string &fileName) { - _PdrPtr->readFromFile(fileName.c_str()); + _PdrPtr->readFromFile(fileName); } void CAIActionsDataRecordPtr::writeFile(const std::string &fileName) { - _PdrPtr->writeToFile(fileName.c_str()); + _PdrPtr->writeToFile(fileName); } void CAIActionsDataRecordPtr::display() diff --git a/code/ryzom/server/src/backup_service/commands.cpp b/code/ryzom/server/src/backup_service/commands.cpp index 79ac6c0f3..4bbdb9dc9 100644 --- a/code/ryzom/server/src/backup_service/commands.cpp +++ b/code/ryzom/server/src/backup_service/commands.cpp @@ -121,7 +121,7 @@ NLMISC_COMMAND ( dumpCharacterFile, "dump the content of the save file for a cha static CPersistentDataRecord pdr; pdr.clear(); - if (!pdr.readFromBinFile(fileName.c_str())) + if (!pdr.readFromBinFile(fileName)) { log.displayNL("Error while reading file '%s'", fileName.c_str()); return true; diff --git a/code/ryzom/server/src/entities_game_service/admin.cpp b/code/ryzom/server/src/entities_game_service/admin.cpp index 22254c64b..ee9eb2630 100644 --- a/code/ryzom/server/src/entities_game_service/admin.cpp +++ b/code/ryzom/server/src/entities_game_service/admin.cpp @@ -2199,7 +2199,7 @@ NLMISC_CATEGORISED_COMMAND(pdr,saveToXML,"save a character to an XML file","store(pdr); - pdr.writeToTxtFile((fileName+".xml").c_str()); + pdr.writeToTxtFile(fileName+".xml"); return true; } @@ -2225,7 +2225,7 @@ NLMISC_CATEGORISED_COMMAND(pdr,loadFromXML,"load a character from an XML file"," static CPersistentDataRecord pdr; pdr.clear(); - pdr.readFromTxtFile((fileName+".xml").c_str()); + pdr.readFromTxtFile(fileName+".xml"); c->apply(pdr); c->setName(name); c->setGuildId(guildId); @@ -2256,7 +2256,7 @@ NLMISC_CATEGORISED_COMMAND(pdr,saveToPDR,"save a character to a binary PDR file" static CPersistentDataRecordRyzomStore pdr; pdr.clear(); c->store(pdr); - pdr.writeToBinFile((fileName+".pdr").c_str()); + pdr.writeToBinFile(fileName+".pdr"); return true; } @@ -2282,7 +2282,7 @@ NLMISC_CATEGORISED_COMMAND(pdr,loadFromPDR,"load a character from a binary PDR f static CPersistentDataRecord pdr; pdr.clear(); - pdr.readFromBinFile((fileName+".pdr").c_str()); + pdr.readFromBinFile(fileName+".pdr"); c->apply(pdr); c->setName(name); diff --git a/code/ryzom/server/src/entities_game_service/entities_game_service.cpp b/code/ryzom/server/src/entities_game_service/entities_game_service.cpp index e6d4d3d8c..fa0985692 100644 --- a/code/ryzom/server/src/entities_game_service/entities_game_service.cpp +++ b/code/ryzom/server/src/entities_game_service/entities_game_service.cpp @@ -1720,7 +1720,7 @@ NLMISC_COMMAND(loadCharacterNames,"load all character save games and extract nam pdr.clear(); { H_AUTO(LoadCharacterNamesLoadFile); - pdr.readFromFile((*it).second.FileName.c_str()); + pdr.readFromFile((*it).second.FileName); } CCharacterNameExtraction nameExtractor; { @@ -1760,25 +1760,25 @@ NLMISC_COMMAND(loadCharacterNames,"load all character save games and extract nam // // std read tst // static CPersistentDataRecord pdrRead(""); // pdrRead.clear(); -// pdrRead.readFromBinFile(files[i].c_str()); -// pdrRead.writeToTxtFile((saveDir + "test/txt_read/" + CFile::getFilenameWithoutExtension(file) + ".txt").c_str(), CPersistentDataRecord::LINES_STRING); +// pdrRead.readFromBinFile(files[i]); +// pdrRead.writeToTxtFile(saveDir + "test/txt_read/" + CFile::getFilenameWithoutExtension(file) + ".txt", CPersistentDataRecord::LINES_STRING); // // // read write tst (even with a bad used RyzomStore class) // static CPersistentDataRecordRyzomStore pdr; // pdr.clear(); -// pdr.readFromBinFile(files[i].c_str()); +// pdr.readFromBinFile(files[i]); // TTime t0= CTime::getLocalTime(); -// pdr.writeToBinFile((saveDir + "test/bin_new/" + file).c_str()); +// pdr.writeToBinFile(saveDir + "test/bin_new/" + file); // TTime t1= CTime::getLocalTime(); // nlinfo("resaved %s in %d ms", file.c_str(), uint32(t1-t0)); -// pdr.writeToTxtFile((saveDir + "test/txt_before/" + CFile::getFilenameWithoutExtension(file) + ".txt").c_str(), CPersistentDataRecord::LINES_STRING); +// pdr.writeToTxtFile(saveDir + "test/txt_before/" + CFile::getFilenameWithoutExtension(file) + ".txt", CPersistentDataRecord::LINES_STRING); // } // // ReLoad // { // static CPersistentDataRecordRyzomStore pdr; // pdr.clear(); -// pdr.readFromBinFile((saveDir + "test/bin_new/" + file).c_str()); -// pdr.writeToTxtFile((saveDir + "test/txt_after/" + CFile::getFilenameWithoutExtension(file) + ".txt").c_str(), CPersistentDataRecord::LINES_STRING); +// pdr.readFromBinFile(saveDir + "test/bin_new/" + file); +// pdr.writeToTxtFile(saveDir + "test/txt_after/" + CFile::getFilenameWithoutExtension(file) + ".txt", CPersistentDataRecord::LINES_STRING); // } // } // } @@ -1813,10 +1813,10 @@ NLMISC_COMMAND(loadCharacterNames,"load all character save games and extract nam // { // static CPersistentDataRecord pdr; // pdr.clear(); -// pdr.readFromFile(files[i].c_str()); +// pdr.readFromFile(files[i]); // string txtFile= files[i]; // strFindReplace(txtFile, ".bin", ".txt"); -// pdr.writeToTxtFile(txtFile.c_str(), CPersistentDataRecord::LINES_STRING); +// pdr.writeToTxtFile(txtFile, CPersistentDataRecord::LINES_STRING); // } // } // } diff --git a/code/ryzom/server/src/entities_game_service/game_event_manager.cpp b/code/ryzom/server/src/entities_game_service/game_event_manager.cpp index b95fb1ad4..d96f122b9 100644 --- a/code/ryzom/server/src/entities_game_service/game_event_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/game_event_manager.cpp @@ -66,7 +66,7 @@ void CGameEventManager::init() { static CPersistentDataRecord pdr; pdr.clear(); - pdr.readFromTxtFile(sFilename.c_str()); + pdr.readFromTxtFile(sFilename); apply(pdr); createEventChannel(); } @@ -308,7 +308,7 @@ void CGameEventManager::saveGameEventFile() static CPersistentDataRecordRyzomStore pdr; pdr.clear(); store(pdr); - pdr.writeToTxtFile(sFilename.c_str()); + pdr.writeToTxtFile(sFilename); } } diff --git a/code/ryzom/server/src/entities_game_service/guild_manager/guild_commands.cpp b/code/ryzom/server/src/entities_game_service/guild_manager/guild_commands.cpp index 9169443a6..3e840bd43 100644 --- a/code/ryzom/server/src/entities_game_service/guild_manager/guild_commands.cpp +++ b/code/ryzom/server/src/entities_game_service/guild_manager/guild_commands.cpp @@ -510,7 +510,7 @@ NLMISC_COMMAND( importGuildFile, "Import a guild file into the server", " 0) { // this is a guild file. We can load it - pdr.readFromBinFile(args[0].c_str()); + pdr.readFromBinFile(args[0]); guildId = id; } @@ -540,7 +540,7 @@ NLMISC_COMMAND( importGuildFile, "Import a guild file into the server", " 0) { // this is a guild file. We can load it - pdr.readFromTxtFile(args[0].c_str()); + pdr.readFromTxtFile(args[0]); guildId = id; } else diff --git a/code/ryzom/server/src/entities_game_service/guild_manager/guild_manager.cpp b/code/ryzom/server/src/entities_game_service/guild_manager/guild_manager.cpp index bb99c253f..a84f797dd 100644 --- a/code/ryzom/server/src/entities_game_service/guild_manager/guild_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/guild_manager/guild_manager.cpp @@ -328,7 +328,7 @@ void CGuildManager::saveGuild( CGuild* guild ) { H_AUTO( CGuildManagerUpdate_PDR_WRITE_TEXT ) string fileName = Bsi.getLocalPath()+NLMISC::toString("guilds/guild_%05u.txt", id & 0x000fffff); - pdr.writeToTxtFile(fileName.c_str()); + pdr.writeToTxtFile(fileName); } else { @@ -360,7 +360,7 @@ void CGuildManager::saveGuild( CGuild* guild ) else { H_AUTO( CGuildManagerUpdatePDR_WRITE_BIN_NO_PDS ) - pdr.writeToBinFile((Bsi.getLocalPath() + fileName).c_str()); + pdr.writeToBinFile(Bsi.getLocalPath() + fileName); } } diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_queue_manager.cpp b/code/ryzom/server/src/entities_game_service/mission_manager/mission_queue_manager.cpp index a821eef45..76ddcc3ae 100644 --- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_queue_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_queue_manager.cpp @@ -55,7 +55,7 @@ void CMissionQueueManager::init() { static CPersistentDataRecord pdr; pdr.clear(); - pdr.readFromTxtFile(sFilename.c_str()); + pdr.readFromTxtFile(sFilename); apply(pdr); } _InitOk = true; diff --git a/code/ryzom/server/src/entities_game_service/outpost_manager/outpost_manager.cpp b/code/ryzom/server/src/entities_game_service/outpost_manager/outpost_manager.cpp index 3fa6429a5..681a9d7dd 100644 --- a/code/ryzom/server/src/entities_game_service/outpost_manager/outpost_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/outpost_manager/outpost_manager.cpp @@ -430,7 +430,7 @@ void COutpostManager::loadOutpostSaveFiles() // // load dynamic data // static CPersistentDataRecord pdr; // pdr.clear(); -// pdr.readFromBinFile(files[i].c_str()); +// pdr.readFromBinFile(files[i]); // outpost->apply( pdr ); // loadedOutposts.push_back( outpost ); // } @@ -808,7 +808,7 @@ void COutpostManager::saveOutpost(NLMISC::CSmartPtr outpost) else { H_AUTO( COutpostManagerSTORE_NO_BS ) - pdr.writeToBinFile((Bsi.getLocalPath() + fileName).c_str()); + pdr.writeToBinFile(Bsi.getLocalPath() + fileName); } } diff --git a/code/ryzom/server/src/entities_game_service/player_manager/player.cpp b/code/ryzom/server/src/entities_game_service/player_manager/player.cpp index 03efc8291..fa5e216ae 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/player.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/player.cpp @@ -831,7 +831,7 @@ void CPlayer::loadAllCharacters() bool isOK; { H_AUTO(LoadAllCharactersPdrBinReadFile); - isOK= pdr.readFromBinFile(pdrBinFileName.c_str()); + isOK= pdr.readFromBinFile(pdrBinFileName); } if (!isOK) break; @@ -854,7 +854,7 @@ void CPlayer::loadAllCharacters() bool isOK; { H_AUTO(LoadAllCharactersPdrXmlReadFile); - isOK= pdr.readFromTxtFile(pdrXmlFileName.c_str()); + isOK= pdr.readFromTxtFile(pdrXmlFileName); } if (!isOK) break; @@ -975,7 +975,7 @@ void CPlayer::loadAllCharactersPdr() // try loading the save data from disk try { - bool isOK= pdr.readFromFile(fileName.c_str()); + bool isOK= pdr.readFromFile(fileName); if (!isOK) continue; } @@ -1478,11 +1478,11 @@ NLMISC_CATEGORISED_COMMAND(egs, convertToPdr, "Load all possible characters from bool writeSuccess = false; if (xml) { - writeSuccess = pdr.writeToTxtFile(dstFile.c_str()); + writeSuccess = pdr.writeToTxtFile(dstFile); } else { - writeSuccess = pdr.writeToBinFile(dstFile.c_str()); + writeSuccess = pdr.writeToBinFile(dstFile); } // check file can be read back @@ -1491,7 +1491,7 @@ NLMISC_CATEGORISED_COMMAND(egs, convertToPdr, "Load all possible characters from static CPersistentDataRecord pdrTest; pdrTest.clear(); - if (pdrTest.readFromFile(dstFile.c_str())) + if (pdrTest.readFromFile(dstFile)) { CCharacter* characterTest = new CCharacter(); characterTest->setId( PlayerManager.createCharacterId( UserId, CharId ) ); diff --git a/code/ryzom/server/src/entities_game_service/player_manager/player_manager.cpp b/code/ryzom/server/src/entities_game_service/player_manager/player_manager.cpp index befc0d95c..d02da2948 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/player_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/player_manager.cpp @@ -846,7 +846,7 @@ void CPlayerManager::savePlayerCharRecurs( uint32 userId, sint32 idx, std::set %s",fd.FileName.c_str(),outputFileName.c_str()); static CPersistentDataRecord pdr; pdr.clear(); - pdr.readFromFile(fd.FileName.c_str()); - pdr.writeToFile(outputFileName.c_str()); + pdr.readFromFile(fd.FileName); + pdr.writeToFile(outputFileName); } } @@ -170,8 +170,8 @@ NLMISC_CATEGORISED_COMMAND(utils,pdr2bin,"convert one or more sets of pdr files log.displayNL("Converting to Binary : %s => %s",fd.FileName.c_str(),outputFileName.c_str()); static CPersistentDataRecord pdr; pdr.clear(); - pdr.readFromFile(fd.FileName.c_str()); - pdr.writeToFile(outputFileName.c_str()); + pdr.readFromFile(fd.FileName); + pdr.writeToFile(outputFileName); } } @@ -202,8 +202,8 @@ NLMISC_CATEGORISED_COMMAND(utils,pdr2txt,"convert one or more sets of pdr files log.displayNL("Converting to TXT : %s => %s",fd.FileName.c_str(),outputFileName.c_str()); static CPersistentDataRecord pdr; pdr.clear(); - pdr.readFromFile(fd.FileName.c_str()); - pdr.writeToFile(outputFileName.c_str()); + pdr.readFromFile(fd.FileName); + pdr.writeToFile(outputFileName); } } @@ -218,10 +218,10 @@ NLMISC_CATEGORISED_COMMAND(utils,pdrFileCompare,"Compare 2 pdr files","