Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ExportDataAsCode not considering some characters for variable name #3824

Closed
wants to merge 1 commit into from
Closed

Fix ExportDataAsCode not considering some characters for variable name #3824

wants to merge 1 commit into from

Conversation

lauchimoon
Copy link
Contributor

With a fileName argument like my-image.png.h, the output inside my-image.png.h looks like this:

#define MY-IMAGE.PNG_DATA_SIZE     119076

static unsigned char MY-IMAGE.PNG_DATA[MY-IMAGE.PNG_DATA_SIZE] = ...

This commit checks if characters such as -, ., ? and ! are present in varFileName and replaces them with _, so my-image.png.h would be

#define MY_IMAGE_PNG_DATA_SIZE     119076

static unsigned char MY_IMAGE_PNG_DATA[MY_IMAGE_PNG_DATA_SIZE] = ...

@Peter0x44
Copy link
Contributor

I think you have not considered enough. Filenames beginning with '+' are also not okay, as an example.
There are also multiple ExportXAsCode functions where this needs to be considered.
See #3814 as well.

@lauchimoon
Copy link
Contributor Author

Right, I checked Ray's decision on this topic and will close the pr. Thanks!

@lauchimoon lauchimoon closed this Feb 25, 2024
@raysan5
Copy link
Owner

raysan5 commented Feb 26, 2024

@lauchimoon I finally decided to implement this change, I merged a similar PR (#3832) but I think yours is better, please, could you resent it?

@lauchimoon lauchimoon reopened this Feb 26, 2024
@lauchimoon
Copy link
Contributor Author

Hi @raysan5, sure thing! If there's any other functions I should modify please lmk :)

@lauchimoon
Copy link
Contributor Author

lauchimoon commented Feb 26, 2024

Will open a new PR because I've made a mess with the conflicts...

@lauchimoon lauchimoon closed this Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants