From c14550edfa82963f3077416c679ab7e4db7dc65f Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 19 Mar 2016 16:21:06 +0100 Subject: [PATCH] Fixed: Use nlfopen in tools and servers --- code/nel/include/nel/pipeline/tool_logger.h | 5 ++- code/nel/samples/3d/cluster_viewer/main.cpp | 3 +- code/nel/samples/net/service/chat_service.cpp | 2 +- code/nel/samples/net/udp/bench_service.cpp | 7 ++-- code/nel/samples/net/udp/client.cpp | 5 ++- code/nel/tools/3d/file_info/main.cpp | 5 +-- code/nel/tools/3d/lightmap_optimizer/main.cpp | 3 +- .../nel_export/nel_export_lightmap_v2.cpp | 9 +++-- .../3d/shapes_exporter/shapes_exporter.cpp | 5 ++- code/nel/tools/3d/tga_2_dds/tga2dds.cpp | 5 ++- code/nel/tools/3d/zone_welder/zone_welder.cpp | 3 +- code/nel/tools/3d/zviewer/zviewer.cpp | 5 ++- .../tools/georges/georges2csv/georges2csv.cpp | 6 ++- .../tools/misc/data_mirror/data_mirrorDlg.cpp | 30 ++++++++++----- code/nel/tools/misc/disp_sheet_id/main.cpp | 3 +- .../misc/make_sheet_id/make_sheet_id.cpp | 5 ++- code/nel/tools/misc/xml_packer/xml_packer.cpp | 15 ++++---- .../admin_executor_service.cpp | 8 ++-- .../nel_launcher_windows_ext2/patch.cpp | 3 +- .../server/src/admin_modules/aes_module.cpp | 15 ++++---- .../server/src/admin_modules/as_module.cpp | 5 ++- .../server/src/ai_data_service/pacs_scan.cpp | 7 ++-- .../src/ai_service/ai_script_data_manager.cpp | 2 +- .../src/entities_game_service/deposit.cpp | 3 +- .../game_item_manager/game_item.cpp | 3 +- .../game_item_manager/game_item_manager.cpp | 2 +- .../entities_game_service/harvest_source.cpp | 4 +- .../phrase_manager/fg_prospection_phrase.cpp | 4 +- .../player_manager/cdb_synchronised.cpp | 2 +- .../player_manager/player.cpp | 4 +- .../cl_contest_logger.cpp | 2 +- .../rr_repository_reciever.cpp | 2 +- .../src/log_analyser_service/commands.cpp | 2 +- .../src/logger_service/logger_service.cpp | 3 +- .../src/patchman_service/file_manager.cpp | 3 +- .../rr_repository_reciever.cpp | 2 +- .../spt_server_patch_terminal.cpp | 5 ++- .../ryzom/server/src/pd_lib/pd_server_utils.h | 3 +- .../src/pd_support_service/daily_commands.cpp | 3 +- .../pd_support_service/hourly_commands.cpp | 3 +- .../testing_tool_service.cpp | 3 +- .../mission_compiler_feDlg.cpp | 5 ++- .../mission_compiler_lib/mission_compiler.cpp | 3 +- .../tools/leveldesign/mp_generator/main.cpp | 3 +- .../tools/leveldesign/mp_generator/utils.h | 4 +- .../named_items_2_csv/named_items_2_csv.cpp | 12 +++--- .../primitive_id_assignator.cpp | 3 +- .../tools/leveldesign/uni_conv/uni_conv.cpp | 3 +- .../world_editor/world_editor/main_frm.cpp | 3 +- code/ryzom/tools/occ2huff/occ2huff.cpp | 2 +- code/ryzom/tools/pd_parser/templatizer.h | 2 +- .../phrase_generator/phrase_generator.cpp | 37 ++++++++++--------- .../sheet_random_generator.cpp | 5 ++- .../sheet_random_generator/srg_utilities.h | 17 +++++---- code/ryzom/tools/translation_tools/main.cpp | 3 +- code/ryzom/tools/xml_packer/xml_packer.cpp | 13 ++++--- .../mission_compiler/validation_file.cpp | 3 +- .../increment_version/increment_version.cpp | 3 +- .../path_content_diff/path_content_diff.cpp | 3 +- 59 files changed, 193 insertions(+), 140 deletions(-) diff --git a/code/nel/include/nel/pipeline/tool_logger.h b/code/nel/include/nel/pipeline/tool_logger.h index 55b3b2455..714f46d2d 100644 --- a/code/nel/include/nel/pipeline/tool_logger.h +++ b/code/nel/include/nel/pipeline/tool_logger.h @@ -39,6 +39,7 @@ // NeL includes #include #include +#include // Project includes @@ -102,7 +103,7 @@ public: { releaseError(); - m_ErrorLog = fopen(errorLog.c_str(), "wt"); + m_ErrorLog = nlfopen(errorLog, "wt"); fwrite(s_ErrorHeader.c_str(), 1, s_ErrorHeader.length(), m_ErrorLog); fwrite("\n", 1, 1, m_ErrorLog); fflush(m_ErrorLog); @@ -113,7 +114,7 @@ public: { releaseDepend(); - m_DependLog = fopen(dependLog.c_str(), "wt"); + m_DependLog = nlfopen(dependLog, "wt"); fwrite(s_DependHeader.c_str(), 1, s_DependHeader.length(), m_DependLog); fwrite("\n", 1, 1, m_DependLog); // fflush(m_DependLog); diff --git a/code/nel/samples/3d/cluster_viewer/main.cpp b/code/nel/samples/3d/cluster_viewer/main.cpp index d7956adbe..ef05d557e 100644 --- a/code/nel/samples/3d/cluster_viewer/main.cpp +++ b/code/nel/samples/3d/cluster_viewer/main.cpp @@ -23,6 +23,7 @@ #include "nel/misc/types_nl.h" #include "nel/misc/file.h" +#include "nel/misc/common.h" #include "nel/misc/path.h" #include "nel/misc/bitmap.h" #include "nel/misc/events.h" @@ -115,7 +116,7 @@ void LoadSceneScript (const char *ScriptName, CScene* pScene, vector &D float posx, posy, posz; float roti, rotj, rotk; - FILE *f = fopen (CPath::lookup(ScriptName).c_str(),"rb"); + FILE *f = nlfopen (CPath::lookup(ScriptName), "rb"); fseek (f, 0, SEEK_END); uint file_size = ftell (f); fseek (f, 0, SEEK_SET); diff --git a/code/nel/samples/net/service/chat_service.cpp b/code/nel/samples/net/service/chat_service.cpp index 36b438e44..c2efc71f4 100644 --- a/code/nel/samples/net/service/chat_service.cpp +++ b/code/nel/samples/net/service/chat_service.cpp @@ -60,7 +60,7 @@ public: nlinfo ("init() was called"); -// fp = fopen (NLMISC::CFile::findNewFile("stat.csv").c_str(), "wt"); +// fp = nlfopen (NLMISC::CFile::findNewFile("stat.csv"), "wt"); } bool update () diff --git a/code/nel/samples/net/udp/bench_service.cpp b/code/nel/samples/net/udp/bench_service.cpp index 4b75a6b93..22f570260 100644 --- a/code/nel/samples/net/udp/bench_service.cpp +++ b/code/nel/samples/net/udp/bench_service.cpp @@ -33,6 +33,7 @@ #endif +#include "nel/misc/common.h" #include "nel/misc/debug.h" #include "nel/misc/mem_stream.h" #include "nel/misc/path.h" @@ -276,11 +277,11 @@ void CClient::updatePong (sint64 pingTime, sint64 pongTime, uint32 pongNumber, u } string fn = StatPathName + ConnectionName + "_" + ha + "_" + getDate() + ".pong"; - FILE *fp = fopen (fn.c_str(), "rt"); + FILE *fp = nlfopen (fn, "rt"); if (fp == NULL) { // new file, add the header - FILE *fp = fopen (fn.c_str(), "wt"); + FILE *fp = nlfopen (fn, "wt"); if (fp != NULL) { fprintf (fp, "#%s\t%s\t%s\t%s\n", "PingTime", "PongTime", "Delta", "PingNumber"); @@ -292,7 +293,7 @@ void CClient::updatePong (sint64 pingTime, sint64 pongTime, uint32 pongNumber, u fclose (fp); } - fp = fopen (fn.c_str(), "at"); + fp = nlfopen (fn, "at"); if (fp == NULL) { nlwarning ("Can't open pong file name '%s'", fn.c_str()); diff --git a/code/nel/samples/net/udp/client.cpp b/code/nel/samples/net/udp/client.cpp index 90de35bb2..0cdb98c53 100644 --- a/code/nel/samples/net/udp/client.cpp +++ b/code/nel/samples/net/udp/client.cpp @@ -21,6 +21,7 @@ #include "nel/misc/types_nl.h" #include "nel/misc/debug.h" +#include "nel/misc/common.h" #include "nel/misc/mem_stream.h" #include "nel/misc/time_nl.h" #include "nel/misc/config_file.h" @@ -112,7 +113,7 @@ void exit (const string &reason) void createConfigFile() { - FILE *fp = fopen ("client.cfg", "wt"); + FILE *fp = nlfopen ("client.cfg", "wt"); if (fp == NULL) { InfoLog->displayRawNL ("Can't create client.cfg"); @@ -159,7 +160,7 @@ void checkConnectionName () void loadConfigFile () { - FILE *fp = fopen ("client.cfg", "rt"); + FILE *fp = nlfopen ("client.cfg", "rt"); if (fp == NULL) { createConfigFile(); diff --git a/code/nel/tools/3d/file_info/main.cpp b/code/nel/tools/3d/file_info/main.cpp index b781e43fe..e8c6e072b 100644 --- a/code/nel/tools/3d/file_info/main.cpp +++ b/code/nel/tools/3d/file_info/main.cpp @@ -17,6 +17,7 @@ #include "nel/misc/file.h" #include "nel/misc/path.h" +#include "nel/misc/common.h" #include "nel/3d/scene_group.h" #include "nel/3d/zone.h" #include "nel/3d/skeleton_shape.h" @@ -660,9 +661,7 @@ int main(int argc, const char *argv[]) options.insert (argv[i]); // Open log - FILE *logStream; - logStream= fopen(std::string(getLogDirectory() + "file_info.log").c_str(), "wt"); - + FILE *logStream = nlfopen(getLogDirectory() + "file_info.log", "wt"); // parse dir or file ?? const char *fileName= argv[1]; diff --git a/code/nel/tools/3d/lightmap_optimizer/main.cpp b/code/nel/tools/3d/lightmap_optimizer/main.cpp index f7e999799..2e1f0f47c 100644 --- a/code/nel/tools/3d/lightmap_optimizer/main.cpp +++ b/code/nel/tools/3d/lightmap_optimizer/main.cpp @@ -998,7 +998,8 @@ int main(int nNbArg, char **ppArgs) ChDir (sExeDir); // out a text file, with list of - FILE *out= fopen(ppArgs[4], "wt"); + FILE *out = nlfopen(ppArgs[4], "wt"); + if(!out) { outString(string("ERROR: cannot save ")+ppArgs[4]); diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_lightmap_v2.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_lightmap_v2.cpp index b79e4884f..f6cd6b80d 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_lightmap_v2.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_lightmap_v2.cpp @@ -8,6 +8,7 @@ #include "nel/misc/time_nl.h" #include "nel/misc/file.h" +#include "nel/misc/common.h" #include "nel/misc/triangle.h" #include "nel/misc/bsphere.h" #include "3d/quad_tree.h" @@ -3121,8 +3122,8 @@ void CNelExport::deleteLM(INode& ZeNode) sprintf( tmp, "%d", i ); sSaveName += tmp; sSaveName += ".tga"; - FILE *file; - if( file = fopen(sSaveName.c_str(),"rb") ) + FILE *file = nlfopen(sSaveName, "rb") + if (file) { fclose( file ); DeleteFile( sSaveName.c_str() ); @@ -3521,8 +3522,8 @@ bool CNelExport::exportScene(std::vector& vectNode) sprintf( tmp, "%d", i ); sSaveName += tmp; sSaveName += ".tga"; - FILE *file; - if( file = fopen(sSaveName.c_str(),"rb") ) + FILE *file = nlfopen(sSaveName, "rb"); + if (file) { fclose( file ); DeleteFile( sSaveName.c_str() ); diff --git a/code/nel/tools/3d/shapes_exporter/shapes_exporter.cpp b/code/nel/tools/3d/shapes_exporter/shapes_exporter.cpp index 0c4d08c4a..a63fcc969 100644 --- a/code/nel/tools/3d/shapes_exporter/shapes_exporter.cpp +++ b/code/nel/tools/3d/shapes_exporter/shapes_exporter.cpp @@ -15,6 +15,7 @@ // along with this program. If not, see . #include +#include #include #include #include @@ -851,7 +852,7 @@ bool ShapesExporter::renderPS(UInstance &entity, const string &output_path, doub { if(step > 0) { - FILE *fp = fopen(string(CPath::standardizePath(output_path)+"nb_steps.txt").c_str(), "w"); + FILE *fp = nlfopen(CPath::standardizePath(output_path)+"nb_steps.txt", "w"); if(fp) { fprintf(fp, "%d", step); fclose(fp); } } nlinfo("PS duration %f after %f with nothing with %d steps, dt %f", duration, startTime, step, deltaTime); @@ -873,7 +874,7 @@ bool ShapesExporter::createThumbnail(const string &filename, const string &path) uint selectedFrame = 0; if(CFile::getExtension(filename) == "ps") { - FILE *fp = fopen(string(CPath::standardizePath(output_path)+"nb_steps.txt").c_str(), "r"); + FILE *fp = nlfopen(CPath::standardizePath(output_path)+"nb_steps.txt", "r"); if(fp) { char str[100]; diff --git a/code/nel/tools/3d/tga_2_dds/tga2dds.cpp b/code/nel/tools/3d/tga_2_dds/tga2dds.cpp index 7f3275694..5e40a4cca 100644 --- a/code/nel/tools/3d/tga_2_dds/tga2dds.cpp +++ b/code/nel/tools/3d/tga_2_dds/tga2dds.cpp @@ -18,6 +18,7 @@ #include #include "nel/misc/file.h" +#include "nel/misc/common.h" #include "nel/misc/bitmap.h" #include "nel/misc/path.h" #include "nel/misc/debug.h" @@ -49,7 +50,7 @@ std::string getOutputFileName(const std::string &inputFileName); uint8 getType(const std::string &sFileNameDest) { uint32 dds; - FILE *f = fopen(sFileNameDest.c_str(),"rb"); + FILE *f = nlfopen(sFileNameDest, "rb"); if(f==NULL) { return NOT_DEFINED; @@ -105,7 +106,7 @@ uint8 getType(const std::string &sFileNameDest) bool sameType(const std::string &sFileNameDest, uint8 &algo, bool wantMipMap) { uint32 dds; - FILE *f = fopen(sFileNameDest.c_str(),"rb"); + FILE *f = nlfopen(sFileNameDest, "rb"); if(f==NULL) { return false; diff --git a/code/nel/tools/3d/zone_welder/zone_welder.cpp b/code/nel/tools/3d/zone_welder/zone_welder.cpp index f30a4b38b..7ca1d822a 100644 --- a/code/nel/tools/3d/zone_welder/zone_welder.cpp +++ b/code/nel/tools/3d/zone_welder/zone_welder.cpp @@ -20,6 +20,7 @@ #include #include "nel/misc/types_nl.h" #include "nel/misc/file.h" +#include "nel/misc/common.h" #include "nel/3d/quad_tree.h" #include "nel/3d/zone.h" #include "nel/3d/landscape.h" @@ -978,7 +979,7 @@ int main(sint argc, char **argv) } #if WELD_LOG - fdbg = fopen("log.txt","wt"); + fdbg = nlfopen("log.txt","wt"); fprintf(fdbg,"Center zone : %s\n",argv[1]); #endif diff --git a/code/nel/tools/3d/zviewer/zviewer.cpp b/code/nel/tools/3d/zviewer/zviewer.cpp index 9d64badb1..c5f4419a4 100644 --- a/code/nel/tools/3d/zviewer/zviewer.cpp +++ b/code/nel/tools/3d/zviewer/zviewer.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -743,7 +744,7 @@ void displayZones() \****************************************************************/ void writeConfigFile(const char * configFileName) { - FILE * f = fopen(configFileName,"wt"); + FILE * f = nlfopen(configFileName, "wt"); if(f==NULL) { @@ -801,7 +802,7 @@ void writeConfigFile(const char * configFileName) \****************************************************************/ void initViewerConfig(const char * configFileName) { - FILE * f = fopen(configFileName,"rt"); + FILE *f = nlfopen(configFileName, "rt"); if(f==NULL) { nlwarning("'%s' not found, default values used", configFileName); diff --git a/code/nel/tools/georges/georges2csv/georges2csv.cpp b/code/nel/tools/georges/georges2csv/georges2csv.cpp index 018a6abff..339479bfe 100644 --- a/code/nel/tools/georges/georges2csv/georges2csv.cpp +++ b/code/nel/tools/georges/georges2csv/georges2csv.cpp @@ -32,6 +32,7 @@ #include "nel/misc/file.h" #include "nel/misc/smart_ptr.h" #include "nel/misc/command.h" +#include "nel/misc/common.h" #include "nel/misc/path.h" //#include "nel/memory/memory_manager.h" #include "nel/misc/i18n.h" @@ -685,12 +686,13 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType { const uint BUFFER_SIZE = 16*1024; char lineBuffer[BUFFER_SIZE]; - FILE *s; vector fields; vector args; - if ((s = fopen(file.c_str(), "r")) == NULL) + FILE *s = nlfopen(file, "r"); + + if (s == NULL) { fprintf(stderr, "Can't find file %s to convert\n", file.c_str()); return; diff --git a/code/nel/tools/misc/data_mirror/data_mirrorDlg.cpp b/code/nel/tools/misc/data_mirror/data_mirrorDlg.cpp index 100bd4e9c..340655e36 100644 --- a/code/nel/tools/misc/data_mirror/data_mirrorDlg.cpp +++ b/code/nel/tools/misc/data_mirror/data_mirrorDlg.cpp @@ -20,6 +20,7 @@ #include "progress_dialog.h" #include #include "nel/misc/file.h" +#include "nel/misc/common.h" using namespace std; using namespace NLMISC; @@ -468,9 +469,13 @@ void CData_mirrorDlg::OnOK() if (!LogDirectory.empty()) { string sTmp = LogDirectory + "data_mirror.txt"; - FILE *f = fopen(sTmp.c_str(),"at"); - fprintf(f,"Modified file : %s\n", dest.c_str()); - fclose(f); + FILE *f = nlfopen(sTmp ,"at"); + + if (f) + { + fprintf(f,"Modified file : %s\n", dest.c_str()); + fclose(f); + } } } @@ -503,9 +508,12 @@ void CData_mirrorDlg::OnOK() if (!LogDirectory.empty()) { string sTmp = LogDirectory + "data_mirror.txt"; - FILE *f = fopen(sTmp.c_str(),"at"); - fprintf(f,"Added file : %s\n", dest.c_str()); - fclose(f); + FILE *f = nlfopen(sTmp, "at"); + if (f) + { + fprintf(f,"Added file : %s\n", dest.c_str()); + fclose(f); + } } } @@ -535,9 +543,13 @@ void CData_mirrorDlg::OnOK() if (!LogDirectory.empty()) { string sTmp = LogDirectory + "data_mirror.txt"; - FILE *f = fopen(sTmp.c_str(),"at"); - fprintf(f,"Removed file : %s\n", dest.c_str()); - fclose(f); + FILE *f = nlfopen(sTmp, "at"); + + if (f) + { + fprintf(f,"Removed file : %s\n", dest.c_str()); + fclose(f); + } } } } diff --git a/code/nel/tools/misc/disp_sheet_id/main.cpp b/code/nel/tools/misc/disp_sheet_id/main.cpp index 7445023ce..c7fe6f782 100644 --- a/code/nel/tools/misc/disp_sheet_id/main.cpp +++ b/code/nel/tools/misc/disp_sheet_id/main.cpp @@ -40,6 +40,7 @@ int _getch() #include "nel/misc/path.h" #include "nel/misc/sheet_id.h" +#include "nel/misc/common.h" #include @@ -86,7 +87,7 @@ int main(int argc, const char *argv[]) sort(sheets.begin(), sheets.end(), Pred); // display. - FILE *out= fopen("sheetid.txt", "wb"); + FILE *out= nlfopen("sheetid.txt", "wb"); if(out) { for(uint i=0;i #include +#include #include #include @@ -567,9 +568,9 @@ int main( int argc, char ** argv ) // dump the list of extensions in a txt file if( dumpExtensions ) { - FILE * extListOutput; string extListFileName = outputPath + "sheet_ext.txt"; - if( !(extListOutput = fopen(extListFileName.c_str(),"w")) ) + FILE *extListOutput = nlfopen(extListFileName, "w"); + if (!extListOutput) { nlwarning("Can't open output file %s",extListFileName.c_str()); return 1; diff --git a/code/nel/tools/misc/xml_packer/xml_packer.cpp b/code/nel/tools/misc/xml_packer/xml_packer.cpp index 2d7695de4..7f7417020 100644 --- a/code/nel/tools/misc/xml_packer/xml_packer.cpp +++ b/code/nel/tools/misc/xml_packer/xml_packer.cpp @@ -17,6 +17,7 @@ #include "nel/misc/types_nl.h" #include "nel/misc/app_context.h" #include "nel/misc/path.h" +#include "nel/misc/common.h" #include "nel/misc/sstring.h" #include "nel/misc/algo.h" @@ -228,7 +229,7 @@ int main(int argc, char *argv[]) // read the index file set fileInIndex; char lineBuffer[1024]; - FILE *fp = fopen(indexFileName.c_str(), "rt"); + FILE *fp = nlfopen(indexFileName, "rt"); while (fgets(lineBuffer, 1024, fp)) fileInIndex.insert(CSString(lineBuffer).strip()); @@ -263,8 +264,8 @@ int main(int argc, char *argv[]) if (!validFiles.empty() && needRepack) { // open the pack file - // FILE *fp = fopen(filename.c_str(), "wt"); - FILE *fp = fopen(packFileName.c_str(), "wt"); + // FILE *fp = nlfopen(filename, "wt"); + FILE *fp = nlfopen(packFileName, "wt"); fprintf(fp, "\n"); @@ -275,7 +276,7 @@ int main(int argc, char *argv[]) printf("Adding file '%s'...\n", CFile::getFilename(subFileName).c_str()); fprintf(fp, " \n", CFile::getFilename(subFileName).c_str()); - FILE *subFp = fopen(subFileName.c_str(), "rt"); + FILE *subFp = nlfopen(subFileName, "rt"); nlassert(subFp != NULL); char buffer[MaxLineSize]; char *result; @@ -304,7 +305,7 @@ int main(int argc, char *argv[]) fclose(fp); // write the disposable index file used by pack to check for erased file - fp = fopen(indexFileName.c_str(), "wt"); + fp = nlfopen(indexFileName, "wt"); for (uint i=0; i") char str[1024]; - FILE *fp = fopen(fn.c_str(), "rt"); + FILE *fp = nlfopen(fn, "rt"); if (fp != NULL) { while (true) @@ -1654,7 +1654,7 @@ NLMISC_COMMAND(aesSystem, "Execute a system() call", "") log.displayNL("No stdout"); } - fp = fopen(fne.c_str(), "rt"); + fp = nlfopen(fne, "rt"); if (fp != NULL) { while (true) diff --git a/code/nelns/login_system/nel_launcher_windows_ext2/patch.cpp b/code/nelns/login_system/nel_launcher_windows_ext2/patch.cpp index a60f129fa..b55c8cdff 100644 --- a/code/nelns/login_system/nel_launcher_windows_ext2/patch.cpp +++ b/code/nelns/login_system/nel_launcher_windows_ext2/patch.cpp @@ -27,6 +27,7 @@ #endif #include "nel/misc/debug.h" +#include "nel/misc/common.h" #include "nel/misc/path.h" #include "nel/misc/thread.h" @@ -586,7 +587,7 @@ private: string dest = filename.substr(0, filename.size ()-4); setRWAccess(dest); if(VerboseLog) nlinfo("Calling fopen('%s','wb')", dest.c_str()); - FILE *fp = fopen (dest.c_str(), "wb"); + FILE *fp = nlfopen (dest, "wb"); if (fp == NULL) { string err = toString("Can't open file '%s' : code=%d %s, (error code 32)", dest.c_str(), errno, strerror(errno)); diff --git a/code/ryzom/server/src/admin_modules/aes_module.cpp b/code/ryzom/server/src/admin_modules/aes_module.cpp index 734dfff64..aee6da68a 100644 --- a/code/ryzom/server/src/admin_modules/aes_module.cpp +++ b/code/ryzom/server/src/admin_modules/aes_module.cpp @@ -19,6 +19,7 @@ #include "nel/misc/singleton.h" #include #include "nel/misc/path.h" +#include "nel/misc/common.h" #include "nel/net/module.h" #include "nel/net/module_builder_parts.h" #include "nel/net/unified_network.h" @@ -297,7 +298,7 @@ namespace ADMIN // read the persistent state file if any string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+AESPersistentStateFilename; - FILE *fp = fopen(filename.c_str(), "rt"); + FILE *fp = nlfopen(filename, "rt"); if (fp != NULL) { char buffer[1024]; @@ -567,7 +568,7 @@ namespace ADMIN if (now > _LastNagiosReport+_NagiosReportDelay) { // write the nagios report - FILE *fp = fopen("aes_nagios_report.txt", "wt"); + FILE *fp = nlfopen("aes_nagios_report.txt", "wt"); if (fp != NULL) { // output the current date @@ -632,7 +633,7 @@ namespace ADMIN { /// The persistent service orders need to be saved string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+AESPersistentStateFilename; - FILE *fp = fopen(filename.c_str(), "wt"); + FILE *fp = nlfopen(filename, "wt"); if (fp != NULL) { { @@ -801,7 +802,7 @@ namespace ADMIN std::string getOfflineServiceState(const std::string& serviceAlias) { // open the file for reading - FILE* f= fopen(getServiceStateFileName(serviceAlias).c_str(),"rt"); + FILE* f= nlfopen(getServiceStateFileName(serviceAlias), "rt"); if (f==NULL) return "STOPPED"; // setup a buffer to hold the text read from the file @@ -825,7 +826,7 @@ namespace ADMIN uint32 getOfflineServicePID(const std::string& serviceAlias) { // open the file for reading - FILE* f= fopen(getServicePIDFileName(serviceAlias).c_str(),"rt"); + FILE* f = nlfopen(getServicePIDFileName(serviceAlias), "rt"); if (f==NULL) return 0; // setup a buffer to hold the text read from the file @@ -853,7 +854,7 @@ namespace ADMIN uint32 getServiceStartLoopCounter(const std::string& serviceAlias) { // open the file for reading - FILE* f= fopen(getServiceLoopCounterFileName(serviceAlias).c_str(),"rt"); + FILE* f= nlfopen(getServiceLoopCounterFileName(serviceAlias), "rt"); if (f==NULL) return 0; @@ -936,7 +937,7 @@ namespace ADMIN NLMISC::CFile::createDirectoryTree(path); // open the file for writing - FILE* f= fopen(getServiceLaunchCtrlFileName(serviceAlias, path, deferred).c_str(),"wt"); + FILE* f = nlfopen(getServiceLaunchCtrlFileName(serviceAlias, path, deferred).c_str(),"wt"); if (f==NULL) return false; // write the text to the file diff --git a/code/ryzom/server/src/admin_modules/as_module.cpp b/code/ryzom/server/src/admin_modules/as_module.cpp index 9717da358..da4b85485 100644 --- a/code/ryzom/server/src/admin_modules/as_module.cpp +++ b/code/ryzom/server/src/admin_modules/as_module.cpp @@ -18,6 +18,7 @@ #include "nel/misc/types_nl.h" #include #include "nel/misc/file.h" +#include "nel/misc/common.h" #include "nel/misc/sstring.h" #include "nel/misc/mutable_container.h" #include "nel/net/service.h" @@ -195,7 +196,7 @@ namespace ADMIN // read the persistent state file if any string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+ASPersistentStateFilename; - FILE *fp = fopen(filename.c_str(), "rt"); + FILE *fp = nlfopen(filename, "rt"); if (fp != NULL) { char buffer[1024]; @@ -232,7 +233,7 @@ namespace ADMIN if (_NeedToWriteStateFile) { string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+ASPersistentStateFilename; - FILE *fp = fopen(filename.c_str(), "wt"); + FILE *fp = nlfopen(filename, "wt"); if (fp != NULL) { CSString line; diff --git a/code/ryzom/server/src/ai_data_service/pacs_scan.cpp b/code/ryzom/server/src/ai_data_service/pacs_scan.cpp index 48dd8c189..b99009bed 100644 --- a/code/ryzom/server/src/ai_data_service/pacs_scan.cpp +++ b/code/ryzom/server/src/ai_data_service/pacs_scan.cpp @@ -18,6 +18,7 @@ #include "nel/misc/command.h" #include "nel/misc/variable.h" +#include "nel/misc/common.h" #include "nel/misc/aabbox.h" #include "nel/misc/vector.h" #include "nel/misc/vectord.h" @@ -1979,7 +1980,7 @@ public: CBMP4Image<2,2>::SHdr imageHdr(imageWidth, imageHeight); CBMP4Image<2,2>::SPalette imagePalette; - FILE *outf = fopen((OutputPath+name+".bmp").c_str(),"wb"); + FILE *outf = nlfopen(OutputPath+name+".bmp", "wb"); if (outf == NULL) return; @@ -2095,8 +2096,8 @@ public: CBMP4Image<2,2>::SHdr imageHdr(imageWidth, imageHeight); CBMP4Image<2,2>::SPalette imagePalette; - FILE *outf = fopen((OutputPath+name+".bmp").c_str(),"wb"); - FILE *outfh = fopen((OutputPath+name+"_hm.bmp").c_str(),"wb"); + FILE *outf = nlfopen(OutputPath+name+".bmp", "wb"); + FILE *outfh = nlfopen(OutputPath+name+"_hm.bmp", "wb"); if (outf == NULL) return; diff --git a/code/ryzom/server/src/ai_service/ai_script_data_manager.cpp b/code/ryzom/server/src/ai_service/ai_script_data_manager.cpp index d7b25129d..7a94283c0 100644 --- a/code/ryzom/server/src/ai_service/ai_script_data_manager.cpp +++ b/code/ryzom/server/src/ai_service/ai_script_data_manager.cpp @@ -183,7 +183,7 @@ std::string CAIScriptDataManager::dirname() // string fullfilename = dirname() + "/" + name + ".ai_script_data"; // if (!CFile::fileExists(fullfilename) || CFile::getFileSize(fullfilename)==0) // { -// FILE* fp = fopen(fullfilename.c_str(), "w"); +// FILE* fp = nlfopen(fullfilename, "w"); // if (fp) // { // fprintf(fp, "// This file contains data for the AI script\n"); diff --git a/code/ryzom/server/src/entities_game_service/deposit.cpp b/code/ryzom/server/src/entities_game_service/deposit.cpp index d4cd560ad..37b8a03a7 100644 --- a/code/ryzom/server/src/entities_game_service/deposit.cpp +++ b/code/ryzom/server/src/entities_game_service/deposit.cpp @@ -25,6 +25,7 @@ #include "entities_game_service.h" #include "egs_globals.h" #include "nel/misc/noise_value.h" +#include "nel/misc/common.h" #include "nel/misc/variable.h" #include "nel/misc/words_dictionary.h" #include "game_share/time_weather_season/time_date_season_manager.h" @@ -587,7 +588,7 @@ void CDeposit::selectRMsByFilters( std::vector& exactRMCodesS, cons if ( ! depositReportCreated ) { depositReportCreated = true; - depositReportFile = fopen( "deposit_contents.csv", "wt" ); // fclose() auto? + depositReportFile = nlfopen( "deposit_contents.csv", "wt" ); // fclose() auto? if ( depositReportFile ) { fprintf( depositReportFile, "Deposit;RM;When in year;When in day;Weather;\n" ); diff --git a/code/ryzom/server/src/entities_game_service/game_item_manager/game_item.cpp b/code/ryzom/server/src/entities_game_service/game_item_manager/game_item.cpp index 80518f463..390916885 100644 --- a/code/ryzom/server/src/entities_game_service/game_item_manager/game_item.cpp +++ b/code/ryzom/server/src/entities_game_service/game_item_manager/game_item.cpp @@ -2564,8 +2564,7 @@ void CGameItem::dumpGameItemStats( const string& fileName ) { if( !fileName.empty() ) { - FILE * f; - f = fopen(fileName.c_str(),"w"); + FILE *f = nlfopen(fileName, "w"); if(f) { diff --git a/code/ryzom/server/src/entities_game_service/game_item_manager/game_item_manager.cpp b/code/ryzom/server/src/entities_game_service/game_item_manager/game_item_manager.cpp index 72e9b2c8c..17d4d7d55 100644 --- a/code/ryzom/server/src/entities_game_service/game_item_manager/game_item_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/game_item_manager/game_item_manager.cpp @@ -791,7 +791,7 @@ void CGameItemManager::destroyItem( CGameItemPtr &ptr ) //void CGameItemManager::dumpGameItemList( const string& fileName ) //{ // FILE * f; -// f = fopen(fileName.c_str(),"w"); +// f = nlfopen(fileName, "w"); // // if(f) // { diff --git a/code/ryzom/server/src/entities_game_service/harvest_source.cpp b/code/ryzom/server/src/entities_game_service/harvest_source.cpp index dcae55a60..3da4285b5 100644 --- a/code/ryzom/server/src/entities_game_service/harvest_source.cpp +++ b/code/ryzom/server/src/entities_game_service/harvest_source.cpp @@ -1240,8 +1240,8 @@ bool forageTestDoExtract( } // Request and output results - FILE *f = fopen( std::string(getLogDirectory() + "forage_test.csv").c_str(), "at" ); - FILE *f2 = fopen( std::string(getLogDirectory() + "forage_test.log").c_str(), "at" ); + FILE *f = nlfopen(getLogDirectory() + "forage_test.csv", "at" ); + FILE *f2 = nlfopen(getLogDirectory() + "forage_test.log", "at" ); float reqS = 1.0f / (reqPeriod * 10.0f); float req [CHarvestSource::NbPosRTProps]; float abs [CHarvestSource::NbPosRTProps]; diff --git a/code/ryzom/server/src/entities_game_service/phrase_manager/fg_prospection_phrase.cpp b/code/ryzom/server/src/entities_game_service/phrase_manager/fg_prospection_phrase.cpp index f2fc03eb0..b45a6043d 100644 --- a/code/ryzom/server/src/entities_game_service/phrase_manager/fg_prospection_phrase.cpp +++ b/code/ryzom/server/src/entities_game_service/phrase_manager/fg_prospection_phrase.cpp @@ -1884,13 +1884,13 @@ void CDepositMapsBatchTask::run() if ( ! CFile::isExists( pathName ) ) CFile::createDirectory( pathName ); pathName += "/"; - FILE *outputF = fopen( (pathName + "deposit_maps.html").c_str(), "w" ); + FILE *outputF = nlfopen(pathName + "deposit_maps.html", "w"); if ( ! outputF ) { nlwarning( "Can't create file %sdeposit_maps.html", pathName.c_str() ); return; } - FILE *inputF = fopen( _InputFilename.c_str(), "r" ); + FILE *inputF = nlfopen(_InputFilename, "r"); if ( ! inputF ) { fprintf( outputF, "File %s not found", _InputFilename.c_str() ); diff --git a/code/ryzom/server/src/entities_game_service/player_manager/cdb_synchronised.cpp b/code/ryzom/server/src/entities_game_service/player_manager/cdb_synchronised.cpp index 2d16c7177..fce468fb4 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/cdb_synchronised.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/cdb_synchronised.cpp @@ -192,7 +192,7 @@ void CCDBSynchronised::write( const string& fileName ) if ( _DataStructRoot ) { TWriteCallbackArg wca; - wca.F = fopen( fileName.c_str(),"w" ); + wca.F = nlfopen(fileName, "w"); wca.Container = &_DataContainer; ICDBStructNode::CTextId id; _DataStructRoot->foreachLeafCall( cbWrite, id, &wca ); 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 fa5e216ae..628a26e9f 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 @@ -102,11 +102,11 @@ void CPlayer::checkCrashMarker() if (!CFile::isExists(LastLoadFileName)) { // create the file if needed - nlverify(LastLoad = fopen(LastLoadFileName, "wb")); + nlverify(LastLoad = nlfopen(LastLoadFileName, "wb")); fclose(LastLoad); } - nlverify(LastLoad = fopen(LastLoadFileName, "r+b")); + nlverify(LastLoad = nlfopen(LastLoadFileName, "r+b")); // check uint32 lastBad[2]; diff --git a/code/ryzom/server/src/general_utilities_service/cl_contest_logger.cpp b/code/ryzom/server/src/general_utilities_service/cl_contest_logger.cpp index bbe2217c0..bfc33c1d6 100644 --- a/code/ryzom/server/src/general_utilities_service/cl_contest_logger.cpp +++ b/code/ryzom/server/src/general_utilities_service/cl_contest_logger.cpp @@ -118,7 +118,7 @@ void CSession::log(const NLMISC::CSString& lang,const NLMISC::CSString& txt) nlassert(!fileName.empty()); nlinfo("Opening new log file: %s",fileName.c_str()); - _Files[lang]= fopen(fileName.c_str(),"wb"); + _Files[lang]= nlfopen(fileName, "wb"); DROP_IF(_Files[lang]==NULL,"Failed to open log file for writing: "+fileName,return); } fprintf(_Files[lang],"%s\n",txt.c_str()); diff --git a/code/ryzom/server/src/general_utilities_service/rr_repository_reciever.cpp b/code/ryzom/server/src/general_utilities_service/rr_repository_reciever.cpp index ee7669e19..b6423e37a 100644 --- a/code/ryzom/server/src/general_utilities_service/rr_repository_reciever.cpp +++ b/code/ryzom/server/src/general_utilities_service/rr_repository_reciever.cpp @@ -391,7 +391,7 @@ void CRepositoryReceiver::beginFile(NLNET::IModuleProxy *sender, const std::stri _CurrentFileExpected= fileSize; // open the temp file - _CurrentFileHandle= fopen(rrTempFileName(_TargetDirectory,_EmitterName).c_str(),"wb"); + _CurrentFileHandle= nlfopen(rrTempFileName(_TargetDirectory,_EmitterName), "wb"); BOMB_IF(_CurrentFileHandle==NULL,"Failed to open temporary file for writing: "+rrTempFileName(_TargetDirectory,_EmitterName),return); } diff --git a/code/ryzom/server/src/log_analyser_service/commands.cpp b/code/ryzom/server/src/log_analyser_service/commands.cpp index 1b70ae4e2..90bfcf09c 100644 --- a/code/ryzom/server/src/log_analyser_service/commands.cpp +++ b/code/ryzom/server/src/log_analyser_service/commands.cpp @@ -88,7 +88,7 @@ public: NLMISC::CFile::deleteFile(_TmpFileName); DROP_IF(NLMISC::CFile::fileExists(_TmpFileName),"Failed to delete file: "+_TmpFileName,return); - _File= fopen(_TmpFileName.c_str(),"wb"); + _File = nlfopen(_TmpFileName,"wb"); } ~CSimpleFileDisplayer() diff --git a/code/ryzom/server/src/logger_service/logger_service.cpp b/code/ryzom/server/src/logger_service/logger_service.cpp index cb51c6a6d..d5d0775fc 100644 --- a/code/ryzom/server/src/logger_service/logger_service.cpp +++ b/code/ryzom/server/src/logger_service/logger_service.cpp @@ -19,6 +19,7 @@ #include #include "nel/misc/time_nl.h" #include "nel/misc/thread.h" +#include "nel/misc/common.h" #include "nel/misc/random.h" #include "nel/misc/singleton.h" #include "nel/net/service.h" @@ -926,7 +927,7 @@ public: // prepare the output file string outputFile = queryOptions.OutputPrefix+LogQueryResultFile.get(); - FILE *fp = fopen(outputFile.c_str(), "wt");; + FILE *fp = nlfopen(outputFile, "wt");; if (fp == NULL) { _QueryStatus.write(TThreadStatus(qs_push_state, "ErrorWritingQueryResult")); diff --git a/code/ryzom/server/src/patchman_service/file_manager.cpp b/code/ryzom/server/src/patchman_service/file_manager.cpp index ca3582bc6..52a41a080 100644 --- a/code/ryzom/server/src/patchman_service/file_manager.cpp +++ b/code/ryzom/server/src/patchman_service/file_manager.cpp @@ -21,6 +21,7 @@ // nel #include "nel/misc/variable.h" #include "nel/misc/file.h" +#include "nel/misc/common.h" // game share #include "game_share/utils.h" @@ -599,7 +600,7 @@ namespace PATCHMAN // nldebug("- Reading file data @offset: %d (%d bytes)",newFileEntry.StartOffset,fileSize); // read in the file - FILE* inf= fopen(fileName.c_str(),"rb"); + FILE* inf = nlfopen(fileName, "rb"); BOMB_IF(inf==NULL,"Failed to open input file for reading: "+fileName,return false); uint32 bytesRead=(uint32)fread(&_CacheBuffer[newFileEntry.StartOffset],1,fileSize,inf); fclose(inf); diff --git a/code/ryzom/server/src/patchman_service/rr_repository_reciever.cpp b/code/ryzom/server/src/patchman_service/rr_repository_reciever.cpp index 9bc2db322..3d413b0cf 100644 --- a/code/ryzom/server/src/patchman_service/rr_repository_reciever.cpp +++ b/code/ryzom/server/src/patchman_service/rr_repository_reciever.cpp @@ -409,7 +409,7 @@ void CRepositoryReceiver::fileList(NLNET::IModuleProxy *sender, uint32 version, // _CurrentFileExpected= fileSize; // // // open the temp file -// _CurrentFileHandle= fopen(rrTempFileName(_TargetDirectories.patchDirectoryName(),_EmitterName).c_str(),"wb"); +// _CurrentFileHandle= nlfopen(rrTempFileName(_TargetDirectories.patchDirectoryName(),_EmitterName), "wb"); // BOMB_IF(_CurrentFileHandle==NULL,"Failed to open temporary file for writing: "+rrTempFileName(_TargetDirectories.patchDirectoryName(),_EmitterName),return); // } // diff --git a/code/ryzom/server/src/patchman_service/spt_server_patch_terminal.cpp b/code/ryzom/server/src/patchman_service/spt_server_patch_terminal.cpp index 2cce1354e..9dc112c3c 100644 --- a/code/ryzom/server/src/patchman_service/spt_server_patch_terminal.cpp +++ b/code/ryzom/server/src/patchman_service/spt_server_patch_terminal.cpp @@ -20,6 +20,7 @@ // nel #include "nel/misc/variable.h" +#include "nel/misc/common.h" #include "nel/net/service.h" #include "nel/net/module.h" #include "nel/net/module_builder_parts.h" @@ -775,7 +776,7 @@ NLMISC_CLASS_COMMAND_IMPL(CServerPatchTerminal, depDevCfg) CSString cfgFileName= appDesc.CmdLine.firstWord()+".cfg"; string fileName = configDirectory+cfgFileName; - FILE *fp = fopen(fileName.c_str(), "wt"); + FILE *fp = nlfopen(fileName, "wt"); nlassert(fp != NULL); fwrite(appDesc.CfgFile.data(), appDesc.CfgFile.size(), 1, fp); fclose(fp); @@ -808,7 +809,7 @@ NLMISC_CLASS_COMMAND_IMPL(CServerPatchTerminal, depDevCfg) batch << "start " << cmdLine; fileName = DevConfigDirectory.get()+"/start_"+appDesc.ShardName+"_"+appDesc.StartOrder+"_"+appDesc.AppName+".bat"; - fp = fopen(fileName.c_str(), "wt"); + fp = nlfopen(fileName, "wt"); nlassert(fp != NULL); fwrite(batch.data(), batch.size(), 1, fp); fclose(fp); diff --git a/code/ryzom/server/src/pd_lib/pd_server_utils.h b/code/ryzom/server/src/pd_lib/pd_server_utils.h index ac67e8a7a..2e7c06363 100644 --- a/code/ryzom/server/src/pd_lib/pd_server_utils.h +++ b/code/ryzom/server/src/pd_lib/pd_server_utils.h @@ -22,6 +22,7 @@ */ #include #include +#include #include #include @@ -282,7 +283,7 @@ public: if (_File != NULL) return false; - _File = fopen(filename, mode); + _File = nlfopen(filename, mode); if (_File == NULL) return false; diff --git a/code/ryzom/server/src/pd_support_service/daily_commands.cpp b/code/ryzom/server/src/pd_support_service/daily_commands.cpp index e3f6d718c..c96310932 100644 --- a/code/ryzom/server/src/pd_support_service/daily_commands.cpp +++ b/code/ryzom/server/src/pd_support_service/daily_commands.cpp @@ -19,6 +19,7 @@ #include "nel/misc/types_nl.h" #include "nel/misc/file.h" #include "nel/misc/path.h" +#include "nel/misc/common.h" #include "nel/misc/sstring.h" #include "nel/net/service.h" #include "game_share/utils.h" @@ -101,7 +102,7 @@ public: ptm = gmtime(&endTime); // write to the log file - FILE* fileHandle= fopen(DailyActivityLogFileName,"ab"); + FILE* fileHandle= nlfopen(DailyActivityLogFileName,"ab"); nlassert(fileHandle!=NULL); fprintf(fileHandle,"%02u/%02u/%u CDailyTaskScheduler: Started: %02u:%02u, Finished: %02u:%02u, Executed %u commands Started %u Jobs\n", ptm->tm_mday, ptm->tm_mon+1, ptm->tm_year+1900, (uint)startTime/3600%24, (uint)startTime/60%60, (uint)endTime/3600%24, (uint)endTime/60%60, commandsVar==NULL?0:commandsVar->size(), jobsRemaining ); diff --git a/code/ryzom/server/src/pd_support_service/hourly_commands.cpp b/code/ryzom/server/src/pd_support_service/hourly_commands.cpp index 6f77396ae..cad7c25ee 100644 --- a/code/ryzom/server/src/pd_support_service/hourly_commands.cpp +++ b/code/ryzom/server/src/pd_support_service/hourly_commands.cpp @@ -19,6 +19,7 @@ #include "nel/misc/types_nl.h" #include "nel/misc/file.h" #include "nel/misc/path.h" +#include "nel/misc/common.h" #include "nel/misc/sstring.h" #include "nel/net/service.h" #include "game_share/utils.h" @@ -101,7 +102,7 @@ public: ptm = gmtime(&endTime); // write to the log file - FILE* fileHandle= fopen(HourlyActivityLogFileName,"ab"); + FILE* fileHandle= nlfopen(HourlyActivityLogFileName,"ab"); nlassert(fileHandle!=NULL); fprintf(fileHandle,"%02u/%02u/%u CHourlyTaskScheduler: Started: %02u:%02u, Finished: %02u:%02u, Executed %u commands Started %u Jobs\n", ptm->tm_mday, ptm->tm_mon+1, ptm->tm_year+1900, (uint)startTime/3600%24, (uint)startTime/60%60, (uint)endTime/3600%24, (uint)endTime/60%60, commandsVar==NULL?0:commandsVar->size(), jobsRemaining ); diff --git a/code/ryzom/server/src/testing_tool_service/testing_tool_service.cpp b/code/ryzom/server/src/testing_tool_service/testing_tool_service.cpp index b81886a47..996c838e2 100644 --- a/code/ryzom/server/src/testing_tool_service/testing_tool_service.cpp +++ b/code/ryzom/server/src/testing_tool_service/testing_tool_service.cpp @@ -31,6 +31,7 @@ // Nel #include "nel/misc/sheet_id.h" #include "nel/misc/command.h" +#include "nel/misc/common.h" #include "nel/georges/u_form_elm.h" #include "nel/georges/u_form.h" #include "nel/georges/u_form_loader.h" @@ -270,7 +271,7 @@ void CTestingTool::startTestSession( const std::string& sheet ) //---------------------------------------------------------------- void CTestingTool::testSessionProceed() { - _TestSessionReport = fopen( "testSessionReport.txt", "w+t" ); + _TestSessionReport = nlfopen( "testSessionReport.txt", "w+t" ); fputs( "=====================================================================\n", _TestSessionReport ); fputs( "===================== NEW TEST SESSION STARTED ======================\n", _TestSessionReport ); diff --git a/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_feDlg.cpp b/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_feDlg.cpp index dbd917b0f..d9097d4cf 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_feDlg.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_feDlg.cpp @@ -23,6 +23,7 @@ #include "CompilDialog.h" #include "nel/misc/path.h" +#include "nel/misc/common.h" #include "nel/ligo/primitive.h" #include "../mission_compiler_lib/mission_compiler.h" #include "nel/misc/config_file.h" @@ -201,7 +202,7 @@ BOOL CMissionCompilerFeDlg::OnInitDialog() if (NLMISC::CFile::fileExists(tmpPath)) { - FILE *f = fopen(tmpPath, "r"); + FILE *f = nlfopen(tmpPath, "r"); if (f == NULL) { nlinfo("Can't open the file for reading !\n%s", tmpPath); @@ -762,7 +763,7 @@ void CValidationFile::saveMissionValidationFile(string filename) nlwarning("Can't find index file '%s' in search path, no mission will be valid", filename.c_str()); return; } - FILE* file = fopen(pathName.c_str(), "w"); + FILE* file = nlfopen(pathName, "w"); nlassert(file!=NULL); // AuthorizedStates diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp index fd119e0df..09d9fc723 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp @@ -17,6 +17,7 @@ #include "mission_compiler.h" #include "step.h" #include "nel/misc/i18n.h" +#include "nel/misc/common.h" #include "nel/ligo/primitive_utils.h" using namespace std; @@ -876,7 +877,7 @@ bool CMissionCompiler::publishFiles(const std::string &serverPathPrim, const std bool CMissionCompiler::includeText(const std::string filename, const std::string text) { - FILE *f = fopen(filename.c_str(), "r+"); + FILE *f = nlfopen(filename, "r+"); if (f == NULL) return false; diff --git a/code/ryzom/tools/leveldesign/mp_generator/main.cpp b/code/ryzom/tools/leveldesign/mp_generator/main.cpp index 935ba31d6..1766a3b3b 100644 --- a/code/ryzom/tools/leveldesign/mp_generator/main.cpp +++ b/code/ryzom/tools/leveldesign/mp_generator/main.cpp @@ -17,6 +17,7 @@ #include "moulinette.h" #include "utils.h" #include "nel/misc/algo.h" +#include "nel/misc/common.h" TRMItem currentDocItem; CRMData SortableData; @@ -1279,7 +1280,7 @@ void ItemNamesSave() CSString data, output; FILE* file; - file = fopen( ITEM_WORDS_WK.c_str(), "rb" ); + file = nlfopen( ITEM_WORDS_WK, "rb" ); char c; fread( &c, 1, 1, file ); diff --git a/code/ryzom/tools/leveldesign/mp_generator/utils.h b/code/ryzom/tools/leveldesign/mp_generator/utils.h index efa42149d..af9f7096a 100644 --- a/code/ryzom/tools/leveldesign/mp_generator/utils.h +++ b/code/ryzom/tools/leveldesign/mp_generator/utils.h @@ -19,6 +19,8 @@ #include +#include "nel/misc/common.h" + // DtName must be the 1st one enum TDataCol { DtName, DtTitle, DtRMFamily, DtGroup, DtEcosystem, DtLevelZone, DtStatQuality, DtProp, DtCreature, DtCreaTitle, DtCraftSlotName, DtCraftCivSpec, DtColor, DtAverageEnergy, DtMaxLevel, DtCustomizedProperties, DtNbCols }; const char *DataColStr [DtNbCols] = { "Code", "Name", "Family", "Group", "Ecosystem", "LevelZone", "Stat Quality", "Properties", "Creature sheets", "Creatures", "Item parts", "Craft civ spec", "Color", "Average energy", "Max level", "Customized" }; @@ -276,7 +278,7 @@ public: if ( ! _Enabled ) return; - _File = fopen( filename.c_str(), "wt" ); + _File = nlfopen( filename, "wt" ); if(!_File) { throw Exception("Could not open html: %s", filename.c_str()); diff --git a/code/ryzom/tools/leveldesign/named_items_2_csv/named_items_2_csv.cpp b/code/ryzom/tools/leveldesign/named_items_2_csv/named_items_2_csv.cpp index 6ab9e2a26..f2fa783dc 100644 --- a/code/ryzom/tools/leveldesign/named_items_2_csv/named_items_2_csv.cpp +++ b/code/ryzom/tools/leveldesign/named_items_2_csv/named_items_2_csv.cpp @@ -57,7 +57,7 @@ vector items; // check the items file (locSlot and item number coherence) int verifItemsFile (const char *filename) { - FILE *f = fopen(filename, "r"); + FILE *f = nlfopen(filename, "r"); if (f == NULL) nlerror("Can't open file : %s", filename); @@ -89,7 +89,7 @@ int verifItemsFile (const char *filename) // check csv file (locSlot and item number coherence) int verifCsvFile (const char *filename) { - FILE *f = fopen(filename, "r"); + FILE *f = nlfopen(filename, "r"); if (f == NULL) nlerror("Can't open file : %s", filename); @@ -165,7 +165,7 @@ int getItemsFromFile(const char *filename) // fill 'fields' structure with values from file int getFieldsFromFile(const char *filename) { - FILE *f = fopen(filename, "r"); + FILE *f = nlfopen(filename, "r"); if (f == NULL) nlerror("Can't open file : %s", filename); @@ -190,7 +190,7 @@ int getFieldsFromFile(const char *filename) // parse the file to count the number of items int getNbItemFromFile(const char *filename) { - FILE *f = fopen(filename, "r"); + FILE *f = nlfopen(filename, "r"); if (f == NULL) nlerror("Can't open file : %s", filename); @@ -214,7 +214,7 @@ int exportCsv(const char *filename) nlassert(fields.size() != 0); uint i, j; - FILE *f = fopen(filename, "w"); + FILE *f = nlfopen(filename, "w"); if (f == NULL) nlerror("Can't open file : %s", filename); @@ -241,7 +241,7 @@ int importCsv(const char *filename) verifCsvFile(filename); char buffer[1024]; - FILE *f = fopen(filename, "r"); + FILE *f = nlfopen(filename, "r"); if (f == NULL) nlerror("Can't open file : %s", filename); diff --git a/code/ryzom/tools/leveldesign/primitive_id_assignator/primitive_id_assignator.cpp b/code/ryzom/tools/leveldesign/primitive_id_assignator/primitive_id_assignator.cpp index 08c1b255f..b3737b6a9 100644 --- a/code/ryzom/tools/leveldesign/primitive_id_assignator/primitive_id_assignator.cpp +++ b/code/ryzom/tools/leveldesign/primitive_id_assignator/primitive_id_assignator.cpp @@ -19,6 +19,7 @@ #include "nel/misc/config_file.h" #include "nel/misc/path.h" #include "nel/misc/file.h" +#include "nel/misc/common.h" using namespace std; @@ -57,7 +58,7 @@ int main(int argc, char *argv[]) { // build a default config file string fileName = vif.asString(); - FILE *fp = fopen(fileName.c_str(), "wt"); + FILE *fp = nlfopen(fileName.c_str(), "wt"); if (fp == NULL) { nlwarning("Can't open file '%s' for writing", diff --git a/code/ryzom/tools/leveldesign/uni_conv/uni_conv.cpp b/code/ryzom/tools/leveldesign/uni_conv/uni_conv.cpp index 1bbe82dcc..fa593d67d 100644 --- a/code/ryzom/tools/leveldesign/uni_conv/uni_conv.cpp +++ b/code/ryzom/tools/leveldesign/uni_conv/uni_conv.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -121,7 +122,7 @@ int main(int argc, char *argv[]) case ASCII: { string s = str.toString(); - FILE *fp = fopen(outputFile.c_str(), "wt"); + FILE *fp = nlfopen(outputFile, "wt"); fwrite(s.data(), s.size(), 1, fp); fclose(fp); } diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.cpp index a70813f47..17fd397da 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.cpp @@ -46,6 +46,7 @@ #include "editor_primitive.h" #include "file_dialog_ex.h" #include "nel/misc/mem_stream.h" +#include "nel/misc/common.h" #include @@ -4334,7 +4335,7 @@ void CMainFrame::OnMissionCompiler() GetEnvironmentVariable("TMP", tmpPath, MAX_PATH); strcat(tmpPath, "\\tmptool.txt"); - FILE *f = fopen(tmpPath, "w"); + FILE *f = nlfopen(tmpPath, "w"); if (f==NULL) infoMessage("Can't open file for writing !\n%s", tmpPath); diff --git a/code/ryzom/tools/occ2huff/occ2huff.cpp b/code/ryzom/tools/occ2huff/occ2huff.cpp index 500e76735..55b3f20b1 100644 --- a/code/ryzom/tools/occ2huff/occ2huff.cpp +++ b/code/ryzom/tools/occ2huff/occ2huff.cpp @@ -257,7 +257,7 @@ sint main( sint argc, char ** argv ) // TEST /*printf("Writing debug text file...\n"); - FILE * outputTest = fopen("chat_static_base_test.log","wt"); + FILE * outputTest = nlfopen("chat_static_base_test.log","wt"); for( itBase = base.begin(); itBase != base.end(); ++itBase ) { fprintf(outputTest,"id: %s str: %s occ: %d\n",(*itBase).second.Id.c_str(),(*itBase).second.Str.c_str(), (*itBase).second.Occurence ); diff --git a/code/ryzom/tools/pd_parser/templatizer.h b/code/ryzom/tools/pd_parser/templatizer.h index 308fdeb2e..5087e033a 100644 --- a/code/ryzom/tools/pd_parser/templatizer.h +++ b/code/ryzom/tools/pd_parser/templatizer.h @@ -1009,7 +1009,7 @@ public: std::string result = ITemplatizerBloc::eval(env); FILE* f; - f = fopen(filename.c_str(), (clearfile == "true" ? "w" : "a")); + f = nlfopen(filename, (clearfile == "true" ? "w" : "a")); if (f != NULL) { fwrite(result.c_str(), 1, result.size(), f); diff --git a/code/ryzom/tools/phrase_generator/phrase_generator.cpp b/code/ryzom/tools/phrase_generator/phrase_generator.cpp index 6fa71e9ae..de02680ca 100644 --- a/code/ryzom/tools/phrase_generator/phrase_generator.cpp +++ b/code/ryzom/tools/phrase_generator/phrase_generator.cpp @@ -33,6 +33,7 @@ #include "nel/misc/file.h" #include "nel/misc/smart_ptr.h" #include "nel/misc/command.h" +#include "nel/misc/common.h" #include "nel/misc/path.h" #include #include @@ -275,7 +276,7 @@ void loadCSVFile( const char *filename, TDeliveryCallback deliveryCallback ) vector args; vector::iterator iarg; - if ( (file = fopen( filename, "r" )) == NULL ) + if ( (file = nlfopen( filename, "r" )) == NULL ) { nlwarning( "Can't find file %s", filename ); } @@ -1282,7 +1283,7 @@ void usage(char *argv0, FILE *out) //----------------------------------------------- void makeIndexFile() { - FILE * indexFile = fopen( ("_" + DocFileNameRoot + "_INDEX.html").c_str(), "wt" ); + FILE * indexFile = nlfopen( "_" + DocFileNameRoot + "_INDEX.html", "wt" ); if( indexFile ) { fprintf( indexFile, ("\n\nSummary of " + DocFileNameRoot + "\n\n").c_str() ); @@ -1295,7 +1296,7 @@ void makeIndexFile() for ( uint l=0; l!=26; ++l ) { string filename = toString( "%s_%c.html", DocFileName.c_str(), 'a'+l ); - PhraseDocFiles[l] = fopen( filename.c_str(), "wt" ); + PhraseDocFiles[l] = nlfopen( filename, "wt" ); fprintf( PhraseDocFiles[l], ("\n\n" + DocFileName + toString( " - %c", (char)('A'+l) ) + "\n\n").c_str() ); fprintf( indexFile, ("" + (char)('A'+l) + " ").c_str() ); } @@ -1304,7 +1305,7 @@ void makeIndexFile() { // One single HTML file fprintf( indexFile, ("Go to action details").c_str() ); - PhraseDocFiles[0] = fopen( (DocFileName + ".html").c_str(), "wt" ); + PhraseDocFiles[0] = nlfopen( DocFileName + ".html", "wt" ); fprintf( PhraseDocFiles[0], ("\n\n" + DocFileName + "\n\n").c_str() ); for ( uint l=1; l!=26; ++l ) { @@ -1393,7 +1394,7 @@ void makeIndexFile() void makeActionsBySkillGroupFile() { // progression by skill - FILE * actionsBySkillGroupFile = fopen( (DocFileName + "__by_skill.html").c_str(), "wt" ); + FILE * actionsBySkillGroupFile = nlfopen( DocFileName + "__by_skill.html", "wt" ); if( actionsBySkillGroupFile ) { fprintf( actionsBySkillGroupFile, ("\n\nProgression of " + DocFileName + "\n\n").c_str() ); @@ -1489,7 +1490,7 @@ void makeActionsBySkillValueFile() //----------------------------------------------- void makeActionsBySkillValueDetailFile() { - FILE * actionsBySkillValueDetailFile = fopen( (DocFileName + "__by_skill_value_detail.html").c_str(), "wt" ); + FILE * actionsBySkillValueDetailFile = nlfopen( DocFileName + "__by_skill_value_detail.html", "wt" ); if( actionsBySkillValueDetailFile ) { fprintf( actionsBySkillValueDetailFile, ("\n\nProgression of " + DocFileName + "\n\n").c_str() ); @@ -1627,9 +1628,9 @@ void makeSkillTreeFile( char filter, string skillFamily, bool withTraduction ) string filenameWithTraduction = skillFamily + "_skill_tree_detailed.html"; FILE * skillTreeFile; if( withTraduction ) - skillTreeFile = fopen( filenameWithTraduction.c_str(), "wt" ); + skillTreeFile = nlfopen( filenameWithTraduction, "wt" ); else - skillTreeFile = fopen( filename.c_str(), "wt" ); + skillTreeFile = nlfopen( filename, "wt" ); fprintf( skillTreeFile,"\n"); fprintf( skillTreeFile,"\n"); fprintf( skillTreeFile,"SKILL TREE ( %s )\n",skillFamily.c_str()); @@ -1980,7 +1981,7 @@ int main(int argc, char* argv[]) // write header and title bar string filename; filename = DocFileNameRoot + "_m.html"; - FILE * brickPhraseDocFile_m = fopen( filename.c_str(), "wt" ); + FILE * brickPhraseDocFile_m = nlfopen( filename, "wt" ); fprintf( brickPhraseDocFile_m,"\n"); fprintf( brickPhraseDocFile_m,"\n"); fprintf( brickPhraseDocFile_m,"Brick phrases\n"); @@ -1988,7 +1989,7 @@ int main(int argc, char* argv[]) fprintf( brickPhraseDocFile_m,"\n"); filename = DocFileNameRoot + "_c.html"; - FILE * brickPhraseDocFile_c = fopen( filename.c_str(), "wt" ); + FILE * brickPhraseDocFile_c = nlfopen( filename, "wt" ); fprintf( brickPhraseDocFile_c,"\n"); fprintf( brickPhraseDocFile_c,"\n"); fprintf( brickPhraseDocFile_c,"Brick phrases\n"); @@ -1996,7 +1997,7 @@ int main(int argc, char* argv[]) fprintf( brickPhraseDocFile_c,"
\n"); filename = DocFileNameRoot + "_o.html"; - FILE * brickPhraseDocFile_o = fopen( filename.c_str(), "wt" ); + FILE * brickPhraseDocFile_o = nlfopen( filename, "wt" ); fprintf( brickPhraseDocFile_o,"\n"); fprintf( brickPhraseDocFile_o,"\n"); fprintf( brickPhraseDocFile_o,"Brick phrases\n"); @@ -2004,7 +2005,7 @@ int main(int argc, char* argv[]) fprintf( brickPhraseDocFile_o,"
\n"); filename = DocFileNameRoot + "_p.html"; - FILE * brickPhraseDocFile_p = fopen( filename.c_str(), "wt" ); + FILE * brickPhraseDocFile_p = nlfopen( filename, "wt" ); fprintf( brickPhraseDocFile_p,"\n"); fprintf( brickPhraseDocFile_p,"\n"); fprintf( brickPhraseDocFile_p,"Brick phrases\n"); @@ -2012,7 +2013,7 @@ int main(int argc, char* argv[]) fprintf( brickPhraseDocFile_p,"
\n"); filename = DocFileNameRoot + "_e.html"; - FILE * brickPhraseDocFile_e = fopen( filename.c_str(), "wt" ); + FILE * brickPhraseDocFile_e = nlfopen( filename, "wt" ); fprintf( brickPhraseDocFile_e,"\n"); fprintf( brickPhraseDocFile_e,"\n"); fprintf( brickPhraseDocFile_e,"Brick phrases\n"); @@ -2082,7 +2083,7 @@ int main(int argc, char* argv[]) // write header and title bar filename = DocFileNameRoot + ".html"; - FILE * brickDocFile = fopen( filename.c_str(), "wt" ); + FILE * brickDocFile = nlfopen( filename, "wt" ); fprintf( brickDocFile,"\n"); fprintf( brickDocFile,"\n"); fprintf( brickDocFile,"Bricks infos\n"); @@ -2197,7 +2198,7 @@ int main(int argc, char* argv[]) // write header and title bar filename = DocFileNameRoot + "_name.html"; - FILE * brickNameDocFile = fopen( filename.c_str(), "wt" ); + FILE * brickNameDocFile = nlfopen( filename, "wt" ); fprintf( brickNameDocFile,"\n"); fprintf( brickNameDocFile,"\n"); fprintf( brickNameDocFile,"Bricks infos\n"); @@ -2332,7 +2333,7 @@ int main(int argc, char* argv[]) // write header and title bar filename = DocFileNameRoot + "_family.html"; - FILE * brickFamilyDocFile = fopen( filename.c_str(), "wt" ); + FILE * brickFamilyDocFile = nlfopen( filename, "wt" ); fprintf( brickFamilyDocFile,"\n"); fprintf( brickFamilyDocFile,"\n"); fprintf( brickFamilyDocFile,"Bricks infos\n"); @@ -2464,7 +2465,7 @@ int main(int argc, char* argv[]) // write header and title bar filename = DocFileNameRoot + "_required_skill_value.html"; - FILE * brickRequiredDocFile = fopen( filename.c_str(), "wt" ); + FILE * brickRequiredDocFile = nlfopen( filename, "wt" ); fprintf( brickRequiredDocFile,"\n"); fprintf( brickRequiredDocFile,"\n"); fprintf( brickRequiredDocFile,"Bricks infos\n"); @@ -2607,7 +2608,7 @@ int main(int argc, char* argv[]) // write header and title bar filename = DocFileNameRoot + "_learn_skill_value.html"; - FILE * brickLearnDocFile = fopen( filename.c_str(), "wt" ); + FILE * brickLearnDocFile = nlfopen( filename, "wt" ); fprintf( brickLearnDocFile,"\n"); fprintf( brickLearnDocFile,"\n"); fprintf( brickLearnDocFile,"Bricks infos\n"); diff --git a/code/ryzom/tools/sheet_random_generator/sheet_random_generator.cpp b/code/ryzom/tools/sheet_random_generator/sheet_random_generator.cpp index 68a6bff3f..eafda628c 100644 --- a/code/ryzom/tools/sheet_random_generator/sheet_random_generator.cpp +++ b/code/ryzom/tools/sheet_random_generator/sheet_random_generator.cpp @@ -20,6 +20,7 @@ #include "srg_utilities.h" #include "game_share/protection_type.h" #include "nel/misc/string_conversion.h" +#include "nel/misc/common.h" /* * V3 @@ -2449,8 +2450,8 @@ void generateRawMaterials() MainStat.init(); FILE *nameOutputFile; if ( OutputNameList ) - nameOutputFile = fopen( "rm_names_output.csv", "wt" ); - GraphFile = fopen( "rm_output_graph.csv", "wt" ); + nameOutputFile = nlfopen( "rm_names_output.csv", "wt" ); + GraphFile = nlfopen( "rm_output_graph.csv", "wt" ); fprintf( GraphFile, "Graph type: Line with markers displayed at each data value, columns B to E. For deposits, sort by column B\n" ); fprintf( GraphFile, "Ecosystem specialization: 100=Desert, 104=Forest, 108=Lake, 112=Jungle, 116=All\n" ); fprintf( GraphFile, "RM code;Zone;Energy;Originality;Eco. spec.;\n\n" ); diff --git a/code/ryzom/tools/sheet_random_generator/srg_utilities.h b/code/ryzom/tools/sheet_random_generator/srg_utilities.h index c4abce34b..686b22418 100644 --- a/code/ryzom/tools/sheet_random_generator/srg_utilities.h +++ b/code/ryzom/tools/sheet_random_generator/srg_utilities.h @@ -27,6 +27,7 @@ #include "nel/misc/file.h" #include "nel/misc/smart_ptr.h" #include "nel/misc/command.h" +#include "nel/misc/common.h" #include "nel/misc/path.h" #include #include @@ -862,7 +863,7 @@ void loadNomenclatureCodes( const char *title, const vector& longNames, vector::iterator iarg; vector::const_iterator ivs; - if ( (rulesFile = fopen( filename, "r" )) == NULL ) + if ( (rulesFile = nlfopen( filename, "r" )) == NULL ) { nlwarning( "Can't find file %s", filename ); } @@ -1121,7 +1122,7 @@ void loadCSVFile( const char *filename, TMapDeliveryCallback deliveryCallback, b vector args; vector::iterator iarg; - if ( (file = fopen( filename, "r" )) == NULL ) + if ( (file = nlfopen( filename, "r" )) == NULL ) { nlwarning( "Can't find file %s", filename ); } @@ -1178,7 +1179,7 @@ void loadCSVFile( const char *filename, TVectorDeliveryCallback deliveryCallback vs args; vs::iterator iarg; - if ( (file = fopen( filename, "r" )) == NULL ) + if ( (file = nlfopen( filename, "r" )) == NULL ) { nlwarning( "Can't find file %s", filename ); } @@ -1217,7 +1218,7 @@ void loadValueFile( const char *filename, const vector& keyStrings, vector args; vector::iterator iarg; - if ( (rulesFile = fopen( filename, "r" )) == NULL ) + if ( (rulesFile = nlfopen( filename, "r" )) == NULL ) { nlwarning( "Can't find file %s", filename ); } @@ -1271,7 +1272,7 @@ void loadRulesFile( const char *filename, const vector& keyStrings, vector args; vector::iterator iarg; - if ( (rulesFile = fopen( filename, "r" )) == NULL ) + if ( (rulesFile = nlfopen( filename, "r" )) == NULL ) { nlwarning( "Can't find file %s", filename ); } @@ -1582,7 +1583,7 @@ void loadTitles( const string& sourceWords, const string& sourceBase, const stri void extractRawMaterialNames() { loadCSVFile( ExtractNamesCsv.c_str(), readRMNames ); - FILE *output = fopen( (CFile::getFilenameWithoutExtension( ExtractNamesCsv ) + "_output.csv").c_str(), "wt" ); + FILE *output = nlfopen( CFile::getFilenameWithoutExtension( ExtractNamesCsv ) + "_output.csv", "wt" ); fprintf( output, "Code;Name\n" ); for ( mss::const_iterator iun=UniqueRMNamesAndSheetCodeHead.begin(); iun!=UniqueRMNamesAndSheetCodeHead.end(); ++iun ) { @@ -2343,7 +2344,7 @@ public: if ( ! _Enabled ) return; - _File = fopen( filename.c_str(), "wt" ); + _File = nlfopen( filename, "wt" ); fprintf( _File, ("\n\n" + title + "\n\n").c_str() ); } @@ -2408,7 +2409,7 @@ public: if ( ! _Enabled ) return; - _File = fopen( filename.c_str(), "wt" ); + _File = nlfopen( filename, "wt" ); } /// diff --git a/code/ryzom/tools/translation_tools/main.cpp b/code/ryzom/tools/translation_tools/main.cpp index 9198196c7..000da9551 100644 --- a/code/ryzom/tools/translation_tools/main.cpp +++ b/code/ryzom/tools/translation_tools/main.cpp @@ -71,6 +71,7 @@ #include "nel/misc/app_context.h" #include "nel/misc/i18n.h" +#include "nel/misc/common.h" #include "nel/misc/file.h" #include "nel/misc/path.h" #include "nel/misc/diff_tool.h" @@ -325,7 +326,7 @@ int readLanguages() else { // append to the existing file - FILE *fp = fopen(filename.c_str(), "ab"); + FILE *fp = nlfopen(filename, "ab"); for (uint i=0; i\n"); @@ -224,7 +225,7 @@ int main(int argc, char *argv[]) printf("Adding file '%s'...\n", CFile::getFilename(subFileName).c_str()); fprintf(fp, " \n", CFile::getFilename(subFileName).c_str()); - FILE *subFp = fopen(subFileName.c_str(), "rt"); + FILE *subFp = nlfopen(subFileName, "rt"); nlassert(subFp != NULL); char buffer[MaxLineSize]; char *result; @@ -262,8 +263,8 @@ int main(int argc, char *argv[]) { printf("Unpacking directory '%s'...\n", dirName.c_str()); // open the pack file -// FILE *fp = fopen((dirName+"/tmp."+DefaultExt).c_str(), "rt"); - FILE *fp = fopen(filename.c_str(), "rt"); +// FILE *fp = nlfopen(dirName+"/tmp."+DefaultExt, "rt"); + FILE *fp = nlfopen(filename, "rt"); nlassert(fp != NULL); uint linecount = 0; @@ -303,7 +304,7 @@ int main(int argc, char *argv[]) printf("Extracting file '%s'...\n", CFile::getFilename(subFileName).c_str()); // open the output file - FILE *output = fopen (subFileName.c_str(), "wt"); + FILE *output = nlfopen(subFileName, "wt"); if (output == NULL) { printf ("Error : can not open output file '%s' from pack file '%s'", subFileName.c_str(), filename.c_str()); diff --git a/code/studio/src/plugins/mission_compiler/validation_file.cpp b/code/studio/src/plugins/mission_compiler/validation_file.cpp index e5536f9a7..c284f50cd 100644 --- a/code/studio/src/plugins/mission_compiler/validation_file.cpp +++ b/code/studio/src/plugins/mission_compiler/validation_file.cpp @@ -1,6 +1,7 @@ #include "validation_file.h" #include +#include #include void CValidationFile::loadMissionValidationFile(std::string filename) @@ -53,7 +54,7 @@ void CValidationFile::saveMissionValidationFile(std::string filename) nlwarning("Can't find index file '%s' in search path, no mission will be valid", filename.c_str()); return; } - FILE* file = fopen(pathName.c_str(), "w"); + FILE* file = nlfopen(pathName, "w"); nlassert(file!=NULL); // AuthorizedStates diff --git a/code/tool/increment_version/increment_version.cpp b/code/tool/increment_version/increment_version.cpp index d24127a6c..45cb93ece 100644 --- a/code/tool/increment_version/increment_version.cpp +++ b/code/tool/increment_version/increment_version.cpp @@ -16,6 +16,7 @@ #include #include +#include #include @@ -51,7 +52,7 @@ sint main( sint argc, char ** argv ) // open the output file string outputFilename = string(argv[1]) + ".out"; - FILE * output = fopen(outputFilename.c_str(),"w"); + FILE * output = nlfopen(outputFilename,"w"); if( output == NULL ) { nlwarning("can't open the output file %s",outputFilename.c_str()); diff --git a/code/tool/path_content_diff/path_content_diff.cpp b/code/tool/path_content_diff/path_content_diff.cpp index c2df4b946..b40a4e75f 100644 --- a/code/tool/path_content_diff/path_content_diff.cpp +++ b/code/tool/path_content_diff/path_content_diff.cpp @@ -14,6 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include #include #include #include @@ -65,7 +66,7 @@ int main( int argc, char ** argv ) CPath::getPathContent(newPath, true, false, true, newPathContent); string outputFileName = CFile::findNewFile("path_content_diff.txt"); - FILE *output = fopen (outputFileName.c_str(), "wt"); + FILE *output = nlfopen(outputFileName, "wt"); if( output == NULL ) { nlwarning("Can't open output file %s",outputFileName.c_str());