mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-10 14:41:50 +00:00
loader/svg: Return actual decoded size
Returns the actual length of the decoded array. related issue: https://github.com/thorvg/thorvg/issues/2156
This commit is contained in:
parent
da45fa6608
commit
1bbf9bbb7d
1 changed files with 4 additions and 3 deletions
|
@ -47,7 +47,6 @@ size_t svgUtilURLDecode(const char *src, char** dst)
|
|||
if (length == 0) return 0;
|
||||
|
||||
char* decoded = (char*)malloc(sizeof(char) * length + 1);
|
||||
decoded[length] = '\0';
|
||||
|
||||
char a, b;
|
||||
int idx =0;
|
||||
|
@ -64,7 +63,9 @@ size_t svgUtilURLDecode(const char *src, char** dst)
|
|||
decoded[idx++] = *src++;
|
||||
}
|
||||
}
|
||||
decoded[idx] = '\0';
|
||||
|
||||
*dst = decoded;
|
||||
return length + 1;
|
||||
}
|
||||
return idx + 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue