Skip to content

Conversation

@flaviut
Copy link

@flaviut flaviut commented Aug 26, 2018

As a bonus feature, also report the error code when loading an object

As a bonus feature, also report the error code when loading an object
if (!f) return -1;

int address = 0;
while (!feof(f))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This loop will happily try to write megabytes of stuff into memory.. it would probably be a good idea to limit read to the actual target buffer size.

FILE *f;
if (aFilename == 0 || aFilename[0] == 0)
return -1;
f = fopen(aFilename, "r");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use mode "rb" instead of "r", otherwise windows targets will just load garbage.

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.

2 participants