summaryrefslogtreecommitdiff
path: root/apps/cuesheet.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/cuesheet.c')
-rw-r--r--apps/cuesheet.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/apps/cuesheet.c b/apps/cuesheet.c
index 45354ad14d..a9169d4494 100644
--- a/apps/cuesheet.c
+++ b/apps/cuesheet.c
@@ -222,22 +222,25 @@ bool parse_cuesheet(struct cuesheet_file *cue_file, struct cuesheet *cue)
222 222
223 /* Look for a Unicode BOM */ 223 /* Look for a Unicode BOM */
224 unsigned char bom_read = 0; 224 unsigned char bom_read = 0;
225 read(fd, line, BOM_UTF_8_SIZE); 225 if (read(fd, line, BOM_UTF_8_SIZE) > 0)
226 if(!memcmp(line, BOM_UTF_8, BOM_UTF_8_SIZE))
227 { 226 {
228 char_enc = CHAR_ENC_UTF_8; 227 if(!memcmp(line, BOM_UTF_8, BOM_UTF_8_SIZE))
229 bom_read = BOM_UTF_8_SIZE; 228 {
230 } 229 char_enc = CHAR_ENC_UTF_8;
231 else if(!memcmp(line, BOM_UTF_16_LE, BOM_UTF_16_SIZE)) 230 bom_read = BOM_UTF_8_SIZE;
232 { 231 }
233 char_enc = CHAR_ENC_UTF_16_LE; 232 else if(!memcmp(line, BOM_UTF_16_LE, BOM_UTF_16_SIZE))
234 bom_read = BOM_UTF_16_SIZE; 233 {
235 } 234 char_enc = CHAR_ENC_UTF_16_LE;
236 else if(!memcmp(line, BOM_UTF_16_BE, BOM_UTF_16_SIZE)) 235 bom_read = BOM_UTF_16_SIZE;
237 { 236 }
238 char_enc = CHAR_ENC_UTF_16_BE; 237 else if(!memcmp(line, BOM_UTF_16_BE, BOM_UTF_16_SIZE))
239 bom_read = BOM_UTF_16_SIZE; 238 {
239 char_enc = CHAR_ENC_UTF_16_BE;
240 bom_read = BOM_UTF_16_SIZE;
241 }
240 } 242 }
243
241 if (bom_read < BOM_UTF_8_SIZE) 244 if (bom_read < BOM_UTF_8_SIZE)
242 lseek(fd, cue_file->pos + bom_read, SEEK_SET); 245 lseek(fd, cue_file->pos + bom_read, SEEK_SET);
243 if (is_embedded) 246 if (is_embedded)