From 2022713bd273c5f54e4c149fc4a54efa38b214fd Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Fri, 25 Mar 2022 13:31:58 +0100 Subject: [PATCH] [c][cpp] Formatter pass. --- formatters/build.gradle | 2 +- formatters/format.sh | 8 +++++--- spine-c/spine-c/src/spine/Sequence.c | 2 +- spine-c/spine-c/src/spine/SkeletonBinary.c | 6 +++--- spine-cpp/spine-cpp/src/spine/Animation.cpp | 8 ++++---- .../spine-cpp/src/spine/AnimationState.cpp | 4 ++-- spine-cpp/spine-cpp/src/spine/Atlas.cpp | 2 +- .../src/spine/AtlasAttachmentLoader.cpp | 2 +- .../spine-cpp/src/spine/CurveTimeline.cpp | 2 +- spine-cpp/spine-cpp/src/spine/IkConstraint.cpp | 2 +- spine-cpp/spine-cpp/src/spine/Log.cpp | 10 +++++----- .../spine-cpp/src/spine/MeshAttachment.cpp | 2 +- .../spine-cpp/src/spine/PathConstraint.cpp | 8 ++++---- spine-cpp/spine-cpp/src/spine/Sequence.cpp | 6 +++--- .../spine-cpp/src/spine/SequenceTimeline.cpp | 2 +- spine-cpp/spine-cpp/src/spine/Skeleton.cpp | 2 +- .../spine-cpp/src/spine/SkeletonBinary.cpp | 18 +++++++++--------- .../spine-cpp/src/spine/SkeletonBounds.cpp | 2 +- .../spine-cpp/src/spine/SkeletonClipping.cpp | 10 +++++----- spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp | 12 ++++++------ spine-cpp/spine-cpp/src/spine/Skin.cpp | 4 ++-- .../src/spine/TransformConstraint.cpp | 2 +- spine-cpp/spine-cpp/src/spine/Triangulator.cpp | 14 +++++++------- .../spine-cpp/src/spine/VertexAttachment.cpp | 6 +++--- .../Private/SpineSkeletonDataAsset.cpp | 2 +- 25 files changed, 70 insertions(+), 68 deletions(-) diff --git a/formatters/build.gradle b/formatters/build.gradle index cce45ba6a..b343aca11 100644 --- a/formatters/build.gradle +++ b/formatters/build.gradle @@ -26,7 +26,7 @@ spotless { 'spine-sfml/**/*.h', 'spine-ue4/**/*.cpp', 'spine-ue4/**/*.h' - clangFormat("12.0.1").pathToExe("$System.env.CLANGFORMAT").style('file') + clangFormat("13.0.1").pathToExe("$System.env.CLANGFORMAT").style('file') } typescript { diff --git a/formatters/format.sh b/formatters/format.sh index a9ff96fb4..66f90b65d 100755 --- a/formatters/format.sh +++ b/formatters/format.sh @@ -28,9 +28,11 @@ setup # Execute spotless and dotnet-format pushd $dir/.. ./formatters/gradlew spotlessApply -dotnet-format spine-csharp/spine-csharp.sln -dotnet-format -f spine-monogame -dotnet-format -f spine-unity +if [ "$1" != "skipdotnet" ] ; then + dotnet-format spine-csharp/spine-csharp.sln + dotnet-format -f spine-monogame + dotnet-format -f spine-unity +fi popd # Delete Gradle, dotnet-format, and clang-format config files in root diff --git a/spine-c/spine-c/src/spine/Sequence.c b/spine-c/spine-c/src/spine/Sequence.c index 510a8bd39..caa256c72 100644 --- a/spine-c/spine-c/src/spine/Sequence.c +++ b/spine-c/spine-c/src/spine/Sequence.c @@ -101,7 +101,7 @@ static char *string_append(char *str, const char *b) { } static char *string_append_int(char *str, int value) { - char intStr[20];; + char intStr[20]; sprintf(intStr, "%i", value); return string_append(str, intStr); } diff --git a/spine-c/spine-c/src/spine/SkeletonBinary.c b/spine-c/spine-c/src/spine/SkeletonBinary.c index 04d2cb96c..50c7f3690 100644 --- a/spine-c/spine-c/src/spine/SkeletonBinary.c +++ b/spine-c/spine-c/src/spine/SkeletonBinary.c @@ -109,7 +109,7 @@ static int readInt(_dataInput *input) { result |= readByte(input); result <<= 8; result |= readByte(input); - return (int)result; + return (int) result; } static int readVarint(_dataInput *input, int /*bool*/ optimizePositive) { @@ -124,12 +124,12 @@ static int readVarint(_dataInput *input, int /*bool*/ optimizePositive) { if (b & 0x80) { b = readByte(input); value |= (b & 0x7F) << 21; - if (b & 0x80) value |= (uint32_t)(readByte(input) & 0x7F) << 28; + if (b & 0x80) value |= (uint32_t) (readByte(input) & 0x7F) << 28; } } } if (!optimizePositive) value = (((unsigned int) value >> 1) ^ -(value & 1)); - return (int)value; + return (int) value; } float readFloat(_dataInput *input) { diff --git a/spine-cpp/spine-cpp/src/spine/Animation.cpp b/spine-cpp/spine-cpp/src/spine/Animation.cpp index ce1ebb55d..bd5545ed4 100644 --- a/spine-cpp/spine-cpp/src/spine/Animation.cpp +++ b/spine-cpp/spine-cpp/src/spine/Animation.cpp @@ -94,14 +94,14 @@ void Animation::setDuration(float inValue) { int Animation::search(Vector &frames, float target) { size_t n = (int) frames.size(); for (size_t i = 1; i < n; i++) { - if (frames[i] > target) return (int)(i - 1); + if (frames[i] > target) return (int) (i - 1); } - return (int)(n - 1); + return (int) (n - 1); } int Animation::search(Vector &frames, float target, int step) { size_t n = frames.size(); for (size_t i = step; i < n; i += step) - if (frames[i] > target) return (int)(i - step); - return (int)(n - step); + if (frames[i] > target) return (int) (i - step); + return (int) (n - step); } diff --git a/spine-cpp/spine-cpp/src/spine/AnimationState.cpp b/spine-cpp/spine-cpp/src/spine/AnimationState.cpp index 9f6ddc19d..1ec221c2c 100644 --- a/spine-cpp/spine-cpp/src/spine/AnimationState.cpp +++ b/spine-cpp/spine-cpp/src/spine/AnimationState.cpp @@ -489,7 +489,7 @@ bool AnimationState::apply(Skeleton &skeleton) { int setupState = _unkeyedState + Setup; Vector &slots = skeleton.getSlots(); - for (int i = 0, n = (int)slots.size(); i < n; i++) { + for (int i = 0, n = (int) slots.size(); i < n; i++) { Slot *slot = slots[i]; if (slot->getAttachmentState() == setupState) { const String &attachmentName = slot->getData().getAttachmentName(); @@ -951,7 +951,7 @@ TrackEntry *AnimationState::newTrackEntry(size_t trackIndex, Animation *animatio TrackEntry *entryP = _trackEntryPool.obtain();// Pooling TrackEntry &entry = *entryP; - entry._trackIndex = (int)trackIndex; + entry._trackIndex = (int) trackIndex; entry._animation = animation; entry._loop = loop; entry._holdPrevious = 0; diff --git a/spine-cpp/spine-cpp/src/spine/Atlas.cpp b/spine-cpp/spine-cpp/src/spine/Atlas.cpp index 8f3a068ef..6930ef3dc 100644 --- a/spine-cpp/spine-cpp/src/spine/Atlas.cpp +++ b/spine-cpp/spine-cpp/src/spine/Atlas.cpp @@ -155,7 +155,7 @@ struct SimpleString { } bool equals(const char *str) { - int otherLen = (int)strlen(str); + int otherLen = (int) strlen(str); if (length != otherLen) return false; for (int i = 0; i < length; i++) { if (start[i] != str[i]) return false; diff --git a/spine-cpp/spine-cpp/src/spine/AtlasAttachmentLoader.cpp b/spine-cpp/spine-cpp/src/spine/AtlasAttachmentLoader.cpp index a7f743882..78d56179b 100644 --- a/spine-cpp/spine-cpp/src/spine/AtlasAttachmentLoader.cpp +++ b/spine-cpp/spine-cpp/src/spine/AtlasAttachmentLoader.cpp @@ -46,7 +46,7 @@ namespace spine { bool loadSequence(Atlas *atlas, const String &basePath, Sequence *sequence) { Vector ®ions = sequence->getRegions(); - for (int i = 0, n = (int)regions.size(); i < n; i++) { + for (int i = 0, n = (int) regions.size(); i < n; i++) { String path = sequence->getPath(basePath, i); regions[i] = atlas->findRegion(path); if (!regions[i]) return false; diff --git a/spine-cpp/spine-cpp/src/spine/CurveTimeline.cpp b/spine-cpp/spine-cpp/src/spine/CurveTimeline.cpp index 5e082d758..5e33db487 100644 --- a/spine-cpp/spine-cpp/src/spine/CurveTimeline.cpp +++ b/spine-cpp/spine-cpp/src/spine/CurveTimeline.cpp @@ -111,7 +111,7 @@ void CurveTimeline1::setFrame(size_t frame, float time, float value) { } float CurveTimeline1::getCurveValue(float time) { - int i = (int)_frames.size() - 2; + int i = (int) _frames.size() - 2; for (int ii = 2; ii <= i; ii += 2) { if (_frames[ii] > time) { i = ii - 2; diff --git a/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp b/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp index 1dfcad8e3..e36bdf18e 100644 --- a/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp +++ b/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp @@ -288,7 +288,7 @@ void IkConstraint::update() { } int IkConstraint::getOrder() { - return (int)_data.getOrder(); + return (int) _data.getOrder(); } IkConstraintData &IkConstraint::getData() { diff --git a/spine-cpp/spine-cpp/src/spine/Log.cpp b/spine-cpp/spine-cpp/src/spine/Log.cpp index 9fa03dfc7..3f22a6d81 100644 --- a/spine-cpp/spine-cpp/src/spine/Log.cpp +++ b/spine-cpp/spine-cpp/src/spine/Log.cpp @@ -37,7 +37,7 @@ void spine::spDebug_printSkeletonData(SkeletonData *skeletonData) { int i, n; spDebug_printBoneDatas(skeletonData->getBones()); - for (i = 0, n = (int)skeletonData->getAnimations().size(); i < n; i++) { + for (i = 0, n = (int) skeletonData->getAnimations().size(); i < n; i++) { spDebug_printAnimation(skeletonData->getAnimations()[i]); } } @@ -69,7 +69,7 @@ void spine::spDebug_printAnimation(Animation *animation) { int i, n; printf("Animation %s: %zu timelines\n", animation->getName().buffer(), animation->getTimelines().size()); - for (i = 0, n = (int)animation->getTimelines().size(); i < n; i++) { + for (i = 0, n = (int) animation->getTimelines().size(); i < n; i++) { Timeline *timeline = animation->getTimelines()[i]; spDebug_printTimeline(timeline); } @@ -77,7 +77,7 @@ void spine::spDebug_printAnimation(Animation *animation) { void spine::spDebug_printBoneDatas(Vector &boneDatas) { int i, n; - for (i = 0, n = (int)boneDatas.size(); i < n; i++) { + for (i = 0, n = (int) boneDatas.size(); i < n; i++) { spDebug_printBoneData(boneDatas[i]); } } @@ -94,7 +94,7 @@ void spine::spDebug_printSkeleton(Skeleton *skeleton) { void spine::spDebug_printBones(Vector &bones) { int i, n; - for (i = 0, n = (int)bones.size(); i < n; i++) { + for (i = 0, n = (int) bones.size(); i < n; i++) { spDebug_printBone(bones[i]); } } @@ -116,7 +116,7 @@ void spine::spDebug_printFloats(float *values, int numFloats) { void spine::spDebug_printFloats(Vector &values) { int i, n; printf("(%zu) [", values.size()); - for (i = 0, n = (int)values.size(); i < n; i++) { + for (i = 0, n = (int) values.size(); i < n; i++) { printf("%f, ", values[i]); } printf("]"); diff --git a/spine-cpp/spine-cpp/src/spine/MeshAttachment.cpp b/spine-cpp/spine-cpp/src/spine/MeshAttachment.cpp index 6c3c58954..44fc15960 100644 --- a/spine-cpp/spine-cpp/src/spine/MeshAttachment.cpp +++ b/spine-cpp/spine-cpp/src/spine/MeshAttachment.cpp @@ -53,7 +53,7 @@ void MeshAttachment::updateRegion() { _uvs.setSize(_regionUVs.size(), 0); } - int i = 0, n = (int)_regionUVs.size(); + int i = 0, n = (int) _regionUVs.size(); float u = _region->u, v = _region->v; float width = 0, height = 0; diff --git a/spine-cpp/spine-cpp/src/spine/PathConstraint.cpp b/spine-cpp/spine-cpp/src/spine/PathConstraint.cpp index 259bba3c3..dbce4e077 100644 --- a/spine-cpp/spine-cpp/src/spine/PathConstraint.cpp +++ b/spine-cpp/spine-cpp/src/spine/PathConstraint.cpp @@ -26,7 +26,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ - + #include #include @@ -148,7 +148,7 @@ void PathConstraint::update() { } } - Vector &positions = computeWorldPositions(*attachment, (int)spacesCount, tangents); + Vector &positions = computeWorldPositions(*attachment, (int) spacesCount, tangents); float boneX = positions[0]; float boneY = positions[1]; float offsetRotation = data.getOffsetRotation(); @@ -221,7 +221,7 @@ void PathConstraint::update() { } int PathConstraint::getOrder() { - return (int)_data.getOrder(); + return (int) _data.getOrder(); } float PathConstraint::getPosition() { @@ -288,7 +288,7 @@ PathConstraint::computeWorldPositions(PathAttachment &path, int spacesCount, boo Vector &out = _positions; Vector &world = _world; bool closed = path.isClosed(); - int verticesLength = (int)path.getWorldVerticesLength(); + int verticesLength = (int) path.getWorldVerticesLength(); int curveCount = verticesLength / 6; int prevCurve = NONE; diff --git a/spine-cpp/spine-cpp/src/spine/Sequence.cpp b/spine-cpp/spine-cpp/src/spine/Sequence.cpp index 951227721..f07f1c861 100644 --- a/spine-cpp/spine-cpp/src/spine/Sequence.cpp +++ b/spine-cpp/spine-cpp/src/spine/Sequence.cpp @@ -47,7 +47,7 @@ Sequence::~Sequence() { } Sequence *Sequence::copy() { - Sequence *copy = new (__FILE__, __LINE__) Sequence((int)_regions.size()); + Sequence *copy = new (__FILE__, __LINE__) Sequence((int) _regions.size()); for (size_t i = 0; i < _regions.size(); i++) { copy->_regions[i] = _regions[i]; } @@ -60,7 +60,7 @@ Sequence *Sequence::copy() { void Sequence::apply(Slot *slot, Attachment *attachment) { int index = slot->getSequenceIndex(); if (index == -1) index = _setupIndex; - if (index >= (int) _regions.size()) index = (int)_regions.size() - 1; + if (index >= (int) _regions.size()) index = (int) _regions.size() - 1; TextureRegion *region = _regions[index]; if (attachment->getRTTI().isExactly(RegionAttachment::rtti)) { @@ -86,7 +86,7 @@ String Sequence::getPath(const String &basePath, int index) { String result(basePath); String frame; frame.append(_start + index); - for (int i = _digits - (int)frame.length(); i > 0; i--) + for (int i = _digits - (int) frame.length(); i > 0; i--) result.append("0"); result.append(frame); return result; diff --git a/spine-cpp/spine-cpp/src/spine/SequenceTimeline.cpp b/spine-cpp/spine-cpp/src/spine/SequenceTimeline.cpp index e09665a88..2740de80b 100644 --- a/spine-cpp/spine-cpp/src/spine/SequenceTimeline.cpp +++ b/spine-cpp/spine-cpp/src/spine/SequenceTimeline.cpp @@ -89,7 +89,7 @@ void SequenceTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vec Sequence *sequence = NULL; if (_attachment->getRTTI().instanceOf(RegionAttachment::rtti)) sequence = ((RegionAttachment *) _attachment)->getSequence(); if (_attachment->getRTTI().instanceOf(MeshAttachment::rtti)) sequence = ((MeshAttachment *) _attachment)->getSequence(); - int index = modeAndIndex >> 4, count = (int)sequence->getRegions().size(); + int index = modeAndIndex >> 4, count = (int) sequence->getRegions().size(); int mode = modeAndIndex & 0xf; if (mode != SequenceMode::hold) { index += (int) (((time - before) / delay + 0.00001)); diff --git a/spine-cpp/spine-cpp/src/spine/Skeleton.cpp b/spine-cpp/spine-cpp/src/spine/Skeleton.cpp index 5a2fae344..5488eee37 100644 --- a/spine-cpp/spine-cpp/src/spine/Skeleton.cpp +++ b/spine-cpp/spine-cpp/src/spine/Skeleton.cpp @@ -368,7 +368,7 @@ void Skeleton::setAttachment(const String &slotName, const String &attachmentNam if (slot->_data.getName() == slotName) { Attachment *attachment = NULL; if (attachmentName.length() > 0) { - attachment = getAttachment((int)i, attachmentName); + attachment = getAttachment((int) i, attachmentName); assert(attachment != NULL); } diff --git a/spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp b/spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp index 5e363967f..b5462b69b 100644 --- a/spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp +++ b/spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp @@ -287,7 +287,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons } /* Linked meshes. */ - for (int i = 0, n = (int)_linkedMeshes.size(); i < n; ++i) { + for (int i = 0, n = (int) _linkedMeshes.size(); i < n; ++i) { LinkedMesh *linkedMesh = _linkedMeshes[i]; Skin *skin = linkedMesh->_skin.length() == 0 ? skeletonData->getDefaultSkin() : skeletonData->findSkin(linkedMesh->_skin); if (skin == NULL) { @@ -753,7 +753,7 @@ void SkeletonBinary::setBezier(DataInput *input, CurveTimeline *timeline, int be Timeline *SkeletonBinary::readTimeline(DataInput *input, CurveTimeline1 *timeline, float scale) { float time = readFloat(input); float value = readFloat(input) * scale; - for (int frame = 0, bezier = 0, frameLast = (int)timeline->getFrameCount() - 1;; frame++) { + for (int frame = 0, bezier = 0, frameLast = (int) timeline->getFrameCount() - 1;; frame++) { timeline->setFrame(frame, time, value); if (frame == frameLast) break; float time2 = readFloat(input); @@ -775,7 +775,7 @@ Timeline *SkeletonBinary::readTimeline2(DataInput *input, CurveTimeline2 *timeli float time = readFloat(input); float value1 = readFloat(input) * scale; float value2 = readFloat(input) * scale; - for (int frame = 0, bezier = 0, frameLast = (int)timeline->getFrameCount() - 1;; frame++) { + for (int frame = 0, bezier = 0, frameLast = (int) timeline->getFrameCount() - 1;; frame++) { timeline->setFrame(frame, time, value1, value2); if (frame == frameLast) break; float time2 = readFloat(input); @@ -1198,7 +1198,7 @@ Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, S float mixRotate = readFloat(input); float mixX = readFloat(input); float mixY = readFloat(input); - for (int frame = 0, bezier = 0, frameLast = (int)timeline->getFrameCount() - 1;; frame++) { + for (int frame = 0, bezier = 0, frameLast = (int) timeline->getFrameCount() - 1;; frame++) { timeline->setFrame(frame, time, mixRotate, mixX, mixY); if (frame == frameLast) break; float time2 = readFloat(input); @@ -1246,7 +1246,7 @@ Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, S case ATTACHMENT_DEFORM: { bool weighted = attachment->_bones.size() > 0; Vector &vertices = attachment->_vertices; - int deformLength = weighted ? (int)vertices.size() / 3 * 2 : (int)vertices.size(); + int deformLength = weighted ? (int) vertices.size() / 3 * 2 : (int) vertices.size(); int bezierCount = readVarint(input, true); DeformTimeline *timeline = new (__FILE__, __LINE__) DeformTimeline(frameCount, bezierCount, slotIndex, @@ -1336,15 +1336,15 @@ Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, S size_t slotIndex = (size_t) readVarint(input, true); // Collect unchanged items. while (originalIndex != slotIndex) - unchanged[unchangedIndex++] = (int)originalIndex++; + unchanged[unchangedIndex++] = (int) originalIndex++; // Set changed items. size_t index = originalIndex; - drawOrder[index + (size_t) readVarint(input, true)] = (int)originalIndex++; + drawOrder[index + (size_t) readVarint(input, true)] = (int) originalIndex++; } // Collect remaining unchanged items. while (originalIndex < slotCount) { - unchanged[unchangedIndex++] = (int)originalIndex++; + unchanged[unchangedIndex++] = (int) originalIndex++; } // Fill in unchanged items. @@ -1382,7 +1382,7 @@ Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, S } float duration = 0; - for (int i = 0, n = (int)timelines.size(); i < n; i++) { + for (int i = 0, n = (int) timelines.size(); i < n; i++) { duration = MathUtil::max(duration, (timelines[i])->getDuration()); } return new (__FILE__, __LINE__) Animation(String(name), timelines, duration); diff --git a/spine-cpp/spine-cpp/src/spine/SkeletonBounds.cpp b/spine-cpp/spine-cpp/src/spine/SkeletonBounds.cpp index c23d89066..2ce6effd3 100644 --- a/spine-cpp/spine-cpp/src/spine/SkeletonBounds.cpp +++ b/spine-cpp/spine-cpp/src/spine/SkeletonBounds.cpp @@ -74,7 +74,7 @@ void SkeletonBounds::update(Skeleton &skeleton, bool updateAabb) { Polygon &polygon = *polygonP; size_t count = boundingBox->getWorldVerticesLength(); - polygon._count = (int)count; + polygon._count = (int) count; if (polygon._vertices.size() < count) { polygon._vertices.setSize(count, 0); } diff --git a/spine-cpp/spine-cpp/src/spine/SkeletonClipping.cpp b/spine-cpp/spine-cpp/src/spine/SkeletonClipping.cpp index 9a1722926..d5f0d7659 100644 --- a/spine-cpp/spine-cpp/src/spine/SkeletonClipping.cpp +++ b/spine-cpp/spine-cpp/src/spine/SkeletonClipping.cpp @@ -48,7 +48,7 @@ size_t SkeletonClipping::clipStart(Slot &slot, ClippingAttachment *clip) { _clipAttachment = clip; - int n = (int)clip->getWorldVerticesLength(); + int n = (int) clip->getWorldVerticesLength(); _clippingPolygon.setSize(n, 0); clip->computeWorldVertices(slot, 0, n, _clippingPolygon, 0, 2); makeClockwise(_clippingPolygon); @@ -103,15 +103,15 @@ void SkeletonClipping::clipTriangles(float *vertices, unsigned short *triangles, size_t i = 0; continue_outer: for (; i < trianglesLength; i += 3) { - int vertexOffset = triangles[i] * (int)stride; + int vertexOffset = triangles[i] * (int) stride; float x1 = vertices[vertexOffset], y1 = vertices[vertexOffset + 1]; float u1 = uvs[vertexOffset], v1 = uvs[vertexOffset + 1]; - vertexOffset = triangles[i + 1] * (int)stride; + vertexOffset = triangles[i + 1] * (int) stride; float x2 = vertices[vertexOffset], y2 = vertices[vertexOffset + 1]; float u2 = uvs[vertexOffset], v2 = uvs[vertexOffset + 1]; - vertexOffset = triangles[i + 2] * (int)stride; + vertexOffset = triangles[i + 2] * (int) stride; float x3 = vertices[vertexOffset], y3 = vertices[vertexOffset + 1]; float u3 = uvs[vertexOffset], v3 = uvs[vertexOffset + 1]; @@ -314,7 +314,7 @@ void SkeletonClipping::makeClockwise(Vector &polygon) { for (size_t i = 0, lastX = verticeslength - 2, n = verticeslength >> 1; i < n; i += 2) { float x = polygon[i], y = polygon[i + 1]; - int other = (int)(lastX - i); + int other = (int) (lastX - i); polygon[i] = polygon[other]; polygon[i + 1] = polygon[other + 1]; polygon[other] = x; diff --git a/spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp b/spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp index 87b834322..2401445a1 100644 --- a/spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp +++ b/spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp @@ -711,7 +711,7 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) { } /* Linked meshes. */ - int n = (int)_linkedMeshes.size(); + int n = (int) _linkedMeshes.size(); for (i = 0; i < n; ++i) { LinkedMesh *linkedMesh = _linkedMeshes[i]; Skin *skin = linkedMesh->_skin.length() == 0 ? skeletonData->getDefaultSkin() : skeletonData->findSkin(linkedMesh->_skin); @@ -1276,7 +1276,7 @@ Animation *SkeletonJson::readAnimation(Json *root, SkeletonData *skeletonData) { VertexAttachment *vertexAttachment = static_cast(attachment); bool weighted = vertexAttachment->_bones.size() != 0; Vector &verts = vertexAttachment->_vertices; - int deformLength = weighted ? (int)verts.size() / 3 * 2 : (int)verts.size(); + int deformLength = weighted ? (int) verts.size() / 3 * 2 : (int) verts.size(); DeformTimeline *timeline = new (__FILE__, __LINE__) DeformTimeline(frames, frames, slotIndex, vertexAttachment); @@ -1376,14 +1376,14 @@ Animation *SkeletonJson::readAnimation(Json *root, SkeletonData *skeletonData) { /* Collect unchanged items. */ while (originalIndex != (size_t) slotIndex) - unchanged[unchangedIndex++] = (int)originalIndex++; + unchanged[unchangedIndex++] = (int) originalIndex++; /* Set changed items. */ - drawOrder2[originalIndex + Json::getInt(offsetMap, "offset", 0)] = (int)originalIndex; + drawOrder2[originalIndex + Json::getInt(offsetMap, "offset", 0)] = (int) originalIndex; originalIndex++; } /* Collect remaining unchanged items. */ - while ((int)originalIndex < (int)skeletonData->_slots.size()) - unchanged[unchangedIndex++] = (int)originalIndex++; + while ((int) originalIndex < (int) skeletonData->_slots.size()) + unchanged[unchangedIndex++] = (int) originalIndex++; /* Fill in unchanged items. */ for (ii = (int) skeletonData->_slots.size() - 1; ii >= 0; ii--) if (drawOrder2[ii] == -1) drawOrder2[ii] = unchanged[--unchangedIndex]; diff --git a/spine-cpp/spine-cpp/src/spine/Skin.cpp b/spine-cpp/spine-cpp/src/spine/Skin.cpp index 6ca94b712..ea4114c23 100644 --- a/spine-cpp/spine-cpp/src/spine/Skin.cpp +++ b/spine-cpp/spine-cpp/src/spine/Skin.cpp @@ -80,7 +80,7 @@ void Skin::AttachmentMap::remove(size_t slotIndex, const String &attachmentName) int Skin::AttachmentMap::findInBucket(Vector &bucket, const String &attachmentName) { for (size_t i = 0; i < bucket.size(); i++) - if (bucket[i]._name == attachmentName) return (int)i; + if (bucket[i]._name == attachmentName) return (int) i; return -1; } @@ -144,7 +144,7 @@ void Skin::attachAll(Skeleton &skeleton, Skin &oldSkin) { Skin::AttachmentMap::Entries entries = oldSkin.getAttachments(); while (entries.hasNext()) { Skin::AttachmentMap::Entry &entry = entries.next(); - int slotIndex = (int)entry._slotIndex; + int slotIndex = (int) entry._slotIndex; Slot *slot = slots[slotIndex]; if (slot->getAttachment() == entry._attachment) { diff --git a/spine-cpp/spine-cpp/src/spine/TransformConstraint.cpp b/spine-cpp/spine-cpp/src/spine/TransformConstraint.cpp index f2032b5c3..1d0611011 100644 --- a/spine-cpp/spine-cpp/src/spine/TransformConstraint.cpp +++ b/spine-cpp/spine-cpp/src/spine/TransformConstraint.cpp @@ -78,7 +78,7 @@ void TransformConstraint::update() { } int TransformConstraint::getOrder() { - return (int)_data.getOrder(); + return (int) _data.getOrder(); } TransformConstraintData &TransformConstraint::getData() { diff --git a/spine-cpp/spine-cpp/src/spine/Triangulator.cpp b/spine-cpp/spine-cpp/src/spine/Triangulator.cpp index 97dfba18c..80833499e 100644 --- a/spine-cpp/spine-cpp/src/spine/Triangulator.cpp +++ b/spine-cpp/spine-cpp/src/spine/Triangulator.cpp @@ -45,15 +45,15 @@ Vector &Triangulator::triangulate(Vector &vertices) { indices.clear(); indices.ensureCapacity(vertexCount); indices.setSize(vertexCount, 0); - for (int i = 0; i < (int)vertexCount; ++i) { + for (int i = 0; i < (int) vertexCount; ++i) { indices[i] = i; } Vector &isConcaveArray = _isConcaveArray; isConcaveArray.ensureCapacity(vertexCount); isConcaveArray.setSize(vertexCount, 0); - for (int i = 0, n = (int)vertexCount; i < n; ++i) { - isConcaveArray[i] = isConcave(i, (int)vertexCount, vertices, indices); + for (int i = 0, n = (int) vertexCount; i < n; ++i) { + isConcaveArray[i] = isConcave(i, (int) vertexCount, vertices, indices); } Vector &triangles = _triangles; @@ -109,10 +109,10 @@ Vector &Triangulator::triangulate(Vector &vertices) { isConcaveArray.removeAt(i); vertexCount--; - int previousIndex = (int)((vertexCount + i - 1) % vertexCount); - int nextIndex = (int)(i == vertexCount ? 0 : i); - isConcaveArray[previousIndex] = isConcave(previousIndex, (int)vertexCount, vertices, indices); - isConcaveArray[nextIndex] = isConcave(nextIndex, (int)vertexCount, vertices, indices); + int previousIndex = (int) ((vertexCount + i - 1) % vertexCount); + int nextIndex = (int) (i == vertexCount ? 0 : i); + isConcaveArray[previousIndex] = isConcave(previousIndex, (int) vertexCount, vertices, indices); + isConcaveArray[nextIndex] = isConcave(nextIndex, (int) vertexCount, vertices, indices); } if (vertexCount == 3) { diff --git a/spine-cpp/spine-cpp/src/spine/VertexAttachment.cpp b/spine-cpp/spine-cpp/src/spine/VertexAttachment.cpp index 5e3fcb419..7141b6cf8 100644 --- a/spine-cpp/spine-cpp/src/spine/VertexAttachment.cpp +++ b/spine-cpp/spine-cpp/src/spine/VertexAttachment.cpp @@ -83,7 +83,7 @@ void VertexAttachment::computeWorldVertices(Slot &slot, size_t start, size_t cou int v = 0, skip = 0; for (size_t i = 0; i < start; i += 2) { - int n = (int)bones[v]; + int n = (int) bones[v]; v += n + 1; skip += n; } @@ -92,7 +92,7 @@ void VertexAttachment::computeWorldVertices(Slot &slot, size_t start, size_t cou if (deformArray->size() == 0) { for (size_t w = offset, b = skip * 3; w < count; w += stride) { float wx = 0, wy = 0; - int n = (int)bones[v++]; + int n = (int) bones[v++]; n += v; for (; v < n; v++, b += 3) { Bone *boneP = skeletonBones[bones[v]]; @@ -109,7 +109,7 @@ void VertexAttachment::computeWorldVertices(Slot &slot, size_t start, size_t cou } else { for (size_t w = offset, b = skip * 3, f = skip << 1; w < count; w += stride) { float wx = 0, wy = 0; - int n = (int)bones[v++]; + int n = (int) bones[v++]; n += v; for (; v < n; v++, b += 3, f += 2) { Bone *boneP = skeletonBones[bones[v]]; diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonDataAsset.cpp b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonDataAsset.cpp index f4e196645..cb7dd2f50 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonDataAsset.cpp +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonDataAsset.cpp @@ -137,7 +137,7 @@ void USpineSkeletonDataAsset::SetRawData(TArray &Data) { static bool checkVersion(const char *version) { if (!version) return false; - char* result = (char*)(strstr(version, SPINE_VERSION_STRING) - version); + char *result = (char *) (strstr(version, SPINE_VERSION_STRING) - version); return result == 0; }