loboris / ESP32_TFT_library

Full featured TFT library for ESP32 with demo application
553 stars 219 forks source link

load_file_font #19

Open nottledim opened 6 years ago

nottledim commented 6 years ago

First time I've seen a "goto" in code for a long time. Guess what - there a bug!

in component/tft/tft.c

If, for some reason the file size check (or one of the other tests) fails after the file is opened it's essential that the file closed otherwise spiffs quickly runs out of file handles.

adding a close(fhndl) after the exit label helps.

loboris commented 6 years ago

Thank you for reporting this. The file should be opened after the size check. It is closed imediately after reading, so there is no need to close it after exit label.

nottledim commented 6 years ago

That's a better solution, thanks

nottledim commented 6 years ago

Whilst you're fixing that would you consider making error numbers reported by compile_font_file and load_file_font unique. Also perhaps print err as well err_msg in penultimate line of compile_font_file. Thanks.