Merge branch 'master' of github.com:assimp/assimp into issue_1330

pull/1462/head
Jared Mulconry 2017-09-29 14:15:53 +10:00
commit d28f45bfa8
1 changed files with 5 additions and 4 deletions

View File

@ -1118,11 +1118,12 @@ inline std::string Asset::FindUniqueID(const std::string& str, const char* suffi
if (it == mUsedIds.end())
return id;
char buffer[256];
int offset = ai_snprintf(buffer, sizeof(buffer), "%s_", id.c_str());
std::vector<char> buffer;
buffer.resize(id.size() + 16);
int offset = ai_snprintf(buffer.data(), buffer.size(), "%s_", id.c_str());
for (int i = 0; it != mUsedIds.end(); ++i) {
ai_snprintf(buffer + offset, sizeof(buffer) - offset, "%d", i);
id = buffer;
ai_snprintf(buffer.data() + offset, buffer.size() - offset, "%d", i);
id = buffer.data();
it = mUsedIds.find(id);
}