# HG changeset patch # User nicodvb # Date 1116171537 0 # Node ID c4af653727ebb33c9490cb9630cf229f37b898d6 # Parent 5e06ac013a061b3c8b8c91f4f7d3b59ded47485b better implementation of read() diff -r 5e06ac013a06 -r c4af653727eb libmpdemux/cue_read.c --- a/libmpdemux/cue_read.c Sun May 15 14:36:28 2005 +0000 +++ b/libmpdemux/cue_read.c Sun May 15 15:38:57 2005 +0000 @@ -168,6 +168,7 @@ /* get the filename out of that */ /* 12345 6 */ + mp_msg (MSGT_OPEN,MSGL_INFO, "[bincue] cue_find_bin(%s)\n", firstline); if (strncmp(firstline, "FILE \"",6)==0) { i = 0; @@ -324,9 +325,9 @@ if (*t == '\0') strcpy(t, "/"); } - mp_msg(MSGT_OPEN,MSGL_V,"dirname: %s\n", t); + strlcpy(bincue_path,t,sizeof( bincue_path )); - + mp_msg(MSGT_OPEN,MSGL_V,"dirname: %s, cuepath: %s\n", t, bincue_path); /* no path at all? */ if (strcmp(bincue_path, ".") == 0) { @@ -497,7 +498,6 @@ static int cue_vcd_read(stream_t *stream, char *mem, int size) { unsigned long position; int track = cue_current_pos.track - 1; - unsigned char tmp[VCD_SECTOR_OFFS]; position = tracks[track].start_offset + (cue_msf_2_sector(cue_current_pos.minute, @@ -510,16 +510,11 @@ if(position >= tracks[track+1].start_offset) return 0; - if(lseek(fd_bin, position, SEEK_SET) == -1) { + if(lseek(fd_bin, position+VCD_SECTOR_OFFS, SEEK_SET) == -1) { mp_msg(MSGT_OPEN,MSGL_ERR, "[bincue] unexpected end of bin file\n"); return 0; } - if(read(fd_bin, tmp, VCD_SECTOR_OFFS) != VCD_SECTOR_OFFS) { - mp_msg(MSGT_OPEN,MSGL_ERR, "[bincue] couldn't skip %d bytes before payload\n", VCD_SECTOR_OFFS); - return 0; - } - if(read(fd_bin, mem, VCD_SECTOR_DATA) != VCD_SECTOR_DATA) { mp_msg(MSGT_OPEN,MSGL_ERR, "[bincue] couldn't read %d bytes of payload\n", VCD_SECTOR_DATA); return 0;