mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-10 06:34:01 +00:00
lottie_loader: custom strtof and strndup used
The custom version of 'strtof' must be used because its result is dependent on the current locale, which is't set in the project.
This commit is contained in:
parent
480917651a
commit
6ad4a0b180
1 changed files with 4 additions and 8 deletions
|
@ -25,6 +25,7 @@
|
|||
#include "tvgLottieModel.h"
|
||||
#include "tvgLottieParser.h"
|
||||
#include "tvgLottieBuilder.h"
|
||||
#include "tvgStr.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* Internal Class Implementation */
|
||||
|
@ -50,13 +51,8 @@ static int _str2int(const char* str, int len)
|
|||
|
||||
static int _str2float(const char* str, int len)
|
||||
{
|
||||
//strndup()
|
||||
auto tmp = (char*)malloc(len + 1);
|
||||
if (!tmp) return 0;
|
||||
tmp[len] = '\0';
|
||||
memcpy(tmp, str, len);
|
||||
|
||||
auto ret = strtof(tmp, nullptr);
|
||||
auto tmp = strDuplicate(str, len);
|
||||
auto ret = strToFloat(tmp, nullptr);
|
||||
free(tmp);
|
||||
return lround(ret);
|
||||
}
|
||||
|
@ -325,4 +321,4 @@ float LottieLoader::duration()
|
|||
void LottieLoader::sync()
|
||||
{
|
||||
this->done();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue