diff --git a/code/nel/include/nel/net/message_recorder.h b/code/nel/include/nel/net/message_recorder.h index 5874aca4c..92fee29fa 100644 --- a/code/nel/include/nel/net/message_recorder.h +++ b/code/nel/include/nel/net/message_recorder.h @@ -61,7 +61,7 @@ struct TMessageRecord { nlassert( stream.stringMode() ); - uint32 len; + uint32 len = 0; std::string s_event; stream.serial( UpdateCounter ); if ( stream.isReading() ) diff --git a/code/nel/src/misc/eval_num_expr.cpp b/code/nel/src/misc/eval_num_expr.cpp index 1bfad17eb..42298c1fa 100644 --- a/code/nel/src/misc/eval_num_expr.cpp +++ b/code/nel/src/misc/eval_num_expr.cpp @@ -632,6 +632,9 @@ CEvalNumExpr::TReturnState CEvalNumExpr::evalExpression (double &finalResult, TT TOperator resultUnaryOp[InternalOperator]; vector resultUnaryOpSup; + // init table + for (uint i = 0; i < (uint)InternalOperator; ++i) resultUnaryOp[i] = NotOperator; + // Current value double value; diff --git a/code/nel/src/net/module_common.cpp b/code/nel/src/net/module_common.cpp index 0133343dd..f16e1bfa9 100644 --- a/code/nel/src/net/module_common.cpp +++ b/code/nel/src/net/module_common.cpp @@ -212,8 +212,8 @@ namespace NLNET { // name is more deep, need to resurse parts.erase(parts.begin()); - CSString subName; - subName.join(reinterpret_cast(parts), "."); + std::string subName; + join(parts, ".", subName); sub->setParam(subName, value); } else diff --git a/code/nel/src/pipeline/database_config.cpp b/code/nel/src/pipeline/database_config.cpp index b326a2888..56369c902 100644 --- a/code/nel/src/pipeline/database_config.cpp +++ b/code/nel/src/pipeline/database_config.cpp @@ -53,7 +53,7 @@ bool CDatabaseConfig::init(const std::string &asset) TPathString configPath = rootPath + "/database.cfg"; while (!CFile::fileExists(configPath)) { - int sep = CFile::getLastSeparator(rootPath); + std::string::size_type sep = CFile::getLastSeparator(rootPath); if (sep == string::npos) return false; diff --git a/code/nel/src/pipeline/project_config.cpp b/code/nel/src/pipeline/project_config.cpp index 995f92fd4..b292f033c 100644 --- a/code/nel/src/pipeline/project_config.cpp +++ b/code/nel/src/pipeline/project_config.cpp @@ -65,7 +65,7 @@ bool CProjectConfig::init(const std::string &asset, Flags flags, bool partial) TPathString configPath = rootPath + "/nel.cfg"; while (!CFile::fileExists(configPath)) { - int sep = CFile::getLastSeparator(rootPath); + std::string::size_type sep = CFile::getLastSeparator(rootPath); if (sep == string::npos) return false; @@ -82,7 +82,7 @@ bool CProjectConfig::init(const std::string &asset, Flags flags, bool partial) std::vector configRootPaths; TPathString projectConfigPath; - uint32 projectConfigModification; + uint32 projectConfigModification = 0; std::string projectName; if (partial) { diff --git a/code/nel/tools/3d/object_viewer/located_target_dlg.cpp b/code/nel/tools/3d/object_viewer/located_target_dlg.cpp index fb84877ad..7cb03426f 100644 --- a/code/nel/tools/3d/object_viewer/located_target_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/located_target_dlg.cpp @@ -137,7 +137,7 @@ void CLocatedTargetDlg::OnRemoveTarget() m_Targets.DeleteString(indexs[k] - k); int l = m_AvailableTargets.AddString(utf8ToTStr(loc->getName())); - m_AvailableTargets.SetItemData(l, (DWORD) loc); + m_AvailableTargets.SetItemData(l, (DWORD_PTR) loc); } UpdateData(FALSE); updateModifiedFlag(); diff --git a/code/nel/tools/misc/log_analyser/PlugInSelector.cpp b/code/nel/tools/misc/log_analyser/PlugInSelector.cpp index 9a21a8df6..594942ddb 100644 --- a/code/nel/tools/misc/log_analyser/PlugInSelector.cpp +++ b/code/nel/tools/misc/log_analyser/PlugInSelector.cpp @@ -87,7 +87,7 @@ BOOL CPlugInSelector::OnInitDialog() } -int getLastSeparator (const string &filename) +std::string::size_type getLastSeparator (const string &filename) { string::size_type pos = filename.find_last_of ('/'); if (pos == string::npos) diff --git a/code/nel/tools/misc/make_sheet_id/make_sheet_id.cpp b/code/nel/tools/misc/make_sheet_id/make_sheet_id.cpp index 5aefbcf4c..a8e095db3 100644 --- a/code/nel/tools/misc/make_sheet_id/make_sheet_id.cpp +++ b/code/nel/tools/misc/make_sheet_id/make_sheet_id.cpp @@ -529,9 +529,9 @@ int main( int argc, char ** argv ) readFormId( outputFileName ); // output path - sint lastSeparator = CFile::getLastSeparator(outputFileName); + std::string::size_type lastSeparator = CFile::getLastSeparator(outputFileName); string outputPath; - if( lastSeparator != -1 ) + if( lastSeparator != std::string::npos ) { outputPath = outputFileName.substr(0,lastSeparator+1); } diff --git a/code/ryzom/server/src/ai_share/16x16_layer.h b/code/ryzom/server/src/ai_share/16x16_layer.h index 49999a8fd..d8c3af912 100644 --- a/code/ryzom/server/src/ai_share/16x16_layer.h +++ b/code/ryzom/server/src/ai_share/16x16_layer.h @@ -77,6 +77,7 @@ typedef CFastBitField T1BitField; class I16x16Layer { public: + virtual ~I16x16Layer() {} /** * Get uncompressed value at i, j where i is y-like and j is x-like diff --git a/code/ryzom/server/src/persistant_data_service/pds_database.h b/code/ryzom/server/src/persistant_data_service/pds_database.h index fdd059c00..d6a26e6fe 100644 --- a/code/ryzom/server/src/persistant_data_service/pds_database.h +++ b/code/ryzom/server/src/persistant_data_service/pds_database.h @@ -74,7 +74,7 @@ public: /** * Destructor */ - ~CDatabase(); + virtual ~CDatabase(); /** 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 39354138d..bc5cb6ad8 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp @@ -875,17 +875,26 @@ bool CMissionCompiler::publishFiles(const std::string &serverPathPrim, const std return true; } -bool CMissionCompiler::includeText(const std::string filename, const std::string text) +bool CMissionCompiler::includeText(const std::string &filename, const std::string &text) { FILE *f = nlfopen(filename, "r+"); if (f == NULL) + { + nlwarning("Unable to open %s", filename.c_str()); return false; + } bool isIn = false; char buffer[1024]; // Check for UTF8 format - fread(buffer, 1, 3, f); + if (fread(buffer, 1, 3, f) != 3) + { + fclose(f); + nlwarning("Unable to read 3 bytes from %s", filename.c_str()); + return false; + } + if (buffer[0] != -17 || buffer[1] != -69 || buffer[2] != -65) fseek(f, 0, SEEK_SET); diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.h b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.h index 46e0cc575..7016bd092 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.h +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.h @@ -447,7 +447,7 @@ public: bool publishFiles(const std::string &serverPathPrim, const std::string &serverPathText, const std::string &localPathText); /// Search for text in the file : add it if it's not in - bool includeText(const std::string filename, const std::string text); + bool includeText(const std::string &filename, const std::string &text); /// Parse the pre requisite node of a mission. bool parsePreRequisite(CMissionData &md, NLLIGO::IPrimitive *preReq); diff --git a/code/ryzom/tools/leveldesign/mp_generator/main.cpp b/code/ryzom/tools/leveldesign/mp_generator/main.cpp index 15740d477..353642ac6 100644 --- a/code/ryzom/tools/leveldesign/mp_generator/main.cpp +++ b/code/ryzom/tools/leveldesign/mp_generator/main.cpp @@ -1279,15 +1279,23 @@ void ItemNamesSave() printf( "-- SAVING ITEM NAMES --\n"); CSString data, output; - FILE* file; - file = nlfopen( ITEM_WORDS_WK, "rb" ); + FILE *file = nlfopen( ITEM_WORDS_WK, "rb" ); char c; - fread( &c, 1, 1, file ); + if (fread(&c, 1, 1, file) != 1) + { + nlwarning("Unable to read 1 byte from %s", ITEM_WORDS_WK.c_str()); + return; + } + while ( !feof( file ) ) { data += toString( "%c", c ); - fread( &c, 1, 1, file ); + if (fread(&c, 1, 1, file) != 1) + { + nlwarning("Unable to read 1 byte from %s", ITEM_WORDS_WK.c_str()); + return; + } } fclose( file ); 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 d34e30c5a..c1c0c7aca 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 @@ -199,7 +199,13 @@ int getNbItemFromFile(const char *filename) while (fgets(buffer, 1024, f)) { int n; - fscanf(f, "_Items#%d", &n); + if (fscanf(f, "_Items#%d", &n) != 1) + { + fclose(f); + nlerror("Unable to parse 1 item from %s", filename); + return max; + } + if (n > max) max = n; } @@ -247,7 +253,13 @@ int importCsv(const char *filename) // read fields name { - fgets(buffer, 1024, f); + if (fgets(buffer, 1024, f) != buffer) + { + fclose(f); + nlerror("Unable to read line from %s", filename); + return 1; + } + CSString s(buffer); s = s.strtok("\n"); diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/display.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/display.cpp index a1c1836a0..e25addbae 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/display.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/display.cpp @@ -3400,7 +3400,7 @@ void CDisplay::updateCursor () // Moved with middle click ? case DragView: - cursor = theApp.LoadCursor (MAKEINTRESOURCE(IDC_HAND)); + cursor = theApp.LoadCursor (MAKEINTRESOURCE(IDC_HAND1)); break; // Moved with left click ? diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/resource.h b/code/ryzom/tools/leveldesign/world_editor/world_editor/resource.h index ce7382e1d..2a294d748 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/resource.h +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/resource.h @@ -65,7 +65,7 @@ #define IDI_LINE_HIDE 149 #define IDC_INSERT_POINT 149 #define IDI_ZONE_HIDE 150 -#define IDC_HAND 150 +#define IDC_HAND1 150 #define IDI_ZONE 151 #define IDI_ZONE_OPENED 151 #define IDD_LOADING 152 diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor.rc b/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor.rc index e465953a6..ce46045e4 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor.rc +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor.rc @@ -934,7 +934,7 @@ IDC_COPY CURSOR DISCARDABLE "res\\copy.cur" IDC_SELECT CURSOR DISCARDABLE "res\\select.cur" IDC_SELECT_COPY CURSOR DISCARDABLE "res\\select_copy.cur" IDC_INSERT_POINT CURSOR DISCARDABLE "res\\insert_point.cur" -IDC_HAND CURSOR DISCARDABLE "res\\hand.cur" +IDC_HAND1 CURSOR DISCARDABLE "res\\hand.cur" IDC_ZOOM CURSOR DISCARDABLE "res\\zoom.cur" IDC_RADIUS CURSOR DISCARDABLE "res\\radius.cur"