Remove a couple of warnings, some of which were removed in the pbatard branch.

This commit is contained in:
R. Bernstein
2012-03-03 19:41:48 -05:00
parent 2145a5c805
commit e5ac559bcd
3 changed files with 109 additions and 92 deletions

View File

@@ -1,5 +1,6 @@
/* -*- C -*- /* -*- C -*-
Copyright (C) 2004, 2006, 2008, 2010, 2011 Rocky Bernstein <rocky@gnu.org> Copyright (C) 2004, 2006, 2008, 2010, 2011, 2012
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
@@ -19,11 +20,9 @@
Regression test for BIN/CUE device driver: lib/driver/image/bincue.c. 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"
# define __CDIO_CONFIG_H__ 1 #define __CDIO_CONFIG_H__ 1
#endif #endif
#include <cdio/cdio.h>
#include <cdio/logging.h>
#ifdef HAVE_STDIO_H #ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
@@ -37,10 +36,14 @@
#ifdef HAVE_STRING_H #ifdef HAVE_STRING_H
#include <string.h> #include <string.h>
#endif #endif
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* chdir */
#endif
#include <cdio/cdio.h>
#include <cdio/logging.h>
#include "helper.h" #include "helper.h"
#ifndef DATA_DIR #ifndef DATA_DIR
#define DATA_DIR "@abs_top_srcdir@/test/data" #define DATA_DIR "@abs_top_srcdir@/test/data"
#endif #endif
@@ -74,16 +77,16 @@ main(int argc, const char *argv[])
for (i=0; i<NUM_GOOD_CUES; i++) { for (i=0; i<NUM_GOOD_CUES; i++) {
char *psz_binfile; char *psz_binfile;
snprintf(psz_cuefile, sizeof(psz_cuefile)-1, snprintf(psz_cuefile, sizeof(psz_cuefile)-1,
"%s/%s", DATA_DIR, cue_file[i]); "%s/%s", DATA_DIR, cue_file[i]);
psz_binfile = cdio_is_cuefile(psz_cuefile); psz_binfile = cdio_is_cuefile(psz_cuefile);
if (!psz_binfile) { if (!psz_binfile) {
printf("Incorrect: %s doesn't parse as a CDRWin CUE file.\n", printf("Incorrect: %s doesn't parse as a CDRWin CUE file.\n",
cue_file[i]); cue_file[i]);
ret=i+1; ret=i+1;
} else { } else {
if (verbose) if (verbose)
printf("Correct: %s parses as a CDRWin CUE file.\n", printf("Correct: %s parses as a CDRWin CUE file.\n",
cue_file[i]); cue_file[i]);
free(psz_binfile); free(psz_binfile);
} }
} }
@@ -91,15 +94,15 @@ main(int argc, const char *argv[])
for (i=0; i<NUM_BAD_CUES; i++) { for (i=0; i<NUM_BAD_CUES; i++) {
char *psz_binfile; char *psz_binfile;
snprintf(psz_cuefile, sizeof(psz_cuefile)-1, snprintf(psz_cuefile, sizeof(psz_cuefile)-1,
"%s/%s", DATA_DIR, badcue_file[i]); "%s/%s", DATA_DIR, badcue_file[i]);
psz_binfile=cdio_is_cuefile(psz_cuefile); psz_binfile=cdio_is_cuefile(psz_cuefile);
if (!psz_binfile) { if (!psz_binfile) {
if (verbose) if (verbose)
printf("Correct: %s doesn't parse as a CDRWin CUE file.\n", printf("Correct: %s doesn't parse as a CDRWin CUE file.\n",
badcue_file[i]); badcue_file[i]);
} else { } else {
printf("Incorrect: %s parses as a CDRWin CUE file.\n", printf("Incorrect: %s parses as a CDRWin CUE file.\n",
badcue_file[i]); badcue_file[i]);
free(psz_binfile); free(psz_binfile);
ret+=50*i+1; ret+=50*i+1;
break; break;
@@ -109,7 +112,7 @@ main(int argc, const char *argv[])
{ {
CdIo_t *p_cdio; CdIo_t *p_cdio;
snprintf(psz_cuefile, sizeof(psz_cuefile)-1, snprintf(psz_cuefile, sizeof(psz_cuefile)-1,
"%s/%s", DATA_DIR, "cdda.cue"); "%s/%s", DATA_DIR, "cdda.cue");
p_cdio = cdio_open (psz_cuefile, DRIVER_UNKNOWN); p_cdio = cdio_open (psz_cuefile, DRIVER_UNKNOWN);
if (!p_cdio) { if (!p_cdio) {
printf("Can't open cdda.cue\n"); printf("Can't open cdda.cue\n");
@@ -122,21 +125,21 @@ main(int argc, const char *argv[])
if (0 == chdir(DATA_DIR)) if (0 == chdir(DATA_DIR))
#endif #endif
{ {
psz_device = cdio_get_default_device(p_cdio); psz_device = cdio_get_default_device(p_cdio);
check_mmc_supported(p_cdio, 1); check_mmc_supported(p_cdio, 1);
check_access_mode(p_cdio, "image"); check_access_mode(p_cdio, "image");
// check_get_arg_source(p_cdio, psz_device); // check_get_arg_source(p_cdio, psz_device);
/* Could chdir to srcdir to hedge the bet? */ /* Could chdir to srcdir to hedge the bet? */
if (psz_device) if (psz_device)
free(psz_device); free(psz_device);
else { else {
/* Unless we do the chdir, will fail. So don't set as an /* Unless we do the chdir, will fail. So don't set as an
* error. */ * error. */
printf("Can't get default device\n"); printf("Can't get default device\n");
} }
drc = cdio_set_speed(p_cdio, 5); drc = cdio_set_speed(p_cdio, 5);
} }
cdio_destroy(p_cdio); cdio_destroy(p_cdio);

View File

@@ -1,5 +1,6 @@
/* /*
Copyright (C) 2004, 2008, 2010, 2011 Rocky Bernstein <rocky@gnu.org> Copyright (C) 2004, 2008, 2010, 2011, 2012
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
@@ -19,11 +20,9 @@
Regression test for cdio_tocfile. Regression test for cdio_tocfile.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" #include "config.h"
# define __CDIO_CONFIG_H__ 1 #define __CDIO_CONFIG_H__ 1
#endif #endif
#include <cdio/cdio.h>
#include <cdio/logging.h>
#ifdef HAVE_STDIO_H #ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
@@ -37,7 +36,12 @@
#ifdef HAVE_STRING_H #ifdef HAVE_STRING_H
#include <string.h> #include <string.h>
#endif #endif
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* chdir */
#endif
#include <cdio/cdio.h>
#include <cdio/logging.h>
#include "helper.h" #include "helper.h"
#ifndef DATA_DIR #ifndef DATA_DIR
@@ -89,60 +93,60 @@ main(int argc, const char *argv[])
if (0 == chdir(DATA_DIR)) if (0 == chdir(DATA_DIR))
#endif #endif
{ {
psz_tocfile[sizeof(psz_tocfile)-1] = '\0'; psz_tocfile[sizeof(psz_tocfile)-1] = '\0';
cdio_loglevel_default = verbose ? CDIO_LOG_DEBUG : CDIO_LOG_WARN; cdio_loglevel_default = verbose ? CDIO_LOG_DEBUG : CDIO_LOG_WARN;
for (i=0; i<NUM_GOOD_TOCS; i++) { for (i=0; i<NUM_GOOD_TOCS; i++) {
CdIo_t *p_cdio; CdIo_t *p_cdio;
snprintf(psz_tocfile, sizeof(psz_tocfile)-1, snprintf(psz_tocfile, sizeof(psz_tocfile)-1,
"%s/%s", DATA_DIR, toc_file[i]); "%s/%s", DATA_DIR, toc_file[i]);
if (!cdio_is_tocfile(psz_tocfile) || if (!cdio_is_tocfile(psz_tocfile) ||
!(p_cdio = cdio_open_cdrdao(psz_tocfile))) { !(p_cdio = cdio_open_cdrdao(psz_tocfile))) {
fprintf(stderr, fprintf(stderr,
"Incorrect: %s doesn't parse as a cdrdao TOC file.\n", toc_file[i]); "Incorrect: %s doesn't parse as a cdrdao TOC file.\n", toc_file[i]);
ret=i+1; ret=i+1;
} else { } else {
cdio_destroy(p_cdio); cdio_destroy(p_cdio);
if (verbose) if (verbose)
printf("Correct: %s parses as a cdrdao TOC file.\n", printf("Correct: %s parses as a cdrdao TOC file.\n",
toc_file[i]); toc_file[i]);
} }
} }
for (i=0; i<NUM_BAD_TOCS; i++) { for (i=0; i<NUM_BAD_TOCS; i++) {
snprintf(psz_tocfile, sizeof(psz_tocfile)-1, snprintf(psz_tocfile, sizeof(psz_tocfile)-1,
"%s/%s", DATA_DIR, badtoc_file[i]); "%s/%s", DATA_DIR, badtoc_file[i]);
if (!cdio_is_tocfile(psz_tocfile)) { if (!cdio_is_tocfile(psz_tocfile)) {
if (verbose) if (verbose)
printf("Correct: %s doesn't parse as a cdrdao TOC file.\n", printf("Correct: %s doesn't parse as a cdrdao TOC file.\n",
badtoc_file[i]); badtoc_file[i]);
} else { } else {
fprintf(stderr, fprintf(stderr,
"Incorrect: %s parses as a cdrdao TOC file.\n", "Incorrect: %s parses as a cdrdao TOC file.\n",
badtoc_file[i]); badtoc_file[i]);
ret+=50*i+1; ret+=50*i+1;
break; break;
} }
} }
{ {
CdIo_t *p_cdio; CdIo_t *p_cdio;
snprintf(psz_tocfile, sizeof(psz_tocfile)-1, snprintf(psz_tocfile, sizeof(psz_tocfile)-1,
"%s/%s", DATA_DIR, "cdda.toc"); "%s/%s", DATA_DIR, "cdda.toc");
p_cdio = cdio_open (psz_tocfile, DRIVER_CDRDAO); p_cdio = cdio_open (psz_tocfile, DRIVER_CDRDAO);
if (!p_cdio) { if (!p_cdio) {
fprintf(stderr, "Can't open %s as a cdrdao TOC file.\n", fprintf(stderr, "Can't open %s as a cdrdao TOC file.\n",
psz_tocfile); psz_tocfile);
exit(5); exit(5);
} }
check_mmc_supported(p_cdio, 1); check_mmc_supported(p_cdio, 1);
check_access_mode(p_cdio, "image"); check_access_mode(p_cdio, "image");
check_get_arg_source(p_cdio, psz_tocfile); check_get_arg_source(p_cdio, psz_tocfile);
cdio_destroy(p_cdio); cdio_destroy(p_cdio);
} }
} }

View File

@@ -20,12 +20,9 @@
Regression test for MMC commands involving read/write access. Regression test for MMC commands involving read/write access.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" #include "config.h"
# define __CDIO_CONFIG_H__ 1 #define __CDIO_CONFIG_H__ 1
#endif #endif
#include <cdio/cdio.h>
#include <cdio/logging.h>
#include <cdio/mmc_cmds.h>
#ifdef HAVE_STDIO_H #ifdef HAVE_STDIO_H
# include <stdio.h> # include <stdio.h>
@@ -36,14 +33,27 @@
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
# include <stdlib.h> # include <stdlib.h>
#endif #endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_STRING_H #ifdef HAVE_STRING_H
# include <string.h> # include <string.h>
#endif #endif
#if !defined(HAVE_SLEEP) && defined(_WIN32) #if !defined(HAVE_SLEEP) && defined(_WIN32)
# include <windows.h> # include <windows.h>
# define sleep(s) Sleep(1000*s)
#endif #endif
#ifndef HAVE_USLEEP
# error usleep() unimplemented
# if !defined(HAVE_SLEEP) && defined(_WIN32)
# include <windows.h>
# define sleep(s) Sleep(1000*s)
# endif
#endif
#include <cdio/cdio.h>
#include <cdio/logging.h>
#include <cdio/mmc_cmds.h>
#define SKIP_TEST 77 #define SKIP_TEST 77
/* gcc may warn if no prototypes are given before function definition */ /* gcc may warn if no prototypes are given before function definition */