diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index 42ba17ad11..62a068f21d 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -60,21 +60,6 @@ /* 3% of 30min file == 54s step size */ #define MIN_FF_REWIND_STEP 500 -#if 0 -/* Skip leading UTF-8 BOM, if present. */ -static char* skip_utf8_bom(char* buf) -{ - unsigned char* s = (unsigned char*) buf; - - if(s[0] == 0xef && s[1] == 0xbb && s[2] == 0xbf) - { - buf += 3; - } - - return buf; -} -#endif - /* draws the statusbar on the given wps-screen */ #ifdef HAVE_LCD_BITMAP void gui_wps_statusbar_draw(struct gui_wps *wps, bool force) diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c index b2969ecb34..3a85b5fad5 100644 --- a/apps/gui/wps_parser.c +++ b/apps/gui/wps_parser.c @@ -671,7 +671,7 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr) char *current_string = data->string_buffer; while(*wps_bufptr && data->num_tokens < WPS_MAX_TOKENS - 1 - && data->num_lines < WPS_MAX_LINES) + && data->num_lines < WPS_MAX_LINES) { switch(*wps_bufptr++) { @@ -906,6 +906,19 @@ static void load_wps_bitmaps(struct wps_data *wps_data, char *bmpdir) #endif /* HAVE_LCD_BITMAP */ +/* Skip leading UTF-8 BOM, if present. */ +static char *skip_utf8_bom(char *buf) +{ + unsigned char *s = (unsigned char *)buf; + + if(s[0] == 0xef && s[1] == 0xbb && s[2] == 0xbf) + { + buf += 3; + } + + return buf; +} + /* to setup up the wps-data from a format-buffer (isfile = false) from a (wps-)file (isfile = true)*/ bool wps_data_load(struct wps_data *wps_data, @@ -975,6 +988,9 @@ bool wps_data_load(struct wps_data *wps_data, clear_bmp_names(); #endif + /* Skip leading UTF-8 BOM, if present. */ + wps_buffer = skip_utf8_bom(wps_buffer); + /* parse the WPS source */ if (!wps_parse(wps_data, wps_buffer)) return false;