mirror of https://github.com/raysan5/raylib
Change sanitization check for `ExportDataAsCode` (#3837)
* Change sanitization check for `ExportDataAsCode` I opted to use `isalnum` function since it should handle most cases. It cannot however handle cases of files beginning with numbers. * Update `ExportDataAsCode` condition * Reinsert comment on `ExportDataAsCode`
This commit is contained in:
parent
074fbb0264
commit
f0807d2be1
|
@ -320,8 +320,8 @@ bool ExportDataAsCode(const unsigned char *data, int dataSize, const char *fileN
|
||||||
{
|
{
|
||||||
// Convert variable name to uppercase
|
// Convert variable name to uppercase
|
||||||
if ((varFileName[i] >= 'a') && (varFileName[i] <= 'z')) { varFileName[i] = varFileName[i] - 32; }
|
if ((varFileName[i] >= 'a') && (varFileName[i] <= 'z')) { varFileName[i] = varFileName[i] - 32; }
|
||||||
// Replace '-' (non valid character for C identifier with '_')
|
// Replace non valid character for C identifier with '_'
|
||||||
if (varFileName[i] == '-') { varFileName[i] = '_'; }
|
else if (varFileName[i] == '.' || varFileName[i] == '-' || varFileName[i] == '?' || varFileName[i] == '!' || varFileName[i] == '+') { varFileName[i] = '_'; }
|
||||||
}
|
}
|
||||||
|
|
||||||
byteCount += sprintf(txtData + byteCount, "#define %s_DATA_SIZE %i\n\n", varFileName, dataSize);
|
byteCount += sprintf(txtData + byteCount, "#define %s_DATA_SIZE %i\n\n", varFileName, dataSize);
|
||||||
|
|
Loading…
Reference in New Issue