From bc994d4bec2e99d92b1d16dfba25e311609f84b1 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 29 May 2011 13:57:08 +0200 Subject: [PATCH] Changed: Use of CFile::createEmptyFile Changed: #142 Replace atoi and sscanf by fromString when it's possible --- code/nel/src/misc/debug.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/code/nel/src/misc/debug.cpp b/code/nel/src/misc/debug.cpp index 472e2cd35..f6b80c9b3 100644 --- a/code/nel/src/misc/debug.cpp +++ b/code/nel/src/misc/debug.cpp @@ -969,14 +969,12 @@ void force_exception_frame(...) {std::cout.flush();} static void exceptionTranslator(unsigned, EXCEPTION_POINTERS *pexp) { #ifndef NL_NO_DEBUG_FILES - FILE *file = fopen ("exception_catched", "wb"); - fclose (file); + CFile::createEmptyFile(getLogDirectory() + "exception_catched"); #endif if (pexp->ExceptionRecord->ExceptionCode == EXCEPTION_BREAKPOINT) { #ifndef NL_NO_DEBUG_FILES - FILE *file2 = fopen ("breakpointed", "wb"); - fclose (file2); + CFile::createEmptyFile(getLogDirectory() + "breakpointed"); #endif return; } @@ -1684,11 +1682,15 @@ NLMISC_CATEGORISED_COMMAND(nel, writeaccess, "write a uint8 value in an invalid uint8 *adr = (uint8*)0; if(args.size() >= 1) #ifdef HAVE_X86_64 - adr = (uint8*)(uint64)atoi(args[0].c_str()); + uint64 addr64; + NLMISC::fromString(args[0], addr64); + adr = (uint8*)addr64; #else - adr = (uint8*)atoi(args[0].c_str()); + uint32 addr32; + NLMISC::fromString(args[0], addr32); + adr = (uint8*)addr32; #endif - if(args.size() >= 2) val = (uint8)atoi(args[1].c_str()); + if(args.size() >= 2) NLMISC::fromString(args[1], val); *adr = val; return true; } @@ -1699,9 +1701,13 @@ NLMISC_CATEGORISED_COMMAND(nel, readaccess, "read a uint8 value in an invalid ad uint8 *adr = (uint8*)0; if(args.size() == 1) #ifdef HAVE_X86_64 - adr = (uint8*)(uint64)atoi(args[0].c_str()); + uint64 addr64; + NLMISC::fromString(args[0], addr64); + adr = (uint8*)addr64; #else - adr = (uint8*)atoi(args[0].c_str()); + uint32 addr32; + NLMISC::fromString(args[0], addr32); + adr = (uint8*)addr32; #endif val = *adr; log.displayNL("value is %hu", (uint16)val);