Fixed: Warnings

This commit is contained in:
kervala 2016-11-22 12:22:17 +01:00
parent 8139222e27
commit d9e8c88dfa
17 changed files with 56 additions and 23 deletions

View file

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

View file

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

View file

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

View file

@ -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;

View file

@ -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<TPathString> configRootPaths;
TPathString projectConfigPath;
uint32 projectConfigModification;
uint32 projectConfigModification = 0;
std::string projectName;
if (partial)
{

View file

@ -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();

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 ('/');
if (pos == string::npos)

View file

@ -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);
}

View file

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

View file

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

View file

@ -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);

View file

@ -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);

View file

@ -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 );

View file

@ -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");

View file

@ -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 ?

View file

@ -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

View file

@ -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"