[MPlayer-cvslog] r25805 - trunk/stream/stream_cddb.c
Ulion
ulion2002 at gmail.com
Sun Jan 20 16:52:17 CET 2008
2008/1/20, reimar <subversion at mplayerhq.hu>:
> Author: reimar
> Date: Sat Jan 19 17:41:35 2008
> New Revision: 25805
>
> Log:
> Cached file must be 0-terminated since we use string processing functions on it
>
>
> Modified:
> trunk/stream/stream_cddb.c
>
> Modified: trunk/stream/stream_cddb.c
> ==============================================================================
> --- trunk/stream/stream_cddb.c (original)
> +++ trunk/stream/stream_cddb.c Sat Jan 19 17:41:35 2008
> @@ -338,10 +338,10 @@ cddb_read_cache(cddb_data_t *cddb_data)
> perror("fstat");
> file_size = 4096;
> } else {
> - file_size = stats.st_size;
> + file_size = stats.st_size < UINT_MAX ? stats.st_size : UINT_MAX - 1;
> }
>
> - cddb_data->xmcd_file = malloc(file_size);
> + cddb_data->xmcd_file = malloc(file_size+1);
> if( cddb_data->xmcd_file==NULL ) {
> mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MemAllocFailed);
> close(file_fd);
> @@ -353,6 +353,7 @@ cddb_read_cache(cddb_data_t *cddb_data)
> close(file_fd);
> return -1;
> }
> + cddb_data->xmcd_file[cddb_data->xmcd_file_size] = 0;
>
> close(file_fd);
This change seems break my compilation:
stream_cddb.c: In function 'cddb_read_cache':
stream_cddb.c:341: error: 'UINT_MAX' undeclared (first use in this function)
stream_cddb.c:341: error: (Each undeclared identifier is reported only once
stream_cddb.c:341: error: for each function it appears in.)
--
Ulion
More information about the MPlayer-cvslog
mailing list