mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-21 07:22:23 +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
a5abc42ed5
commit
4f4ff68896
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;
|
if (length == 0) return 0;
|
||||||
|
|
||||||
char* decoded = (char*)malloc(sizeof(char) * length + 1);
|
char* decoded = (char*)malloc(sizeof(char) * length + 1);
|
||||||
decoded[length] = '\0';
|
|
||||||
|
|
||||||
char a, b;
|
char a, b;
|
||||||
int idx =0;
|
int idx =0;
|
||||||
|
@ -64,7 +63,9 @@ size_t svgUtilURLDecode(const char *src, char** dst)
|
||||||
decoded[idx++] = *src++;
|
decoded[idx++] = *src++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
decoded[idx] = '\0';
|
||||||
|
|
||||||
*dst = decoded;
|
*dst = decoded;
|
||||||
return length + 1;
|
return idx + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue