diff options
| author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2008-08-02 20:39:03 +0000 |
|---|---|---|
| committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2008-08-02 20:39:03 +0000 |
| commit | 02103a2fa701954e42c8081fccf75eea26f52ce8 (patch) | |
| tree | 8055c7c0b7e3fa710e07a19928ec8c46d6a08d1d /apps/gui | |
| parent | 6485d6d3ba999e8cacde267a30c8415959fcfc79 (diff) | |
| download | rockbox-02103a2fa701954e42c8081fccf75eea26f52ce8.zip rockbox-02103a2fa701954e42c8081fccf75eea26f52ce8.tar.gz rockbox-02103a2fa701954e42c8081fccf75eea26f52ce8.tar.bz2 rockbox-02103a2fa701954e42c8081fccf75eea26f52ce8.tar.xz | |
Unify opening of utf-8 files (FS#6203). This also adds ignoring the BOM in several places it has been missing (as FS#6071).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18185 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
| -rw-r--r-- | apps/gui/wps_parser.c | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c index 88a237c..714c419 100644 --- a/apps/gui/wps_parser.c +++ b/apps/gui/wps_parser.c @@ -1527,19 +1527,6 @@ static bool 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, @@ -1604,7 +1591,7 @@ bool wps_data_load(struct wps_data *wps_data, #endif #endif /* __PCTOOL__ */ - int fd = open(buf, O_RDONLY); + int fd = open_utf8(buf, O_RDONLY); if (fd < 0) return false; @@ -1639,9 +1626,6 @@ bool wps_data_load(struct wps_data *wps_data, memset(bmp_names, 0, sizeof(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)) { wps_reset(wps_data); |