瀏覽代碼

[cpp] First Clang-Tidy run.

badlogic 7 年之前
父節點
當前提交
a8af3fa07e
共有 56 個文件被更改,包括 178 次插入183 次删除
  1. 2 2
      spine-cpp/spine-cpp-unit-tests/CMakeLists.txt
  2. 1 1
      spine-cpp/spine-cpp-unit-tests/src/TestHarness.cpp
  3. 1 1
      spine-cpp/spine-cpp-unit-tests/src/TestHarness.h
  4. 13 13
      spine-cpp/spine-cpp-unit-tests/src/main.cpp
  5. 1 1
      spine-cpp/spine-cpp/include/spine/AnimationState.h
  6. 4 4
      spine-cpp/spine-cpp/include/spine/AnimationStateData.h
  7. 5 2
      spine-cpp/spine-cpp/include/spine/Atlas.h
  8. 1 1
      spine-cpp/spine-cpp/include/spine/AtlasAttachmentLoader.h
  9. 1 1
      spine-cpp/spine-cpp/include/spine/Attachment.h
  10. 1 1
      spine-cpp/spine-cpp/include/spine/AttachmentTimeline.h
  11. 1 1
      spine-cpp/spine-cpp/include/spine/BoundingBoxAttachment.h
  12. 1 1
      spine-cpp/spine-cpp/include/spine/ClippingAttachment.h
  13. 1 1
      spine-cpp/spine-cpp/include/spine/ColorTimeline.h
  14. 1 3
      spine-cpp/spine-cpp/include/spine/CurveTimeline.h
  15. 1 1
      spine-cpp/spine-cpp/include/spine/DeformTimeline.h
  16. 1 1
      spine-cpp/spine-cpp/include/spine/DrawOrderTimeline.h
  17. 1 1
      spine-cpp/spine-cpp/include/spine/EventData.h
  18. 1 1
      spine-cpp/spine-cpp/include/spine/EventTimeline.h
  19. 1 1
      spine-cpp/spine-cpp/include/spine/HashMap.h
  20. 1 1
      spine-cpp/spine-cpp/include/spine/IkConstraintData.h
  21. 1 1
      spine-cpp/spine-cpp/include/spine/IkConstraintTimeline.h
  22. 1 1
      spine-cpp/spine-cpp/include/spine/Json.h
  23. 10 10
      spine-cpp/spine-cpp/include/spine/MathUtil.h
  24. 1 1
      spine-cpp/spine-cpp/include/spine/MeshAttachment.h
  25. 1 1
      spine-cpp/spine-cpp/include/spine/PathAttachment.h
  26. 1 1
      spine-cpp/spine-cpp/include/spine/PathConstraintData.h
  27. 1 1
      spine-cpp/spine-cpp/include/spine/PathConstraintMixTimeline.h
  28. 1 1
      spine-cpp/spine-cpp/include/spine/PathConstraintPositionTimeline.h
  29. 1 1
      spine-cpp/spine-cpp/include/spine/PathConstraintSpacingTimeline.h
  30. 1 1
      spine-cpp/spine-cpp/include/spine/PointAttachment.h
  31. 2 2
      spine-cpp/spine-cpp/include/spine/RTTI.h
  32. 1 1
      spine-cpp/spine-cpp/include/spine/RegionAttachment.h
  33. 2 2
      spine-cpp/spine-cpp/include/spine/RotateTimeline.h
  34. 1 1
      spine-cpp/spine-cpp/include/spine/ScaleTimeline.h
  35. 1 1
      spine-cpp/spine-cpp/include/spine/ShearTimeline.h
  36. 3 3
      spine-cpp/spine-cpp/include/spine/Skeleton.h
  37. 6 6
      spine-cpp/spine-cpp/include/spine/SkeletonBinary.h
  38. 3 3
      spine-cpp/spine-cpp/include/spine/SkeletonJson.h
  39. 4 4
      spine-cpp/spine-cpp/include/spine/Skin.h
  40. 1 1
      spine-cpp/spine-cpp/include/spine/TransformConstraintData.h
  41. 2 2
      spine-cpp/spine-cpp/include/spine/TransformConstraintTimeline.h
  42. 2 2
      spine-cpp/spine-cpp/include/spine/TranslateTimeline.h
  43. 2 2
      spine-cpp/spine-cpp/include/spine/TwoColorTimeline.h
  44. 1 1
      spine-cpp/spine-cpp/include/spine/Vector.h
  45. 1 1
      spine-cpp/spine-cpp/include/spine/VertexAttachment.h
  46. 2 1
      spine-cpp/spine-cpp/src/spine/AnimationState.cpp
  47. 1 1
      spine-cpp/spine-cpp/src/spine/Atlas.cpp
  48. 0 1
      spine-cpp/spine-cpp/src/spine/Extension.cpp
  49. 15 15
      spine-cpp/spine-cpp/src/spine/IkConstraint.cpp
  50. 4 8
      spine-cpp/spine-cpp/src/spine/Json.cpp
  51. 2 2
      spine-cpp/spine-cpp/src/spine/MathUtil.cpp
  52. 11 11
      spine-cpp/spine-cpp/src/spine/PathConstraint.cpp
  53. 2 2
      spine-cpp/spine-cpp/src/spine/Skeleton.cpp
  54. 41 41
      spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp
  55. 1 3
      spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp
  56. 8 8
      spine-cpp/spine-cpp/src/spine/TransformConstraint.cpp

+ 2 - 2
spine-cpp/spine-cpp-unit-tests/CMakeLists.txt

@@ -3,8 +3,8 @@ project(spine_cpp_unit_test)
 
 set(CMAKE_INSTALL_PREFIX "./")
 set(CMAKE_VERBOSE_MAKEFILE ON)
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -std=c++03 -fno-exceptions -fno-rtti")
-set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -Wall -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -std=c++03 -fno-exceptions -fno-rtti")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -std=c++03 -fno-exceptions -fno-rtti")
+set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -std=c++03 -fno-exceptions -fno-rtti")
 
 include_directories(../spine-cpp/include teamcity minicppunit tests memory)
 

+ 1 - 1
spine-cpp/spine-cpp-unit-tests/src/TestHarness.cpp

@@ -78,7 +78,7 @@ void Spine::TestSpineExtension::reportLeaks() {
 	for (std::vector<Allocation>::iterator it = allocated.begin(); it != allocated.end(); it++) {
 		printf("\"%s:%i (%zu bytes at %p)\n", it->fileName, it->line, it->size, it->address);
 	}
-	if (allocated.size() == 0) printf("No leaks detected");
+	if (allocated.empty()) printf("No leaks detected");
 }
 
 void Spine::TestSpineExtension::clearAllocations() {

+ 1 - 1
spine-cpp/spine-cpp-unit-tests/src/TestHarness.h

@@ -42,7 +42,7 @@ namespace Spine {
 		const char* fileName;
 		int line;
 
-		Allocation() : address(0), size(0), fileName(0), line(0) {
+		Allocation() : address(NULL), size(0), fileName(NULL), line(0) {
 		}
 
 		Allocation(void* a, size_t s, const char* f, int l) : address(a), size(s), fileName(f), line(l) {

+ 13 - 13
spine-cpp/spine-cpp-unit-tests/src/main.cpp

@@ -45,36 +45,36 @@
 using namespace Spine;
 
 void loadBinary(const char* binaryFile, const char* atlasFile, Atlas* &atlas, SkeletonData* &skeletonData, AnimationStateData* &stateData, Skeleton* &skeleton, AnimationState* &state) {
-	atlas = new (__FILE__, __LINE__) Atlas(atlasFile, 0);
-	assert(atlas != 0);
+	atlas = new (__FILE__, __LINE__) Atlas(atlasFile, NULL);
+	assert(atlas != NULL);
 
 	SkeletonBinary binary(atlas);
 	skeletonData = binary.readSkeletonDataFile(binaryFile);
 	assert(skeletonData);
 
 	skeleton = new (__FILE__, __LINE__) Skeleton(skeletonData);
-	assert(skeleton != 0);
+	assert(skeleton != NULL);
 
 	stateData = new (__FILE__, __LINE__) AnimationStateData(skeletonData);
-	assert(stateData != 0);
+	assert(stateData != NULL);
 	stateData->setDefaultMix(0.4f);
 
 	state = new (__FILE__, __LINE__) AnimationState(stateData);
 }
 
 void loadJson(const char* jsonFile, const char* atlasFile, Atlas* &atlas, SkeletonData* &skeletonData, AnimationStateData* &stateData, Skeleton* &skeleton, AnimationState* &state) {
-	atlas = new (__FILE__, __LINE__) Atlas(atlasFile, 0);
-	assert(atlas != 0);
+	atlas = new (__FILE__, __LINE__) Atlas(atlasFile, NULL);
+	assert(atlas != NULL);
 
 	SkeletonJson json(atlas);
 	skeletonData = json.readSkeletonDataFile(jsonFile);
 	assert(skeletonData);
 
 	skeleton = new (__FILE__, __LINE__) Skeleton(skeletonData);
-	assert(skeleton != 0);
+	assert(skeleton != NULL);
 
 	stateData = new (__FILE__, __LINE__) AnimationStateData(skeletonData);
-	assert(stateData != 0);
+	assert(stateData != NULL);
 	stateData->setDefaultMix(0.4f);
 
 	state = new (__FILE__, __LINE__) AnimationState(stateData);
@@ -89,11 +89,11 @@ void dispose(Atlas* atlas, SkeletonData* skeletonData, AnimationStateData* state
 }
 
 void reproduceIssue_776() {
-	Atlas* atlas = 0;
-	SkeletonData* skeletonData = 0;
-	AnimationStateData* stateData = 0;
-	Skeleton* skeleton = 0;
-	AnimationState* state = 0;
+	Atlas* atlas = NULL;
+	SkeletonData* skeletonData = NULL;
+	AnimationStateData* stateData = NULL;
+	Skeleton* skeleton = NULL;
+	AnimationState* state = NULL;
 
 	loadJson(R_JSON, R_ATLAS, atlas, skeletonData, stateData, skeleton, state);
 	dispose(atlas, skeletonData, stateData, skeleton, state);

+ 1 - 1
spine-cpp/spine-cpp/include/spine/AnimationState.h

@@ -289,7 +289,7 @@ namespace Spine {
         friend class EventQueue;
         
     public:
-        AnimationState(AnimationStateData* data);
+        explicit AnimationState(AnimationStateData* data);
         
         ~AnimationState();
         

+ 4 - 4
spine-cpp/spine-cpp/include/spine/AnimationStateData.h

@@ -52,8 +52,8 @@ namespace Spine {
         /// The mix duration to use when no mix duration has been specifically defined between two animations.
         float getDefaultMix();
         void setDefaultMix(float inValue);
-        
-        AnimationStateData(SkeletonData* skeletonData);
+
+        explicit AnimationStateData(SkeletonData* skeletonData);
         
         /// Sets a mix duration by animation names.
         void setMix(const String& fromName, const String& toName, float duration);
@@ -73,8 +73,8 @@ namespace Spine {
         public:
             Animation* _a1;
             Animation* _a2;
-            
-            AnimationPair(Animation* a1 = NULL, Animation* a2 = NULL);
+
+            explicit AnimationPair(Animation* a1 = NULL, Animation* a2 = NULL);
             
             bool operator==(const AnimationPair &other) const;
         };

+ 5 - 2
spine-cpp/spine-cpp/include/spine/Atlas.h

@@ -73,8 +73,11 @@ namespace Spine {
         TextureWrap vWrap;
         void* rendererObject;
         int width, height;
-        
-        AtlasPage(const String& inName) : name(inName) {}
+
+        explicit AtlasPage(const String& inName) : name(inName), format(Format_RGBA8888), minFilter(TextureFilter_Nearest),
+                                          magFilter(TextureFilter_Nearest), uWrap(TextureWrap_ClampToEdge),
+                                          vWrap(TextureWrap_ClampToEdge) {
+        }
     };
     
     class AtlasRegion : public SpineObject {

+ 1 - 1
spine-cpp/spine-cpp/include/spine/AtlasAttachmentLoader.h

@@ -48,7 +48,7 @@ namespace Spine {
         RTTI_DECL
         
     public:
-        AtlasAttachmentLoader(Atlas* atlas);
+        explicit AtlasAttachmentLoader(Atlas* atlas);
         
         virtual RegionAttachment* newRegionAttachment(Skin& skin, const String& name, const String& path);
         

+ 1 - 1
spine-cpp/spine-cpp/include/spine/Attachment.h

@@ -40,7 +40,7 @@ namespace Spine {
         RTTI_DECL
         
     public:
-        Attachment(const String& name);
+        explicit Attachment(const String& name);
         virtual ~Attachment();
 
         const String& getName();

+ 1 - 1
spine-cpp/spine-cpp/include/spine/AttachmentTimeline.h

@@ -50,7 +50,7 @@ namespace Spine {
         RTTI_DECL
         
     public:
-        AttachmentTimeline(int frameCount);
+        explicit AttachmentTimeline(int frameCount);
         
         virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
         

+ 1 - 1
spine-cpp/spine-cpp/include/spine/BoundingBoxAttachment.h

@@ -39,7 +39,7 @@ namespace Spine {
     class BoundingBoxAttachment : public VertexAttachment {
         RTTI_DECL
         
-        BoundingBoxAttachment(const String& name);
+        explicit BoundingBoxAttachment(const String& name);
     };
 }
 

+ 1 - 1
spine-cpp/spine-cpp/include/spine/ClippingAttachment.h

@@ -45,7 +45,7 @@ namespace Spine {
         RTTI_DECL
         
     public:
-        ClippingAttachment(const String& name);
+        explicit ClippingAttachment(const String& name);
         
         SlotData* getEndSlot();
         void setEndSlot(SlotData* inValue);

+ 1 - 1
spine-cpp/spine-cpp/include/spine/ColorTimeline.h

@@ -43,7 +43,7 @@ namespace Spine {
     public:
         static const int ENTRIES;
         
-        ColorTimeline (int frameCount);
+        explicit ColorTimeline (int frameCount);
         
         virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
         

+ 1 - 3
spine-cpp/spine-cpp/include/spine/CurveTimeline.h

@@ -34,15 +34,13 @@
 #include <spine/Timeline.h>
 #include <spine/Vector.h>
 
-#include <assert.h>
-
 namespace Spine {
     /// Base class for frames that use an interpolation bezier curve.
     class CurveTimeline : public Timeline {
         RTTI_DECL
         
     public:
-        CurveTimeline(int frameCount);
+        explicit CurveTimeline(int frameCount);
 
         virtual ~CurveTimeline();
         

+ 1 - 1
spine-cpp/spine-cpp/include/spine/DeformTimeline.h

@@ -43,7 +43,7 @@ namespace Spine {
         RTTI_DECL
         
     public:
-        DeformTimeline(int frameCount);
+        explicit DeformTimeline(int frameCount);
         
         virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
         

+ 1 - 1
spine-cpp/spine-cpp/include/spine/DrawOrderTimeline.h

@@ -41,7 +41,7 @@ namespace Spine {
         RTTI_DECL
     
     public:
-        DrawOrderTimeline(int frameCount);
+        explicit DrawOrderTimeline(int frameCount);
         
         virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
         

+ 1 - 1
spine-cpp/spine-cpp/include/spine/EventData.h

@@ -42,7 +42,7 @@ namespace Spine {
         friend class Event;
         
     public:
-        EventData(const String& name);
+        explicit EventData(const String& name);
         
         /// The name of the event, which is unique within the skeleton.
         const String& getName();

+ 1 - 1
spine-cpp/spine-cpp/include/spine/EventTimeline.h

@@ -41,7 +41,7 @@ namespace Spine {
         RTTI_DECL
         
     public:
-        EventTimeline(int frameCount);
+        explicit EventTimeline(int frameCount);
         
         ~EventTimeline();
         

+ 1 - 1
spine-cpp/spine-cpp/include/spine/HashMap.h

@@ -46,7 +46,7 @@ namespace Spine {
             friend class HashMap;
             
         public:
-            Iterator(Entry* entry = NULL) : _entry(entry) {
+            explicit Iterator(Entry* entry = NULL) : _entry(entry) {
                 // Empty
             }
             

+ 1 - 1
spine-cpp/spine-cpp/include/spine/IkConstraintData.h

@@ -46,7 +46,7 @@ namespace Spine {
         friend class IkConstraintTimeline;
         
     public:
-        IkConstraintData(const String& name);
+        explicit IkConstraintData(const String& name);
         
         /// The IK constraint's name, which is unique within the skeleton.
         const String& getName();

+ 1 - 1
spine-cpp/spine-cpp/include/spine/IkConstraintTimeline.h

@@ -43,7 +43,7 @@ namespace Spine {
     public:
         static const int ENTRIES;
         
-        IkConstraintTimeline(int frameCount);
+        explicit IkConstraintTimeline(int frameCount);
         
         virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
         

+ 1 - 1
spine-cpp/spine-cpp/include/spine/Json.h

@@ -65,7 +65,7 @@ namespace Spine {
         static const char* getError();
         
         /* Supply a block of JSON, and this returns a Json object you can interrogate. Call Json_dispose when finished. */
-        Json(const char* value);
+        explicit Json(const char* value);
         
         ~Json();
         

+ 10 - 10
spine-cpp/spine-cpp/include/spine/MathUtil.h

@@ -37,18 +37,18 @@
 #include <float.h>
 
 #define SPINE_PI 3.1415927f
-#define SPINE_PI_2 SPINE_PI * 2
-#define RadDeg 180.0f / SPINE_PI
-#define DegRad SPINE_PI / 180.0f
+#define SPINE_PI_2 (SPINE_PI * 2)
+#define RadDeg (180.0f / SPINE_PI)
+#define DegRad (SPINE_PI / 180.0f)
 #define SIN_BITS 14 // 16KB. Adjust for accuracy.
-#define SIN_MASK ~(-(1 << SIN_BITS))
-#define SIN_COUNT SIN_MASK + 1
-#define RadFull SPINE_PI * 2
+#define SIN_MASK (~(-(1 << SIN_BITS)))
+#define SIN_COUNT (SIN_MASK + 1)
+#define RadFull (SPINE_PI * 2)
 #define DegFull 360
-#define RadToIndex SIN_COUNT / RadFull
-#define DegToIndex SIN_COUNT / DegFull
-#define MAX(a, b) (((a) > (b)) ? (a) : (b))
-#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#define RadToIndex (SIN_COUNT / RadFull)
+#define DegToIndex (SIN_COUNT / DegFull)
+#define MAX(a, b) ((((a) > (b)) ? (a) : (b)))
+#define MIN(a, b) ((((a) < (b)) ? (a) : (b)))
 
 namespace Spine {
     template <typename T>

+ 1 - 1
spine-cpp/spine-cpp/include/spine/MeshAttachment.h

@@ -45,7 +45,7 @@ namespace Spine {
         RTTI_DECL
         
     public:
-        MeshAttachment(const String& name);
+        explicit MeshAttachment(const String& name);
 
         void updateUVs();
 

+ 1 - 1
spine-cpp/spine-cpp/include/spine/PathAttachment.h

@@ -41,7 +41,7 @@ namespace Spine {
         RTTI_DECL
         
     public:
-        PathAttachment(const String& name);
+        explicit PathAttachment(const String& name);
         
         /// The length in the setup pose from the start of the path to the end of each curve.
         Vector<float>& getLengths();

+ 1 - 1
spine-cpp/spine-cpp/include/spine/PathConstraintData.h

@@ -53,7 +53,7 @@ namespace Spine {
         friend class PathConstraintSpacingTimeline;
         
     public:
-        PathConstraintData(const String& name);
+        explicit PathConstraintData(const String& name);
 
         const String& getName();
         

+ 1 - 1
spine-cpp/spine-cpp/include/spine/PathConstraintMixTimeline.h

@@ -43,7 +43,7 @@ namespace Spine {
     public:
         static const int ENTRIES;
         
-        PathConstraintMixTimeline(int frameCount);
+        explicit PathConstraintMixTimeline(int frameCount);
         
         virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
         

+ 1 - 1
spine-cpp/spine-cpp/include/spine/PathConstraintPositionTimeline.h

@@ -43,7 +43,7 @@ namespace Spine {
     public:
         static const int ENTRIES;
         
-        PathConstraintPositionTimeline(int frameCount);
+        explicit PathConstraintPositionTimeline(int frameCount);
 
         virtual ~PathConstraintPositionTimeline();
         

+ 1 - 1
spine-cpp/spine-cpp/include/spine/PathConstraintSpacingTimeline.h

@@ -41,7 +41,7 @@ namespace Spine {
         RTTI_DECL
         
     public:
-        PathConstraintSpacingTimeline(int frameCount);
+        explicit PathConstraintSpacingTimeline(int frameCount);
         
         virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
         

+ 1 - 1
spine-cpp/spine-cpp/include/spine/PointAttachment.h

@@ -50,7 +50,7 @@ namespace Spine {
         RTTI_DECL
         
     public:
-        PointAttachment(const String& name);
+        explicit PointAttachment(const String& name);
         
         void computeWorldPosition(Bone& bone, float& ox, float& oy);
         

+ 2 - 2
spine-cpp/spine-cpp/include/spine/RTTI.h

@@ -38,7 +38,7 @@
 namespace Spine {
     class RTTI : public SpineObject {
     public:
-        RTTI(const std::string& className);
+        explicit RTTI(const std::string& className);
         
         RTTI(const std::string& className, const RTTI& baseRTTI);
         
@@ -53,7 +53,7 @@ namespace Spine {
         RTTI(const RTTI& obj);
         RTTI& operator=(const RTTI& obj);
         
-        const std::string& _className;
+        const std::string _className;
         const RTTI *_pBaseRTTI;
     };
 }

+ 1 - 1
spine-cpp/spine-cpp/include/spine/RegionAttachment.h

@@ -51,7 +51,7 @@ namespace Spine {
         RTTI_DECL
         
     public:
-        RegionAttachment(const String& name);
+        explicit RegionAttachment(const String& name);
 
         void updateOffset();
         

+ 2 - 2
spine-cpp/spine-cpp/include/spine/RotateTimeline.h

@@ -43,8 +43,8 @@ namespace Spine {
         
     public:
         static const int ENTRIES = 2;
-        
-        RotateTimeline(int frameCount);
+
+        explicit RotateTimeline(int frameCount);
         
         virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
         

+ 1 - 1
spine-cpp/spine-cpp/include/spine/ScaleTimeline.h

@@ -41,7 +41,7 @@ namespace Spine {
         RTTI_DECL
         
     public:
-        ScaleTimeline(int frameCount);
+        explicit ScaleTimeline(int frameCount);
         
         virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
         

+ 1 - 1
spine-cpp/spine-cpp/include/spine/ShearTimeline.h

@@ -41,7 +41,7 @@ namespace Spine {
         RTTI_DECL
         
     public:
-        ShearTimeline(int frameCount);
+        explicit ShearTimeline(int frameCount);
         
         virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
         

+ 3 - 3
spine-cpp/spine-cpp/include/spine/Skeleton.h

@@ -70,7 +70,7 @@ namespace Spine {
         friend class TwoColorTimeline;
         
     public:
-        Skeleton(SkeletonData* skeletonData);
+        explicit Skeleton(SkeletonData* skeletonData);
         
         ~Skeleton();
         
@@ -169,9 +169,9 @@ namespace Spine {
         float getY();
         void setY(float inValue);
         bool getFlipX();
-        void setFlipX(float inValue);
+        void setFlipX(bool inValue);
         bool getFlipY();
-        void setFlipY(float inValue);
+        void setFlipY(bool inValue);
         
     private:
         SkeletonData* _data;

+ 6 - 6
spine-cpp/spine-cpp/include/spine/SkeletonBinary.h

@@ -67,14 +67,14 @@ namespace Spine {
         static const int CURVE_BEZIER;
         
         static const TransformMode TRANSFORM_MODE_VALUES[5];
-        
-        SkeletonBinary(Atlas* atlasArray);
-        
-        SkeletonBinary(AttachmentLoader* attachmentLoader);
+
+        explicit SkeletonBinary(Atlas* atlasArray);
+
+        explicit SkeletonBinary(AttachmentLoader* attachmentLoader);
         
         ~SkeletonBinary();
         
-        SkeletonData* readSkeletonData(const unsigned char* binary, const int length);
+        SkeletonData* readSkeletonData(const unsigned char* binary, int length);
         
         SkeletonData* readSkeletonDataFile(const char* path);
         
@@ -100,7 +100,7 @@ namespace Spine {
         
         signed char readSByte(DataInput* input);
         
-        int readBoolean(DataInput* input);
+        bool readBoolean(DataInput* input);
         
         int readInt(DataInput* input);
         

+ 3 - 3
spine-cpp/spine-cpp/include/spine/SkeletonJson.h

@@ -47,9 +47,9 @@ namespace Spine {
     
     class SkeletonJson : public SpineObject {
     public:
-        SkeletonJson(Atlas* atlas);
-        
-        SkeletonJson(AttachmentLoader* attachmentLoader);
+        explicit SkeletonJson(Atlas* atlas);
+
+        explicit SkeletonJson(AttachmentLoader* attachmentLoader);
         
         ~SkeletonJson();
         

+ 4 - 4
spine-cpp/spine-cpp/include/spine/Skin.h

@@ -50,8 +50,8 @@ namespace Spine {
         public:
             int _slotIndex;
             String _name;
-            
-            AttachmentKey(int slotIndex = 0, const String& name = "");
+
+            explicit AttachmentKey(int slotIndex = 0, const String& name = "");
 
             AttachmentKey(const AttachmentKey &other) {
                 this->_slotIndex = other._slotIndex;
@@ -64,8 +64,8 @@ namespace Spine {
         struct HashAttachmentKey : public SpineObject {
             std::size_t operator()(const Spine::Skin::AttachmentKey& val) const;
         };
-        
-        Skin(const String& name);
+
+        explicit Skin(const String& name);
         ~Skin();
         
         /// Adds an attachment to the skin for the specified slot index and name.

+ 1 - 1
spine-cpp/spine-cpp/include/spine/TransformConstraintData.h

@@ -47,7 +47,7 @@ namespace Spine {
         friend class TransformConstraintTimeline;
         
     public:
-        TransformConstraintData(const String& name);
+        explicit TransformConstraintData(const String& name);
 
         const String& getName();
         int getOrder();

+ 2 - 2
spine-cpp/spine-cpp/include/spine/TransformConstraintTimeline.h

@@ -42,8 +42,8 @@ namespace Spine {
         
     public:
         static const int ENTRIES;
-        
-        TransformConstraintTimeline(int frameCount);
+
+        explicit TransformConstraintTimeline(int frameCount);
         
         virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
         

+ 2 - 2
spine-cpp/spine-cpp/include/spine/TranslateTimeline.h

@@ -45,8 +45,8 @@ namespace Spine {
         
     public:
         static const int ENTRIES;
-        
-        TranslateTimeline(int frameCount);
+
+        explicit TranslateTimeline(int frameCount);
 
         virtual ~TranslateTimeline();
         

+ 2 - 2
spine-cpp/spine-cpp/include/spine/TwoColorTimeline.h

@@ -42,8 +42,8 @@ namespace Spine {
         
     public:
         static const int ENTRIES;
-        
-        TwoColorTimeline(int frameCount);
+
+        explicit TwoColorTimeline(int frameCount);
         
         virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
         

+ 1 - 1
spine-cpp/spine-cpp/include/spine/Vector.h

@@ -56,7 +56,7 @@ namespace Spine {
             }
         }
 
-        Vector& operator=(Vector& inVector) {
+        Vector& operator=(const Vector& inVector) {
             if (this != &inVector) {
                 clear();
                 deallocate(_buffer);

+ 1 - 1
spine-cpp/spine-cpp/include/spine/VertexAttachment.h

@@ -47,7 +47,7 @@ namespace Spine {
         RTTI_DECL
         
     public:
-        VertexAttachment(const String& name);
+        explicit VertexAttachment(const String& name);
 
         virtual ~VertexAttachment();
         

+ 2 - 1
spine-cpp/spine-cpp/src/spine/AnimationState.cpp

@@ -310,7 +310,8 @@ namespace Spine {
     _queue(EventQueue::newEventQueue(*this, _trackEntryPool)),
     _animationsChanged(false),
     _onAnimationEventFunc(dummyOnAnimationEventFunc),
-    _timeScale(1) {
+    _timeScale(1),
+    _rendererObject(NULL){
         // Empty
     }
     

+ 1 - 1
spine-cpp/spine-cpp/src/spine/Atlas.cpp

@@ -279,7 +279,7 @@ namespace Spine {
 
     int Atlas::beginPast(Str* str, char c) {
         const char* begin = str->begin;
-        while (1) {
+        while (true) {
             char lastSkippedChar = *begin;
             if (begin == str->end) {
                 return 0;

+ 0 - 1
spine-cpp/spine-cpp/src/spine/Extension.cpp

@@ -32,7 +32,6 @@
 
 #include <fstream>
 #include <assert.h>
-#include <cstring>
 
 namespace Spine {
     DefaultSpineExtension _defaultExtension;

+ 15 - 15
spine-cpp/spine-cpp/src/spine/IkConstraint.cpp

@@ -51,7 +51,7 @@ namespace Spine {
         float id = 1 / (p._a * p._d - p._b * p._c);
         float x = targetX - p._worldX, y = targetY - p._worldY;
         float tx = (x * p._d - y * p._b) * id - bone._ax, ty = (y * p._a - x * p._c) * id - bone._ay;
-        float rotationIK = (float)atan2(ty, tx) * RadDeg - bone._ashearX - bone._arotation;
+        float rotationIK = atan2(ty, tx) * RadDeg - bone._ashearX - bone._arotation;
         
         if (bone._ascaleX < 0) {
             rotationIK += 180;
@@ -146,7 +146,7 @@ namespace Spine {
         x = cwx - pp._worldX;
         y = cwy - pp._worldY;
         float dx = (x * d - y * b) * id - px, dy = (y * a - x * c) * id - py;
-        float l1 = (float)sqrt(dx * dx + dy * dy), l2 = child._data.getLength() * csx, a1, a2;
+        float l1 = sqrt(dx * dx + dy * dy), l2 = child._data.getLength() * csx, a1, a2;
         if (u) {
             l2 *= psx;
             float cos = (tx * tx + ty * ty - l1 * l1 - l2 * l2) / (2 * l1 * l2);
@@ -157,30 +157,30 @@ namespace Spine {
                 cos = 1;
             }
             
-            a2 = (float)acos(cos) * bendDir;
+            a2 = acos(cos) * bendDir;
             a = l1 + l2 * cos;
-            b = l2 * (float)sin(a2);
-            a1 = (float)atan2(ty * a - tx * b, tx * a + ty * b);
+            b = l2 * sin(a2);
+            a1 = atan2(ty * a - tx * b, tx * a + ty * b);
         }
         else {
             a = psx * l2;
             b = psy * l2;
-            float aa = a * a, bb = b * b, dd = tx * tx + ty * ty, ta = (float)atan2(ty, tx);
+            float aa = a * a, bb = b * b, dd = tx * tx + ty * ty, ta = atan2(ty, tx);
             c = bb * l1 * l1 + aa * dd - aa * bb;
             float c1 = -2 * bb * l1, c2 = bb - aa;
             d = c1 * c1 - 4 * c2 * c;
             if (d >= 0) {
-                float q = (float)sqrt(d);
+                float q = sqrt(d);
                 if (c1 < 0) q = -q;
                 q = -(c1 + q) / 2;
                 float r0 = q / c2, r1 = c / q;
                 float r = fabs(r0) < fabs(r1) ? r0 : r1;
                 if (r * r <= dd) {
-                    y = (float)sqrt(dd - r * r) * bendDir;
-                    a1 = ta - (float)atan2(y, r);
-                    a2 = (float)atan2(y / psy, (r - l1) / psx);
+                    y = sqrt(dd - r * r) * bendDir;
+                    a1 = ta - atan2(y, r);
+                    a2 = atan2(y / psy, (r - l1) / psx);
                     
-                    float os = (float)atan2(cy, cx) * s2;
+                    float os = atan2(cy, cx) * s2;
                     float rotation = parent._arotation;
                     a1 = (a1 - os) * RadDeg + os1 - rotation;
                     if (a1 > 180) {
@@ -211,8 +211,8 @@ namespace Spine {
             float maxAngle = 0, maxX = l1 + a, maxDist = maxX * maxX, maxY = 0;
             c = -a * l1 / (aa - bb);
             if (c >= -1 && c <= 1) {
-                c = (float)acos(c);
-                x = a * (float)cos(c) + l1;
+                c = acos(c);
+                x = a * cos(c) + l1;
                 y = b * (float)sin(c);
                 d = x * x + y * y;
                 
@@ -232,11 +232,11 @@ namespace Spine {
             }
             
             if (dd <= (minDist + maxDist) / 2) {
-                a1 = ta - (float)atan2(minY * bendDir, minX);
+                a1 = ta - atan2(minY * bendDir, minX);
                 a2 = minAngle * bendDir;
             }
             else {
-                a1 = ta - (float)atan2(maxY * bendDir, maxX);
+                a1 = ta - atan2(maxY * bendDir, maxX);
                 a2 = maxAngle * bendDir;
             }
         }

+ 4 - 8
spine-cpp/spine-cpp/src/spine/Json.cpp

@@ -114,9 +114,7 @@ namespace Spine {
     }
     
     Json::~Json() {
-        if (_child) {
-            delete _child;
-        }
+        delete _child;
         
         if (_valueString) {
             SpineExtension::free(_valueString, __FILE__, __LINE__);
@@ -125,10 +123,8 @@ namespace Spine {
         if (_name) {
             SpineExtension::free(_name, __FILE__, __LINE__);
         }
-        
-        if (_next) {
-            delete _next;
-        }
+
+        delete _next;
     }
     
     const char* Json::skip(const char* inValue) {
@@ -223,7 +219,7 @@ namespace Spine {
             }
         }
         
-        out = (char*)SpineExtension::alloc<char>(len + 1, __FILE__, __LINE__); /* The length needed for the string, roughly. */
+        out = SpineExtension::alloc<char>(len + 1, __FILE__, __LINE__); /* The length needed for the string, roughly. */
         if (!out) {
             return 0;
         }

+ 2 - 2
spine-cpp/spine-cpp/src/spine/MathUtil.cpp

@@ -35,11 +35,11 @@ namespace Spine {
     
     MathUtil::MathUtil() {
         for (int i = 0; i < SIN_COUNT; ++i) {
-            SIN_TABLE[i] = (float)sin((i + 0.5f) / SIN_COUNT * RadFull);
+            SIN_TABLE[i] = sin((i + 0.5f) / SIN_COUNT * RadFull);
         }
         
         for (int i = 0; i < 360; i += 90) {
-            SIN_TABLE[(int)(i * DegToIndex) & SIN_MASK] = (float)sin(i * DegRad);
+            SIN_TABLE[i * DegToIndex & SIN_MASK] = sin(i * DegRad);
         }
     }
     

+ 11 - 11
spine-cpp/spine-cpp/src/spine/PathConstraint.cpp

@@ -118,7 +118,7 @@ namespace Spine {
                 else {
                     float x = setupLength * bone._a;
                     float y = setupLength * bone._c;
-                    float length = (float)sqrt(x * x + y * y);
+                    float length = sqrt(x * x + y * y);
                     if (scale) {
                         _lengths[i] = length;
                     }
@@ -159,7 +159,7 @@ namespace Spine {
             if (scale) {
                 float length = _lengths[i];
                 if (length >= PathConstraint::EPSILON) {
-                    float s = ((float)sqrt(dx * dx + dy * dy) / length - 1) * rotateMix + 1;
+                    float s = (sqrt(dx * dx + dy * dy) / length - 1) * rotateMix + 1;
                     bone._a *= s;
                     bone._c *= s;
                 }
@@ -398,18 +398,18 @@ namespace Spine {
             ddfy = tmpy * 2 + dddfy;
             dfx = (cx1 - x1) * 0.75f + tmpx + dddfx * 0.16666667f;
             dfy = (cy1 - y1) * 0.75f + tmpy + dddfy * 0.16666667f;
-            pathLength += (float)sqrt(dfx * dfx + dfy * dfy);
+            pathLength += sqrt(dfx * dfx + dfy * dfy);
             dfx += ddfx;
             dfy += ddfy;
             ddfx += dddfx;
             ddfy += dddfy;
-            pathLength += (float)sqrt(dfx * dfx + dfy * dfy);
+            pathLength += sqrt(dfx * dfx + dfy * dfy);
             dfx += ddfx;
             dfy += ddfy;
-            pathLength += (float)sqrt(dfx * dfx + dfy * dfy);
+            pathLength += sqrt(dfx * dfx + dfy * dfy);
             dfx += ddfx + dddfx;
             dfy += ddfy + dddfy;
-            pathLength += (float)sqrt(dfx * dfx + dfy * dfy);
+            pathLength += sqrt(dfx * dfx + dfy * dfy);
             _curves[i] = pathLength;
             x1 = x2;
             y1 = y2;
@@ -485,23 +485,23 @@ namespace Spine {
                 ddfy = tmpy * 2 + dddfy;
                 dfx = (cx1 - x1) * 0.3f + tmpx + dddfx * 0.16666667f;
                 dfy = (cy1 - y1) * 0.3f + tmpy + dddfy * 0.16666667f;
-                curveLength = (float)sqrt(dfx * dfx + dfy * dfy);
+                curveLength = sqrt(dfx * dfx + dfy * dfy);
                 _segments[0] = curveLength;
                 for (ii = 1; ii < 8; ii++) {
                     dfx += ddfx;
                     dfy += ddfy;
                     ddfx += dddfx;
                     ddfy += dddfy;
-                    curveLength += (float)sqrt(dfx * dfx + dfy * dfy);
+                    curveLength += sqrt(dfx * dfx + dfy * dfy);
                     _segments[ii] = curveLength;
                 }
                 dfx += ddfx;
                 dfy += ddfy;
-                curveLength += (float)sqrt(dfx * dfx + dfy * dfy);
+                curveLength += sqrt(dfx * dfx + dfy * dfy);
                 _segments[8] = curveLength;
                 dfx += ddfx + dddfx;
                 dfy += ddfy + dddfy;
-                curveLength += (float)sqrt(dfx * dfx + dfy * dfy);
+                curveLength += sqrt(dfx * dfx + dfy * dfy);
                 _segments[9] = curveLength;
                 segment = 0;
             }
@@ -563,7 +563,7 @@ namespace Spine {
         output[o] = x;
         output[o + 1] = y;
         if (tangents) {
-            output[o + 2] = (float)atan2(y - (y1 * uu + cy1 * ut * 2 + cy2 * tt), x - (x1 * uu + cx1 * ut * 2 + cx2 * tt));
+            output[o + 2] = atan2(y - (y1 * uu + cy1 * ut * 2 + cy2 * tt), x - (x1 * uu + cx1 * ut * 2 + cx2 * tt));
         }
     }
 }

+ 2 - 2
spine-cpp/spine-cpp/src/spine/Skeleton.cpp

@@ -550,7 +550,7 @@ namespace Spine {
         return _flipX;
     }
     
-    void Skeleton::setFlipX(float inValue) {
+    void Skeleton::setFlipX(bool inValue) {
         _flipX = inValue;
     }
     
@@ -558,7 +558,7 @@ namespace Spine {
         return _flipY;
     }
     
-    void Skeleton::setFlipY(float inValue) {
+    void Skeleton::setFlipY(bool inValue) {
         _flipY = inValue;
     }
     

+ 41 - 41
spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp

@@ -153,14 +153,14 @@ namespace Spine {
         }
         
         /* Bones. */
-        int bonesCount = readVarint(input, 1);
+        int bonesCount = readVarint(input, true);
         skeletonData->_bones.reserve(bonesCount);
         skeletonData->_bones.setSize(bonesCount);
         for (i = 0; i < bonesCount; ++i) {
             BoneData* data;
             int mode;
             const char* name = readString(input);
-            BoneData* parent = i == 0 ? 0 : skeletonData->_bones[readVarint(input, 1)];
+            BoneData* parent = i == 0 ? 0 : skeletonData->_bones[readVarint(input, true)];
             
             data = new (__FILE__, __LINE__) BoneData(i, String(name, true), parent);
             data->_rotation = readFloat(input);
@@ -172,7 +172,7 @@ namespace Spine {
             data->_shearY = readFloat(input);
             data->_length = readFloat(input) * _scale;
             
-            mode = readVarint(input, 1);
+            mode = readVarint(input, true);
             switch (mode) {
                 case 0:
                     data->_transformMode = TransformMode_Normal;
@@ -200,13 +200,13 @@ namespace Spine {
         }
 
         /* Slots. */
-        int slotsCount = readVarint(input, 1);
+        int slotsCount = readVarint(input, true);
         skeletonData->_slots.reserve(slotsCount);
         skeletonData->_slots.setSize(slotsCount);
         for (i = 0; i < slotsCount; ++i) {
             int r, g, b, a;
             const char* slotName = readString(input);
-            BoneData* boneData = skeletonData->_bones[readVarint(input, 1)];
+            BoneData* boneData = skeletonData->_bones[readVarint(input, true)];
             
             SlotData* slotData = new (__FILE__, __LINE__) SlotData(i, String(slotName, true), *boneData);
 
@@ -221,13 +221,13 @@ namespace Spine {
                 slotData->_b2 = b / 255.0f;
             }
             slotData->_attachmentName.own(readString(input));
-            slotData->_blendMode = static_cast<BlendMode>(readVarint(input, 1));
+            slotData->_blendMode = static_cast<BlendMode>(readVarint(input, true));
             
             skeletonData->_slots[i] = slotData;
         }
 
         /* IK constraints. */
-        int ikConstraintsCount = readVarint(input, 1);
+        int ikConstraintsCount = readVarint(input, true);
         skeletonData->_ikConstraints.reserve(ikConstraintsCount);
         skeletonData->_ikConstraints.setSize(ikConstraintsCount);
         for (i = 0; i < ikConstraintsCount; ++i) {
@@ -235,15 +235,15 @@ namespace Spine {
             
             IkConstraintData* data = new (__FILE__, __LINE__) IkConstraintData(String(name, true));
             
-            data->_order = readVarint(input, 1);
+            data->_order = readVarint(input, true);
 
-            int bonesCount = readVarint(input, 1);
+            int bonesCount = readVarint(input, true);
             data->_bones.reserve(bonesCount);
             data->_bones.setSize(bonesCount);
             for (ii = 0; ii < bonesCount; ++ii) {
-                data->_bones[ii] = skeletonData->_bones[readVarint(input, 1)];
+                data->_bones[ii] = skeletonData->_bones[readVarint(input, true)];
             }
-            data->_target = skeletonData->_bones[readVarint(input, 1)];
+            data->_target = skeletonData->_bones[readVarint(input, true)];
             data->_mix = readFloat(input);
             data->_bendDirection = readSByte(input);
             
@@ -251,7 +251,7 @@ namespace Spine {
         }
 
         /* Transform constraints. */
-        int transformConstraintsCount = readVarint(input, 1);
+        int transformConstraintsCount = readVarint(input, true);
         skeletonData->_transformConstraints.reserve(transformConstraintsCount);
         skeletonData->_transformConstraints.setSize(transformConstraintsCount);
         for (i = 0; i < transformConstraintsCount; ++i) {
@@ -259,14 +259,14 @@ namespace Spine {
             
             TransformConstraintData* data = new (__FILE__, __LINE__) TransformConstraintData(String(name, true));
             
-            data->_order = readVarint(input, 1);
-            int bonesCount = readVarint(input, 1);
+            data->_order = readVarint(input, true);
+            int bonesCount = readVarint(input, true);
             data->_bones.reserve(bonesCount);
             data->_bones.setSize(bonesCount);
             for (ii = 0; ii < bonesCount; ++ii) {
-                data->_bones[ii] = skeletonData->_bones[readVarint(input, 1)];
+                data->_bones[ii] = skeletonData->_bones[readVarint(input, true)];
             }
-            data->_target = skeletonData->_bones[readVarint(input, 1)];
+            data->_target = skeletonData->_bones[readVarint(input, true)];
             data->_local = readBoolean(input);
             data->_relative = readBoolean(input);
             data->_offsetRotation = readFloat(input);
@@ -284,7 +284,7 @@ namespace Spine {
         }
 
         /* Path constraints */
-        int pathConstraintsCount = readVarint(input, 1);
+        int pathConstraintsCount = readVarint(input, true);
         skeletonData->_pathConstraints.reserve(pathConstraintsCount);
         skeletonData->_pathConstraints.setSize(pathConstraintsCount);
         for (i = 0; i < pathConstraintsCount; ++i) {
@@ -292,18 +292,18 @@ namespace Spine {
             
             PathConstraintData* data = new (__FILE__, __LINE__) PathConstraintData(String(name, true));
             
-            data->_order = readVarint(input, 1);
+            data->_order = readVarint(input, true);
             
-            int bonesCount = readVarint(input, 1);
+            int bonesCount = readVarint(input, true);
             data->_bones.reserve(bonesCount);
             data->_bones.setSize(bonesCount);
             for (ii = 0; ii < bonesCount; ++ii) {
-                data->_bones[ii] = skeletonData->_bones[readVarint(input, 1)];
+                data->_bones[ii] = skeletonData->_bones[readVarint(input, true)];
             }
-            data->_target = skeletonData->_slots[readVarint(input, 1)];
-            data->_positionMode = static_cast<PositionMode>(readVarint(input, 1));
-            data->_spacingMode = static_cast<SpacingMode>(readVarint(input, 1));
-            data->_rotateMode = static_cast<RotateMode>(readVarint(input, 1));
+            data->_target = skeletonData->_slots[readVarint(input, true)];
+            data->_positionMode = static_cast<PositionMode>(readVarint(input, true));
+            data->_spacingMode = static_cast<SpacingMode>(readVarint(input, true));
+            data->_rotateMode = static_cast<RotateMode>(readVarint(input, true));
             data->_offsetRotation = readFloat(input);
             data->_position = readFloat(input);
             if (data->_positionMode == PositionMode_Fixed) {
@@ -322,7 +322,7 @@ namespace Spine {
 
         /* Default skin. */
         skeletonData->_defaultSkin = readSkin(input, "default", skeletonData, nonessential);
-        int skinsCount = readVarint(input, 1);
+        int skinsCount = readVarint(input, true);
 
         if (skeletonData->_defaultSkin) {
             ++skinsCount;
@@ -365,13 +365,13 @@ namespace Spine {
         _linkedMeshes.clear();
 
         /* Events. */
-        int eventsCount = readVarint(input, 1);
+        int eventsCount = readVarint(input, true);
         skeletonData->_events.reserve(eventsCount);
         skeletonData->_events.setSize(eventsCount);
         for (i = 0; i < eventsCount; ++i) {
             const char* name = readString(input);
             EventData* eventData = new (__FILE__, __LINE__) EventData(String(name, true));
-            eventData->_intValue = readVarint(input, 0);
+            eventData->_intValue = readVarint(input, false);
             eventData->_floatValue = readFloat(input);
             eventData->_stringValue.own(readString(input));
             SpineExtension::free(readString(input), __FILE__, __LINE__); // skip audio path
@@ -379,7 +379,7 @@ namespace Spine {
         }
 
         /* Animations. */
-        int animationsCount = readVarint(input, 1);
+        int animationsCount = readVarint(input, true);
         skeletonData->_animations.reserve(animationsCount);
         skeletonData->_animations.setSize(animationsCount);
         for (i = 0; i < animationsCount; ++i) {
@@ -421,11 +421,11 @@ namespace Spine {
             strncat(message + length, value2, 255 - length);
         }
         
-        _error = message;
+        _error = String(message);
     }
     
     char* SkeletonBinary::readString(DataInput* input) {
-        int length = readVarint(input, 1);
+        int length = readVarint(input, true);
         char* string;
         if (length == 0) {
             return NULL;
@@ -456,7 +456,7 @@ namespace Spine {
         return (signed char)readByte(input);
     }
     
-    int SkeletonBinary::readBoolean(DataInput* input) {
+    bool SkeletonBinary::readBoolean(DataInput* input) {
         return readByte(input) != 0;
     }
     
@@ -504,7 +504,7 @@ namespace Spine {
     
     Skin* SkeletonBinary::readSkin(DataInput* input, const char* skinName, SkeletonData* skeletonData, bool nonessential) {
         Skin* skin = NULL;
-        int slotCount = readVarint(input, 1);
+        int slotCount = readVarint(input, true);
         int i, ii, nn;
         if (slotCount == 0) {
             return NULL;
@@ -513,8 +513,8 @@ namespace Spine {
         skin = new (__FILE__, __LINE__) Skin(String(skinName));
         
         for (i = 0; i < slotCount; ++i) {
-            int slotIndex = readVarint(input, 1);
-            for (ii = 0, nn = readVarint(input, 1); ii < nn; ++ii) {
+            int slotIndex = readVarint(input, true);
+            for (ii = 0, nn = readVarint(input, true); ii < nn; ++ii) {
                 const char* name = readString(input);
                 Attachment* attachment = readAttachment(input, skin, slotIndex, name, skeletonData, nonessential);
                 if (attachment) {
@@ -565,7 +565,7 @@ namespace Spine {
                 return region;
             }
             case AttachmentType_Boundingbox: {
-                int vertexCount = readVarint(input, 1);
+                int vertexCount = readVarint(input, true);
                 BoundingBoxAttachment* box = _attachmentLoader->newBoundingBoxAttachment(*skin, String(name));
                 readVertices(input, static_cast<VertexAttachment*>(box), vertexCount);
                 if (nonessential) {
@@ -588,14 +588,14 @@ namespace Spine {
                 mesh = _attachmentLoader->newMeshAttachment(*skin, String(name), String(path));
                 mesh->_path = String(path);
                 readColor(input, &mesh->_r, &mesh->_g, &mesh->_b, &mesh->_a);
-                vertexCount = readVarint(input, 1);
+                vertexCount = readVarint(input, true);
                 Vector<float> float_array = readFloatArray(input, vertexCount << 1, 1);
                 mesh->setRegionUVs(float_array);
                 Vector<short> triangles = readShortArray(input);
                 mesh->setTriangles(triangles);
                 readVertices(input, static_cast<VertexAttachment*>(mesh), vertexCount);
                 mesh->updateUVs();
-                mesh->_hullLength = readVarint(input, 1) << 1;
+                mesh->_hullLength = readVarint(input, true) << 1;
                 if (nonessential) {
                     Vector<short> edges = readShortArray(input);
                     mesh->setEdges(edges);
@@ -650,7 +650,7 @@ namespace Spine {
                 int vertexCount = 0;
                 path->_closed = readBoolean(input);
                 path->_constantSpeed = readBoolean(input);
-                vertexCount = readVarint(input, 1);
+                vertexCount = readVarint(input, true);
                 readVertices(input, static_cast<VertexAttachment*>(path), vertexCount);
                 int lengthsLength = vertexCount / 3;
                 path->_lengths.reserve(lengthsLength);
@@ -684,8 +684,8 @@ namespace Spine {
                 return point;
             }
             case AttachmentType_Clipping: {
-                int endSlotIndex = readVarint(input, 1);
-                int vertexCount = readVarint(input, 1);
+                int endSlotIndex = readVarint(input, true);
+                int vertexCount = readVarint(input, true);
                 ClippingAttachment* clip = _attachmentLoader->newClippingAttachment(*skin, name);
                 readVertices(input, static_cast<VertexAttachment*>(clip), vertexCount);
                 
@@ -760,7 +760,7 @@ namespace Spine {
     }
     
     Vector<short> SkeletonBinary::readShortArray(DataInput *input) {
-        int n = readVarint(input, 1);
+        int n = readVarint(input, true);
         
         Vector<short> array;
         array.reserve(n);

+ 1 - 3
spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp

@@ -1226,8 +1226,6 @@ namespace Spine {
         
         _error = String(message);
         
-        if (root) {
-            delete root;
-        }
+        delete root;
     }
 }

+ 8 - 8
spine-cpp/spine-cpp/src/spine/TransformConstraint.cpp

@@ -171,17 +171,17 @@ namespace Spine {
             }
             
             if (scaleMix > 0) {
-                float s = (float)sqrt(bone._a * bone._a + bone._c * bone._c);
+                float s = sqrt(bone._a * bone._a + bone._c * bone._c);
                 
                 if (s > 0.00001f) {
-                    s = (s + ((float)sqrt(ta * ta + tc * tc) - s + _data._offsetScaleX) * scaleMix) / s;
+                    s = (s + (sqrt(ta * ta + tc * tc) - s + _data._offsetScaleX) * scaleMix) / s;
                 }
                 bone._a *= s;
                 bone._c *= s;
-                s = (float)sqrt(bone._b * bone._b + bone._d * bone._d);
+                s = sqrt(bone._b * bone._b + bone._d * bone._d);
                 
                 if (s > 0.00001f) {
-                    s = (s + ((float)sqrt(tb * tb + td * td) - s + _data._offsetScaleY) * scaleMix) / s;
+                    s = (s + (sqrt(tb * tb + td * td) - s + _data._offsetScaleY) * scaleMix) / s;
                 }
                 bone._b *= s;
                 bone._d *= s;
@@ -200,7 +200,7 @@ namespace Spine {
                 }
                 
                 r = by + (r + offsetShearY) * shearMix;
-                float s = (float)sqrt(b * b + d * d);
+                float s = sqrt(b * b + d * d);
                 bone._b = MathUtil::cos(r) * s;
                 bone._d = MathUtil::sin(r) * s;
                 modified = true;
@@ -252,10 +252,10 @@ namespace Spine {
             }
             
             if (scaleMix > 0) {
-                float s = ((float)sqrt(ta * ta + tc * tc) - 1 + _data._offsetScaleX) * scaleMix + 1;
+                float s = (sqrt(ta * ta + tc * tc) - 1 + _data._offsetScaleX) * scaleMix + 1;
                 bone._a *= s;
                 bone._c *= s;
-                s = ((float)sqrt(tb * tb + td * td) - 1 + _data._offsetScaleY) * scaleMix + 1;
+                s = (sqrt(tb * tb + td * td) - 1 + _data._offsetScaleY) * scaleMix + 1;
                 bone._b *= s;
                 bone._d *= s;
                 modified = true;
@@ -272,7 +272,7 @@ namespace Spine {
                 
                 float b = bone._b, d = bone._d;
                 r = MathUtil::atan2(d, b) + (r - SPINE_PI / 2 + offsetShearY) * shearMix;
-                float s = (float)sqrt(b * b + d * d);
+                float s = sqrt(b * b + d * d);
                 bone._b = MathUtil::cos(r) * s;
                 bone._d = MathUtil::sin(r) * s;
                 modified = true;