Reduce complation warnings via changes in pbatard branch

This commit is contained in:
R. Bernstein
2012-03-03 19:52:41 -05:00
parent e5ac559bcd
commit b1d2146ab4
5 changed files with 43 additions and 43 deletions

View File

@@ -133,7 +133,7 @@ mciSendCommand_aspi(int id, UINT msg, DWORD flags, void *arg)
{ {
MCIERROR mci_error; MCIERROR mci_error;
mci_error = mciSendCommand(id, msg, flags, (DWORD)arg); mci_error = mciSendCommand(id, msg, flags, (DWORD_PTR)arg);
if ( mci_error ) { if ( mci_error ) {
char error[256]; char error[256];
@@ -445,7 +445,7 @@ init_aspi (_img_private_t *env)
if( ( srbGDEVBlock.SRB_Status == SS_COMP ) && if( ( srbGDEVBlock.SRB_Status == SS_COMP ) &&
( srbGDEVBlock.SRB_DeviceType == DTYPE_CDROM ) ) { ( srbGDEVBlock.SRB_DeviceType == DTYPE_CDROM ) ) {
env->i_sid = MAKEWORD( i_adapter, i_target ); env->i_sid = MAKEWORD( i_adapter, i_target );
env->hASPI = (long)hASPI; env->hASPI = hASPI;
env->lpSendCommand = lpSendCommand; env->lpSendCommand = lpSendCommand;
env->b_aspi_init = true; env->b_aspi_init = true;
env->i_lun = i_lun; env->i_lun = i_lun;
@@ -785,7 +785,6 @@ get_track_format_aspi(const _img_private_t *p_env, track_t track_num)
MCI_OPEN_PARMS op; MCI_OPEN_PARMS op;
MCI_STATUS_PARMS st; MCI_STATUS_PARMS st;
DWORD i_flags; DWORD i_flags;
int ret;
memset( &op, 0, sizeof(MCI_OPEN_PARMS) ); memset( &op, 0, sizeof(MCI_OPEN_PARMS) );
op.lpstrDeviceType = (LPCSTR)MCI_DEVTYPE_CD_AUDIO; op.lpstrDeviceType = (LPCSTR)MCI_DEVTYPE_CD_AUDIO;
@@ -799,7 +798,7 @@ get_track_format_aspi(const _img_private_t *p_env, track_t track_num)
st.dwItem = MCI_CDA_STATUS_TYPE_TRACK; st.dwItem = MCI_CDA_STATUS_TYPE_TRACK;
st.dwTrack = track_num; st.dwTrack = track_num;
i_flags = MCI_TRACK | MCI_STATUS_ITEM ; i_flags = MCI_TRACK | MCI_STATUS_ITEM ;
ret = mciSendCommand_aspi( op.wDeviceID, MCI_STATUS, i_flags, &st ); mciSendCommand_aspi( op.wDeviceID, MCI_STATUS, i_flags, &st );
/* Release access to the device */ /* Release access to the device */
mciSendCommand_aspi( op.wDeviceID, MCI_CLOSE, MCI_WAIT, 0 ); mciSendCommand_aspi( op.wDeviceID, MCI_CLOSE, MCI_WAIT, 0 );

View File

@@ -227,7 +227,7 @@ cdtext_data_init(cdtext_t *p_cdtext, uint8_t *wdata, size_t i_data)
memset( buffer, 0x00, sizeof(buffer) ); memset( buffer, 0x00, sizeof(buffer) );
idx = 0; idx = 0;
bzero(&p_blocksize, sizeof(CDText_blocksize_t)); memset( &p_blocksize, 0x00, sizeof(CDText_blocksize_t) );
p_data = (CDText_data_t *) wdata; p_data = (CDText_data_t *) wdata;
if (0 != i_data % sizeof(CDText_data_t)) { if (0 != i_data % sizeof(CDText_data_t)) {

View File

@@ -1,5 +1,5 @@
/* /*
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008, 2011 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008, 2011, 2012
Rocky Bernstein <rocky@gnu.org> Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
cue parsing routine adapted from cuetools cue parsing routine adapted from cuetools
@@ -51,6 +51,12 @@
#ifdef HAVE_GLOB_H #ifdef HAVE_GLOB_H
#include <glob.h> #include <glob.h>
#endif #endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#else
#define PRId64 "lld"
#endif
#include <ctype.h> #include <ctype.h>
#include "filemode.h" #include "filemode.h"
@@ -130,12 +136,12 @@ _lseek_bincue (void *p_user_data, off_t offset, int whence)
track_info_t *this_track=&(p_env->tocent[i]); track_info_t *this_track=&(p_env->tocent[i]);
p_env->pos.index = i; p_env->pos.index = i;
if ( (this_track->sec_count*this_track->datasize) >= offset) { if ( (this_track->sec_count*this_track->datasize) >= offset) {
int blocks = offset / this_track->datasize; int blocks = (int) (offset / this_track->datasize);
int rem = offset % this_track->datasize; int rem = (int) (offset % this_track->datasize);
int block_offset = blocks * this_track->blocksize; off_t block_offset = blocks * this_track->blocksize;
real_offset += block_offset + rem; real_offset += block_offset + rem;
p_env->pos.buff_offset = rem; p_env->pos.buff_offset = rem;
p_env->pos.lba += blocks; p_env->pos.lba += (lba_t) blocks;
break; break;
} }
real_offset += this_track->sec_count*this_track->blocksize; real_offset += this_track->sec_count*this_track->blocksize;
@@ -171,7 +177,7 @@ _read_bincue (void *p_user_data, void *data, size_t size)
ssize_t skip_size = this_track->datastart + this_track->endsize; ssize_t skip_size = this_track->datastart + this_track->endsize;
while (size > 0) { while (size > 0) {
long int rem = this_track->datasize - p_env->pos.buff_offset; long int rem = (long int) (this_track->datasize - p_env->pos.buff_offset);
if ((long int) size <= rem) { if ((long int) size <= rem) {
this_size = cdio_stream_read(p_env->gen.data_source, buf, size, 1); this_size = cdio_stream_read(p_env->gen.data_source, buf, size, 1);
final_size += this_size; final_size += this_size;
@@ -214,14 +220,14 @@ static lsn_t
get_disc_last_lsn_bincue (void *p_user_data) get_disc_last_lsn_bincue (void *p_user_data)
{ {
_img_private_t *p_env = p_user_data; _img_private_t *p_env = p_user_data;
long size; off_t size;
size = cdio_stream_stat (p_env->gen.data_source); size = cdio_stream_stat (p_env->gen.data_source);
if (size % CDIO_CD_FRAMESIZE_RAW) if (size % CDIO_CD_FRAMESIZE_RAW)
{ {
cdio_warn ("image %s size (%ld) not multiple of blocksize (%d)", cdio_warn ("image %s size (%" PRId64 ") not multiple of blocksize (%d)",
p_env->gen.source_name, size, CDIO_CD_FRAMESIZE_RAW); p_env->gen.source_name, (int64_t)size, CDIO_CD_FRAMESIZE_RAW);
if (size % M2RAW_SECTOR_SIZE == 0) if (size % M2RAW_SECTOR_SIZE == 0)
cdio_warn ("this may be a 2336-type disc image"); cdio_warn ("this may be a 2336-type disc image");
else if (size % CDIO_CD_FRAMESIZE_RAW == 0) else if (size % CDIO_CD_FRAMESIZE_RAW == 0)
@@ -231,7 +237,7 @@ get_disc_last_lsn_bincue (void *p_user_data)
size /= CDIO_CD_FRAMESIZE_RAW; size /= CDIO_CD_FRAMESIZE_RAW;
return size; return (lsn_t)size;
} }
#define MAXLINE 4096 /* maximum line length + 1 */ #define MAXLINE 4096 /* maximum line length + 1 */
@@ -328,7 +334,6 @@ parse_cuefile (_img_private_t *cd, const char *psz_cue_name)
if(NULL != (psz_field = strtok (NULL, "\"\t\n\r"))) { if(NULL != (psz_field = strtok (NULL, "\"\t\n\r"))) {
if (cd) { if (cd) {
uint8_t cdt_data[MAX_CDTEXT_DATA_LENGTH+4]; uint8_t cdt_data[MAX_CDTEXT_DATA_LENGTH+4];
uint8_t *ptr;
int size; int size;
CdioDataSource_t *source; CdioDataSource_t *source;
const char *dirname = cdio_dirname(psz_cue_name); const char *dirname = cdio_dirname(psz_cue_name);
@@ -347,11 +352,8 @@ parse_cuefile (_img_private_t *cd, const char *psz_cue_name)
/* cut header */ /* cut header */
if (cdt_data[0] > 0x80) { if (cdt_data[0] > 0x80) {
ptr = &cdt_data[4];
size -= 4; size -= 4;
} }
else
ptr = cdt_data;
/* init cdtext */ /* init cdtext */
if (NULL == cd->gen.cdtext) { if (NULL == cd->gen.cdtext) {

View File

@@ -1,5 +1,5 @@
/* /*
Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011, 2012
Rocky Bernstein <rocky@gnu.org> Rocky Bernstein <rocky@gnu.org>
toc reading routine adapted from cuetools toc reading routine adapted from cuetools
Copyright (C) 2003 Svend Sanjay Sorensen <ssorensen@fastmail.fm> Copyright (C) 2003 Svend Sanjay Sorensen <ssorensen@fastmail.fm>
@@ -54,6 +54,11 @@
#ifdef HAVE_ERRNO_H #ifdef HAVE_ERRNO_H
#include <errno.h> #include <errno.h>
#endif #endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#else
#define PRId64 "lld"
#endif
#include <ctype.h> #include <ctype.h>
@@ -72,13 +77,13 @@ static bool parse_tocfile (_img_private_t *cd, const char *p_toc_name);
static bool static bool
check_track_is_blocksize_multiple(const char *psz_fname, check_track_is_blocksize_multiple(const char *psz_fname,
track_t i_track, long i_size, track_t i_track, off_t i_size,
uint16_t i_blocksize) uint16_t i_blocksize)
{ {
if (i_size % i_blocksize) { if (i_size % i_blocksize) {
cdio_info ("image %s track %d size (%ld) not a multiple" cdio_info ("image %s track %d size (%" PRId64 ") not a multiple"
" of the blocksize (%ld)", " of the blocksize (%ld)",
psz_fname ? psz_fname : "unknown??", i_track, i_size, psz_fname ? psz_fname : "unknown??", i_track, (int64_t)i_size,
(long int) i_blocksize); (long int) i_blocksize);
if (i_size % M2RAW_SECTOR_SIZE == 0) if (i_size % M2RAW_SECTOR_SIZE == 0)
cdio_info ("this may be a 2336-type disc image"); cdio_info ("this may be a 2336-type disc image");
@@ -150,12 +155,12 @@ _lseek_cdrdao (void *user_data, off_t offset, int whence)
track_info_t *this_track=&(env->tocent[i]); track_info_t *this_track=&(env->tocent[i]);
env->pos.index = i; env->pos.index = i;
if ( (this_track->sec_count*this_track->datasize) >= offset) { if ( (this_track->sec_count*this_track->datasize) >= offset) {
int blocks = offset / this_track->datasize; int blocks = (int) (offset / this_track->datasize);
int rem = offset % this_track->datasize; int rem = (int) (offset % this_track->datasize);
int block_offset = blocks * this_track->blocksize; off_t block_offset = blocks * this_track->blocksize;
real_offset += block_offset + rem; real_offset += block_offset + rem;
env->pos.buff_offset = rem; env->pos.buff_offset = rem;
env->pos.lba += blocks; env->pos.lba += (lba_t)blocks;
break; break;
} }
real_offset += this_track->sec_count*this_track->blocksize; real_offset += this_track->sec_count*this_track->blocksize;
@@ -191,7 +196,7 @@ _read_cdrdao (void *user_data, void *data, size_t size)
ssize_t skip_size = this_track->datastart + this_track->endsize; ssize_t skip_size = this_track->datastart + this_track->endsize;
while (size > 0) { while (size > 0) {
int rem = this_track->datasize - env->pos.buff_offset; int rem = (int) (this_track->datasize - env->pos.buff_offset);
if (size <= rem) { if (size <= rem) {
this_size = cdio_stream_read(this_track->data_source, buf, size, 1); this_size = cdio_stream_read(this_track->data_source, buf, size, 1);
final_size += this_size; final_size += this_size;
@@ -239,7 +244,7 @@ get_disc_last_lsn_cdrdao (void *p_user_data)
_img_private_t *p_env = p_user_data; _img_private_t *p_env = p_user_data;
track_t i_leadout = p_env->gen.i_tracks; track_t i_leadout = p_env->gen.i_tracks;
uint16_t i_blocksize = p_env->tocent[i_leadout-1].blocksize; uint16_t i_blocksize = p_env->tocent[i_leadout-1].blocksize;
long i_size; off_t i_size;
if (p_env->tocent[i_leadout-1].sec_count) { if (p_env->tocent[i_leadout-1].sec_count) {
i_size = p_env->tocent[i_leadout-1].sec_count; i_size = p_env->tocent[i_leadout-1].sec_count;
@@ -261,7 +266,7 @@ get_disc_last_lsn_cdrdao (void *p_user_data)
if (i_size < 0) { if (i_size < 0) {
cdio_error ("Disc data size too small for track specification in image %s", cdio_error ("Disc data size too small for track specification in image %s",
p_env->gen.source_name); p_env->gen.source_name);
return i_size; return (lsn_t)i_size;
} }
if (check_track_is_blocksize_multiple(p_env->tocent[i_leadout-1].filename, if (check_track_is_blocksize_multiple(p_env->tocent[i_leadout-1].filename,
i_leadout-1, i_size, i_blocksize)) { i_leadout-1, i_size, i_blocksize)) {
@@ -275,7 +280,7 @@ get_disc_last_lsn_cdrdao (void *p_user_data)
i_size += p_env->tocent[i_leadout-1].start_lba; i_size += p_env->tocent[i_leadout-1].start_lba;
i_size -= CDIO_PREGAP_SECTORS; i_size -= CDIO_PREGAP_SECTORS;
return i_size; return (lsn_t)i_size;
} }
#define MAXLINE 512 #define MAXLINE 512
@@ -678,8 +683,6 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
|| 0 == strcmp ("AUDIOFILE", psz_keyword)) { || 0 == strcmp ("AUDIOFILE", psz_keyword)) {
if (0 <= i) { if (0 <= i) {
if (NULL != (psz_field = strtok (NULL, "\"\t\n\r"))) { if (NULL != (psz_field = strtok (NULL, "\"\t\n\r"))) {
long i_size;
/* Handle "<filename>" */ /* Handle "<filename>" */
if (cd) { if (cd) {
const char *dirname = cdio_dirname(psz_cue_name); const char *dirname = cdio_dirname(psz_cue_name);
@@ -692,7 +695,6 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
psz_cue_name, i_line, psz_field); psz_cue_name, i_line, psz_field);
goto err_exit; goto err_exit;
} }
i_size = cdio_stream_stat(cd->tocent[i].data_source);
} else { } else {
CdioDataSource_t *s = cdio_stdio_new (psz_field); CdioDataSource_t *s = cdio_stdio_new (psz_field);
if (!s) { if (!s) {
@@ -701,7 +703,6 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
psz_cue_name, i_line, psz_field); psz_cue_name, i_line, psz_field);
goto err_exit; goto err_exit;
} }
i_size = cdio_stream_stat(s);
cdio_stdio_destroy (s); cdio_stdio_destroy (s);
} }
} }
@@ -730,7 +731,7 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
goto err_exit; goto err_exit;
} }
if (cd) { if (cd) {
long i_size = cdio_stream_stat(cd->tocent[i].data_source); off_t i_size = cdio_stream_stat(cd->tocent[i].data_source);
if (lba) { if (lba) {
if ( (lba * cd->tocent[i].datasize) > i_size) { if ( (lba * cd->tocent[i].datasize) > i_size) {
cdio_log(log_level, cdio_log(log_level,
@@ -739,7 +740,7 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
goto err_exit; goto err_exit;
} }
} else { } else {
lba = i_size / cd->tocent[i].blocksize; lba = (lba_t) (i_size / cd->tocent[i].blocksize);
} }
cd->tocent[i].sec_count = lba; cd->tocent[i].sec_count = lba;
} }
@@ -819,14 +820,14 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
if (cd) { if (cd) {
if (i) { if (i) {
uint16_t i_blocksize = cd->tocent[i-1].blocksize; uint16_t i_blocksize = cd->tocent[i-1].blocksize;
long i_size = off_t i_size =
cdio_stream_stat(cd->tocent[i-1].data_source); cdio_stream_stat(cd->tocent[i-1].data_source);
check_track_is_blocksize_multiple(cd->tocent[i-1].filename, check_track_is_blocksize_multiple(cd->tocent[i-1].filename,
i-1, i_size, i_blocksize); i-1, i_size, i_blocksize);
/* Append size of previous datafile. */ /* Append size of previous datafile. */
cd->tocent[i].start_lba = cd->tocent[i-1].start_lba + cd->tocent[i].start_lba = (lba_t) (cd->tocent[i-1].start_lba +
(i_size / i_blocksize); (i_size / i_blocksize));
} }
cd->tocent[i].offset = 0; cd->tocent[i].offset = 0;
cd->tocent[i].start_lba += CDIO_PREGAP_SECTORS; cd->tocent[i].start_lba += CDIO_PREGAP_SECTORS;

View File

@@ -333,7 +333,7 @@ mmc_read_cdtext_private ( void *p_user_data,
generic_img_private_t *p_env = p_user_data; generic_img_private_t *p_env = p_user_data;
mmc_cdb_t cdb = {{0, }}; mmc_cdb_t cdb = {{0, }};
unsigned char * wdata; unsigned char * wdata;
int i_status, i_errno; int i_status;
if ( ! p_env || ! run_mmc_cmd || p_env->b_cdtext_error ) if ( ! p_env || ! run_mmc_cmd || p_env->b_cdtext_error )
return false; return false;
@@ -361,7 +361,6 @@ mmc_read_cdtext_private ( void *p_user_data,
if (i_status != 0) { if (i_status != 0) {
cdio_info ("CD-Text read failed for header: %s\n", strerror(errno)); cdio_info ("CD-Text read failed for header: %s\n", strerror(errno));
i_errno = errno;
p_env->b_cdtext_error = true; p_env->b_cdtext_error = true;
free(wdata); free(wdata);
return NULL; return NULL;
@@ -383,7 +382,6 @@ mmc_read_cdtext_private ( void *p_user_data,
i_cdtext, wdata); i_cdtext, wdata);
if (i_status != 0) { if (i_status != 0) {
cdio_info ("CD-Text read for text failed: %s\n", strerror(errno)); cdio_info ("CD-Text read for text failed: %s\n", strerror(errno));
i_errno = errno;
p_env->b_cdtext_error = true; p_env->b_cdtext_error = true;
free(wdata); free(wdata);
return NULL; return NULL;