mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 17:56:04 +08:00
[cpp] Use snprintf in String.
This commit is contained in:
parent
37d9a8c796
commit
745d412d7d
@ -36,11 +36,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
// Required for sprintf on MSVC
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(disable:4996)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
class SP_API String : public SpineObject {
|
class SP_API String : public SpineObject {
|
||||||
public:
|
public:
|
||||||
@ -170,14 +165,14 @@ namespace spine {
|
|||||||
|
|
||||||
String &append(int other) {
|
String &append(int other) {
|
||||||
char str[100];
|
char str[100];
|
||||||
sprintf(str, "%i", other);
|
snprintf(str, 100, "%i", other);
|
||||||
append(str);
|
append(str);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
String &append(float other) {
|
String &append(float other) {
|
||||||
char str[100];
|
char str[100];
|
||||||
sprintf(str, "%f", other);
|
snprintf(str, 100, "%f", other);
|
||||||
append(str);
|
append(str);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user