mirror of https://github.com/axmolengine/axmol.git
Fixed warnings
- signed/unsigned mismatch - printing enum with %d - using int as bool
This commit is contained in:
parent
6edf125c4e
commit
0c70660551
|
@ -110,8 +110,8 @@ void Animate3D::startWithTarget(Node *target)
|
|||
_boneCurves.clear();
|
||||
auto skin = sprite->getSkeleton();
|
||||
bool hasCurve = false;
|
||||
for (unsigned int i = 0; i < skin->getBoneCount(); i++) {
|
||||
auto bone = skin->getBoneByIndex(i);
|
||||
for (int i = 0; i < skin->getBoneCount(); i++) {
|
||||
auto bone = skin->getBoneByIndex(static_cast<unsigned int>(i));
|
||||
auto curve = _animation->getBoneCurveByName(bone->getName());
|
||||
if (curve)
|
||||
{
|
||||
|
|
|
@ -113,9 +113,9 @@ void getChildMap(std::map<int, std::vector<int> >& map, SkinData* skinData, cons
|
|||
skinData->nodeBoneOriginMatrices.push_back(transform);
|
||||
parent_name_index = skinData->getBoneNameIndex(parent_name);
|
||||
}
|
||||
else if (parent_name_index < skinData->skinBoneNames.size())
|
||||
else if (parent_name_index < static_cast<int>(skinData->skinBoneNames.size()))
|
||||
{
|
||||
skinData->skinBoneOriginMatrices[parent_name_index] = (transform);
|
||||
skinData->skinBoneOriginMatrices[parent_name_index] = transform;
|
||||
}
|
||||
|
||||
// set root bone index
|
||||
|
@ -246,7 +246,7 @@ bool Bundle3D::loadObj(MeshDatas& meshdatas, MaterialDatas& materialdatas, NodeD
|
|||
meshdata->attribs.push_back(attrib);
|
||||
}
|
||||
auto vertexNum = shapes.positions.size() / 3;
|
||||
for(auto i = 0; i < vertexNum; i++)
|
||||
for(unsigned int i = 0; i < vertexNum; i++)
|
||||
{
|
||||
meshdata->vertex.push_back(shapes.positions[i * 3]);
|
||||
meshdata->vertex.push_back(shapes.positions[i * 3 + 1]);
|
||||
|
@ -372,7 +372,7 @@ bool Bundle3D::loadMeshDatasBinary(MeshDatas& meshdatas)
|
|||
CCLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str());
|
||||
return false;
|
||||
}
|
||||
for(int i = 0; i < meshSize ; i++ )
|
||||
for(unsigned int i = 0; i < meshSize ; i++ )
|
||||
{
|
||||
MeshData* meshData = new (std::nothrow) MeshData();
|
||||
unsigned int attribSize=0;
|
||||
|
@ -489,7 +489,7 @@ bool Bundle3D::loadMeshDatasBinary_0_1(MeshDatas& meshdatas)
|
|||
// backward compatibility
|
||||
VERTEX_ATTRIB_TEX_COORDS = VERTEX_ATTRIB_TEX_COORD,
|
||||
};
|
||||
for (ssize_t i = 0; i < attribSize; i++)
|
||||
for (unsigned int i = 0; i < attribSize; i++)
|
||||
{
|
||||
unsigned int vUsage, vSize;
|
||||
if (_binaryReader.read(&vUsage, 4, 1) != 1 || _binaryReader.read(&vSize, 4, 1) != 1)
|
||||
|
@ -598,7 +598,7 @@ bool Bundle3D::loadMeshDatasBinary_0_2(MeshDatas& meshdatas)
|
|||
// backward compatibility
|
||||
VERTEX_ATTRIB_TEX_COORDS = VERTEX_ATTRIB_TEX_COORD,
|
||||
};
|
||||
for (ssize_t i = 0; i < attribSize; i++)
|
||||
for (unsigned int i = 0; i < attribSize; i++)
|
||||
{
|
||||
unsigned int vUsage, vSize;
|
||||
if (_binaryReader.read(&vUsage, 4, 1) != 1 || _binaryReader.read(&vSize, 4, 1) != 1)
|
||||
|
@ -695,7 +695,7 @@ bool Bundle3D::loadMeshDatasJson(MeshDatas& meshdatas)
|
|||
MeshVertexAttrib tempAttrib;
|
||||
meshData->attribCount=mesh_vertex_attribute.Size();
|
||||
meshData->attribs.resize(meshData->attribCount);
|
||||
for (int i = 0; i < mesh_vertex_attribute.Size(); i++)
|
||||
for (rapidjson::SizeType i = 0; i < mesh_vertex_attribute.Size(); i++)
|
||||
{
|
||||
const rapidjson::Value& mesh_vertex_attribute_val = mesh_vertex_attribute[i];
|
||||
|
||||
|
@ -856,7 +856,7 @@ bool Bundle3D::loadMaterialsBinary(MaterialDatas& materialdatas)
|
|||
return false;
|
||||
unsigned int materialnum = 1;
|
||||
_binaryReader.read(&materialnum, 4, 1);
|
||||
for (int i = 0; i < materialnum; i++)
|
||||
for (unsigned int i = 0; i < materialnum; i++)
|
||||
{
|
||||
NMaterialData materialData;
|
||||
materialData.id = _binaryReader.readString();
|
||||
|
@ -865,7 +865,7 @@ bool Bundle3D::loadMaterialsBinary(MaterialDatas& materialdatas)
|
|||
|
||||
unsigned int textruenum = 1;
|
||||
_binaryReader.read(&textruenum, 4, 1);
|
||||
for(int j = 0; j < textruenum ; j++ )
|
||||
for(unsigned int j = 0; j < textruenum ; j++ )
|
||||
{
|
||||
NTextureData textureData;
|
||||
textureData.id = _binaryReader.readString();
|
||||
|
@ -924,7 +924,7 @@ bool Bundle3D::loadMaterialsBinary_0_2(MaterialDatas& materialdatas)
|
|||
unsigned int materialnum = 1;
|
||||
_binaryReader.read(&materialnum, 4, 1);
|
||||
|
||||
for (int i = 0; i < materialnum; i++)
|
||||
for (unsigned int i = 0; i < materialnum; i++)
|
||||
{
|
||||
NMaterialData materialData;
|
||||
|
||||
|
@ -1051,14 +1051,14 @@ bool Bundle3D::loadBinary(const std::string& path)
|
|||
// Read all refs
|
||||
CC_SAFE_DELETE_ARRAY(_references);
|
||||
_references = new (std::nothrow) Reference[_referenceCount];
|
||||
for (ssize_t i = 0; i < _referenceCount; ++i)
|
||||
for (unsigned int i = 0; i < _referenceCount; ++i)
|
||||
{
|
||||
if ((_references[i].id = _binaryReader.readString()).empty() ||
|
||||
_binaryReader.read(&_references[i].type, 4, 1) != 1 ||
|
||||
_binaryReader.read(&_references[i].offset, 4, 1) != 1)
|
||||
{
|
||||
clear();
|
||||
CCLOG("warning: Failed to read ref number %d for bundle '%s'.", (int)i, path.c_str());
|
||||
CCLOG("warning: Failed to read ref number %u for bundle '%s'.", i, path.c_str());
|
||||
CC_SAFE_DELETE_ARRAY(_references);
|
||||
return false;
|
||||
}
|
||||
|
@ -1376,17 +1376,17 @@ bool Bundle3D::loadAnimationDataJson(const std::string& id, Animation3DData* ani
|
|||
|
||||
if (!_jsonReader.HasMember(anim.c_str())) return false;
|
||||
int the_index = -1;
|
||||
const rapidjson::Value& animation_data_array = _jsonReader[anim.c_str()];
|
||||
const rapidjson::Value& animation_data_array = _jsonReader[anim.c_str()];
|
||||
|
||||
if (animation_data_array.Size()==0) return false;
|
||||
|
||||
if(!id.empty())
|
||||
{
|
||||
for(int i=0 ;i<animation_data_array.Size();i++)
|
||||
for (rapidjson::SizeType i = 0; i < animation_data_array.Size(); i++)
|
||||
{
|
||||
if(animation_data_array[i][ID].GetString() ==id )
|
||||
if(animation_data_array[i][ID].GetString() == id)
|
||||
{
|
||||
the_index = i;
|
||||
the_index = static_cast<int>(i);
|
||||
}
|
||||
}
|
||||
if(the_index < 0) return false;
|
||||
|
@ -1797,7 +1797,7 @@ NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton)
|
|||
CCLOG("warning: Failed to read nodedata: uvMapping '%s'.", _path.c_str());
|
||||
return nullptr;
|
||||
}
|
||||
for(int j = 0 ; j < uvMapping ; j++)
|
||||
for(unsigned int j = 0; j < uvMapping; j++)
|
||||
{
|
||||
unsigned int textureIndexSize=0;
|
||||
if (_binaryReader.read(&textureIndexSize, 4, 1) != 1)
|
||||
|
@ -1805,7 +1805,7 @@ NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton)
|
|||
CCLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str());
|
||||
return nullptr;
|
||||
}
|
||||
for(unsigned int k = 0; k < textureIndexSize ; k++)
|
||||
for(unsigned int k = 0; k < textureIndexSize; k++)
|
||||
{
|
||||
unsigned int index=0;
|
||||
if (_binaryReader.read(&index, 4, 1) != 1)
|
||||
|
|
|
@ -170,7 +170,7 @@ std::string BundleReader::readString()
|
|||
std::string str;
|
||||
|
||||
ssize_t validLength = _length - _position;
|
||||
if (length > 0 && length <= validLength)
|
||||
if (length > 0 && static_cast<ssize_t>(length) <= validLength)
|
||||
{
|
||||
str.resize(length);
|
||||
if (read(&str[0], 1, length) != length)
|
||||
|
@ -187,4 +187,4 @@ bool BundleReader::readMatrix(float* m)
|
|||
return (read(m, sizeof(float), 16) == 16);
|
||||
}
|
||||
|
||||
}
|
||||
NS_CC_END
|
||||
|
|
|
@ -70,7 +70,7 @@ ssize_t MeshSkin::getBoneCount() const
|
|||
//get bone
|
||||
Bone3D* MeshSkin::getBoneByIndex(unsigned int index) const
|
||||
{
|
||||
if (index < _skinBones.size())
|
||||
if (static_cast<int>(index) < _skinBones.size())
|
||||
return _skinBones.at(index);
|
||||
|
||||
return nullptr;
|
||||
|
|
|
@ -609,7 +609,7 @@ ActionInterval* CCBAnimationManager::getEaseAction(ActionInterval *pAction, CCBK
|
|||
}
|
||||
else
|
||||
{
|
||||
log("CCBReader: Unkown easing type %d", easingType);
|
||||
log("CCBReader: Unkown easing type %d", static_cast<int>(easingType));
|
||||
return pAction;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -361,7 +361,7 @@ void NodeLoader::parseProperties(Node * pNode, Node * pParent, CCBReader * ccbRe
|
|||
break;
|
||||
}
|
||||
default:
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTYTYPE(type);
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTYTYPE(static_cast<int>(type));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -722,10 +722,10 @@ void EventFrame::setNode(cocos2d::Node* node)
|
|||
|
||||
void EventFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||
{
|
||||
if(_frameIndex < _action->getStartFrame() || _frameIndex > _action->getEndFrame())
|
||||
if (static_cast<int>(_frameIndex) < _action->getStartFrame() || static_cast<int>(_frameIndex) > _action->getEndFrame())
|
||||
return;
|
||||
|
||||
if(currentFrameIndex >= _frameIndex)
|
||||
if (currentFrameIndex >= static_cast<int>(_frameIndex))
|
||||
emitEvent();
|
||||
}
|
||||
|
||||
|
|
|
@ -184,8 +184,8 @@ MeshCommand::~MeshCommand()
|
|||
|
||||
void MeshCommand::applyRenderState()
|
||||
{
|
||||
_renderStateCullFace = glIsEnabled(GL_CULL_FACE);
|
||||
_renderStateDepthTest = glIsEnabled(GL_DEPTH_TEST);
|
||||
_renderStateCullFace = glIsEnabled(GL_CULL_FACE) != GL_FALSE;
|
||||
_renderStateDepthTest = glIsEnabled(GL_DEPTH_TEST) != GL_FALSE;
|
||||
glGetBooleanv(GL_DEPTH_WRITEMASK, &_renderStateDepthWrite);
|
||||
|
||||
if (_cullFaceEnabled && !_renderStateCullFace)
|
||||
|
|
|
@ -137,8 +137,8 @@ void RenderQueue::clear()
|
|||
|
||||
void RenderQueue::saveRenderState()
|
||||
{
|
||||
_isDepthEnabled = glIsEnabled(GL_DEPTH_TEST);
|
||||
_isCullEnabled = glIsEnabled(GL_CULL_FACE);
|
||||
_isDepthEnabled = glIsEnabled(GL_DEPTH_TEST) != GL_FALSE;
|
||||
_isCullEnabled = glIsEnabled(GL_CULL_FACE) != GL_FALSE;
|
||||
glGetBooleanv(GL_DEPTH_WRITEMASK, &_isDepthWrite);
|
||||
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
|
Loading…
Reference in New Issue