Merge branch 'master' into 'master'

more warn fixes, we're down to one complaining about tmpnam but there's no cross platform alternative



See merge request !11
This commit is contained in:
DarthArgus
2015-10-17 02:14:49 -04:00
8 changed files with 44 additions and 57 deletions
+7 -7
View File
@@ -4520,7 +4520,7 @@ static void yy_flex_strncpy (char *,yyconst char *,int );
#endif
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * );
static int yy_flex_strnlen (yyconst char * );
#endif
#ifndef YY_NO_INPUT
@@ -4726,9 +4726,9 @@ YY_RULE_SETUP
char *s; // allocate space for string and pass the string pointer rather then yytext
count();
s = MIFFallocString(strlen(yytext) + 1);
s = MIFFallocString(strnlen(yytext) + 1);
strcpy(s, yytext+1); /* strip off the double quotes */
s[strlen(yytext+1)-1] = 0; /* strip off the ending double quotes */
s[strnlen(yytext+1)-1] = 0; /* strip off the ending double quotes */
yylval.stype = s;
return(STR_LIT);
}
@@ -4977,7 +4977,7 @@ YY_RULE_SETUP
char *s; // allocate space for string and pass the string pointer rather then yytext
count();
s = MIFFallocString(strlen(yytext) + 1);
s = MIFFallocString(strnlen(yytext) + 1);
strcpy(s, yytext);
yylval.stype = s;
return(IDENTIFIER);
@@ -5915,7 +5915,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
{
return yy_scan_bytes(yystr,strlen(yystr) );
return yy_scan_bytes(yystr,strnlen(yystr) );
}
/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
@@ -6126,7 +6126,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
#endif
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * s )
static int yy_flex_strnlen (yyconst char * s )
{
register int n;
for ( n = 0; s[n]; ++n )
@@ -6219,7 +6219,7 @@ void yyerror(char *err) /* called by yyparse() */
**-------------------------*/
int MIFFYYInput(char *buf,int max_size)
{
int len = strlen(MIFFInputStream);
int len = strnlen(MIFFInputStream);
int n = max_size < len ? max_size : len;
if (n > 0)
{
@@ -199,18 +199,11 @@ void compare_results_int( std::set<TriggerVolume *> &results, std::set<TriggerVo
{
TriggerVolume* volume = *iter;
ServerObject const &volumeOwner = volume->getOwner();
if ( &volumeOwner == NULL )
{
LOG("SphereGrid", ("Ack null owner!"));
}
else
{
const Object* pob = getContainingPobForObjectInWorld(volume->getOwner());
Sphere const &localSphere = volumeOwner.getLocalSphere();
Sphere world(volumeOwner.getTransform_o2w().rotateTranslate_l2p(localSphere.getCenter()), volume->getRadius());
Vector c=world.getCenter();
LOG("SphereGrid",(" (%f %f %f) %f POB = %p DIST=%f",c.x,c.y,c.z,world.getRadius(),pob, c.magnitudeBetween(v) ));
}
const Object* pob = getContainingPobForObjectInWorld(volume->getOwner());
Sphere const &localSphere = volumeOwner.getLocalSphere();
Sphere world(volumeOwner.getTransform_o2w().rotateTranslate_l2p(localSphere.getCenter()), volume->getRadius());
Vector c=world.getCenter();
LOG("SphereGrid",(" (%f %f %f) %f POB = %p DIST=%f",c.x,c.y,c.z,world.getRadius(),pob, c.magnitudeBetween(v) ));
}
LOG("SphereGrid", ("------------------ Grid Results %d ------------------",results2.size()));
@@ -218,18 +211,11 @@ void compare_results_int( std::set<TriggerVolume *> &results, std::set<TriggerVo
{
TriggerVolume* volume = *iter;
ServerObject const &volumeOwner = volume->getOwner();
if ( &volumeOwner == NULL )
{
LOG("SphereGrid", ("shit null owner."));
}
else
{
const Object* pob = getContainingPobForObjectInWorld(volume->getOwner());
Sphere const &localSphere = volumeOwner.getLocalSphere();
Sphere world(volumeOwner.getTransform_o2w().rotateTranslate_l2p(localSphere.getCenter()), volume->getRadius()); // o2p or o2w
Vector c=world.getCenter();
LOG("SphereGrid",(" (%f %f %f) %f POB = %p DIST=%f",c.x,c.y,c.z,world.getRadius(),pob, c.magnitudeBetween(v) ));
}
const Object* pob = getContainingPobForObjectInWorld(volume->getOwner());
Sphere const &localSphere = volumeOwner.getLocalSphere();
Sphere world(volumeOwner.getTransform_o2w().rotateTranslate_l2p(localSphere.getCenter()), volume->getRadius()); // o2p or o2w
Vector c=world.getCenter();
LOG("SphereGrid",(" (%f %f %f) %f POB = %p DIST=%f",c.x,c.y,c.z,world.getRadius(),pob, c.magnitudeBetween(v) ));
}
DEBUG_FATAL(true,("FATAL: SphereGrid failed to match SphereTree result set."));
@@ -11892,7 +11892,7 @@ void CreatureObject::setNumberOfMissionsWantedInMissionBag(int n)
{
// remove mission objects from the bag
int j = 0;
for (iter = container->begin(), j = 0; iter != container->end(), j < i - n; ++iter, ++j)
for (iter = container->begin(), j = 0; (iter != container->end() && j < i - n); ++iter, ++j)
{
Object * const o = (*iter).getObject();
if (o)
@@ -168,7 +168,7 @@ int ServerCreatureObjectTemplate::getAttributes(Attributes index) const
base = dynamic_cast<const ServerCreatureObjectTemplate *>(m_baseData);
}
DEBUG_FATAL(index < 0 || index >= 6, ("template param index out of range"));
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 6, ("template param static_cast<int>(index) <out of range"));
if (!m_attributes[index].isLoaded())
{
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL)
@@ -217,7 +217,7 @@ int ServerCreatureObjectTemplate::getAttributesMin(Attributes index) const
base = dynamic_cast<const ServerCreatureObjectTemplate *>(m_baseData);
}
DEBUG_FATAL(index < 0 || index >= 6, ("template param index out of range"));
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 6, ("template param static_cast<int>(index) <out of range"));
if (!m_attributes[index].isLoaded())
{
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL)
@@ -266,7 +266,7 @@ int ServerCreatureObjectTemplate::getAttributesMax(Attributes index) const
base = dynamic_cast<const ServerCreatureObjectTemplate *>(m_baseData);
}
DEBUG_FATAL(index < 0 || index >= 6, ("template param index out of range"));
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 6, ("template param static_cast<int>(index) <out of range"));
if (!m_attributes[index].isLoaded())
{
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL)
@@ -315,7 +315,7 @@ int ServerCreatureObjectTemplate::getMinAttributes(Attributes index) const
base = dynamic_cast<const ServerCreatureObjectTemplate *>(m_baseData);
}
DEBUG_FATAL(index < 0 || index >= 6, ("template param index out of range"));
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 6, ("template param static_cast<int>(index) <out of range"));
if (!m_minAttributes[index].isLoaded())
{
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL)
@@ -364,7 +364,7 @@ int ServerCreatureObjectTemplate::getMinAttributesMin(Attributes index) const
base = dynamic_cast<const ServerCreatureObjectTemplate *>(m_baseData);
}
DEBUG_FATAL(index < 0 || index >= 6, ("template param index out of range"));
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 6, ("template param static_cast<int>(index) <out of range"));
if (!m_minAttributes[index].isLoaded())
{
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL)
@@ -413,7 +413,7 @@ int ServerCreatureObjectTemplate::getMinAttributesMax(Attributes index) const
base = dynamic_cast<const ServerCreatureObjectTemplate *>(m_baseData);
}
DEBUG_FATAL(index < 0 || index >= 6, ("template param index out of range"));
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 6, ("template param static_cast<int>(index) <out of range"));
if (!m_minAttributes[index].isLoaded())
{
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL)
@@ -462,7 +462,7 @@ int ServerCreatureObjectTemplate::getMaxAttributes(Attributes index) const
base = dynamic_cast<const ServerCreatureObjectTemplate *>(m_baseData);
}
DEBUG_FATAL(index < 0 || index >= 6, ("template param index out of range"));
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 6, ("template param static_cast<int>(index) <out of range"));
if (!m_maxAttributes[index].isLoaded())
{
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL)
@@ -511,7 +511,7 @@ int ServerCreatureObjectTemplate::getMaxAttributesMin(Attributes index) const
base = dynamic_cast<const ServerCreatureObjectTemplate *>(m_baseData);
}
DEBUG_FATAL(index < 0 || index >= 6, ("template param index out of range"));
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 6, ("template param static_cast<int>(index) <out of range"));
if (!m_maxAttributes[index].isLoaded())
{
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL)
@@ -560,7 +560,7 @@ int ServerCreatureObjectTemplate::getMaxAttributesMax(Attributes index) const
base = dynamic_cast<const ServerCreatureObjectTemplate *>(m_baseData);
}
DEBUG_FATAL(index < 0 || index >= 6, ("template param index out of range"));
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 6, ("template param static_cast<int>(index) <out of range"));
if (!m_maxAttributes[index].isLoaded())
{
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL)
@@ -1395,7 +1395,7 @@ void ServerCreatureObjectTemplate::getAttribMods(AttribMod &data, int index) con
if (m_attribModsAppend && base != NULL)
{
int baseCount = base->getAttribModsCount();
if (index < baseCount)
if (static_cast<int>(index) < baseCount)
{
base->getAttribMods(data, index);
return;
@@ -1403,7 +1403,7 @@ void ServerCreatureObjectTemplate::getAttribMods(AttribMod &data, int index) con
index -= baseCount;
}
DEBUG_FATAL(index < 0 || static_cast<size_t>(index) >= m_attribMods.size(), ("template param index out of range"));
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<size_t>(index) >= m_attribMods.size(), ("template param static_cast<int>(index) <out of range"));
const ObjectTemplate * structTemplate = (*m_attribMods[index]).getValue();
NOT_NULL(structTemplate);
const _AttribMod *param = dynamic_cast<const _AttribMod *>(structTemplate);
@@ -1441,7 +1441,7 @@ void ServerCreatureObjectTemplate::getAttribModsMin(AttribMod &data, int index)
if (m_attribModsAppend && base != NULL)
{
int baseCount = base->getAttribModsCount();
if (index < baseCount)
if (static_cast<int>(index) < baseCount)
{
base->getAttribModsMin(data, index);
return;
@@ -1449,7 +1449,7 @@ void ServerCreatureObjectTemplate::getAttribModsMin(AttribMod &data, int index)
index -= baseCount;
}
DEBUG_FATAL(index < 0 || static_cast<size_t>(index) >= m_attribMods.size(), ("template param index out of range"));
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<size_t>(index) >= m_attribMods.size(), ("template param static_cast<int>(index) <out of range"));
const ObjectTemplate * structTemplate = (*m_attribMods[index]).getValue();
NOT_NULL(structTemplate);
const _AttribMod *param = dynamic_cast<const _AttribMod *>(structTemplate);
@@ -1487,7 +1487,7 @@ void ServerCreatureObjectTemplate::getAttribModsMax(AttribMod &data, int index)
if (m_attribModsAppend && base != NULL)
{
int baseCount = base->getAttribModsCount();
if (index < baseCount)
if (static_cast<int>(index) < baseCount)
{
base->getAttribModsMax(data, index);
return;
@@ -1495,7 +1495,7 @@ void ServerCreatureObjectTemplate::getAttribModsMax(AttribMod &data, int index)
index -= baseCount;
}
DEBUG_FATAL(index < 0 || static_cast<size_t>(index) >= m_attribMods.size(), ("template param index out of range"));
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<size_t>(index) >= m_attribMods.size(), ("template param static_cast<int>(index) <out of range"));
const ObjectTemplate * structTemplate = (*m_attribMods[index]).getValue();
NOT_NULL(structTemplate);
const _AttribMod *param = dynamic_cast<const _AttribMod *>(structTemplate);
@@ -2007,7 +2007,7 @@ float ServerCreatureObjectTemplate::getMaxMentalStates(MentalStates index) const
base = dynamic_cast<const ServerCreatureObjectTemplate *>(m_baseData);
}
DEBUG_FATAL(index < 0 || index >= 4, ("template param index out of range"));
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 4, ("template param static_cast<int>(index) <out of range"));
if (!m_maxMentalStates[index].isLoaded())
{
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL)
@@ -2056,7 +2056,7 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMin(MentalStates index) co
base = dynamic_cast<const ServerCreatureObjectTemplate *>(m_baseData);
}
DEBUG_FATAL(index < 0 || index >= 4, ("template param index out of range"));
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 4, ("template param static_cast<int>(index) <out of range"));
if (!m_maxMentalStates[index].isLoaded())
{
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL)
@@ -2105,7 +2105,7 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMax(MentalStates index) co
base = dynamic_cast<const ServerCreatureObjectTemplate *>(m_baseData);
}
DEBUG_FATAL(index < 0 || index >= 4, ("template param index out of range"));
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 4, ("template param static_cast<int>(index) <out of range"));
if (!m_maxMentalStates[index].isLoaded())
{
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL)
@@ -2154,7 +2154,7 @@ float ServerCreatureObjectTemplate::getMentalStatesDecay(MentalStates index) con
base = dynamic_cast<const ServerCreatureObjectTemplate *>(m_baseData);
}
DEBUG_FATAL(index < 0 || index >= 4, ("template param index out of range"));
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 4, ("template param static_cast<int>(index) <out of range"));
if (!m_mentalStatesDecay[index].isLoaded())
{
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL)
@@ -2203,7 +2203,7 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMin(MentalStates index)
base = dynamic_cast<const ServerCreatureObjectTemplate *>(m_baseData);
}
DEBUG_FATAL(index < 0 || index >= 4, ("template param index out of range"));
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 4, ("template param static_cast<int>(index) <out of range"));
if (!m_mentalStatesDecay[index].isLoaded())
{
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL)
@@ -2252,7 +2252,7 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMax(MentalStates index)
base = dynamic_cast<const ServerCreatureObjectTemplate *>(m_baseData);
}
DEBUG_FATAL(index < 0 || index >= 4, ("template param index out of range"));
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 4, ("template param static_cast<int>(index) <out of range"));
if (!m_mentalStatesDecay[index].isLoaded())
{
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL)
@@ -68,7 +68,7 @@ void SetWarningCallback(WarningCallback);
template <class T>
inline T *NonNull(T *pointer, const char *name)
{
FATAL(!pointer, ("%s pointer is null", name));
WARNING(!pointer, ("%s pointer is null", name));
return pointer;
}
@@ -20,6 +20,7 @@ class MxCifQuadTreeBounds
{
public:
MxCifQuadTreeBounds(float minX, float minY, float maxX, float maxY, void * data = NULL);
virtual ~MxCifQuadTreeBounds(){};
const float getMinX(void) const;
const float getMinY(void) const;
@@ -1184,7 +1184,7 @@ void AlterScheduler::moveObjectsFromAlterNextFrameListToAlterNowList(int schedul
{
PROFILER_AUTO_BLOCK_DEFINE("copy next frame");
if (s_alterNextFrameListFirst != NULL) {
//if (s_alterNextFrameListFirst != NULL) {
for (Object *object = s_alterNextFrameListFirst[schedulePhaseIndex]->getNextFromAlterNextFrameList(); object != NULL; )
{
//-- Add object to alter now list. This removes the object from the alter next frame list.
@@ -1203,7 +1203,7 @@ void AlterScheduler::moveObjectsFromAlterNextFrameListToAlterNowList(int schedul
//-- Increment loop.
object = nextObject;
}
}
//}
}
}
@@ -80,7 +80,7 @@ namespace CSHandlerNamespace
return 0;
}
std::string getOneArg( std::string input, unsigned &position )
std::string getOneArg( std::string input, int position)
{
unsigned pos; // where we stop looking
unsigned lastpos; // the last character in our argument.