Hey @brammool just chucking a few more things your way, hope you don't mind ^^
On line 2153 in /src/gui_photon.c, utf8_buffer isn't freed from memory after usage.
Alongside that, I noticed that if true condition on line 2151 is met, isn't len & s a little redundant if said condition holds true, on line 2165 & 2164
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
@brammool Ah, didn't notice!
My question in regards to the redundancy:
#endif
)
{
int src_taken, dst_made;
/* Use a static buffer to avoid large amounts of de/allocations */
if (utf8_len < len)
{
utf8_buffer = realloc(utf8_buffer, len * MB_LEN_MAX);
utf8_len = len;
}
PxTranslateToUTF(
charset_translate,
s,
len,
&src_taken,
utf8_buffer,
utf8_len,
&dst_made);
s = utf8_buffer;
len = dst_made;
}
PgDrawText(s, len, &pos, 0);
Q1
We create the variable dst_made on line 2148, then assign len on line 2166, considering it's existence unaltered before, is this line not redundant?
Q2
If the condition on line 5151 is met, and we have the utf8_buffer on line 5153,
isn't the assignment of s unneeded? Because as is the same if the condition returns false. utf8_buffer maintains its NULL or realloc data in the end, renamings a bit strange.
—
Closed #795.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
i am closing this.
—
You are receiving this because you are subscribed to this thread.