浏览代码

[cpp] Use snprintf in String.

Mario Zechner 2 年之前
父节点
当前提交
745d412d7d
共有 1 个文件被更改,包括 2 次插入7 次删除
  1. 2 7
      spine-cpp/spine-cpp/include/spine/SpineString.h

+ 2 - 7
spine-cpp/spine-cpp/include/spine/SpineString.h

@@ -36,11 +36,6 @@
 #include <string.h>
 #include <stdio.h>
 
-// Required for sprintf on MSVC
-#ifdef _MSC_VER
-#pragma warning(disable:4996)
-#endif
-
 namespace spine {
 	class SP_API String : public SpineObject {
 	public:
@@ -170,14 +165,14 @@ namespace spine {
 
 		String &append(int other) {
 			char str[100];
-			sprintf(str, "%i", other);
+			snprintf(str, 100, "%i", other);
 			append(str);
 			return *this;
 		}
 
 		String &append(float other) {
 			char str[100];
-			sprintf(str, "%f", other);
+			snprintf(str, 100, "%f", other);
 			append(str);
 			return *this;
 		}