Changed: #825 Remove all warning when compiling Ryzom

This commit is contained in:
kervala 2010-08-09 16:20:03 +02:00
parent 67ebdb938a
commit c693c47cac
39 changed files with 220 additions and 138 deletions

View file

@ -52,6 +52,13 @@ public:
LongFormat : 1, // true if the message format is long (d'ho ? all message are long !?!, always true)
MessageType : 2; // type of the message (from TMessageType), classical message are 'OneWay'
TFormat()
{
StringMode = 0;
LongFormat = 0;
MessageType = 0;
}
void serial(NLMISC::IStream &s)
{
if (s.isReading())

View file

@ -486,6 +486,7 @@ void CLightingManager::computeModelLightContributions(NLMISC::CRGBA sunAmbient,
v= NLMISC::OptFastFloor(mergedAmbient.R); fastClamp8(v); amb.R= v;
v= NLMISC::OptFastFloor(mergedAmbient.G); fastClamp8(v); amb.G= v;
v= NLMISC::OptFastFloor(mergedAmbient.B); fastClamp8(v); amb.B= v;
amb.R = 255;
lightContrib.MergedPointLight= amb;
// Indicate we use the merged pointLight => the model must recompute lighting each frame

View file

@ -136,7 +136,7 @@ float CMRMBuilder::getDeltaFaceNormals(sint numvertex)
// return a positive value of Somme(|DeltaNormals|) / NNormals.
CMRMVertex &vert= TmpVertices[numvertex];
float delta=0;
CVector refNormal;
CVector refNormal(0.f, 0.f, 0.f);
sint nfaces=(sint)vert.SharedFaces.size();
for(sint i=0;i<nfaces;i++)
{
@ -448,7 +448,7 @@ CMesh::CSkinWeight CMRMBuilder::collapseSkinWeight(const CMesh::CSkinWeight &sw1
sort(sws.begin(), sws.end());
// clamp the result to the wanted max matrix.
uint nbMatsOut;
uint nbMatsOut = 0;
switch(_SkinReduction)
{
case CMRMParameters::SkinReductionMin:

View file

@ -657,7 +657,7 @@ void CPackedZone32::build(std::vector<const CTessFace*> &leaves,
{
CMatrix instanceMatrix;
igs[k]->getInstanceMatrix(l, instanceMatrix);
if (NLMISC::strlwr(NLMISC::CFile::getExtension(igs[k]->getShapeName(l))) == "pacs_prim") continue;
if (NLMISC::toLower(NLMISC::CFile::getExtension(igs[k]->getShapeName(l))) == "pacs_prim") continue;
std::string stdShapeName = standardizeShapeName(igs[k]->getShapeName(l));
TShapeCache::const_iterator it = shapeCache.find(stdShapeName);
if (it != shapeCache.end())

View file

@ -226,7 +226,7 @@ void CShapeInfo::build(const CMeshBase &meshBase, const CMeshMRMGeom &meshGeom)
// ***************************************************************************
std::string standardizeShapeName(const std::string &name)
{
std::string result = NLMISC::strlwr(name);
std::string result = NLMISC::toLower(name);
if (CFile::getExtension(result).empty())
{
result += ".shape";

View file

@ -558,25 +558,25 @@ void CBufFIFO::display ()
{
if (_Rewinder != NULL && _Rewinder >= pos && _Rewinder < pos + gran)
{
strncat (str, "*", 1024);
strncat (str, "*", 1);
}
else
{
strncat (str, "@", 1024);
strncat (str, "@", 1);
}
}
else
{
strncat (str, "T", 1024);
strncat (str, "T", 1);
}
}
else if (_Head >= pos && _Head < pos + gran)
{
strncat (str, "H", 1024);
strncat (str, "H", 1);
}
else if (_Rewinder != NULL && _Rewinder >= pos && _Rewinder < pos + gran)
{
strncat (str, "R", 1024);
strncat (str, "R", 1);
}
else
{
@ -595,12 +595,12 @@ void CBufFIFO::display ()
for (; i < s; i+= gran)
{
strncat (str, " ", 1024);
strncat (str, " ", 1);
}
#ifdef NL_DEBUG
strncat (str, "\n", 1024);
strncat (str, "\n", 1);
#else
strncat (str, "\r", 1024);
strncat (str, "\r", 1);
#endif
DebugLog->display (str);
}

View file

@ -440,7 +440,7 @@ void cbInvalidEntityNamesFilename(const std::string &invalidEntityNamesFilename)
for(;;)
{
char str[512];
if (fgets(str, 511, fp) == NULL)
if (!fgets(str, 511, fp))
break;
if(feof(fp))
break;

View file

@ -1523,13 +1523,13 @@ void CFileContainer::removeBigFiles(const std::vector<std::string> &bnpFilenames
TFiles::iterator fileIt, fileCurrIt;
for (uint k = 0; k < bnpFilenames.size(); ++k)
{
std::string completeBNPName = strlwr(bnpFilenames[k]) + "@";
std::string completeBNPName = toLower(bnpFilenames[k]) + "@";
if (SSMpath.isAdded(completeBNPName))
{
bnpStrIds.insert(SSMpath.add(completeBNPName));
}
CBigFile::getInstance().remove(bnpFilenames[k]);
fileIt = _Files.find(strlwr(bnpFilenames[k]));
fileIt = _Files.find(toLower(bnpFilenames[k]));
if (fileIt != _Files.end())
{
_Files.erase(fileIt);

View file

@ -26,6 +26,7 @@
# include <windows.h>
#elif defined NL_OS_UNIX
# include <unistd.h>
# include <cerrno>
# include <sys/types.h>
# include <sys/time.h>
#endif
@ -125,7 +126,10 @@ void CListenTask::init( uint16 port, sint32 maxExpectedBlockSize )
CServerTask::CServerTask() : NbLoop (0), _ExitRequired(false)
{
#ifdef NL_OS_UNIX
pipe( _WakeUpPipeHandle );
if (pipe( _WakeUpPipeHandle ) == -1)
{
nlwarning("LNETL1: pipe() failed: code=%d '%s'", errno, strerror(errno));
}
#endif
}
@ -981,7 +985,10 @@ void CServerReceiveTask::run()
#if defined NL_OS_UNIX
// POLL7
nice( 2 ); // is this really useful as long as select() sleeps?
if (nice( 2 ) == -1) // is this really useful as long as select() sleeps?
{
nlwarning("LNETL1: nice() failed: code=%d '%s'", errno, strerror(errno));
}
#endif // NL_OS_UNIX
// Copy of _Connections

View file

@ -79,7 +79,11 @@ namespace NLNET
// get the next command from the command line
char theCommand[1024] = "";
fgets(theCommand, sizeofarray(theCommand), stdin);
if (!fgets(theCommand, sizeofarray(theCommand), stdin))
{
nlwarning("fgets failed");
break;
}
// push the command to allow reader thread to deal with it
pushCommand(theCommand);

View file

@ -208,6 +208,9 @@ public:
_Retriever = retriever;
_Chain = uint16(chain);
_OChainIndex = 0;
_IndexInOChain = 0;
_MaxIndexInOChain = 0;
_OChainForward = 0;
setupIndex();
}

View file

@ -87,7 +87,7 @@ static ov_callbacks OV_CALLBACKS_NLMISC_STREAM = {
};
CMusicBufferVorbis::CMusicBufferVorbis(NLMISC::IStream *stream, bool loop)
: _Stream(stream), _Loop(loop), _StreamSize(0), _IsMusicEnded(false)
: _Stream(stream), _Loop(loop), _IsMusicEnded(false)
{
_StreamOffset = stream->getPos();
stream->seek(0, NLMISC::IStream::end);

View file

@ -212,10 +212,8 @@ int main(int argc, char *argv[])
for(j=0;j<LodFilters.size();j++)
{
// Make the test case-unsensitive
string lwrFileName= fileNameIn;
string lwrFilter= LodFilters[j];
strlwr(lwrFileName);
strlwr(lwrFilter);
string lwrFileName= toLower(fileNameIn);
string lwrFilter= toLower(LodFilters[j]);
if( testWildCard(lwrFileName.c_str(), lwrFilter.c_str()) )
{
string clodFile= clod_dir_in+"/"+LodNames[j]+".clod";

View file

@ -426,16 +426,18 @@ int main(int nNbArg, char **ppArgs)
while (!iFile.eof())
{
iFile.getline (bufTmp, 256);
sscanf (bufTmp, "%s %f %f %f %f", tgaName, &uvMinU, &uvMinV, &uvMaxU, &uvMaxV);
if (sscanf (bufTmp, "%s %f %f %f %f", tgaName, &uvMinU, &uvMinV, &uvMaxU, &uvMaxV) != 5)
{
nlwarning("Can't parse %s", bufTmp);
continue;
}
sTGAname = tgaName;
sTGAname = strlwr(sTGAname);
sTGAname = toLower(string(tgaName));
string findTGAName;
for (i = 0; i < mapSize; ++i)
{
// get the string whitout path
findTGAName = CFile::getFilename(AllMapNames[i]);
findTGAName = strlwr(findTGAName);
findTGAName = toLower(CFile::getFilename(AllMapNames[i]));
if( findTGAName == sTGAname )
break;
}

View file

@ -109,22 +109,24 @@ void LoadSceneScript (const char *ScriptName, CScene* pScene, vector<SDispCS> &D
FILE *f = fopen (ScriptName,"rb");
fseek (f, 0, SEEK_END);
int file_size = ftell (f);
sint file_size = ftell (f);
fseek (f, 0, SEEK_SET);
char *file_buf = (char*)malloc(file_size+1);
fread (file_buf, 1, file_size, f);
if (fread (file_buf, 1, file_size, f) != file_size)
nlwarning("Can't read %d elements", file_size);
file_buf[file_size] = 0;
++file_size;
fclose (f);
char *buf_ptr = file_buf;
int nLastNbPlus = 0;
sint nLastNbPlus = 0;
vector<CInstanceGroup*> pile;
pile.clear ();
do
{
char Line[256], *line_ptr;
int nNbPlus = 0;
sint nNbPlus = 0;
line_ptr = &Line[0];
buf_ptr = readLine (line_ptr, buf_ptr);

View file

@ -298,8 +298,7 @@ void statRyzomBug(const char *dirSrc)
}
else if(str.compare(0, nel3dIdTok.size(), nel3dIdTok)==0)
{
string tmp= str;
strlwr(tmp);
string tmp= toLower(str);
if(tmp.find("opengl")!=string::npos)
precNel3DMode= 0;
else if(tmp.find("direct3d")!=string::npos)

View file

@ -66,8 +66,8 @@ int main(int argc, char **argv)
printf("---------\n");
// IGSurfaceLight info.
const CIGSurfaceLight::TRetrieverGridMap &rgm= ig.getIGSurfaceLight().getRetrieverGridMap();
printf("IGSurfaceLighting: CellSize: %f. NumGridRetriever: %d\n",
ig.getIGSurfaceLight().getCellSize(), rgm.size() );
printf("IGSurfaceLighting: CellSize: %f. NumGridRetriever: %u\n",
ig.getIGSurfaceLight().getCellSize(), (uint)rgm.size() );
uint rgmInst= 0;
uint totalCells= 0;
CIGSurfaceLight::TRetrieverGridMap::const_iterator it= rgm.begin();
@ -85,6 +85,6 @@ int main(int argc, char **argv)
}
catch (std::exception &e)
{
printf(e.what());
printf("%s\n", e.what());
}
}

View file

@ -83,8 +83,7 @@ public:
for (i=(uint)strlen(msg); i<79; i++)
msg[i]=' ';
msg[i]=0;
printf (msg);
printf ("\r");
printf ("%s\r", msg);
}
protected:

View file

@ -413,7 +413,7 @@ int main(int nNbArg, char **ppArgs)
CTextureFile *pTF = dynamic_cast<CTextureFile*>(pIT);
if (pTF != NULL)
{
string sTexName = NLMISC::strlwr(pTF->getFileName());
string sTexName = NLMISC::toLower(pTF->getFileName());
if(pTF->getUploadFormat()==ITexture::Luminance)
setLM8Bit.insert(sTexName);
}
@ -462,7 +462,7 @@ int main(int nNbArg, char **ppArgs)
tmpLMs.clear();
for (i = 0; i < (sint32)AllLightmapNames.size(); ++i)
{
bool lm8Bit= setLM8Bit.find( NLMISC::strlwr(AllLightmapNames[i]) ) !=setLM8Bit.end();
bool lm8Bit= setLM8Bit.find( NLMISC::toLower(AllLightmapNames[i]) ) !=setLM8Bit.end();
// if same mode
if( lm8Bit == (lmc8bitMode==1) )
{
@ -756,13 +756,13 @@ int main(int nNbArg, char **ppArgs)
CTextureFile *pTF = dynamic_cast<CTextureFile*>(pIT);
if (pTF != NULL)
{
string sTexName = NLMISC::strlwr(getBaseName(pTF->getFileName()));
string sTexNameMoved = NLMISC::strlwr(getBaseName(AllLightmapNames[i]));
string sTexName = NLMISC::toLower(getBaseName(pTF->getFileName()));
string sTexNameMoved = NLMISC::toLower(getBaseName(AllLightmapNames[i]));
if (sTexName == sTexNameMoved)
{
// We must remap the name and indicate to remap uvs
bMustRemapUV = true;
//string sNewTexName = NLMISC::strlwr(getBaseName(AllLightmapNames[j]));
//string sNewTexName = NLMISC::toLower(getBaseName(AllLightmapNames[j]));
//sNewTexName += NLMISC::toString(getLayerNb(pTF->getFileName())) + ".tga";
//pTF->setFileName (sNewTexName);
}
@ -823,11 +823,11 @@ int main(int nNbArg, char **ppArgs)
CTextureFile *pTF = dynamic_cast<CTextureFile*>(pIT);
if (pTF != NULL)
{
string sTexName = NLMISC::strlwr(getBaseName(pTF->getFileName()));
string sTexNameMoved = NLMISC::strlwr(getBaseName(AllLightmapNames[i]));
string sTexName = NLMISC::toLower(getBaseName(pTF->getFileName()));
string sTexNameMoved = NLMISC::toLower(getBaseName(AllLightmapNames[i]));
if (sTexName == sTexNameMoved)
{
string sNewTexName = NLMISC::strlwr(getBaseName(AllLightmapNames[j]));
string sNewTexName = NLMISC::toLower(getBaseName(AllLightmapNames[j]));
sNewTexName += NLMISC::toString(getLayerNb(pTF->getFileName())) + ".tga";
pTF->setFileName (sNewTexName);
}

View file

@ -3703,7 +3703,7 @@ void CObjectViewer::shootScene()
string extension = NLMISC::CFile::getExtension ((const char*)fileDlg.GetPathName ());
// The file name without extension
bool jpeg = strlwr (extension) == "jpg";
bool jpeg = toLower (extension) == "jpg";
// Activate the driver
CNELU::Driver->activate ();

View file

@ -454,7 +454,7 @@ void CSnapshotToolDlg::OnGo()
CString wildCard;
m_Filters.GetText(l, wildCard);
wildCard.MakeLower();
if (testWildCard(strlwr(NLMISC::CFile::getFilename(files[k]).c_str()), (LPCTSTR) wildCard))
if (testWildCard(toLower(NLMISC::CFile::getFilename(files[k])).c_str(), (LPCTSTR) wildCard))
{
_FilteredFiles.push_back(files[k]);
break;

View file

@ -1220,7 +1220,7 @@ void VertexPaintData::SynchVerts(Mesh &m)
}
else
assert(0);
nlassert(0);
}
}
}
@ -1293,7 +1293,7 @@ void VertexPaintRestore::Restore(int isUndo)
{
if(isUndo)
{
assert(pPaintData->colordata);
nlassert(pPaintData->colordata);
redoColordata = pPaintData->colordata;
redonumcolors = pPaintData->numColors;
@ -1310,7 +1310,7 @@ void VertexPaintRestore::Restore(int isUndo)
void VertexPaintRestore::Redo()
{
assert(pPaintData->colordata);
nlassert(pPaintData->colordata);
colordata = pPaintData->colordata;
numcolors = pPaintData->numColors;

View file

@ -877,7 +877,8 @@ bool ShapesExporter::createThumbnail(const string &filename, const string &path)
if(fp)
{
char str[100];
fgets(str, 100, fp);
if (!fgets(str, 100, fp))
strcpy(str, "0");
fclose(fp);
selectedFrame = atoi(str)/2;
}

View file

@ -82,8 +82,7 @@ void progress (const char *message, float progress)
for (i=(uint)strlen(msg); i<79; i++)
msg[i]=' ';
msg[i]=0;
printf (msg);
printf ("\r");
printf ("%s\r", msg);
}
class CZoneDependencies
@ -523,7 +522,7 @@ int main (int argc, char* argv[])
// Write the dependencies file
FILE *outputFile;
if ((outputFile=fopen (strlwr (outputFileName).c_str(), "w")))
if ((outputFile=fopen (toLower (outputFileName).c_str(), "w")))
{
// Add a dependency entry
fprintf (outputFile, "dependencies =\n{\n");
@ -538,7 +537,7 @@ int main (int argc, char* argv[])
// Write it
string message="\t\""+zoneName+"\"";
fprintf (outputFile, strlwr (message).c_str());
fprintf (outputFile, "%s", toLower (message).c_str());
// Next ite;
ite++;
@ -705,7 +704,7 @@ static void computeIGBBox(const NL3D::CInstanceGroup &ig, CLightingBBox &result,
static void computeZoneIGBBox(const char *zoneName, CLightingBBox &result, TShapeMap &shapeMap, const TString2LightingBBox &additionnalIG)
{
result = CLightingBBox(); // starts with a void box
std::string lcZoneName = NLMISC::strlwr(std::string(zoneName));
std::string lcZoneName = NLMISC::toLower(std::string(zoneName));
TString2LightingBBox::const_iterator zoneIt = additionnalIG.find(lcZoneName);
if (zoneIt != additionnalIG.end())
{
@ -895,7 +894,7 @@ static void computeIGBBoxFromContinent(NLMISC::CConfigFile &parameter,
nlwarning("Couldn't get zone name of village %d in continent %s", continentName.c_str(), k);
continue;
}
zoneName = NLMISC::strlwr(CFile::getFilenameWithoutExtension(zoneName));
zoneName = NLMISC::toLower(CFile::getFilenameWithoutExtension(zoneName));
CLightingBBox result;
// ok, it is in the dependant zones
computeBBoxFromVillage(currVillage, continentName, k, shapeMap, result);

View file

@ -75,11 +75,10 @@ class CMyIgZoneLighter : public CInstanceLighter
pgId= min(pgId, (uint)(BAR_LENGTH-1));
sprintf (msg, "\r%s: %s", message, progressbar[pgId]);
uint i;
for (i=strlen(msg); i<79; i++)
for (i=(uint)strlen(msg); i<79; i++)
msg[i]=' ';
msg[i]=0;
printf (msg);
printf ("\r");
printf ("%s\r", msg);
}
};
@ -114,7 +113,7 @@ int main(int argc, char* argv[])
if (inputFile.open (argv[1]))
{
// Zone name
string zoneName=strlwr (string ("zone_"+getName (argv[1])));
string zoneName=toLower (string ("zone_"+getName (argv[1])));
// Load the zone
try

View file

@ -85,8 +85,7 @@ class CMyZoneLighter : public CZoneLighter
for (i=strlen(msg); i<79; i++)
msg[i]=' ';
msg[i]=0;
printf (msg);
printf ("\r");
printf ("%s\r", msg);
}
};
@ -138,7 +137,7 @@ static void loadIGFromVillage(const NLGEORGES::UFormElm *villageItem, const std:
// verify that the ig is not already added (case of tr_water.ig in additional_igs)
for(uint igAdd= 0;igAdd<(uint)additionalIgNames.size();igAdd++)
{
if( strlwr(additionalIgNames.asString()) == strlwr(igName) )
if( toLower(additionalIgNames.asString()) == toLower(igName) )
{
nlwarning("Skipping Village Ig %s, cause already exist in additional ig", igName.c_str());
continue;
@ -313,7 +312,7 @@ int main(int argc, char* argv[])
if (inputFile.open (argv[1]))
{
// Zone name
string zoneName=strlwr (string ("zone_"+getName (argv[1])));
string zoneName=toLower (string ("zone_"+getName (argv[1])));
// Load the zone
try
@ -701,7 +700,7 @@ int main(int argc, char* argv[])
continue;
// PS ?
if (strlwr (CFile::getExtension (name)) == "ps")
if (toLower (CFile::getExtension (name)) == "ps")
continue;
// Add a .shape at the end ?

View file

@ -346,7 +346,7 @@ void weldZones(const char *center)
}
}
fprintf(fdbg,"(before) zone %d bordervertices size : %d\n",i,adjZoneBorderVertices.size());
fprintf(fdbg,"(before) zone %u bordervertices size : %u\n",i,(uint)adjZoneBorderVertices.size());
// delete border vertices of the adjacent zone if their neighbour zoneId
// is equal to current zone zoneId
@ -360,7 +360,7 @@ void weldZones(const char *center)
else
itborder++;
}
fprintf(fdbg,"(after) zone %d bordervertices size : %d\n",i,adjZoneBorderVertices.size());
fprintf(fdbg,"(after) zone %u bordervertices size : %u\n",i,(uint)adjZoneBorderVertices.size());
// A set for storing base vertex index already added in the quad tree
std::set<uint16> adjBaseVertexIndexSet;

View file

@ -447,13 +447,10 @@ void displayZones()
}
catch(Exception &e)
{
printf(e.what ());
printf("%s\n", e.what ());
}
}
// Load instance group.
CNELU::clearBuffers(CRGBA(0,0,0));
ViewerCfg.TextContext.printfAt(0.5f,0.5f,"Loading objects...");
@ -472,7 +469,7 @@ void displayZones()
}
catch(Exception &e)
{
printf(e.what ());
printf("%s\n", e.what ());
}
}

View file

@ -401,6 +401,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shapes_exporter", "3d\shape
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "georges2csv", "georges\georges2csv\georges2csv.vcproj", "{885542B1-BE3C-401A-A2A4-DA49E48DF0AB}"
ProjectSection(ProjectDependencies) = postProject
{44B21233-EFCC-4825-B5E5-3A3BD6CC5516} = {44B21233-EFCC-4825-B5E5-3A3BD6CC5516}
{9D284C6B-BE12-4549-87E5-2337D64F31BE} = {9D284C6B-BE12-4549-87E5-2337D64F31BE}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View file

@ -44,13 +44,14 @@
#include "nel/georges/u_form_loader.h"
#include "nel/georges/load_form.h"
// Georges, bypassing interface
#include "georges/stdgeorges.h"
#include "georges/form.h"
#include "../../../src/georges/stdgeorges.h"
#include "../../../src/georges/form.h"
// Basic C++
#include <iostream>
//#include <conio.h>
#include <stdio.h>
#include <limits>
//#include <io.h>
// stl
@ -695,14 +696,18 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
return;
}
if (!fgets(lineBuffer, BUFFER_SIZE, s))
{
nlwarning("fgets() failed");
return;
}
loadSheetPath();
UFormLoader *formLoader = UFormLoader::createLoader ();
NLMISC::CSmartPtr<CForm> form;
NLMISC::CSmartPtr<UFormDfn> formDfn;
fgets(lineBuffer, BUFFER_SIZE, s);
explode(std::string(lineBuffer), std::string(SEPARATOR), fields);
vector<bool> activeFields( fields.size(), true );
@ -728,7 +733,7 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
}
else if ( nlstricmp( fields[i], "parent" ) == 0 )
{
strlwr( fields[i] ); // non-const version
fields[i] = toLower( fields[i] );
}
else
{
@ -748,7 +753,7 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
}
string addExtension = "." + sheetType;
uint dirmapLetterIndex = ~0;
uint dirmapLetterIndex = std::numeric_limits<uint>::max();
bool dirmapLetterBackward = false;
vector<string> dirmapDirs;
string dirmapSheetCode;
@ -812,7 +817,7 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
nlinfo( "Sheet code: %s", dirmapSheetCode.c_str() );
if ( ! dirmapLetterBackward )
dirmapLetterIndex += dirmapSheetCode.size();
dirmapLetterIndex += (uint)dirmapSheetCode.size();
CConfigFile::CVar *wep = dirmapcfg.getVarPtr( "WriteEmptyProperties" );
if ( wep )
@ -849,7 +854,12 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
while (!feof(s))
{
lineBuffer[0] = '\0';
fgets(lineBuffer, BUFFER_SIZE, s);
if (!fgets(lineBuffer, BUFFER_SIZE, s))
{
nlwarning("fgets() failed");
break;
}
explode(std::string(lineBuffer), std::string(SEPARATOR), args);
if (args.size() < 1)
@ -868,7 +878,7 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
{
filebase += "." + sheetType;
}
strlwr (filebase);
filebase = toLower(filebase);
string filename, dirbase;
bool isNewSheet=true;
@ -890,7 +900,7 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
else
{
// Load template sheet
filename = strlwr( static_cast<const string&>(filebase) );
filename = toLower(filebase);
form = (CForm*)formLoader->loadForm( (string("_empty.") + sheetType).c_str() );
if (form == NULL)
{
@ -898,14 +908,14 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
}
// Deduce directory from sheet name
if ( dirmapLetterIndex != ~0 )
if ( dirmapLetterIndex != std::numeric_limits<uint>::max() )
{
if ( dirmapLetterIndex < filebase.size() )
{
uint letterIndex;
char c;
if ( dirmapLetterBackward )
letterIndex = filebase.size() - 1 - (CFile::getExtension( filebase ).size()+1) - dirmapLetterIndex;
letterIndex = (uint)(filebase.size() - 1 - (CFile::getExtension( filebase ).size()+1)) - dirmapLetterIndex;
else
letterIndex = dirmapLetterIndex;
c = tolower( filebase[letterIndex] );

View file

@ -39,7 +39,7 @@ bool keepFile (const char *fileName)
uint i;
bool ifPresent = false;
bool ifTrue = false;
string file = strlwr(CFile::getFilename (fileName));
string file = toLower(CFile::getFilename (fileName));
for (i=0; i<WildCards.size(); i++)
{
if (WildCards[i].Not)
@ -252,7 +252,7 @@ uint readOptions (int nNbArg, char **ppArgs)
if ((strcmp (ppArgs[i], "-if") == 0) && ((i+1)<(uint)nNbArg))
{
CWildCard card;
card.Expression = strlwr(string(ppArgs[i+1]));
card.Expression = toLower(string(ppArgs[i+1]));
card.Not = false;
WildCards.push_back (card);
optionCount += 2;
@ -261,7 +261,7 @@ uint readOptions (int nNbArg, char **ppArgs)
if ((strcmp (ppArgs[i], "-ifnot") == 0) && ((i+1)<(uint)nNbArg))
{
CWildCard card;
card.Expression = strlwr(string(ppArgs[i+1]));
card.Expression = toLower(string(ppArgs[i+1]));
card.Not = true;
WildCards.push_back (card);
optionCount += 2;

View file

@ -1,3 +1,19 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// 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/>.
// data_mirror.cpp : Defines the class behaviors for the application.
//
@ -89,21 +105,21 @@ BOOL CData_mirrorApp::InitInstance()
cf.load (path);
MainDirectory = cf.getVar ("MainDirectory").asString ();
MainDirectory = strlwr (CPath::standardizePath (MainDirectory));
MainDirectory = toLower (CPath::standardizePath (MainDirectory));
MirrorDirectory = cf.getVar ("MirrorDirectory").asString ();
MirrorDirectory = strlwr (CPath::standardizePath (MirrorDirectory));
MirrorDirectory = toLower (CPath::standardizePath (MirrorDirectory));
LogDirectory = cf.getVar ("LogDirectory").asString ();
LogDirectory = strlwr (CPath::standardizePath (LogDirectory));
LogDirectory = toLower (CPath::standardizePath (LogDirectory));
IgnoreDirectory = cf.getVar ("IgnoreDirectory").asString ();
IgnoreDirectory = strlwr (CPath::standardizePath (IgnoreDirectory));
IgnoreDirectory = toLower (CPath::standardizePath (IgnoreDirectory));
if (IgnoreDirectory.empty())
IgnoreDirectory = MainDirectory;
string sBinaryCompare = cf.getVar ("BinaryCompare").asString ();
sBinaryCompare = strlwr (sBinaryCompare);
sBinaryCompare = toLower (sBinaryCompare);
BinaryCompare = false;
if ((sBinaryCompare == "true") || (sBinaryCompare=="1"))
BinaryCompare = true;
@ -126,12 +142,12 @@ BOOL CData_mirrorApp::InitInstance()
if (NLMISC::CFile::isDirectory (CurrentDir))
{
directory = true;
CurrentDir = strlwr (CPath::standardizePath (CurrentDir));
CurrentDir = toLower(CPath::standardizePath (CurrentDir));
}
else if (NLMISC::CFile::fileExists (CurrentDir))
{
directory = false;
CurrentDir = strlwr (CPath::standardizePath (NLMISC::CFile::getPath (CurrentDir)));
CurrentDir = toLower(CPath::standardizePath (NLMISC::CFile::getPath (CurrentDir)));
}
else
{

View file

@ -1,5 +1,18 @@
// data_mirrorDlg.cpp : implementation file
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// 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/>.
#include "stdafx.h"
#include "data_mirror.h"
@ -600,8 +613,7 @@ void CData_mirrorDlg::buildSourceFiles ()
{
// Get the filename
string &str = fileSource[i];
str = strlwr (str);
str = str.substr (MainDirectory.size (), str.size ());
str = toLower(str.substr (MainDirectory.size (), str.size ()));
// In the ignore list ?
if (IgnoreFiles.find (str) == IgnoreFiles.end () && (str != "ignore_list.txt"))
@ -689,8 +701,7 @@ void CData_mirrorDlg::buildSourceFiles ()
{
// Get the filename
string &str = fileSource[i];
str = strlwr (str);
str = str.substr (MirrorDirectory.size (), str.size ());
str = toLower(str.substr (MirrorDirectory.size (), str.size ()));
// In the ignore list ?
if (IgnoreFiles.find (str) == IgnoreFiles.end () && (str != "ignore_list.txt"))

View file

@ -23,7 +23,11 @@ using namespace NLMISC;
#ifdef NL_DEBUG
#define INFO nlinfo
#else // NL_DEBUG
#define INFO ((void)0)
# if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9)
# define INFO __noop
# else
# define INFO 0&&
# endif
#endif // NL_DEBUG
bool readTheFile (const char *filename, vector<char> &fileArray)
@ -207,7 +211,7 @@ void extractStringsFromBinary (const vector<char> &fileArray, set<string> &filen
if (str != "")
{
// Lower case
str = strlwr (str);
str = toLower (str);
// Filter extensions
if (filterExtension (str.c_str(), extensions))
@ -273,7 +277,7 @@ void extractStringsFromASCII (const vector<char> &fileArray, set<string> &filena
temp[c] = begin[c];
// Lower case
temp = strlwr (temp);
temp = toLower (temp);
// Filter extensions
if (filterExtension (temp.c_str(), extensions))
@ -317,15 +321,12 @@ bool loadConfigFiles (const char *ext, const char *input_files, const char *avai
char name[512];
while (fgets (name, 512, file))
{
// To string
temp = name;
// To string and lower
temp = toLower (string(name));
// Remove return
removeChar (temp, '\n');
// Lower
strlwr (temp);
// Valid extension ?
if (temp.size() && temp[0] == '.')
// Add the extension
@ -369,12 +370,9 @@ bool loadConfigFiles (const char *ext, const char *input_files, const char *avai
char name[512];
while (fgets (name, 512, file))
{
temp = name;
temp2 = name;
// To lower
temp = strlwr (temp);
temp2 = strlwr (temp2);
temp = toLower (string(name));
temp2 = toLower (string(name));
// Remove space
removeBeginEndSpaces (temp);
@ -596,7 +594,7 @@ int main(int argc, char* argv[])
// It is used ?
if (usedFiles.find (available->first) == usedFiles.end())
{
string temp = strlwr (available->second.c_str());
string temp = toLower (available->second);
fprintf (stderr, "UNUSED: %s\n", temp.c_str());
}
@ -610,7 +608,7 @@ int main(int argc, char* argv[])
}
else
{
printf ("extract_filename.exe [extensions.txt] [inputFiles.txt] [availableFiles.txt]\n");
printf ("extract_filename [extensions.txt] [inputFiles.txt] [availableFiles.txt]\n");
}
return 0;
}

View file

@ -326,31 +326,36 @@ int main(int argc, char *argv[])
// read the first line
char buffer[MaxLineSize];
fgets(buffer, MaxLineSize, fp);
linecount++;
if (strcmp(buffer, "<nel:packed_xml>\n") != 0)
if (!fgets(buffer, MaxLineSize, fp) || strcmp(buffer, "<nel:packed_xml>\n") != 0)
{
printf ("Error : invalid pack file '%s'\n", filename.c_str());
exit(-1);
return -1;
}
linecount++;
char *result = NULL;
do
{
// read a file line
fgets(buffer, MaxLineSize, fp);
CSString parser(buffer);
linecount++;
if (!fgets(buffer, MaxLineSize, fp))
{
fclose(fp);
printf ("Error : invalid pack file '%s' at line %u", filename.c_str(), linecount);
return -1;
}
CSString parser(buffer);
if (parser.find(" <nel:xml_file name=") != 0)
{
if (parser.find("</nel:packed_xml>") == 0)
{
// end of pack file
fclose(fp);
// end of pack file
if (parser.find("</nel:packed_xml>") == 0)
break;
}
printf ("Error : invalid pack file '%s' at line %u", filename.c_str(), linecount);
exit(-1);
return -1;
}
CSString subFileName = parser.leftCrop(sizeof(" <nel:xml_file name=")-1);

View file

@ -217,7 +217,7 @@ void processAllPasses(string &zoneName)
}
catch(Exception &e)
{
printf(e.what ());
printf("%s\n", e.what ());
}
}
@ -935,7 +935,7 @@ void processGlobalRetriever()
}
catch (Exception &e)
{
printf(e.what ());
printf("%s\n", e.what ());
}
}
}

View file

@ -558,9 +558,9 @@ void NLPACS::CComputableSurface::followBorder(CZoneTessellation *zoneTessel, CSu
current->IsBorder = true;
if ((oppositeSurfId != UnaffectedSurfaceId && (next == NULL || (next->SurfaceId != oppositeSurfId && next->SurfaceId != currentSurfId))) ||
(oppositeSurfId == UnaffectedSurfaceId && (next != NULL && next->SurfaceId != currentSurfId || next == NULL && current->getZoneIdOnEdge(nextEdge) != oppositeZid)) ||
((current->EdgeFlag[nextEdge] || zoneTessel->VerticesFlags[current->Tri[pivot]]!=0) && !allowThis))
if (((oppositeSurfId != UnaffectedSurfaceId) && (next == NULL || (next->SurfaceId != oppositeSurfId && next->SurfaceId != currentSurfId))) ||
((oppositeSurfId == UnaffectedSurfaceId) && ((next != NULL && next->SurfaceId != currentSurfId) || (next == NULL && current->getZoneIdOnEdge(nextEdge) != oppositeZid))) ||
((current->EdgeFlag[nextEdge] || (zoneTessel->VerticesFlags[current->Tri[pivot]]!=0)) && !allowThis))
{
// if reaches the end of the border, then quits.
loop = (absoluteEquals(vstore.front(), vstore.back(), 1e-2f) && loopCount != 1);
@ -1296,7 +1296,7 @@ void NLPACS::CZoneTessellation::compile()
if ((bits0 & CPrimChecker::Water)!=0 || (bits1 & CPrimChecker::Water)!=0 || (bits2 & CPrimChecker::Water)!=0)
{
uint ws;
uint ws = 0;
uint16 ws0 = PrimChecker.index((uint)v0.x, (uint)v0.y);
uint16 ws1 = PrimChecker.index((uint)v1.x, (uint)v1.y);

View file

@ -394,7 +394,9 @@ public:
void floodFill(CSurfElement *first, sint32 surfId, const A &cmp, CZoneTessellation *zoneTessel)
{
if (Verbose)
{
nldebug("flood fill surface %d", surfId);
}
std::vector<CSurfElement *> stack;
sint i;
@ -436,7 +438,9 @@ public:
}
if (Verbose)
{
nldebug("%d elements added", Elements.size());
}
Center = NLMISC::CVector::Null;
for (i=0; i<(sint)Elements.size(); ++i)

View file

@ -19,8 +19,8 @@
#include "nel/misc/types_nl.h"
#include "nel/../../src/pacs/local_retriever.h"
#include "nel/../../src/pacs/quad_grid.h"
#include "../../../src/pacs/local_retriever.h"
#include "../../../src/pacs/quad_grid.h"
#include <map>
@ -394,6 +394,7 @@ public:
}
bool operator != (const iterator &it) { return !(*this == it); }
// ++it
iterator &operator ++ ()
{
ChainVertex += ChainDirection;
@ -402,7 +403,23 @@ public:
Chain += Direction;
resetChain();
}
// FIXME add return value here!
return *this;
}
// it++
iterator operator ++ (int)
{
iterator tmp(*this);
ChainVertex += ChainDirection;
if (ChainVertex == 0 || ChainVertex == (sint)pChain->Vertices.size()-1)
{
Chain += Direction;
resetChain();
}
return tmp;
}
void resetChain()