use sscanf_s in MSVC

consistent with other uses of sscanf in the library
This commit is contained in:
Nicolas Guillemot
2016-04-02 15:15:29 -07:00
parent ad9911ef1b
commit b40e8c9427

View File

@@ -1089,7 +1089,11 @@ bool LoadObj(std::vector<shape_t> &shapes, // [output]
char namebuf[4096]; char namebuf[4096];
token += 2; token += 2;
#ifdef _MSC_VER
sscanf_s(token, "%s", namebuf, (unsigned)_countof(namebuf));
#else
sscanf(token, "%s", namebuf); sscanf(token, "%s", namebuf);
#endif
tag.name = std::string(namebuf); tag.name = std::string(namebuf);
token += tag.name.size() + 1; token += tag.name.size() + 1;
@@ -1113,7 +1117,11 @@ bool LoadObj(std::vector<shape_t> &shapes, // [output]
for (size_t i = 0; i < static_cast<size_t>(ts.num_strings); ++i) { for (size_t i = 0; i < static_cast<size_t>(ts.num_strings); ++i) {
char stringValueBuffer[4096]; char stringValueBuffer[4096];
#ifdef _MSC_VER
sscanf_s(token, "%s", stringValueBuffer, (unsigned)_countof(stringValueBuffer));
#else
sscanf(token, "%s", stringValueBuffer); sscanf(token, "%s", stringValueBuffer);
#endif
tag.stringValues[i] = stringValueBuffer; tag.stringValues[i] = stringValueBuffer;
token += tag.stringValues[i].size() + 1; token += tag.stringValues[i].size() + 1;
} }