Fixed: Use nlfopen in tools and servers

This commit is contained in:
kervala 2016-03-19 16:21:06 +01:00
parent 5b892c1ed4
commit 82985016cf
59 changed files with 193 additions and 140 deletions

View file

@ -39,6 +39,7 @@
// NeL includes // NeL includes
#include <nel/misc/time_nl.h> #include <nel/misc/time_nl.h>
#include <nel/misc/string_common.h> #include <nel/misc/string_common.h>
#include <nel/misc/common.h>
// Project includes // Project includes
@ -102,7 +103,7 @@ public:
{ {
releaseError(); 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(s_ErrorHeader.c_str(), 1, s_ErrorHeader.length(), m_ErrorLog);
fwrite("\n", 1, 1, m_ErrorLog); fwrite("\n", 1, 1, m_ErrorLog);
fflush(m_ErrorLog); fflush(m_ErrorLog);
@ -113,7 +114,7 @@ public:
{ {
releaseDepend(); 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(s_DependHeader.c_str(), 1, s_DependHeader.length(), m_DependLog);
fwrite("\n", 1, 1, m_DependLog); fwrite("\n", 1, 1, m_DependLog);
// fflush(m_DependLog); // fflush(m_DependLog);

View file

@ -23,6 +23,7 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/common.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/bitmap.h" #include "nel/misc/bitmap.h"
#include "nel/misc/events.h" #include "nel/misc/events.h"
@ -115,7 +116,7 @@ void LoadSceneScript (const char *ScriptName, CScene* pScene, vector<SDispCS> &D
float posx, posy, posz; float posx, posy, posz;
float roti, rotj, rotk; 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); fseek (f, 0, SEEK_END);
uint file_size = ftell (f); uint file_size = ftell (f);
fseek (f, 0, SEEK_SET); fseek (f, 0, SEEK_SET);

View file

@ -60,7 +60,7 @@ public:
nlinfo ("init() was called"); nlinfo ("init() was called");
// fp = fopen (NLMISC::CFile::findNewFile("stat.csv").c_str(), "wt"); // fp = nlfopen (NLMISC::CFile::findNewFile("stat.csv"), "wt");
} }
bool update () bool update ()

View file

@ -33,6 +33,7 @@
#endif #endif
#include "nel/misc/common.h"
#include "nel/misc/debug.h" #include "nel/misc/debug.h"
#include "nel/misc/mem_stream.h" #include "nel/misc/mem_stream.h"
#include "nel/misc/path.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"; string fn = StatPathName + ConnectionName + "_" + ha + "_" + getDate() + ".pong";
FILE *fp = fopen (fn.c_str(), "rt"); FILE *fp = nlfopen (fn, "rt");
if (fp == NULL) if (fp == NULL)
{ {
// new file, add the header // new file, add the header
FILE *fp = fopen (fn.c_str(), "wt"); FILE *fp = nlfopen (fn, "wt");
if (fp != NULL) if (fp != NULL)
{ {
fprintf (fp, "#%s\t%s\t%s\t%s\n", "PingTime", "PongTime", "Delta", "PingNumber"); 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); fclose (fp);
} }
fp = fopen (fn.c_str(), "at"); fp = nlfopen (fn, "at");
if (fp == NULL) if (fp == NULL)
{ {
nlwarning ("Can't open pong file name '%s'", fn.c_str()); nlwarning ("Can't open pong file name '%s'", fn.c_str());

View file

@ -21,6 +21,7 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/misc/debug.h" #include "nel/misc/debug.h"
#include "nel/misc/common.h"
#include "nel/misc/mem_stream.h" #include "nel/misc/mem_stream.h"
#include "nel/misc/time_nl.h" #include "nel/misc/time_nl.h"
#include "nel/misc/config_file.h" #include "nel/misc/config_file.h"
@ -112,7 +113,7 @@ void exit (const string &reason)
void createConfigFile() void createConfigFile()
{ {
FILE *fp = fopen ("client.cfg", "wt"); FILE *fp = nlfopen ("client.cfg", "wt");
if (fp == NULL) if (fp == NULL)
{ {
InfoLog->displayRawNL ("Can't create client.cfg"); InfoLog->displayRawNL ("Can't create client.cfg");
@ -159,7 +160,7 @@ void checkConnectionName ()
void loadConfigFile () void loadConfigFile ()
{ {
FILE *fp = fopen ("client.cfg", "rt"); FILE *fp = nlfopen ("client.cfg", "rt");
if (fp == NULL) if (fp == NULL)
{ {
createConfigFile(); createConfigFile();

View file

@ -17,6 +17,7 @@
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/common.h"
#include "nel/3d/scene_group.h" #include "nel/3d/scene_group.h"
#include "nel/3d/zone.h" #include "nel/3d/zone.h"
#include "nel/3d/skeleton_shape.h" #include "nel/3d/skeleton_shape.h"
@ -660,9 +661,7 @@ int main(int argc, const char *argv[])
options.insert (argv[i]); options.insert (argv[i]);
// Open log // Open log
FILE *logStream; FILE *logStream = nlfopen(getLogDirectory() + "file_info.log", "wt");
logStream= fopen(std::string(getLogDirectory() + "file_info.log").c_str(), "wt");
// parse dir or file ?? // parse dir or file ??
const char *fileName= argv[1]; const char *fileName= argv[1];

View file

@ -998,7 +998,8 @@ int main(int nNbArg, char **ppArgs)
ChDir (sExeDir); ChDir (sExeDir);
// out a text file, with list of // out a text file, with list of
FILE *out= fopen(ppArgs[4], "wt"); FILE *out = nlfopen(ppArgs[4], "wt");
if(!out) if(!out)
{ {
outString(string("ERROR: cannot save ")+ppArgs[4]); outString(string("ERROR: cannot save ")+ppArgs[4]);

View file

@ -8,6 +8,7 @@
#include "nel/misc/time_nl.h" #include "nel/misc/time_nl.h"
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/common.h"
#include "nel/misc/triangle.h" #include "nel/misc/triangle.h"
#include "nel/misc/bsphere.h" #include "nel/misc/bsphere.h"
#include "3d/quad_tree.h" #include "3d/quad_tree.h"
@ -3121,8 +3122,8 @@ void CNelExport::deleteLM(INode& ZeNode)
sprintf( tmp, "%d", i ); sprintf( tmp, "%d", i );
sSaveName += tmp; sSaveName += tmp;
sSaveName += ".tga"; sSaveName += ".tga";
FILE *file; FILE *file = nlfopen(sSaveName, "rb")
if( file = fopen(sSaveName.c_str(),"rb") ) if (file)
{ {
fclose( file ); fclose( file );
DeleteFile( sSaveName.c_str() ); DeleteFile( sSaveName.c_str() );
@ -3521,8 +3522,8 @@ bool CNelExport::exportScene(std::vector<INode*>& vectNode)
sprintf( tmp, "%d", i ); sprintf( tmp, "%d", i );
sSaveName += tmp; sSaveName += tmp;
sSaveName += ".tga"; sSaveName += ".tga";
FILE *file; FILE *file = nlfopen(sSaveName, "rb");
if( file = fopen(sSaveName.c_str(),"rb") ) if (file)
{ {
fclose( file ); fclose( file );
DeleteFile( sSaveName.c_str() ); DeleteFile( sSaveName.c_str() );

View file

@ -15,6 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <nel/misc/path.h> #include <nel/misc/path.h>
#include <nel/misc/common.h>
#include <nel/misc/file.h> #include <nel/misc/file.h>
#include <nel/misc/config_file.h> #include <nel/misc/config_file.h>
#include <nel/3d/u_light.h> #include <nel/3d/u_light.h>
@ -851,7 +852,7 @@ bool ShapesExporter::renderPS(UInstance &entity, const string &output_path, doub
{ {
if(step > 0) 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); } 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); 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; uint selectedFrame = 0;
if(CFile::getExtension(filename) == "ps") 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) if(fp)
{ {
char str[100]; char str[100];

View file

@ -18,6 +18,7 @@
#include <iostream> #include <iostream>
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/common.h"
#include "nel/misc/bitmap.h" #include "nel/misc/bitmap.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/debug.h" #include "nel/misc/debug.h"
@ -49,7 +50,7 @@ std::string getOutputFileName(const std::string &inputFileName);
uint8 getType(const std::string &sFileNameDest) uint8 getType(const std::string &sFileNameDest)
{ {
uint32 dds; uint32 dds;
FILE *f = fopen(sFileNameDest.c_str(),"rb"); FILE *f = nlfopen(sFileNameDest, "rb");
if(f==NULL) if(f==NULL)
{ {
return NOT_DEFINED; return NOT_DEFINED;
@ -105,7 +106,7 @@ uint8 getType(const std::string &sFileNameDest)
bool sameType(const std::string &sFileNameDest, uint8 &algo, bool wantMipMap) bool sameType(const std::string &sFileNameDest, uint8 &algo, bool wantMipMap)
{ {
uint32 dds; uint32 dds;
FILE *f = fopen(sFileNameDest.c_str(),"rb"); FILE *f = nlfopen(sFileNameDest, "rb");
if(f==NULL) if(f==NULL)
{ {
return false; return false;

View file

@ -20,6 +20,7 @@
#include <iostream> #include <iostream>
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/common.h"
#include "nel/3d/quad_tree.h" #include "nel/3d/quad_tree.h"
#include "nel/3d/zone.h" #include "nel/3d/zone.h"
#include "nel/3d/landscape.h" #include "nel/3d/landscape.h"
@ -978,7 +979,7 @@ int main(sint argc, char **argv)
} }
#if WELD_LOG #if WELD_LOG
fdbg = fopen("log.txt","wt"); fdbg = nlfopen("log.txt","wt");
fprintf(fdbg,"Center zone : %s\n",argv[1]); fprintf(fdbg,"Center zone : %s\n",argv[1]);
#endif #endif

View file

@ -20,6 +20,7 @@
#include <nel/misc/types_nl.h> #include <nel/misc/types_nl.h>
#include <nel/misc/config_file.h> #include <nel/misc/config_file.h>
#include <nel/misc/debug.h> #include <nel/misc/debug.h>
#include <nel/misc/common.h>
#include <nel/misc/path.h> #include <nel/misc/path.h>
#include <nel/misc/i18n.h> #include <nel/misc/i18n.h>
@ -743,7 +744,7 @@ void displayZones()
\****************************************************************/ \****************************************************************/
void writeConfigFile(const char * configFileName) void writeConfigFile(const char * configFileName)
{ {
FILE * f = fopen(configFileName,"wt"); FILE * f = nlfopen(configFileName, "wt");
if(f==NULL) if(f==NULL)
{ {
@ -801,7 +802,7 @@ void writeConfigFile(const char * configFileName)
\****************************************************************/ \****************************************************************/
void initViewerConfig(const char * configFileName) void initViewerConfig(const char * configFileName)
{ {
FILE * f = fopen(configFileName,"rt"); FILE *f = nlfopen(configFileName, "rt");
if(f==NULL) if(f==NULL)
{ {
nlwarning("'%s' not found, default values used", configFileName); nlwarning("'%s' not found, default values used", configFileName);

View file

@ -32,6 +32,7 @@
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/smart_ptr.h" #include "nel/misc/smart_ptr.h"
#include "nel/misc/command.h" #include "nel/misc/command.h"
#include "nel/misc/common.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
//#include "nel/memory/memory_manager.h" //#include "nel/memory/memory_manager.h"
#include "nel/misc/i18n.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; const uint BUFFER_SIZE = 16*1024;
char lineBuffer[BUFFER_SIZE]; char lineBuffer[BUFFER_SIZE];
FILE *s;
vector<string> fields; vector<string> fields;
vector<string> args; vector<string> 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()); fprintf(stderr, "Can't find file %s to convert\n", file.c_str());
return; return;

View file

@ -20,6 +20,7 @@
#include "progress_dialog.h" #include "progress_dialog.h"
#include <sys/timeb.h> #include <sys/timeb.h>
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/common.h"
using namespace std; using namespace std;
using namespace NLMISC; using namespace NLMISC;
@ -468,9 +469,13 @@ void CData_mirrorDlg::OnOK()
if (!LogDirectory.empty()) if (!LogDirectory.empty())
{ {
string sTmp = LogDirectory + "data_mirror.txt"; string sTmp = LogDirectory + "data_mirror.txt";
FILE *f = fopen(sTmp.c_str(),"at"); FILE *f = nlfopen(sTmp ,"at");
fprintf(f,"Modified file : %s\n", dest.c_str());
fclose(f); if (f)
{
fprintf(f,"Modified file : %s\n", dest.c_str());
fclose(f);
}
} }
} }
@ -503,9 +508,12 @@ void CData_mirrorDlg::OnOK()
if (!LogDirectory.empty()) if (!LogDirectory.empty())
{ {
string sTmp = LogDirectory + "data_mirror.txt"; string sTmp = LogDirectory + "data_mirror.txt";
FILE *f = fopen(sTmp.c_str(),"at"); FILE *f = nlfopen(sTmp, "at");
fprintf(f,"Added file : %s\n", dest.c_str()); if (f)
fclose(f); {
fprintf(f,"Added file : %s\n", dest.c_str());
fclose(f);
}
} }
} }
@ -535,9 +543,13 @@ void CData_mirrorDlg::OnOK()
if (!LogDirectory.empty()) if (!LogDirectory.empty())
{ {
string sTmp = LogDirectory + "data_mirror.txt"; string sTmp = LogDirectory + "data_mirror.txt";
FILE *f = fopen(sTmp.c_str(),"at"); FILE *f = nlfopen(sTmp, "at");
fprintf(f,"Removed file : %s\n", dest.c_str());
fclose(f); if (f)
{
fprintf(f,"Removed file : %s\n", dest.c_str());
fclose(f);
}
} }
} }
} }

View file

@ -40,6 +40,7 @@ int _getch()
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/sheet_id.h" #include "nel/misc/sheet_id.h"
#include "nel/misc/common.h"
#include <vector> #include <vector>
@ -86,7 +87,7 @@ int main(int argc, const char *argv[])
sort(sheets.begin(), sheets.end(), Pred); sort(sheets.begin(), sheets.end(), Pred);
// display. // display.
FILE *out= fopen("sheetid.txt", "wb"); FILE *out= nlfopen("sheetid.txt", "wb");
if(out) if(out)
{ {
for(uint i=0;i<sheets.size();i++) for(uint i=0;i<sheets.size();i++)

View file

@ -18,6 +18,7 @@
// misc // misc
#include <nel/misc/types_nl.h> #include <nel/misc/types_nl.h>
#include <nel/misc/file.h> #include <nel/misc/file.h>
#include <nel/misc/common.h>
#include <nel/misc/path.h> #include <nel/misc/path.h>
#include <nel/misc/config_file.h> #include <nel/misc/config_file.h>
@ -567,9 +568,9 @@ int main( int argc, char ** argv )
// dump the list of extensions in a txt file // dump the list of extensions in a txt file
if( dumpExtensions ) if( dumpExtensions )
{ {
FILE * extListOutput;
string extListFileName = outputPath + "sheet_ext.txt"; 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()); nlwarning("Can't open output file %s",extListFileName.c_str());
return 1; return 1;

View file

@ -17,6 +17,7 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/misc/app_context.h" #include "nel/misc/app_context.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/common.h"
#include "nel/misc/sstring.h" #include "nel/misc/sstring.h"
#include "nel/misc/algo.h" #include "nel/misc/algo.h"
@ -228,7 +229,7 @@ int main(int argc, char *argv[])
// read the index file // read the index file
set<string> fileInIndex; set<string> fileInIndex;
char lineBuffer[1024]; char lineBuffer[1024];
FILE *fp = fopen(indexFileName.c_str(), "rt"); FILE *fp = nlfopen(indexFileName, "rt");
while (fgets(lineBuffer, 1024, fp)) while (fgets(lineBuffer, 1024, fp))
fileInIndex.insert(CSString(lineBuffer).strip()); fileInIndex.insert(CSString(lineBuffer).strip());
@ -263,8 +264,8 @@ int main(int argc, char *argv[])
if (!validFiles.empty() && needRepack) if (!validFiles.empty() && needRepack)
{ {
// open the pack file // open the pack file
// FILE *fp = fopen(filename.c_str(), "wt"); // FILE *fp = nlfopen(filename, "wt");
FILE *fp = fopen(packFileName.c_str(), "wt"); FILE *fp = nlfopen(packFileName, "wt");
fprintf(fp, "<nel:packed_xml>\n"); fprintf(fp, "<nel:packed_xml>\n");
@ -275,7 +276,7 @@ int main(int argc, char *argv[])
printf("Adding file '%s'...\n", CFile::getFilename(subFileName).c_str()); printf("Adding file '%s'...\n", CFile::getFilename(subFileName).c_str());
fprintf(fp, " <nel:xml_file name=\"%s\">\n", CFile::getFilename(subFileName).c_str()); fprintf(fp, " <nel:xml_file name=\"%s\">\n", CFile::getFilename(subFileName).c_str());
FILE *subFp = fopen(subFileName.c_str(), "rt"); FILE *subFp = nlfopen(subFileName, "rt");
nlassert(subFp != NULL); nlassert(subFp != NULL);
char buffer[MaxLineSize]; char buffer[MaxLineSize];
char *result; char *result;
@ -304,7 +305,7 @@ int main(int argc, char *argv[])
fclose(fp); fclose(fp);
// write the disposable index file used by pack to check for erased file // 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<validFiles.size(); ++i) for (uint i=0; i<validFiles.size(); ++i)
{ {
fprintf(fp, "%s\n", CFile::getFilename(validFiles[i]).c_str()); fprintf(fp, "%s\n", CFile::getFilename(validFiles[i]).c_str());
@ -327,8 +328,8 @@ int main(int argc, char *argv[])
{ {
printf("Unpacking directory '%s'...\n", dirName.c_str()); printf("Unpacking directory '%s'...\n", dirName.c_str());
// open the pack file // open the pack file
// FILE *fp = fopen((dirName+"/tmp."+DefaultExt).c_str(), "rt"); // FILE *fp = nlfopen(dirName+"/tmp."+DefaultExt, "rt");
FILE *fp = fopen(filename.c_str(), "rt"); FILE *fp = nlfopen(filename, "rt");
if (!recursive) if (!recursive)
{ {
// if we are not recursive, we MUST have a file here // if we are not recursive, we MUST have a file here

View file

@ -333,7 +333,7 @@ std::string getServiceStateFileName(const std::string& serviceAlias,const std::s
std::string getOfflineServiceState(const std::string& serviceAlias,const std::string& serviceExecutionPath) std::string getOfflineServiceState(const std::string& serviceAlias,const std::string& serviceExecutionPath)
{ {
// open the file for reading // open the file for reading
FILE* f= fopen(getServiceStateFileName(serviceAlias,serviceExecutionPath).c_str(),"rt"); FILE* f = nlfopen(getServiceStateFileName(serviceAlias,serviceExecutionPath), "rt");
if (f==NULL) return "Offline"; if (f==NULL) return "Offline";
// setup a buffer to hold the text read from the file // setup a buffer to hold the text read from the file
@ -366,7 +366,7 @@ bool writeServiceLaunchCtrl(const std::string& serviceAlias,const std::string& s
NLMISC::CFile::createDirectoryTree(serviceExecutionPath); NLMISC::CFile::createDirectoryTree(serviceExecutionPath);
// open the file for writing // open the file for writing
FILE* f= fopen(getServiceLaunchCtrlFileName(serviceAlias,serviceExecutionPath,delay).c_str(),"wt"); FILE* f= nlfopen(getServiceLaunchCtrlFileName(serviceAlias,serviceExecutionPath,delay), "wt");
if (f==NULL) return false; if (f==NULL) return false;
// write the text to the file // write the text to the file
@ -1636,7 +1636,7 @@ NLMISC_COMMAND(aesSystem, "Execute a system() call", "<command>")
char str[1024]; char str[1024];
FILE *fp = fopen(fn.c_str(), "rt"); FILE *fp = nlfopen(fn, "rt");
if (fp != NULL) if (fp != NULL)
{ {
while (true) while (true)
@ -1654,7 +1654,7 @@ NLMISC_COMMAND(aesSystem, "Execute a system() call", "<command>")
log.displayNL("No stdout"); log.displayNL("No stdout");
} }
fp = fopen(fne.c_str(), "rt"); fp = nlfopen(fne, "rt");
if (fp != NULL) if (fp != NULL)
{ {
while (true) while (true)

View file

@ -27,6 +27,7 @@
#endif #endif
#include "nel/misc/debug.h" #include "nel/misc/debug.h"
#include "nel/misc/common.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/thread.h" #include "nel/misc/thread.h"
@ -586,7 +587,7 @@ private:
string dest = filename.substr(0, filename.size ()-4); string dest = filename.substr(0, filename.size ()-4);
setRWAccess(dest); setRWAccess(dest);
if(VerboseLog) nlinfo("Calling fopen('%s','wb')", dest.c_str()); 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) if (fp == NULL)
{ {
string err = toString("Can't open file '%s' : code=%d %s, (error code 32)", dest.c_str(), errno, strerror(errno)); string err = toString("Can't open file '%s' : code=%d %s, (error code 32)", dest.c_str(), errno, strerror(errno));

View file

@ -19,6 +19,7 @@
#include "nel/misc/singleton.h" #include "nel/misc/singleton.h"
#include <time.h> #include <time.h>
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/common.h"
#include "nel/net/module.h" #include "nel/net/module.h"
#include "nel/net/module_builder_parts.h" #include "nel/net/module_builder_parts.h"
#include "nel/net/unified_network.h" #include "nel/net/unified_network.h"
@ -297,7 +298,7 @@ namespace ADMIN
// read the persistent state file if any // read the persistent state file if any
string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+AESPersistentStateFilename; 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) if (fp != NULL)
{ {
char buffer[1024]; char buffer[1024];
@ -567,7 +568,7 @@ namespace ADMIN
if (now > _LastNagiosReport+_NagiosReportDelay) if (now > _LastNagiosReport+_NagiosReportDelay)
{ {
// write the nagios report // write the nagios report
FILE *fp = fopen("aes_nagios_report.txt", "wt"); FILE *fp = nlfopen("aes_nagios_report.txt", "wt");
if (fp != NULL) if (fp != NULL)
{ {
// output the current date // output the current date
@ -632,7 +633,7 @@ namespace ADMIN
{ {
/// The persistent service orders need to be saved /// The persistent service orders need to be saved
string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+AESPersistentStateFilename; 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) if (fp != NULL)
{ {
{ {
@ -801,7 +802,7 @@ namespace ADMIN
std::string getOfflineServiceState(const std::string& serviceAlias) std::string getOfflineServiceState(const std::string& serviceAlias)
{ {
// open the file for reading // open the file for reading
FILE* f= fopen(getServiceStateFileName(serviceAlias).c_str(),"rt"); FILE* f= nlfopen(getServiceStateFileName(serviceAlias), "rt");
if (f==NULL) return "STOPPED"; if (f==NULL) return "STOPPED";
// setup a buffer to hold the text read from the file // setup a buffer to hold the text read from the file
@ -825,7 +826,7 @@ namespace ADMIN
uint32 getOfflineServicePID(const std::string& serviceAlias) uint32 getOfflineServicePID(const std::string& serviceAlias)
{ {
// open the file for reading // open the file for reading
FILE* f= fopen(getServicePIDFileName(serviceAlias).c_str(),"rt"); FILE* f = nlfopen(getServicePIDFileName(serviceAlias), "rt");
if (f==NULL) return 0; if (f==NULL) return 0;
// setup a buffer to hold the text read from the file // setup a buffer to hold the text read from the file
@ -853,7 +854,7 @@ namespace ADMIN
uint32 getServiceStartLoopCounter(const std::string& serviceAlias) uint32 getServiceStartLoopCounter(const std::string& serviceAlias)
{ {
// open the file for reading // open the file for reading
FILE* f= fopen(getServiceLoopCounterFileName(serviceAlias).c_str(),"rt"); FILE* f= nlfopen(getServiceLoopCounterFileName(serviceAlias), "rt");
if (f==NULL) if (f==NULL)
return 0; return 0;
@ -936,7 +937,7 @@ namespace ADMIN
NLMISC::CFile::createDirectoryTree(path); NLMISC::CFile::createDirectoryTree(path);
// open the file for writing // 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; if (f==NULL) return false;
// write the text to the file // write the text to the file

View file

@ -18,6 +18,7 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include <time.h> #include <time.h>
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/common.h"
#include "nel/misc/sstring.h" #include "nel/misc/sstring.h"
#include "nel/misc/mutable_container.h" #include "nel/misc/mutable_container.h"
#include "nel/net/service.h" #include "nel/net/service.h"
@ -195,7 +196,7 @@ namespace ADMIN
// read the persistent state file if any // read the persistent state file if any
string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+ASPersistentStateFilename; 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) if (fp != NULL)
{ {
char buffer[1024]; char buffer[1024];
@ -232,7 +233,7 @@ namespace ADMIN
if (_NeedToWriteStateFile) if (_NeedToWriteStateFile)
{ {
string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+ASPersistentStateFilename; 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) if (fp != NULL)
{ {
CSString line; CSString line;

View file

@ -18,6 +18,7 @@
#include "nel/misc/command.h" #include "nel/misc/command.h"
#include "nel/misc/variable.h" #include "nel/misc/variable.h"
#include "nel/misc/common.h"
#include "nel/misc/aabbox.h" #include "nel/misc/aabbox.h"
#include "nel/misc/vector.h" #include "nel/misc/vector.h"
#include "nel/misc/vectord.h" #include "nel/misc/vectord.h"
@ -1979,7 +1980,7 @@ public:
CBMP4Image<2,2>::SHdr imageHdr(imageWidth, imageHeight); CBMP4Image<2,2>::SHdr imageHdr(imageWidth, imageHeight);
CBMP4Image<2,2>::SPalette imagePalette; CBMP4Image<2,2>::SPalette imagePalette;
FILE *outf = fopen((OutputPath+name+".bmp").c_str(),"wb"); FILE *outf = nlfopen(OutputPath+name+".bmp", "wb");
if (outf == NULL) if (outf == NULL)
return; return;
@ -2095,8 +2096,8 @@ public:
CBMP4Image<2,2>::SHdr imageHdr(imageWidth, imageHeight); CBMP4Image<2,2>::SHdr imageHdr(imageWidth, imageHeight);
CBMP4Image<2,2>::SPalette imagePalette; CBMP4Image<2,2>::SPalette imagePalette;
FILE *outf = fopen((OutputPath+name+".bmp").c_str(),"wb"); FILE *outf = nlfopen(OutputPath+name+".bmp", "wb");
FILE *outfh = fopen((OutputPath+name+"_hm.bmp").c_str(),"wb"); FILE *outfh = nlfopen(OutputPath+name+"_hm.bmp", "wb");
if (outf == NULL) if (outf == NULL)
return; return;

View file

@ -183,7 +183,7 @@ std::string CAIScriptDataManager::dirname()
// string fullfilename = dirname() + "/" + name + ".ai_script_data"; // string fullfilename = dirname() + "/" + name + ".ai_script_data";
// if (!CFile::fileExists(fullfilename) || CFile::getFileSize(fullfilename)==0) // if (!CFile::fileExists(fullfilename) || CFile::getFileSize(fullfilename)==0)
// { // {
// FILE* fp = fopen(fullfilename.c_str(), "w"); // FILE* fp = nlfopen(fullfilename, "w");
// if (fp) // if (fp)
// { // {
// fprintf(fp, "// This file contains data for the AI script\n"); // fprintf(fp, "// This file contains data for the AI script\n");

View file

@ -25,6 +25,7 @@
#include "entities_game_service.h" #include "entities_game_service.h"
#include "egs_globals.h" #include "egs_globals.h"
#include "nel/misc/noise_value.h" #include "nel/misc/noise_value.h"
#include "nel/misc/common.h"
#include "nel/misc/variable.h" #include "nel/misc/variable.h"
#include "nel/misc/words_dictionary.h" #include "nel/misc/words_dictionary.h"
#include "game_share/time_weather_season/time_date_season_manager.h" #include "game_share/time_weather_season/time_date_season_manager.h"
@ -587,7 +588,7 @@ void CDeposit::selectRMsByFilters( std::vector<std::string>& exactRMCodesS, cons
if ( ! depositReportCreated ) if ( ! depositReportCreated )
{ {
depositReportCreated = true; depositReportCreated = true;
depositReportFile = fopen( "deposit_contents.csv", "wt" ); // fclose() auto? depositReportFile = nlfopen( "deposit_contents.csv", "wt" ); // fclose() auto?
if ( depositReportFile ) if ( depositReportFile )
{ {
fprintf( depositReportFile, "Deposit;RM;When in year;When in day;Weather;\n" ); fprintf( depositReportFile, "Deposit;RM;When in year;When in day;Weather;\n" );

View file

@ -2564,8 +2564,7 @@ void CGameItem::dumpGameItemStats( const string& fileName )
{ {
if( !fileName.empty() ) if( !fileName.empty() )
{ {
FILE * f; FILE *f = nlfopen(fileName, "w");
f = fopen(fileName.c_str(),"w");
if(f) if(f)
{ {

View file

@ -791,7 +791,7 @@ void CGameItemManager::destroyItem( CGameItemPtr &ptr )
//void CGameItemManager::dumpGameItemList( const string& fileName ) //void CGameItemManager::dumpGameItemList( const string& fileName )
//{ //{
// FILE * f; // FILE * f;
// f = fopen(fileName.c_str(),"w"); // f = nlfopen(fileName, "w");
// //
// if(f) // if(f)
// { // {

View file

@ -1240,8 +1240,8 @@ bool forageTestDoExtract(
} }
// Request and output results // Request and output results
FILE *f = fopen( std::string(getLogDirectory() + "forage_test.csv").c_str(), "at" ); FILE *f = nlfopen(getLogDirectory() + "forage_test.csv", "at" );
FILE *f2 = fopen( std::string(getLogDirectory() + "forage_test.log").c_str(), "at" ); FILE *f2 = nlfopen(getLogDirectory() + "forage_test.log", "at" );
float reqS = 1.0f / (reqPeriod * 10.0f); float reqS = 1.0f / (reqPeriod * 10.0f);
float req [CHarvestSource::NbPosRTProps]; float req [CHarvestSource::NbPosRTProps];
float abs [CHarvestSource::NbPosRTProps]; float abs [CHarvestSource::NbPosRTProps];

View file

@ -1884,13 +1884,13 @@ void CDepositMapsBatchTask::run()
if ( ! CFile::isExists( pathName ) ) if ( ! CFile::isExists( pathName ) )
CFile::createDirectory( pathName ); CFile::createDirectory( pathName );
pathName += "/"; pathName += "/";
FILE *outputF = fopen( (pathName + "deposit_maps.html").c_str(), "w" ); FILE *outputF = nlfopen(pathName + "deposit_maps.html", "w");
if ( ! outputF ) if ( ! outputF )
{ {
nlwarning( "Can't create file %sdeposit_maps.html", pathName.c_str() ); nlwarning( "Can't create file %sdeposit_maps.html", pathName.c_str() );
return; return;
} }
FILE *inputF = fopen( _InputFilename.c_str(), "r" ); FILE *inputF = nlfopen(_InputFilename, "r");
if ( ! inputF ) if ( ! inputF )
{ {
fprintf( outputF, "File %s not found", _InputFilename.c_str() ); fprintf( outputF, "File %s not found", _InputFilename.c_str() );

View file

@ -192,7 +192,7 @@ void CCDBSynchronised::write( const string& fileName )
if ( _DataStructRoot ) if ( _DataStructRoot )
{ {
TWriteCallbackArg wca; TWriteCallbackArg wca;
wca.F = fopen( fileName.c_str(),"w" ); wca.F = nlfopen(fileName, "w");
wca.Container = &_DataContainer; wca.Container = &_DataContainer;
ICDBStructNode::CTextId id; ICDBStructNode::CTextId id;
_DataStructRoot->foreachLeafCall( cbWrite, id, &wca ); _DataStructRoot->foreachLeafCall( cbWrite, id, &wca );

View file

@ -102,11 +102,11 @@ void CPlayer::checkCrashMarker()
if (!CFile::isExists(LastLoadFileName)) if (!CFile::isExists(LastLoadFileName))
{ {
// create the file if needed // create the file if needed
nlverify(LastLoad = fopen(LastLoadFileName, "wb")); nlverify(LastLoad = nlfopen(LastLoadFileName, "wb"));
fclose(LastLoad); fclose(LastLoad);
} }
nlverify(LastLoad = fopen(LastLoadFileName, "r+b")); nlverify(LastLoad = nlfopen(LastLoadFileName, "r+b"));
// check // check
uint32 lastBad[2]; uint32 lastBad[2];

View file

@ -118,7 +118,7 @@ void CSession::log(const NLMISC::CSString& lang,const NLMISC::CSString& txt)
nlassert(!fileName.empty()); nlassert(!fileName.empty());
nlinfo("Opening new log file: %s",fileName.c_str()); 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); DROP_IF(_Files[lang]==NULL,"Failed to open log file for writing: "+fileName,return);
} }
fprintf(_Files[lang],"%s\n",txt.c_str()); fprintf(_Files[lang],"%s\n",txt.c_str());

View file

@ -391,7 +391,7 @@ void CRepositoryReceiver::beginFile(NLNET::IModuleProxy *sender, const std::stri
_CurrentFileExpected= fileSize; _CurrentFileExpected= fileSize;
// open the temp file // 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); BOMB_IF(_CurrentFileHandle==NULL,"Failed to open temporary file for writing: "+rrTempFileName(_TargetDirectory,_EmitterName),return);
} }

View file

@ -88,7 +88,7 @@ public:
NLMISC::CFile::deleteFile(_TmpFileName); NLMISC::CFile::deleteFile(_TmpFileName);
DROP_IF(NLMISC::CFile::fileExists(_TmpFileName),"Failed to delete file: "+_TmpFileName,return); DROP_IF(NLMISC::CFile::fileExists(_TmpFileName),"Failed to delete file: "+_TmpFileName,return);
_File= fopen(_TmpFileName.c_str(),"wb"); _File = nlfopen(_TmpFileName,"wb");
} }
~CSimpleFileDisplayer() ~CSimpleFileDisplayer()

View file

@ -19,6 +19,7 @@
#include <time.h> #include <time.h>
#include "nel/misc/time_nl.h" #include "nel/misc/time_nl.h"
#include "nel/misc/thread.h" #include "nel/misc/thread.h"
#include "nel/misc/common.h"
#include "nel/misc/random.h" #include "nel/misc/random.h"
#include "nel/misc/singleton.h" #include "nel/misc/singleton.h"
#include "nel/net/service.h" #include "nel/net/service.h"
@ -926,7 +927,7 @@ public:
// prepare the output file // prepare the output file
string outputFile = queryOptions.OutputPrefix+LogQueryResultFile.get(); string outputFile = queryOptions.OutputPrefix+LogQueryResultFile.get();
FILE *fp = fopen(outputFile.c_str(), "wt");; FILE *fp = nlfopen(outputFile, "wt");;
if (fp == NULL) if (fp == NULL)
{ {
_QueryStatus.write(TThreadStatus(qs_push_state, "ErrorWritingQueryResult")); _QueryStatus.write(TThreadStatus(qs_push_state, "ErrorWritingQueryResult"));

View file

@ -21,6 +21,7 @@
// nel // nel
#include "nel/misc/variable.h" #include "nel/misc/variable.h"
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/common.h"
// game share // game share
#include "game_share/utils.h" #include "game_share/utils.h"
@ -599,7 +600,7 @@ namespace PATCHMAN
// nldebug("- Reading file data @offset: %d (%d bytes)",newFileEntry.StartOffset,fileSize); // nldebug("- Reading file data @offset: %d (%d bytes)",newFileEntry.StartOffset,fileSize);
// read in the file // 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); BOMB_IF(inf==NULL,"Failed to open input file for reading: "+fileName,return false);
uint32 bytesRead=(uint32)fread(&_CacheBuffer[newFileEntry.StartOffset],1,fileSize,inf); uint32 bytesRead=(uint32)fread(&_CacheBuffer[newFileEntry.StartOffset],1,fileSize,inf);
fclose(inf); fclose(inf);

View file

@ -409,7 +409,7 @@ void CRepositoryReceiver::fileList(NLNET::IModuleProxy *sender, uint32 version,
// _CurrentFileExpected= fileSize; // _CurrentFileExpected= fileSize;
// //
// // open the temp file // // 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); // BOMB_IF(_CurrentFileHandle==NULL,"Failed to open temporary file for writing: "+rrTempFileName(_TargetDirectories.patchDirectoryName(),_EmitterName),return);
// } // }
// //

View file

@ -20,6 +20,7 @@
// nel // nel
#include "nel/misc/variable.h" #include "nel/misc/variable.h"
#include "nel/misc/common.h"
#include "nel/net/service.h" #include "nel/net/service.h"
#include "nel/net/module.h" #include "nel/net/module.h"
#include "nel/net/module_builder_parts.h" #include "nel/net/module_builder_parts.h"
@ -775,7 +776,7 @@ NLMISC_CLASS_COMMAND_IMPL(CServerPatchTerminal, depDevCfg)
CSString cfgFileName= appDesc.CmdLine.firstWord()+".cfg"; CSString cfgFileName= appDesc.CmdLine.firstWord()+".cfg";
string fileName = configDirectory+cfgFileName; string fileName = configDirectory+cfgFileName;
FILE *fp = fopen(fileName.c_str(), "wt"); FILE *fp = nlfopen(fileName, "wt");
nlassert(fp != NULL); nlassert(fp != NULL);
fwrite(appDesc.CfgFile.data(), appDesc.CfgFile.size(), 1, fp); fwrite(appDesc.CfgFile.data(), appDesc.CfgFile.size(), 1, fp);
fclose(fp); fclose(fp);
@ -808,7 +809,7 @@ NLMISC_CLASS_COMMAND_IMPL(CServerPatchTerminal, depDevCfg)
batch << "start " << cmdLine; batch << "start " << cmdLine;
fileName = DevConfigDirectory.get()+"/start_"+appDesc.ShardName+"_"+appDesc.StartOrder+"_"+appDesc.AppName+".bat"; fileName = DevConfigDirectory.get()+"/start_"+appDesc.ShardName+"_"+appDesc.StartOrder+"_"+appDesc.AppName+".bat";
fp = fopen(fileName.c_str(), "wt"); fp = nlfopen(fileName, "wt");
nlassert(fp != NULL); nlassert(fp != NULL);
fwrite(batch.data(), batch.size(), 1, fp); fwrite(batch.data(), batch.size(), 1, fp);
fclose(fp); fclose(fp);

View file

@ -22,6 +22,7 @@
*/ */
#include <nel/misc/types_nl.h> #include <nel/misc/types_nl.h>
#include <nel/misc/stream.h> #include <nel/misc/stream.h>
#include <nel/misc/common.h>
#include <nel/misc/bit_set.h> #include <nel/misc/bit_set.h>
#include <nel/misc/variable.h> #include <nel/misc/variable.h>
@ -282,7 +283,7 @@ public:
if (_File != NULL) if (_File != NULL)
return false; return false;
_File = fopen(filename, mode); _File = nlfopen(filename, mode);
if (_File == NULL) if (_File == NULL)
return false; return false;

View file

@ -19,6 +19,7 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/common.h"
#include "nel/misc/sstring.h" #include "nel/misc/sstring.h"
#include "nel/net/service.h" #include "nel/net/service.h"
#include "game_share/utils.h" #include "game_share/utils.h"
@ -101,7 +102,7 @@ public:
ptm = gmtime(&endTime); ptm = gmtime(&endTime);
// write to the log file // write to the log file
FILE* fileHandle= fopen(DailyActivityLogFileName,"ab"); FILE* fileHandle= nlfopen(DailyActivityLogFileName,"ab");
nlassert(fileHandle!=NULL); nlassert(fileHandle!=NULL);
fprintf(fileHandle,"%02u/%02u/%u CDailyTaskScheduler: Started: %02u:%02u, Finished: %02u:%02u, Executed %u commands Started %u Jobs\n", 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 ); 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 );

View file

@ -19,6 +19,7 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/common.h"
#include "nel/misc/sstring.h" #include "nel/misc/sstring.h"
#include "nel/net/service.h" #include "nel/net/service.h"
#include "game_share/utils.h" #include "game_share/utils.h"
@ -101,7 +102,7 @@ public:
ptm = gmtime(&endTime); ptm = gmtime(&endTime);
// write to the log file // write to the log file
FILE* fileHandle= fopen(HourlyActivityLogFileName,"ab"); FILE* fileHandle= nlfopen(HourlyActivityLogFileName,"ab");
nlassert(fileHandle!=NULL); nlassert(fileHandle!=NULL);
fprintf(fileHandle,"%02u/%02u/%u CHourlyTaskScheduler: Started: %02u:%02u, Finished: %02u:%02u, Executed %u commands Started %u Jobs\n", 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 ); 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 );

View file

@ -31,6 +31,7 @@
// Nel // Nel
#include "nel/misc/sheet_id.h" #include "nel/misc/sheet_id.h"
#include "nel/misc/command.h" #include "nel/misc/command.h"
#include "nel/misc/common.h"
#include "nel/georges/u_form_elm.h" #include "nel/georges/u_form_elm.h"
#include "nel/georges/u_form.h" #include "nel/georges/u_form.h"
#include "nel/georges/u_form_loader.h" #include "nel/georges/u_form_loader.h"
@ -270,7 +271,7 @@ void CTestingTool::startTestSession( const std::string& sheet )
//---------------------------------------------------------------- //----------------------------------------------------------------
void CTestingTool::testSessionProceed() void CTestingTool::testSessionProceed()
{ {
_TestSessionReport = fopen( "testSessionReport.txt", "w+t" ); _TestSessionReport = nlfopen( "testSessionReport.txt", "w+t" );
fputs( "=====================================================================\n", _TestSessionReport ); fputs( "=====================================================================\n", _TestSessionReport );
fputs( "===================== NEW TEST SESSION STARTED ======================\n", _TestSessionReport ); fputs( "===================== NEW TEST SESSION STARTED ======================\n", _TestSessionReport );

View file

@ -23,6 +23,7 @@
#include "CompilDialog.h" #include "CompilDialog.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/common.h"
#include "nel/ligo/primitive.h" #include "nel/ligo/primitive.h"
#include "../mission_compiler_lib/mission_compiler.h" #include "../mission_compiler_lib/mission_compiler.h"
#include "nel/misc/config_file.h" #include "nel/misc/config_file.h"
@ -201,7 +202,7 @@ BOOL CMissionCompilerFeDlg::OnInitDialog()
if (NLMISC::CFile::fileExists(tmpPath)) if (NLMISC::CFile::fileExists(tmpPath))
{ {
FILE *f = fopen(tmpPath, "r"); FILE *f = nlfopen(tmpPath, "r");
if (f == NULL) if (f == NULL)
{ {
nlinfo("Can't open the file for reading !\n%s", tmpPath); 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()); nlwarning("Can't find index file '%s' in search path, no mission will be valid", filename.c_str());
return; return;
} }
FILE* file = fopen(pathName.c_str(), "w"); FILE* file = nlfopen(pathName, "w");
nlassert(file!=NULL); nlassert(file!=NULL);
// AuthorizedStates // AuthorizedStates

View file

@ -17,6 +17,7 @@
#include "mission_compiler.h" #include "mission_compiler.h"
#include "step.h" #include "step.h"
#include "nel/misc/i18n.h" #include "nel/misc/i18n.h"
#include "nel/misc/common.h"
#include "nel/ligo/primitive_utils.h" #include "nel/ligo/primitive_utils.h"
using namespace std; 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) 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) if (f == NULL)
return false; return false;

View file

@ -17,6 +17,7 @@
#include "moulinette.h" #include "moulinette.h"
#include "utils.h" #include "utils.h"
#include "nel/misc/algo.h" #include "nel/misc/algo.h"
#include "nel/misc/common.h"
TRMItem currentDocItem; TRMItem currentDocItem;
CRMData SortableData; CRMData SortableData;
@ -1279,7 +1280,7 @@ void ItemNamesSave()
CSString data, output; CSString data, output;
FILE* file; FILE* file;
file = fopen( ITEM_WORDS_WK.c_str(), "rb" ); file = nlfopen( ITEM_WORDS_WK, "rb" );
char c; char c;
fread( &c, 1, 1, file ); fread( &c, 1, 1, file );

View file

@ -19,6 +19,8 @@
#include <limits> #include <limits>
#include "nel/misc/common.h"
// DtName must be the 1st one // 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 }; 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" }; 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 ) if ( ! _Enabled )
return; return;
_File = fopen( filename.c_str(), "wt" ); _File = nlfopen( filename, "wt" );
if(!_File) if(!_File)
{ {
throw Exception("Could not open html: %s", filename.c_str()); throw Exception("Could not open html: %s", filename.c_str());

View file

@ -57,7 +57,7 @@ vector<CVectorSString> items;
// check the items file (locSlot and item number coherence) // check the items file (locSlot and item number coherence)
int verifItemsFile (const char *filename) int verifItemsFile (const char *filename)
{ {
FILE *f = fopen(filename, "r"); FILE *f = nlfopen(filename, "r");
if (f == NULL) if (f == NULL)
nlerror("Can't open file : %s", filename); nlerror("Can't open file : %s", filename);
@ -89,7 +89,7 @@ int verifItemsFile (const char *filename)
// check csv file (locSlot and item number coherence) // check csv file (locSlot and item number coherence)
int verifCsvFile (const char *filename) int verifCsvFile (const char *filename)
{ {
FILE *f = fopen(filename, "r"); FILE *f = nlfopen(filename, "r");
if (f == NULL) if (f == NULL)
nlerror("Can't open file : %s", filename); nlerror("Can't open file : %s", filename);
@ -165,7 +165,7 @@ int getItemsFromFile(const char *filename)
// fill 'fields' structure with values from file // fill 'fields' structure with values from file
int getFieldsFromFile(const char *filename) int getFieldsFromFile(const char *filename)
{ {
FILE *f = fopen(filename, "r"); FILE *f = nlfopen(filename, "r");
if (f == NULL) if (f == NULL)
nlerror("Can't open file : %s", filename); 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 // parse the file to count the number of items
int getNbItemFromFile(const char *filename) int getNbItemFromFile(const char *filename)
{ {
FILE *f = fopen(filename, "r"); FILE *f = nlfopen(filename, "r");
if (f == NULL) if (f == NULL)
nlerror("Can't open file : %s", filename); nlerror("Can't open file : %s", filename);
@ -214,7 +214,7 @@ int exportCsv(const char *filename)
nlassert(fields.size() != 0); nlassert(fields.size() != 0);
uint i, j; uint i, j;
FILE *f = fopen(filename, "w"); FILE *f = nlfopen(filename, "w");
if (f == NULL) if (f == NULL)
nlerror("Can't open file : %s", filename); nlerror("Can't open file : %s", filename);
@ -241,7 +241,7 @@ int importCsv(const char *filename)
verifCsvFile(filename); verifCsvFile(filename);
char buffer[1024]; char buffer[1024];
FILE *f = fopen(filename, "r"); FILE *f = nlfopen(filename, "r");
if (f == NULL) if (f == NULL)
nlerror("Can't open file : %s", filename); nlerror("Can't open file : %s", filename);

View file

@ -19,6 +19,7 @@
#include "nel/misc/config_file.h" #include "nel/misc/config_file.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/common.h"
using namespace std; using namespace std;
@ -57,7 +58,7 @@ int main(int argc, char *argv[])
{ {
// build a default config file // build a default config file
string fileName = vif.asString(); string fileName = vif.asString();
FILE *fp = fopen(fileName.c_str(), "wt"); FILE *fp = nlfopen(fileName.c_str(), "wt");
if (fp == NULL) if (fp == NULL)
{ {
nlwarning("Can't open file '%s' for writing", nlwarning("Can't open file '%s' for writing",

View file

@ -17,6 +17,7 @@
#include <nel/misc/types_nl.h> #include <nel/misc/types_nl.h>
#include <nel/misc/ucstring.h> #include <nel/misc/ucstring.h>
#include <nel/misc/common.h>
#include <nel/misc/sstring.h> #include <nel/misc/sstring.h>
#include <nel/misc/i18n.h> #include <nel/misc/i18n.h>
@ -121,7 +122,7 @@ int main(int argc, char *argv[])
case ASCII: case ASCII:
{ {
string s = str.toString(); string s = str.toString();
FILE *fp = fopen(outputFile.c_str(), "wt"); FILE *fp = nlfopen(outputFile, "wt");
fwrite(s.data(), s.size(), 1, fp); fwrite(s.data(), s.size(), 1, fp);
fclose(fp); fclose(fp);
} }

View file

@ -46,6 +46,7 @@
#include "editor_primitive.h" #include "editor_primitive.h"
#include "file_dialog_ex.h" #include "file_dialog_ex.h"
#include "nel/misc/mem_stream.h" #include "nel/misc/mem_stream.h"
#include "nel/misc/common.h"
#include <string> #include <string>
@ -4334,7 +4335,7 @@ void CMainFrame::OnMissionCompiler()
GetEnvironmentVariable("TMP", tmpPath, MAX_PATH); GetEnvironmentVariable("TMP", tmpPath, MAX_PATH);
strcat(tmpPath, "\\tmptool.txt"); strcat(tmpPath, "\\tmptool.txt");
FILE *f = fopen(tmpPath, "w"); FILE *f = nlfopen(tmpPath, "w");
if (f==NULL) if (f==NULL)
infoMessage("Can't open file for writing !\n%s", tmpPath); infoMessage("Can't open file for writing !\n%s", tmpPath);

View file

@ -257,7 +257,7 @@ sint main( sint argc, char ** argv )
// TEST // TEST
/*printf("Writing debug text file...\n"); /*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 ) 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 ); fprintf(outputTest,"id: %s str: %s occ: %d\n",(*itBase).second.Id.c_str(),(*itBase).second.Str.c_str(), (*itBase).second.Occurence );

View file

@ -1009,7 +1009,7 @@ public:
std::string result = ITemplatizerBloc::eval(env); std::string result = ITemplatizerBloc::eval(env);
FILE* f; FILE* f;
f = fopen(filename.c_str(), (clearfile == "true" ? "w" : "a")); f = nlfopen(filename, (clearfile == "true" ? "w" : "a"));
if (f != NULL) if (f != NULL)
{ {
fwrite(result.c_str(), 1, result.size(), f); fwrite(result.c_str(), 1, result.size(), f);

View file

@ -33,6 +33,7 @@
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/smart_ptr.h" #include "nel/misc/smart_ptr.h"
#include "nel/misc/command.h" #include "nel/misc/command.h"
#include "nel/misc/common.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include <nel/misc/sstring.h> #include <nel/misc/sstring.h>
#include <nel/misc/diff_tool.h> #include <nel/misc/diff_tool.h>
@ -275,7 +276,7 @@ void loadCSVFile( const char *filename, TDeliveryCallback deliveryCallback )
vector<string> args; vector<string> args;
vector<string>::iterator iarg; vector<string>::iterator iarg;
if ( (file = fopen( filename, "r" )) == NULL ) if ( (file = nlfopen( filename, "r" )) == NULL )
{ {
nlwarning( "Can't find file %s", filename ); nlwarning( "Can't find file %s", filename );
} }
@ -1282,7 +1283,7 @@ void usage(char *argv0, FILE *out)
//----------------------------------------------- //-----------------------------------------------
void makeIndexFile() void makeIndexFile()
{ {
FILE * indexFile = fopen( ("_" + DocFileNameRoot + "_INDEX.html").c_str(), "wt" ); FILE * indexFile = nlfopen( "_" + DocFileNameRoot + "_INDEX.html", "wt" );
if( indexFile ) if( indexFile )
{ {
fprintf( indexFile, ("<html><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n<title>Summary of " + DocFileNameRoot + "</title>\n</head><body>\n").c_str() ); fprintf( indexFile, ("<html><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n<title>Summary of " + DocFileNameRoot + "</title>\n</head><body>\n").c_str() );
@ -1295,7 +1296,7 @@ void makeIndexFile()
for ( uint l=0; l!=26; ++l ) for ( uint l=0; l!=26; ++l )
{ {
string filename = toString( "%s_%c.html", DocFileName.c_str(), 'a'+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], ("<html><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n<title>" + DocFileName + toString( " - %c", (char)('A'+l) ) + "</title>\n</head><body>\n").c_str() ); fprintf( PhraseDocFiles[l], ("<html><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n<title>" + DocFileName + toString( " - %c", (char)('A'+l) ) + "</title>\n</head><body>\n").c_str() );
fprintf( indexFile, ("<A HREF=\"" + filename + "\">" + (char)('A'+l) + "</A> ").c_str() ); fprintf( indexFile, ("<A HREF=\"" + filename + "\">" + (char)('A'+l) + "</A> ").c_str() );
} }
@ -1304,7 +1305,7 @@ void makeIndexFile()
{ {
// One single HTML file // One single HTML file
fprintf( indexFile, ("<A HREF=\"" + DocFileName + ".html\">Go to action details</A>").c_str() ); fprintf( indexFile, ("<A HREF=\"" + DocFileName + ".html\">Go to action details</A>").c_str() );
PhraseDocFiles[0] = fopen( (DocFileName + ".html").c_str(), "wt" ); PhraseDocFiles[0] = nlfopen( DocFileName + ".html", "wt" );
fprintf( PhraseDocFiles[0], ("<html><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n<title>" + DocFileName + "</title>\n</head><body>\n").c_str() ); fprintf( PhraseDocFiles[0], ("<html><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n<title>" + DocFileName + "</title>\n</head><body>\n").c_str() );
for ( uint l=1; l!=26; ++l ) for ( uint l=1; l!=26; ++l )
{ {
@ -1393,7 +1394,7 @@ void makeIndexFile()
void makeActionsBySkillGroupFile() void makeActionsBySkillGroupFile()
{ {
// progression by skill // progression by skill
FILE * actionsBySkillGroupFile = fopen( (DocFileName + "__by_skill.html").c_str(), "wt" ); FILE * actionsBySkillGroupFile = nlfopen( DocFileName + "__by_skill.html", "wt" );
if( actionsBySkillGroupFile ) if( actionsBySkillGroupFile )
{ {
fprintf( actionsBySkillGroupFile, ("<html><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n<title>Progression of " + DocFileName + "</title>\n</head><body>\n").c_str() ); fprintf( actionsBySkillGroupFile, ("<html><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n<title>Progression of " + DocFileName + "</title>\n</head><body>\n").c_str() );
@ -1489,7 +1490,7 @@ void makeActionsBySkillValueFile()
//----------------------------------------------- //-----------------------------------------------
void makeActionsBySkillValueDetailFile() 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 ) if( actionsBySkillValueDetailFile )
{ {
fprintf( actionsBySkillValueDetailFile, ("<html><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n<title>Progression of " + DocFileName + "</title>\n</head><body>\n").c_str() ); fprintf( actionsBySkillValueDetailFile, ("<html><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n<title>Progression of " + DocFileName + "</title>\n</head><body>\n").c_str() );
@ -1627,9 +1628,9 @@ void makeSkillTreeFile( char filter, string skillFamily, bool withTraduction )
string filenameWithTraduction = skillFamily + "_skill_tree_detailed.html"; string filenameWithTraduction = skillFamily + "_skill_tree_detailed.html";
FILE * skillTreeFile; FILE * skillTreeFile;
if( withTraduction ) if( withTraduction )
skillTreeFile = fopen( filenameWithTraduction.c_str(), "wt" ); skillTreeFile = nlfopen( filenameWithTraduction, "wt" );
else else
skillTreeFile = fopen( filename.c_str(), "wt" ); skillTreeFile = nlfopen( filename, "wt" );
fprintf( skillTreeFile,"<html><head>\n"); fprintf( skillTreeFile,"<html><head>\n");
fprintf( skillTreeFile,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n"); fprintf( skillTreeFile,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n");
fprintf( skillTreeFile,"<title>SKILL TREE ( %s )</title>\n",skillFamily.c_str()); fprintf( skillTreeFile,"<title>SKILL TREE ( %s )</title>\n",skillFamily.c_str());
@ -1980,7 +1981,7 @@ int main(int argc, char* argv[])
// write header and title bar // write header and title bar
string filename; string filename;
filename = DocFileNameRoot + "_m.html"; filename = DocFileNameRoot + "_m.html";
FILE * brickPhraseDocFile_m = fopen( filename.c_str(), "wt" ); FILE * brickPhraseDocFile_m = nlfopen( filename, "wt" );
fprintf( brickPhraseDocFile_m,"<html><head>\n"); fprintf( brickPhraseDocFile_m,"<html><head>\n");
fprintf( brickPhraseDocFile_m,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n"); fprintf( brickPhraseDocFile_m,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n");
fprintf( brickPhraseDocFile_m,"<title>Brick phrases</title>\n"); fprintf( brickPhraseDocFile_m,"<title>Brick phrases</title>\n");
@ -1988,7 +1989,7 @@ int main(int argc, char* argv[])
fprintf( brickPhraseDocFile_m,"<table cellpadding=\"0\" cellspacing=\"1\" border=\"0\" style=\"text-align: left;\"><tbody>\n"); fprintf( brickPhraseDocFile_m,"<table cellpadding=\"0\" cellspacing=\"1\" border=\"0\" style=\"text-align: left;\"><tbody>\n");
filename = DocFileNameRoot + "_c.html"; filename = DocFileNameRoot + "_c.html";
FILE * brickPhraseDocFile_c = fopen( filename.c_str(), "wt" ); FILE * brickPhraseDocFile_c = nlfopen( filename, "wt" );
fprintf( brickPhraseDocFile_c,"<html><head>\n"); fprintf( brickPhraseDocFile_c,"<html><head>\n");
fprintf( brickPhraseDocFile_c,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n"); fprintf( brickPhraseDocFile_c,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n");
fprintf( brickPhraseDocFile_c,"<title>Brick phrases</title>\n"); fprintf( brickPhraseDocFile_c,"<title>Brick phrases</title>\n");
@ -1996,7 +1997,7 @@ int main(int argc, char* argv[])
fprintf( brickPhraseDocFile_c,"<table cellpadding=\"0\" cellspacing=\"1\" border=\"0\" style=\"text-align: left;\"><tbody>\n"); fprintf( brickPhraseDocFile_c,"<table cellpadding=\"0\" cellspacing=\"1\" border=\"0\" style=\"text-align: left;\"><tbody>\n");
filename = DocFileNameRoot + "_o.html"; filename = DocFileNameRoot + "_o.html";
FILE * brickPhraseDocFile_o = fopen( filename.c_str(), "wt" ); FILE * brickPhraseDocFile_o = nlfopen( filename, "wt" );
fprintf( brickPhraseDocFile_o,"<html><head>\n"); fprintf( brickPhraseDocFile_o,"<html><head>\n");
fprintf( brickPhraseDocFile_o,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n"); fprintf( brickPhraseDocFile_o,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n");
fprintf( brickPhraseDocFile_o,"<title>Brick phrases</title>\n"); fprintf( brickPhraseDocFile_o,"<title>Brick phrases</title>\n");
@ -2004,7 +2005,7 @@ int main(int argc, char* argv[])
fprintf( brickPhraseDocFile_o,"<table cellpadding=\"0\" cellspacing=\"1\" border=\"0\" style=\"text-align: left;\"><tbody>\n"); fprintf( brickPhraseDocFile_o,"<table cellpadding=\"0\" cellspacing=\"1\" border=\"0\" style=\"text-align: left;\"><tbody>\n");
filename = DocFileNameRoot + "_p.html"; filename = DocFileNameRoot + "_p.html";
FILE * brickPhraseDocFile_p = fopen( filename.c_str(), "wt" ); FILE * brickPhraseDocFile_p = nlfopen( filename, "wt" );
fprintf( brickPhraseDocFile_p,"<html><head>\n"); fprintf( brickPhraseDocFile_p,"<html><head>\n");
fprintf( brickPhraseDocFile_p,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n"); fprintf( brickPhraseDocFile_p,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n");
fprintf( brickPhraseDocFile_p,"<title>Brick phrases</title>\n"); fprintf( brickPhraseDocFile_p,"<title>Brick phrases</title>\n");
@ -2012,7 +2013,7 @@ int main(int argc, char* argv[])
fprintf( brickPhraseDocFile_p,"<table cellpadding=\"0\" cellspacing=\"1\" border=\"0\" style=\"text-align: left;\"><tbody>\n"); fprintf( brickPhraseDocFile_p,"<table cellpadding=\"0\" cellspacing=\"1\" border=\"0\" style=\"text-align: left;\"><tbody>\n");
filename = DocFileNameRoot + "_e.html"; filename = DocFileNameRoot + "_e.html";
FILE * brickPhraseDocFile_e = fopen( filename.c_str(), "wt" ); FILE * brickPhraseDocFile_e = nlfopen( filename, "wt" );
fprintf( brickPhraseDocFile_e,"<html><head>\n"); fprintf( brickPhraseDocFile_e,"<html><head>\n");
fprintf( brickPhraseDocFile_e,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n"); fprintf( brickPhraseDocFile_e,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n");
fprintf( brickPhraseDocFile_e,"<title>Brick phrases</title>\n"); fprintf( brickPhraseDocFile_e,"<title>Brick phrases</title>\n");
@ -2082,7 +2083,7 @@ int main(int argc, char* argv[])
// write header and title bar // write header and title bar
filename = DocFileNameRoot + ".html"; filename = DocFileNameRoot + ".html";
FILE * brickDocFile = fopen( filename.c_str(), "wt" ); FILE * brickDocFile = nlfopen( filename, "wt" );
fprintf( brickDocFile,"<html><head>\n"); fprintf( brickDocFile,"<html><head>\n");
fprintf( brickDocFile,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n"); fprintf( brickDocFile,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n");
fprintf( brickDocFile,"<title>Bricks infos</title>\n"); fprintf( brickDocFile,"<title>Bricks infos</title>\n");
@ -2197,7 +2198,7 @@ int main(int argc, char* argv[])
// write header and title bar // write header and title bar
filename = DocFileNameRoot + "_name.html"; filename = DocFileNameRoot + "_name.html";
FILE * brickNameDocFile = fopen( filename.c_str(), "wt" ); FILE * brickNameDocFile = nlfopen( filename, "wt" );
fprintf( brickNameDocFile,"<html><head>\n"); fprintf( brickNameDocFile,"<html><head>\n");
fprintf( brickNameDocFile,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n"); fprintf( brickNameDocFile,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n");
fprintf( brickNameDocFile,"<title>Bricks infos</title>\n"); fprintf( brickNameDocFile,"<title>Bricks infos</title>\n");
@ -2332,7 +2333,7 @@ int main(int argc, char* argv[])
// write header and title bar // write header and title bar
filename = DocFileNameRoot + "_family.html"; filename = DocFileNameRoot + "_family.html";
FILE * brickFamilyDocFile = fopen( filename.c_str(), "wt" ); FILE * brickFamilyDocFile = nlfopen( filename, "wt" );
fprintf( brickFamilyDocFile,"<html><head>\n"); fprintf( brickFamilyDocFile,"<html><head>\n");
fprintf( brickFamilyDocFile,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n"); fprintf( brickFamilyDocFile,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n");
fprintf( brickFamilyDocFile,"<title>Bricks infos</title>\n"); fprintf( brickFamilyDocFile,"<title>Bricks infos</title>\n");
@ -2464,7 +2465,7 @@ int main(int argc, char* argv[])
// write header and title bar // write header and title bar
filename = DocFileNameRoot + "_required_skill_value.html"; filename = DocFileNameRoot + "_required_skill_value.html";
FILE * brickRequiredDocFile = fopen( filename.c_str(), "wt" ); FILE * brickRequiredDocFile = nlfopen( filename, "wt" );
fprintf( brickRequiredDocFile,"<html><head>\n"); fprintf( brickRequiredDocFile,"<html><head>\n");
fprintf( brickRequiredDocFile,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n"); fprintf( brickRequiredDocFile,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n");
fprintf( brickRequiredDocFile,"<title>Bricks infos</title>\n"); fprintf( brickRequiredDocFile,"<title>Bricks infos</title>\n");
@ -2607,7 +2608,7 @@ int main(int argc, char* argv[])
// write header and title bar // write header and title bar
filename = DocFileNameRoot + "_learn_skill_value.html"; filename = DocFileNameRoot + "_learn_skill_value.html";
FILE * brickLearnDocFile = fopen( filename.c_str(), "wt" ); FILE * brickLearnDocFile = nlfopen( filename, "wt" );
fprintf( brickLearnDocFile,"<html><head>\n"); fprintf( brickLearnDocFile,"<html><head>\n");
fprintf( brickLearnDocFile,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n"); fprintf( brickLearnDocFile,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n");
fprintf( brickLearnDocFile,"<title>Bricks infos</title>\n"); fprintf( brickLearnDocFile,"<title>Bricks infos</title>\n");

View file

@ -20,6 +20,7 @@
#include "srg_utilities.h" #include "srg_utilities.h"
#include "game_share/protection_type.h" #include "game_share/protection_type.h"
#include "nel/misc/string_conversion.h" #include "nel/misc/string_conversion.h"
#include "nel/misc/common.h"
/* /*
* V3 * V3
@ -2449,8 +2450,8 @@ void generateRawMaterials()
MainStat.init(); MainStat.init();
FILE *nameOutputFile; FILE *nameOutputFile;
if ( OutputNameList ) if ( OutputNameList )
nameOutputFile = fopen( "rm_names_output.csv", "wt" ); nameOutputFile = nlfopen( "rm_names_output.csv", "wt" );
GraphFile = fopen( "rm_output_graph.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, "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, "Ecosystem specialization: 100=Desert, 104=Forest, 108=Lake, 112=Jungle, 116=All\n" );
fprintf( GraphFile, "RM code;Zone;Energy;Originality;Eco. spec.;\n\n" ); fprintf( GraphFile, "RM code;Zone;Energy;Originality;Eco. spec.;\n\n" );

View file

@ -27,6 +27,7 @@
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/smart_ptr.h" #include "nel/misc/smart_ptr.h"
#include "nel/misc/command.h" #include "nel/misc/command.h"
#include "nel/misc/common.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include <nel/misc/diff_tool.h> #include <nel/misc/diff_tool.h>
#include <nel/misc/random.h> #include <nel/misc/random.h>
@ -862,7 +863,7 @@ void loadNomenclatureCodes( const char *title, const vector<string>& longNames,
vector<string>::iterator iarg; vector<string>::iterator iarg;
vector<string>::const_iterator ivs; vector<string>::const_iterator ivs;
if ( (rulesFile = fopen( filename, "r" )) == NULL ) if ( (rulesFile = nlfopen( filename, "r" )) == NULL )
{ {
nlwarning( "Can't find file %s", filename ); nlwarning( "Can't find file %s", filename );
} }
@ -1121,7 +1122,7 @@ void loadCSVFile( const char *filename, TMapDeliveryCallback deliveryCallback, b
vector<string> args; vector<string> args;
vector<string>::iterator iarg; vector<string>::iterator iarg;
if ( (file = fopen( filename, "r" )) == NULL ) if ( (file = nlfopen( filename, "r" )) == NULL )
{ {
nlwarning( "Can't find file %s", filename ); nlwarning( "Can't find file %s", filename );
} }
@ -1178,7 +1179,7 @@ void loadCSVFile( const char *filename, TVectorDeliveryCallback deliveryCallback
vs args; vs args;
vs::iterator iarg; vs::iterator iarg;
if ( (file = fopen( filename, "r" )) == NULL ) if ( (file = nlfopen( filename, "r" )) == NULL )
{ {
nlwarning( "Can't find file %s", filename ); nlwarning( "Can't find file %s", filename );
} }
@ -1217,7 +1218,7 @@ void loadValueFile( const char *filename, const vector<string>& keyStrings,
vector<string> args; vector<string> args;
vector<string>::iterator iarg; vector<string>::iterator iarg;
if ( (rulesFile = fopen( filename, "r" )) == NULL ) if ( (rulesFile = nlfopen( filename, "r" )) == NULL )
{ {
nlwarning( "Can't find file %s", filename ); nlwarning( "Can't find file %s", filename );
} }
@ -1271,7 +1272,7 @@ void loadRulesFile( const char *filename, const vector<string>& keyStrings,
vector<string> args; vector<string> args;
vector<string>::iterator iarg; vector<string>::iterator iarg;
if ( (rulesFile = fopen( filename, "r" )) == NULL ) if ( (rulesFile = nlfopen( filename, "r" )) == NULL )
{ {
nlwarning( "Can't find file %s", filename ); nlwarning( "Can't find file %s", filename );
} }
@ -1582,7 +1583,7 @@ void loadTitles( const string& sourceWords, const string& sourceBase, const stri
void extractRawMaterialNames() void extractRawMaterialNames()
{ {
loadCSVFile( ExtractNamesCsv.c_str(), readRMNames ); 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" ); fprintf( output, "Code;Name\n" );
for ( mss::const_iterator iun=UniqueRMNamesAndSheetCodeHead.begin(); iun!=UniqueRMNamesAndSheetCodeHead.end(); ++iun ) for ( mss::const_iterator iun=UniqueRMNamesAndSheetCodeHead.begin(); iun!=UniqueRMNamesAndSheetCodeHead.end(); ++iun )
{ {
@ -2343,7 +2344,7 @@ public:
if ( ! _Enabled ) if ( ! _Enabled )
return; return;
_File = fopen( filename.c_str(), "wt" ); _File = nlfopen( filename, "wt" );
fprintf( _File, ("<html><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n<title>" + title + "</title>\n</head><body>\n").c_str() ); fprintf( _File, ("<html><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n<title>" + title + "</title>\n</head><body>\n").c_str() );
} }
@ -2408,7 +2409,7 @@ public:
if ( ! _Enabled ) if ( ! _Enabled )
return; return;
_File = fopen( filename.c_str(), "wt" ); _File = nlfopen( filename, "wt" );
} }
/// ///

View file

@ -71,6 +71,7 @@
#include "nel/misc/app_context.h" #include "nel/misc/app_context.h"
#include "nel/misc/i18n.h" #include "nel/misc/i18n.h"
#include "nel/misc/common.h"
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/diff_tool.h" #include "nel/misc/diff_tool.h"
@ -325,7 +326,7 @@ int readLanguages()
else else
{ {
// append to the existing file // append to the existing file
FILE *fp = fopen(filename.c_str(), "ab"); FILE *fp = nlfopen(filename, "ab");
for (uint i=0; i<text.size(); ++i) for (uint i=0; i<text.size(); ++i)
{ {

View file

@ -3,6 +3,7 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/misc/app_context.h" #include "nel/misc/app_context.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/common.h"
#include "nel/misc/sstring.h" #include "nel/misc/sstring.h"
#include "nel/misc/algo.h" #include "nel/misc/algo.h"
@ -212,8 +213,8 @@ int main(int argc, char *argv[])
if (needRepack) if (needRepack)
{ {
// open the pack file // open the pack file
// FILE *fp = fopen(filename.c_str(), "wt"); // FILE *fp = nlfopen(filename, "wt");
FILE *fp = fopen(packFileName.c_str(), "wt"); FILE *fp = nlfopen(packFileName, "wt");
fprintf(fp, "<packed_xml>\n"); fprintf(fp, "<packed_xml>\n");
@ -224,7 +225,7 @@ int main(int argc, char *argv[])
printf("Adding file '%s'...\n", CFile::getFilename(subFileName).c_str()); printf("Adding file '%s'...\n", CFile::getFilename(subFileName).c_str());
fprintf(fp, " <xml_file name=\"%s\">\n", CFile::getFilename(subFileName).c_str()); fprintf(fp, " <xml_file name=\"%s\">\n", CFile::getFilename(subFileName).c_str());
FILE *subFp = fopen(subFileName.c_str(), "rt"); FILE *subFp = nlfopen(subFileName, "rt");
nlassert(subFp != NULL); nlassert(subFp != NULL);
char buffer[MaxLineSize]; char buffer[MaxLineSize];
char *result; char *result;
@ -262,8 +263,8 @@ int main(int argc, char *argv[])
{ {
printf("Unpacking directory '%s'...\n", dirName.c_str()); printf("Unpacking directory '%s'...\n", dirName.c_str());
// open the pack file // open the pack file
// FILE *fp = fopen((dirName+"/tmp."+DefaultExt).c_str(), "rt"); // FILE *fp = nlfopen(dirName+"/tmp."+DefaultExt, "rt");
FILE *fp = fopen(filename.c_str(), "rt"); FILE *fp = nlfopen(filename, "rt");
nlassert(fp != NULL); nlassert(fp != NULL);
uint linecount = 0; uint linecount = 0;
@ -303,7 +304,7 @@ int main(int argc, char *argv[])
printf("Extracting file '%s'...\n", CFile::getFilename(subFileName).c_str()); printf("Extracting file '%s'...\n", CFile::getFilename(subFileName).c_str());
// open the output file // open the output file
FILE *output = fopen (subFileName.c_str(), "wt"); FILE *output = nlfopen(subFileName, "wt");
if (output == NULL) if (output == NULL)
{ {
printf ("Error : can not open output file '%s' from pack file '%s'", subFileName.c_str(), filename.c_str()); printf ("Error : can not open output file '%s' from pack file '%s'", subFileName.c_str(), filename.c_str());

View file

@ -1,6 +1,7 @@
#include "validation_file.h" #include "validation_file.h"
#include <nel/misc/config_file.h> #include <nel/misc/config_file.h>
#include <nel/misc/common.h>
#include <nel/misc/path.h> #include <nel/misc/path.h>
void CValidationFile::loadMissionValidationFile(std::string filename) 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()); nlwarning("Can't find index file '%s' in search path, no mission will be valid", filename.c_str());
return; return;
} }
FILE* file = fopen(pathName.c_str(), "w"); FILE* file = nlfopen(pathName, "w");
nlassert(file!=NULL); nlassert(file!=NULL);
// AuthorizedStates // AuthorizedStates

View file

@ -16,6 +16,7 @@
#include <nel/misc/types_nl.h> #include <nel/misc/types_nl.h>
#include <nel/misc/debug.h> #include <nel/misc/debug.h>
#include <nel/misc/common.h>
#include <nel/misc/file.h> #include <nel/misc/file.h>
@ -51,7 +52,7 @@ sint main( sint argc, char ** argv )
// open the output file // open the output file
string outputFilename = string(argv[1]) + ".out"; string outputFilename = string(argv[1]) + ".out";
FILE * output = fopen(outputFilename.c_str(),"w"); FILE * output = nlfopen(outputFilename,"w");
if( output == NULL ) if( output == NULL )
{ {
nlwarning("can't open the output file %s",outputFilename.c_str()); nlwarning("can't open the output file %s",outputFilename.c_str());

View file

@ -14,6 +14,7 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <nel/misc/common.h>
#include <nel/misc/path.h> #include <nel/misc/path.h>
#include <nel/misc/debug.h> #include <nel/misc/debug.h>
#include <nel/misc/file.h> #include <nel/misc/file.h>
@ -65,7 +66,7 @@ int main( int argc, char ** argv )
CPath::getPathContent(newPath, true, false, true, newPathContent); CPath::getPathContent(newPath, true, false, true, newPathContent);
string outputFileName = CFile::findNewFile("path_content_diff.txt"); string outputFileName = CFile::findNewFile("path_content_diff.txt");
FILE *output = fopen (outputFileName.c_str(), "wt"); FILE *output = nlfopen(outputFileName, "wt");
if( output == NULL ) if( output == NULL )
{ {
nlwarning("Can't open output file %s",outputFileName.c_str()); nlwarning("Can't open output file %s",outputFileName.c_str());