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/driver/Makefile \
test/driver/bincue.c \
test/driver/nrg.c \
test/testgetdevices.c \
test/testisocd2.c \
test/testpregap.c \
test/testnrg.c \
test/check_common_fn \
test/Makefile \
])

View File

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

View File

@@ -1,7 +1,7 @@
/*
$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
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/>.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "common_interface.h"
#include "utils.h"
void
cderror(cdrom_drive_t *d,const char *s)
{
ssize_t bytes_ret;
if(s && d){
switch(d->errordest){
case CDDA_MESSAGE_PRINTIT:
write(STDERR_FILENO,s,strlen(s));
bytes_ret = write(STDERR_FILENO, s, strlen(s));
if (strlen(s) != bytes_ret)
break;
case CDDA_MESSAGE_LOGIT:
d->errorbuf=catstring(d->errorbuf,s);
@@ -40,10 +47,11 @@ cderror(cdrom_drive_t *d,const char *s)
void
cdmessage(cdrom_drive_t *d, const char *s)
{
ssize_t bytes_ret;
if(s && d){
switch(d->messagedest){
case CDDA_MESSAGE_PRINTIT:
write(STDERR_FILENO,s,strlen(s));
bytes_ret = write(STDERR_FILENO, s, strlen(s));
break;
case CDDA_MESSAGE_LOGIT:
d->messagebuf=catstring(d->messagebuf,s);
@@ -73,13 +81,14 @@ idperror(int messagedest,char **messages,const char *f,
}
if(buffer){
ssize_t bytes_ret;
switch(messagedest){
case CDDA_MESSAGE_PRINTIT:
write(STDERR_FILENO,buffer,strlen(buffer));
bytes_ret = write(STDERR_FILENO,buffer,strlen(buffer));
if(errno){
write(STDERR_FILENO,": ",2);
write(STDERR_FILENO,strerror(errno),strlen(strerror(errno)));
write(STDERR_FILENO,"\n",1);
bytes_ret = write(STDERR_FILENO,": ",2);
bytes_ret = write(STDERR_FILENO,strerror(errno),strlen(strerror(errno)));
bytes_ret = write(STDERR_FILENO,"\n",1);
}
break;
case CDDA_MESSAGE_LOGIT:
@@ -118,11 +127,13 @@ idmessage(int messagedest,char **messages,const char *f,
malloced=1;
}
if(buffer){
if(buffer) {
ssize_t bytes_ret;
switch(messagedest){
case CDDA_MESSAGE_PRINTIT:
write(STDERR_FILENO,buffer,strlen(buffer));
if(!malloced)write(STDERR_FILENO,"\n",1);
bytes_ret = write(STDERR_FILENO,buffer,strlen(buffer));
if(!malloced)
bytes_ret = write(STDERR_FILENO,"\n",1);
break;
case CDDA_MESSAGE_LOGIT:
if(messages){

View File

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

View File

@@ -30,7 +30,7 @@ endif
hack = check_sizeof testassert testgetdevices testischar \
testisocd testisocd2 testiso9660 test_lib_driver_util \
testnrg $(testparanoia) testtoc testpregap
$(testparanoia) testtoc testpregap
EXTRA_PROGRAMS = testdefault
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_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_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
@@ -83,7 +80,7 @@ check_DATA = vcd_demo.right vcd_demo_vcdinfo.right \
EXTRA_DIST = $(check_SCRIPTS) $(check_DATA) \
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
TESTS = $(check_PROGRAMS) $(check_SCRIPTS)

View File

@@ -31,6 +31,9 @@ gnu_linux_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
mmc_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV)
mmc_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
nrg_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV)
nrg_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
osx_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV)
osx_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
@@ -40,14 +43,19 @@ solaris_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
win32_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV)
win32_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
hack = bincue freebsd gnu_linux mmc osx realpath solaris win32
check_PROGRAMS = $(hack)
check_PROGRAMS = \
bincue freebsd gnu_linux mmc nrg \
osx realpath solaris win32
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

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
# 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_device = cdio_get_default_device(p_cdio);
@@ -155,7 +154,7 @@ main(int argc, const char *argv[])
fprintf(stderr,
"cdio_get_arg(\"source\") should return \"%s\"; got: \"%s\".\n",
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
# 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_device = cdio_get_default_device(p_cdio);
@@ -155,7 +154,7 @@ main(int argc, const char *argv[])
fprintf(stderr,
"cdio_get_arg(\"source\") should return \"%s\"; got: \"%s\".\n",
psz_source, psz_device);
exit(4);
exit(5);
}
}

View File

@@ -1,7 +1,5 @@
/* -*- C -*-
$Id: testnrg.c.in,v 1.1 2008/03/22 22:43:56 rocky Exp $
Copyright (C) 2008 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2008, 2010 Rocky Bernstein <rocky@gnu.org>
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
@@ -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/logging.h>
#include <cdio/cdtext.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_STDIO_H
#include <stdio.h>
#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);
return 0;