diff --git a/CMakeLists.txt b/CMakeLists.txt index cd7637280..f3b7f35cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,8 +6,8 @@ if(MSVC) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}") else() - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -std=c89") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wnon-virtual-dtor -pedantic -std=c++03 -fno-exceptions -fno-rtti") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -Wshadow -std=c89") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wnon-virtual-dtor -pedantic -Wshadow -std=c++03 -fno-exceptions -fno-rtti") endif() set(CMAKE_INSTALL_PREFIX "./") diff --git a/spine-cpp/spine-cpp/src/spine/DeformTimeline.cpp b/spine-cpp/spine-cpp/src/spine/DeformTimeline.cpp index 37ca544f8..de62f9e65 100644 --- a/spine-cpp/spine-cpp/src/spine/DeformTimeline.cpp +++ b/spine-cpp/spine-cpp/src/spine/DeformTimeline.cpp @@ -74,8 +74,8 @@ void DeformTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vecto return; } - VertexAttachment *vertexAttachment = static_cast(slotAttachment); - if (!vertexAttachment->applyDeform(_attachment)) { + VertexAttachment *attachment = static_cast(slotAttachment); + if (!attachment->applyDeform(_attachment)) { return; } @@ -100,9 +100,9 @@ void DeformTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vecto } verticesArray.setSize(vertexCount, 0); Vector &vertices = verticesArray; - if (vertexAttachment->getBones().size() == 0) { + if (attachment->getBones().size() == 0) { // Unweighted vertex positions. - Vector &setupVertices = vertexAttachment->getVertices(); + Vector &setupVertices = attachment->getVertices(); for (size_t i = 0; i < vertexCount; i++) vertices[i] += (setupVertices[i] - vertices[i]) * alpha; } else { diff --git a/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp b/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp index a32c12953..1c2237e62 100644 --- a/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp +++ b/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp @@ -60,7 +60,7 @@ void IkConstraint::apply(Bone &bone, float targetX, float targetY, bool compress float sy = bone._ascaleY; if (compress || stretch) { float b = bone._data.getLength() * sx, dd = MathUtil::sqrt(tx * tx + ty * ty); - if ((compress && dd < b) || (stretch && dd > b) && b > 0.0001f) { + if (((compress && dd < b) || (stretch && dd > b)) && (b > 0.0001f)) { float s = (dd / b - 1) * alpha + 1; sx *= s; if (uniform) sy *= s; diff --git a/spine-cpp/spine-cpp/src/spine/RTTI.cpp b/spine-cpp/spine-cpp/src/spine/RTTI.cpp index e7fec06bb..0822ebc72 100644 --- a/spine-cpp/spine-cpp/src/spine/RTTI.cpp +++ b/spine-cpp/spine-cpp/src/spine/RTTI.cpp @@ -63,4 +63,4 @@ bool RTTI::instanceOf(const RTTI &rtti) const { } return false; -} \ No newline at end of file +} diff --git a/spine-cpp/spine-cpp/src/spine/Skeleton.cpp b/spine-cpp/spine-cpp/src/spine/Skeleton.cpp index 33550e702..c8772d14c 100644 --- a/spine-cpp/spine-cpp/src/spine/Skeleton.cpp +++ b/spine-cpp/spine-cpp/src/spine/Skeleton.cpp @@ -176,7 +176,8 @@ void Skeleton::updateCache() { } } - for (size_t i = 0, n = _bones.size(); i < n; ++i) { + size_t n = _bones.size(); + for (i = 0; i < n; ++i) { sortBone(_bones[i]); } } diff --git a/spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp b/spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp index 5ceb029bc..7dafcdad2 100644 --- a/spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp +++ b/spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp @@ -144,9 +144,9 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons } /* Bones. */ - int bonesCount = readVarint(input, true); - skeletonData->_bones.setSize(bonesCount, 0); - for (int i = 0; i < bonesCount; ++i) { + int numBones = readVarint(input, true); + skeletonData->_bones.setSize(numBones, 0); + for (int i = 0; i < numBones; ++i) { const char *name = readString(input); BoneData *parent = i == 0 ? 0 : skeletonData->_bones[readVarint(input, true)]; BoneData *data = new(__FILE__, __LINE__) BoneData(i, String(name, true), parent); @@ -916,8 +916,8 @@ Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, S if (end == 0) { if (weighted) { deform.setSize(deformLength, 0); - for (size_t i = 0; i < deformLength; ++i) { - deform[i] = 0; + for (size_t iiii = 0; iiii < deformLength; ++iiii) { + deform[iiii] = 0; } } else { deform.clearAndAddAll(vertices); diff --git a/spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp b/spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp index 9dfd527d3..3edb0deda 100644 --- a/spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp +++ b/spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp @@ -643,7 +643,8 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) { } /* Linked meshes. */ - for (int i = 0, n = _linkedMeshes.size(); i < n; ++i) { + int n = _linkedMeshes.size(); + for (i = 0; i < n; ++i) { LinkedMesh *linkedMesh = _linkedMeshes[i]; Skin *skin = linkedMesh->_skin.length() == 0 ? skeletonData->getDefaultSkin() : skeletonData->findSkin( linkedMesh->_skin); @@ -1062,8 +1063,8 @@ Animation *SkeletonJson::readAnimation(Json *root, SkeletonData *skeletonData) { VertexAttachment *attachment = static_cast(baseAttachment); weighted = attachment->_bones.size() != 0; - Vector &vertices = attachment->_vertices; - deformLength = weighted ? vertices.size() / 3 * 2 : vertices.size(); + Vector &verts = attachment->_vertices; + deformLength = weighted ? verts.size() / 3 * 2 : verts.size(); timeline = new(__FILE__, __LINE__) DeformTimeline(timelineMap->_size); @@ -1072,34 +1073,34 @@ Animation *SkeletonJson::readAnimation(Json *root, SkeletonData *skeletonData) { for (valueMap = timelineMap->_child, frameIndex = 0; valueMap; valueMap = valueMap->_next, ++frameIndex) { Json *vertices = Json::getItem(valueMap, "vertices"); - Vector deform; + Vector deformed; if (!vertices) { if (weighted) { - deform.setSize(deformLength, 0); + deformed.setSize(deformLength, 0); } else { - deform.clearAndAddAll(attachment->_vertices); + deformed.clearAndAddAll(attachment->_vertices); } } else { int v, start = Json::getInt(valueMap, "offset", 0); Json *vertex; - deform.setSize(deformLength, 0); + deformed.setSize(deformLength, 0); if (_scale == 1) { for (vertex = vertices->_child, v = start; vertex; vertex = vertex->_next, ++v) { - deform[v] = vertex->_valueFloat; + deformed[v] = vertex->_valueFloat; } } else { for (vertex = vertices->_child, v = start; vertex; vertex = vertex->_next, ++v) { - deform[v] = vertex->_valueFloat * _scale; + deformed[v] = vertex->_valueFloat * _scale; } } if (!weighted) { Vector &verticesAttachment = attachment->_vertices; for (v = 0; v < deformLength; ++v) { - deform[v] += verticesAttachment[v]; + deformed[v] += verticesAttachment[v]; } } } - timeline->setFrame(frameIndex, Json::getFloat(valueMap, "time", 0), deform); + timeline->setFrame(frameIndex, Json::getFloat(valueMap, "time", 0), deformed); readCurve(valueMap, timeline, frameIndex); } diff --git a/spine-sfml/cpp/src/spine/spine-sfml.cpp b/spine-sfml/cpp/src/spine/spine-sfml.cpp index 32ad83b33..ec54ee1f6 100644 --- a/spine-sfml/cpp/src/spine/spine-sfml.cpp +++ b/spine-sfml/cpp/src/spine/spine-sfml.cpp @@ -233,11 +233,11 @@ void SkeletonDrawable::draw(RenderTarget &target, RenderStates states) const { if (vertexEffect != 0) { tempUvs.clear(); tempColors.clear(); - for (int i = 0; i < verticesCount; i++) { + for (int ii = 0; ii < verticesCount; ii++) { Color vertexColor = light; Color dark; dark.r = dark.g = dark.b = dark.a = 0; - int index = i << 1; + int index = ii << 1; float x = (*vertices)[index]; float y = (*vertices)[index + 1]; float u = (*uvs)[index]; @@ -250,8 +250,8 @@ void SkeletonDrawable::draw(RenderTarget &target, RenderStates states) const { tempColors.add(vertexColor); } - for (int i = 0; i < indicesCount; ++i) { - int index = (*indices)[i] << 1; + for (int ii = 0; ii < indicesCount; ++ii) { + int index = (*indices)[ii] << 1; vertex.position.x = (*vertices)[index]; vertex.position.y = (*vertices)[index + 1]; vertex.texCoords.x = (*uvs)[index] * size.x;