Fixed: Warnings

--HG--
branch : develop
This commit is contained in:
kervala 2016-11-22 12:22:17 +01:00
parent 94d3440148
commit a3262bb971
17 changed files with 56 additions and 23 deletions

View file

@ -61,7 +61,7 @@ struct TMessageRecord
{ {
nlassert( stream.stringMode() ); nlassert( stream.stringMode() );
uint32 len; uint32 len = 0;
std::string s_event; std::string s_event;
stream.serial( UpdateCounter ); stream.serial( UpdateCounter );
if ( stream.isReading() ) if ( stream.isReading() )

View file

@ -632,6 +632,9 @@ CEvalNumExpr::TReturnState CEvalNumExpr::evalExpression (double &finalResult, TT
TOperator resultUnaryOp[InternalOperator]; TOperator resultUnaryOp[InternalOperator];
vector<TOperator> resultUnaryOpSup; vector<TOperator> resultUnaryOpSup;
// init table
for (uint i = 0; i < (uint)InternalOperator; ++i) resultUnaryOp[i] = NotOperator;
// Current value // Current value
double value; double value;

View file

@ -212,8 +212,8 @@ namespace NLNET
{ {
// name is more deep, need to resurse // name is more deep, need to resurse
parts.erase(parts.begin()); parts.erase(parts.begin());
CSString subName; std::string subName;
subName.join(reinterpret_cast<CVectorSString&>(parts), "."); join(parts, ".", subName);
sub->setParam(subName, value); sub->setParam(subName, value);
} }
else else

View file

@ -53,7 +53,7 @@ bool CDatabaseConfig::init(const std::string &asset)
TPathString configPath = rootPath + "/database.cfg"; TPathString configPath = rootPath + "/database.cfg";
while (!CFile::fileExists(configPath)) while (!CFile::fileExists(configPath))
{ {
int sep = CFile::getLastSeparator(rootPath); std::string::size_type sep = CFile::getLastSeparator(rootPath);
if (sep == string::npos) if (sep == string::npos)
return false; return false;

View file

@ -65,7 +65,7 @@ bool CProjectConfig::init(const std::string &asset, Flags flags, bool partial)
TPathString configPath = rootPath + "/nel.cfg"; TPathString configPath = rootPath + "/nel.cfg";
while (!CFile::fileExists(configPath)) while (!CFile::fileExists(configPath))
{ {
int sep = CFile::getLastSeparator(rootPath); std::string::size_type sep = CFile::getLastSeparator(rootPath);
if (sep == string::npos) if (sep == string::npos)
return false; return false;
@ -82,7 +82,7 @@ bool CProjectConfig::init(const std::string &asset, Flags flags, bool partial)
std::vector<TPathString> configRootPaths; std::vector<TPathString> configRootPaths;
TPathString projectConfigPath; TPathString projectConfigPath;
uint32 projectConfigModification; uint32 projectConfigModification = 0;
std::string projectName; std::string projectName;
if (partial) if (partial)
{ {

View file

@ -137,7 +137,7 @@ void CLocatedTargetDlg::OnRemoveTarget()
m_Targets.DeleteString(indexs[k] - k); m_Targets.DeleteString(indexs[k] - k);
int l = m_AvailableTargets.AddString(utf8ToTStr(loc->getName())); int l = m_AvailableTargets.AddString(utf8ToTStr(loc->getName()));
m_AvailableTargets.SetItemData(l, (DWORD) loc); m_AvailableTargets.SetItemData(l, (DWORD_PTR) loc);
} }
UpdateData(FALSE); UpdateData(FALSE);
updateModifiedFlag(); updateModifiedFlag();

View file

@ -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 ('/'); string::size_type pos = filename.find_last_of ('/');
if (pos == string::npos) if (pos == string::npos)

View file

@ -529,9 +529,9 @@ int main( int argc, char ** argv )
readFormId( outputFileName ); readFormId( outputFileName );
// output path // output path
sint lastSeparator = CFile::getLastSeparator(outputFileName); std::string::size_type lastSeparator = CFile::getLastSeparator(outputFileName);
string outputPath; string outputPath;
if( lastSeparator != -1 ) if( lastSeparator != std::string::npos )
{ {
outputPath = outputFileName.substr(0,lastSeparator+1); outputPath = outputFileName.substr(0,lastSeparator+1);
} }

View file

@ -77,6 +77,7 @@ typedef CFastBitField<uint16, 16> T1BitField;
class I16x16Layer class I16x16Layer
{ {
public: public:
virtual ~I16x16Layer() {}
/** /**
* Get uncompressed value at i, j where i is y-like and j is x-like * Get uncompressed value at i, j where i is y-like and j is x-like

View file

@ -74,7 +74,7 @@ public:
/** /**
* Destructor * Destructor
*/ */
~CDatabase(); virtual ~CDatabase();
/** /**

View file

@ -875,17 +875,26 @@ bool CMissionCompiler::publishFiles(const std::string &serverPathPrim, const std
return true; 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+"); FILE *f = nlfopen(filename, "r+");
if (f == NULL) if (f == NULL)
{
nlwarning("Unable to open %s", filename.c_str());
return false; return false;
}
bool isIn = false; bool isIn = false;
char buffer[1024]; char buffer[1024];
// Check for UTF8 format // 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) if (buffer[0] != -17 || buffer[1] != -69 || buffer[2] != -65)
fseek(f, 0, SEEK_SET); fseek(f, 0, SEEK_SET);

View file

@ -447,7 +447,7 @@ public:
bool publishFiles(const std::string &serverPathPrim, const std::string &serverPathText, const std::string &localPathText); 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 /// 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. /// Parse the pre requisite node of a mission.
bool parsePreRequisite(CMissionData &md, NLLIGO::IPrimitive *preReq); bool parsePreRequisite(CMissionData &md, NLLIGO::IPrimitive *preReq);

View file

@ -1279,15 +1279,23 @@ void ItemNamesSave()
printf( "-- SAVING ITEM NAMES --\n"); printf( "-- SAVING ITEM NAMES --\n");
CSString data, output; CSString data, output;
FILE* file; FILE *file = nlfopen( ITEM_WORDS_WK, "rb" );
file = nlfopen( ITEM_WORDS_WK, "rb" );
char c; 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 ) ) while ( !feof( file ) )
{ {
data += toString( "%c", c ); 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 ); fclose( file );

View file

@ -199,7 +199,13 @@ int getNbItemFromFile(const char *filename)
while (fgets(buffer, 1024, f)) while (fgets(buffer, 1024, f))
{ {
int n; 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) if (n > max)
max = n; max = n;
} }
@ -247,7 +253,13 @@ int importCsv(const char *filename)
// read fields name // 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); CSString s(buffer);
s = s.strtok("\n"); s = s.strtok("\n");

View file

@ -3400,7 +3400,7 @@ void CDisplay::updateCursor ()
// Moved with middle click ? // Moved with middle click ?
case DragView: case DragView:
cursor = theApp.LoadCursor (MAKEINTRESOURCE(IDC_HAND)); cursor = theApp.LoadCursor (MAKEINTRESOURCE(IDC_HAND1));
break; break;
// Moved with left click ? // Moved with left click ?

View file

@ -65,7 +65,7 @@
#define IDI_LINE_HIDE 149 #define IDI_LINE_HIDE 149
#define IDC_INSERT_POINT 149 #define IDC_INSERT_POINT 149
#define IDI_ZONE_HIDE 150 #define IDI_ZONE_HIDE 150
#define IDC_HAND 150 #define IDC_HAND1 150
#define IDI_ZONE 151 #define IDI_ZONE 151
#define IDI_ZONE_OPENED 151 #define IDI_ZONE_OPENED 151
#define IDD_LOADING 152 #define IDD_LOADING 152

View file

@ -934,7 +934,7 @@ IDC_COPY CURSOR DISCARDABLE "res\\copy.cur"
IDC_SELECT CURSOR DISCARDABLE "res\\select.cur" IDC_SELECT CURSOR DISCARDABLE "res\\select.cur"
IDC_SELECT_COPY CURSOR DISCARDABLE "res\\select_copy.cur" IDC_SELECT_COPY CURSOR DISCARDABLE "res\\select_copy.cur"
IDC_INSERT_POINT CURSOR DISCARDABLE "res\\insert_point.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_ZOOM CURSOR DISCARDABLE "res\\zoom.cur"
IDC_RADIUS CURSOR DISCARDABLE "res\\radius.cur" IDC_RADIUS CURSOR DISCARDABLE "res\\radius.cur"