Remove more warnings. test/testnrg.c.in -> test/driver/nrg.c.in

This commit is contained in:
R. Bernstein
2010-01-21 02:58:19 -05:00
parent cda73dfa47
commit 2b4a36f758
9 changed files with 100 additions and 49 deletions

View File

@@ -663,10 +663,10 @@ AC_CONFIG_FILES([
test/data/Makefile \ test/data/Makefile \
test/driver/Makefile \ test/driver/Makefile \
test/driver/bincue.c \ test/driver/bincue.c \
test/driver/nrg.c \
test/testgetdevices.c \ test/testgetdevices.c \
test/testisocd2.c \ test/testisocd2.c \
test/testpregap.c \ test/testpregap.c \
test/testnrg.c \
test/check_common_fn \ test/check_common_fn \
test/Makefile \ test/Makefile \
]) ])

View File

@@ -65,10 +65,11 @@ put_num(long int num, int f, int bytes)
/* Write a the header for a WAV file. */ /* Write a the header for a WAV file. */
static void static void
write_WAV_header(int fd, int32_t i_bytecount){ write_WAV_header(int fd, int32_t i_bytecount){
ssize_t bytes_ret;
/* quick and dirty */ /* quick and dirty */
writestr(fd, "RIFF"); /* 0-3 */ bytes_ret = writestr(fd, "RIFF"); /* 0-3 */
put_num(i_bytecount+44-8, fd, 4); /* 4-7 */ put_num(i_bytecount+44-8, fd, 4); /* 4-7 */
writestr(fd, "WAVEfmt "); /* 8-15 */ bytes_ret = writestr(fd, "WAVEfmt "); /* 8-15 */
put_num(16, fd, 4); /* 16-19 */ put_num(16, fd, 4); /* 16-19 */
put_num(1, fd, 2); /* 20-21 */ put_num(1, fd, 2); /* 20-21 */
put_num(2, fd, 2); /* 22-23 */ put_num(2, fd, 2); /* 22-23 */
@@ -76,7 +77,7 @@ write_WAV_header(int fd, int32_t i_bytecount){
put_num(44100*2*2, fd, 4); /* 28-31 */ put_num(44100*2*2, fd, 4); /* 28-31 */
put_num(4, fd, 2); /* 32-33 */ put_num(4, fd, 2); /* 32-33 */
put_num(16, fd, 2); /* 34-35 */ put_num(16, fd, 2); /* 34-35 */
writestr(fd, "data"); /* 36-39 */ bytes_ret = writestr(fd, "data"); /* 36-39 */
put_num(i_bytecount, fd, 4); /* 40-43 */ put_num(i_bytecount, fd, 4); /* 40-43 */
} }
@@ -124,6 +125,7 @@ main(int argc, const char *argv[])
printf("Trouble getting starting LSN\n"); printf("Trouble getting starting LSN\n");
} else { } else {
lsn_t i_cursor; lsn_t i_cursor;
ssize_t bytes_ret;
track_t i_track = cdda_sector_gettrack(d, i_first_lsn); track_t i_track = cdda_sector_gettrack(d, i_first_lsn);
lsn_t i_last_lsn = cdda_track_lastsector(d, i_track); lsn_t i_last_lsn = cdda_track_lastsector(d, i_track);
int fd = creat("track1s.wav", 0644); int fd = creat("track1s.wav", 0644);
@@ -157,7 +159,7 @@ main(int argc, const char *argv[])
printf("paranoia read error. Stopping.\n"); printf("paranoia read error. Stopping.\n");
break; break;
} }
write(fd, p_readbuf, CDIO_CD_FRAMESIZE_RAW); bytes_ret = write(fd, p_readbuf, CDIO_CD_FRAMESIZE_RAW);
} }
close(fd); close(fd);
} }

View File

@@ -1,7 +1,7 @@
/* /*
$Id: utils.c,v 1.4 2008/04/16 17:00:41 karl Exp $ $Id: utils.c,v 1.4 2008/04/16 17:00:41 karl Exp $
Copyright (C) 2004, 2008 Rocky Bernstein <rocky@gnu.org> Copyright (C) 2004, 2008, 2010 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 1998 Monty xiphmont@mit.edu Copyright (C) 1998 Monty xiphmont@mit.edu
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
@@ -18,15 +18,22 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "common_interface.h" #include "common_interface.h"
#include "utils.h" #include "utils.h"
void void
cderror(cdrom_drive_t *d,const char *s) cderror(cdrom_drive_t *d,const char *s)
{ {
ssize_t bytes_ret;
if(s && d){ if(s && d){
switch(d->errordest){ switch(d->errordest){
case CDDA_MESSAGE_PRINTIT: case CDDA_MESSAGE_PRINTIT:
write(STDERR_FILENO,s,strlen(s)); bytes_ret = write(STDERR_FILENO, s, strlen(s));
if (strlen(s) != bytes_ret)
break; break;
case CDDA_MESSAGE_LOGIT: case CDDA_MESSAGE_LOGIT:
d->errorbuf=catstring(d->errorbuf,s); d->errorbuf=catstring(d->errorbuf,s);
@@ -40,10 +47,11 @@ cderror(cdrom_drive_t *d,const char *s)
void void
cdmessage(cdrom_drive_t *d, const char *s) cdmessage(cdrom_drive_t *d, const char *s)
{ {
ssize_t bytes_ret;
if(s && d){ if(s && d){
switch(d->messagedest){ switch(d->messagedest){
case CDDA_MESSAGE_PRINTIT: case CDDA_MESSAGE_PRINTIT:
write(STDERR_FILENO,s,strlen(s)); bytes_ret = write(STDERR_FILENO, s, strlen(s));
break; break;
case CDDA_MESSAGE_LOGIT: case CDDA_MESSAGE_LOGIT:
d->messagebuf=catstring(d->messagebuf,s); d->messagebuf=catstring(d->messagebuf,s);
@@ -73,13 +81,14 @@ idperror(int messagedest,char **messages,const char *f,
} }
if(buffer){ if(buffer){
ssize_t bytes_ret;
switch(messagedest){ switch(messagedest){
case CDDA_MESSAGE_PRINTIT: case CDDA_MESSAGE_PRINTIT:
write(STDERR_FILENO,buffer,strlen(buffer)); bytes_ret = write(STDERR_FILENO,buffer,strlen(buffer));
if(errno){ if(errno){
write(STDERR_FILENO,": ",2); bytes_ret = write(STDERR_FILENO,": ",2);
write(STDERR_FILENO,strerror(errno),strlen(strerror(errno))); bytes_ret = write(STDERR_FILENO,strerror(errno),strlen(strerror(errno)));
write(STDERR_FILENO,"\n",1); bytes_ret = write(STDERR_FILENO,"\n",1);
} }
break; break;
case CDDA_MESSAGE_LOGIT: case CDDA_MESSAGE_LOGIT:
@@ -119,10 +128,12 @@ idmessage(int messagedest,char **messages,const char *f,
} }
if(buffer) { if(buffer) {
ssize_t bytes_ret;
switch(messagedest){ switch(messagedest){
case CDDA_MESSAGE_PRINTIT: case CDDA_MESSAGE_PRINTIT:
write(STDERR_FILENO,buffer,strlen(buffer)); bytes_ret = write(STDERR_FILENO,buffer,strlen(buffer));
if(!malloced)write(STDERR_FILENO,"\n",1); if(!malloced)
bytes_ret = write(STDERR_FILENO,"\n",1);
break; break;
case CDDA_MESSAGE_LOGIT: case CDDA_MESSAGE_LOGIT:
if(messages){ if(messages){

View File

@@ -586,9 +586,10 @@ main(int argc, char *argv[])
if (opts.hexdump) if (opts.hexdump)
hexdump(output_stream, buffer, blocklen, opts.just_hex); hexdump(output_stream, buffer, blocklen, opts.just_hex);
else if (opts.output_file) else if (opts.output_file) {
write(output_fd, buffer, blocklen); ssize_t bytes_ret;
else { bytes_ret = write(output_fd, buffer, blocklen);
} else {
unsigned int i; unsigned int i;
for (i=0; i<blocklen; i++) printf("%c", buffer[i]); for (i=0; i<blocklen; i++) printf("%c", buffer[i]);
} }

View File

@@ -30,7 +30,7 @@ endif
hack = check_sizeof testassert testgetdevices testischar \ hack = check_sizeof testassert testgetdevices testischar \
testisocd testisocd2 testiso9660 test_lib_driver_util \ testisocd testisocd2 testiso9660 test_lib_driver_util \
testnrg $(testparanoia) testtoc testpregap $(testparanoia) testtoc testpregap
EXTRA_PROGRAMS = testdefault EXTRA_PROGRAMS = testdefault
DATA_DIR = @abs_top_srcdir@/test/data DATA_DIR = @abs_top_srcdir@/test/data
@@ -57,9 +57,6 @@ test_lib_driver_util_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
testpregap_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV) testpregap_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV)
testpregap_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\" testpregap_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
testnrg_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV)
testnrg_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
check_SCRIPTS = check_nrg.sh check_cue.sh check_cd_read.sh \ check_SCRIPTS = check_nrg.sh check_cue.sh check_cd_read.sh \
check_iso.sh check_fuzzyiso.sh check_paranoia.sh check_opts.sh check_iso.sh check_fuzzyiso.sh check_paranoia.sh check_opts.sh
# If we beefed this up so it checked to see if a CD-DA was loaded # If we beefed this up so it checked to see if a CD-DA was loaded
@@ -83,7 +80,7 @@ check_DATA = vcd_demo.right vcd_demo_vcdinfo.right \
EXTRA_DIST = $(check_SCRIPTS) $(check_DATA) \ EXTRA_DIST = $(check_SCRIPTS) $(check_DATA) \
check_common_fn check_cue.sh.in check_nrg.sh.in \ check_common_fn check_cue.sh.in check_nrg.sh.in \
testpregap.c.in testnrg.c.in \ testpregap.c.in \
testgetdevices.c.in check_iso.sh.in testgetdevices.c.in check_iso.sh.in
TESTS = $(check_PROGRAMS) $(check_SCRIPTS) TESTS = $(check_PROGRAMS) $(check_SCRIPTS)

View File

@@ -31,6 +31,9 @@ gnu_linux_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
mmc_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV) mmc_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV)
mmc_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\" mmc_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
nrg_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV)
nrg_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
osx_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV) osx_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV)
osx_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\" osx_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
@@ -40,14 +43,19 @@ solaris_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
win32_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV) win32_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV)
win32_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\" win32_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
hack = bincue freebsd gnu_linux mmc osx realpath solaris win32 check_PROGRAMS = \
check_PROGRAMS = $(hack) bincue freebsd gnu_linux mmc nrg \
osx realpath solaris win32
TESTS = $(check_PROGRAMS) TESTS = $(check_PROGRAMS)
EXTRA_DIST = bincue.c.in EXTRA_DIST = \
bincue.c.in \
nrg.c.in
MOSTLYCLEANFILES = core core.* *.dump cdda-orig.wav cdda-try.wav *.raw MOSTLYCLEANFILES = \
$(check_PROGRAMS) \
core core.* *.dump cdda-orig.wav cdda-try.wav *.raw
test: check-am test: check-am

View File

@@ -16,7 +16,7 @@
*/ */
/* /*
Regression test for BIN/CUE device driver. Regression test for BIN/CUE device driver: lib/driver/image/bincue.c.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
@@ -146,7 +146,6 @@ main(int argc, const char *argv[])
} }
} }
{ {
const char *psz_source = cdio_get_arg(p_cdio, "source"); const char *psz_source = cdio_get_arg(p_cdio, "source");
const char *psz_device = cdio_get_default_device(p_cdio); const char *psz_device = cdio_get_default_device(p_cdio);
@@ -155,7 +154,7 @@ main(int argc, const char *argv[])
fprintf(stderr, fprintf(stderr,
"cdio_get_arg(\"source\") should return \"%s\"; got: \"%s\".\n", "cdio_get_arg(\"source\") should return \"%s\"; got: \"%s\".\n",
psz_source, psz_device); psz_source, psz_device);
exit(4); exit(5);
} }
} }

View File

@@ -16,7 +16,7 @@
*/ */
/* /*
Regression test for BIN/CUE device driver. Regression test for BIN/CUE device driver: lib/driver/image/bincue.c.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
@@ -146,7 +146,6 @@ main(int argc, const char *argv[])
} }
} }
{ {
const char *psz_source = cdio_get_arg(p_cdio, "source"); const char *psz_source = cdio_get_arg(p_cdio, "source");
const char *psz_device = cdio_get_default_device(p_cdio); const char *psz_device = cdio_get_default_device(p_cdio);
@@ -155,7 +154,7 @@ main(int argc, const char *argv[])
fprintf(stderr, fprintf(stderr,
"cdio_get_arg(\"source\") should return \"%s\"; got: \"%s\".\n", "cdio_get_arg(\"source\") should return \"%s\"; got: \"%s\".\n",
psz_source, psz_device); psz_source, psz_device);
exit(4); exit(5);
} }
} }

View File

@@ -1,7 +1,5 @@
/* -*- C -*- /* -*- C -*-
$Id: testnrg.c.in,v 1.1 2008/03/22 22:43:56 rocky Exp $ Copyright (C) 2008, 2010 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2008 Rocky Bernstein <rocky@gnu.org>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -18,15 +16,16 @@
*/ */
/* /*
Regression test for cdio_nrgfile(). Regression test for Nero image driver: lib/driver/image/nrg.c.
*/ */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/logging.h> #include <cdio/logging.h>
#include <cdio/cdtext.h> #include <cdio/cdtext.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_STDIO_H #ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif #endif
@@ -85,6 +84,41 @@ main(int argc, const char *argv[])
} }
} }
} }
{
const char *psz_response = cdio_get_arg(p_cdio, "mmc-supported?");
if ( psz_response == NULL ||
((0 != strncmp("false", psz_response, sizeof("false")))) ) {
fprintf(stderr,
"cdio_get_arg(\"mmc-supported?\") should return \"false\"; got: \"%s\".\n",
psz_response);
exit(3);
}
}
{
const char *psz_access_mode = cdio_get_arg(p_cdio, "access-mode");
if ( psz_access_mode == NULL ||
((0 != strncmp("image", psz_access_mode, sizeof("image")))) ) {
fprintf(stderr,
"cdio_get_arg(\"access-mode?\") should return \"image\"; got: \"%s\".\n",
psz_access_mode);
exit(4);
}
}
{
const char *psz_source = cdio_get_arg(p_cdio, "source");
if ( psz_source == NULL ||
(0 != strcmp(psz_nrgfile, psz_source)) ) {
fprintf(stderr,
"cdio_get_arg(\"source\") should return \"%s\"; got: \"%s\".\n",
psz_source, psz_nrgfile);
exit(4);
}
}
cdio_destroy(p_cdio); cdio_destroy(p_cdio);
return 0; return 0;