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 -*-
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
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.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
# define __CDIO_CONFIG_H__ 1
#include "config.h"
#define __CDIO_CONFIG_H__ 1
#endif
#include <cdio/cdio.h>
#include <cdio/logging.h>
#ifdef HAVE_STDIO_H
#include <stdio.h>
@@ -37,10 +36,14 @@
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* chdir */
#endif
#include <cdio/cdio.h>
#include <cdio/logging.h>
#include "helper.h"
#ifndef DATA_DIR
#define DATA_DIR "@abs_top_srcdir@/test/data"
#endif
@@ -74,16 +77,16 @@ main(int argc, const char *argv[])
for (i=0; i<NUM_GOOD_CUES; i++) {
char *psz_binfile;
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);
if (!psz_binfile) {
printf("Incorrect: %s doesn't parse as a CDRWin CUE file.\n",
cue_file[i]);
cue_file[i]);
ret=i+1;
} else {
if (verbose)
printf("Correct: %s parses as a CDRWin CUE file.\n",
cue_file[i]);
if (verbose)
printf("Correct: %s parses as a CDRWin CUE file.\n",
cue_file[i]);
free(psz_binfile);
}
}
@@ -91,15 +94,15 @@ main(int argc, const char *argv[])
for (i=0; i<NUM_BAD_CUES; i++) {
char *psz_binfile;
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);
if (!psz_binfile) {
if (verbose)
printf("Correct: %s doesn't parse as a CDRWin CUE file.\n",
badcue_file[i]);
if (verbose)
printf("Correct: %s doesn't parse as a CDRWin CUE file.\n",
badcue_file[i]);
} else {
printf("Incorrect: %s parses as a CDRWin CUE file.\n",
badcue_file[i]);
badcue_file[i]);
free(psz_binfile);
ret+=50*i+1;
break;
@@ -109,7 +112,7 @@ main(int argc, const char *argv[])
{
CdIo_t *p_cdio;
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);
if (!p_cdio) {
printf("Can't open cdda.cue\n");
@@ -122,21 +125,21 @@ main(int argc, const char *argv[])
if (0 == chdir(DATA_DIR))
#endif
{
psz_device = cdio_get_default_device(p_cdio);
psz_device = cdio_get_default_device(p_cdio);
check_mmc_supported(p_cdio, 1);
check_access_mode(p_cdio, "image");
// check_get_arg_source(p_cdio, psz_device);
check_mmc_supported(p_cdio, 1);
check_access_mode(p_cdio, "image");
// check_get_arg_source(p_cdio, psz_device);
/* Could chdir to srcdir to hedge the bet? */
if (psz_device)
free(psz_device);
else {
/* Unless we do the chdir, will fail. So don't set as an
* error. */
printf("Can't get default device\n");
}
drc = cdio_set_speed(p_cdio, 5);
/* Could chdir to srcdir to hedge the bet? */
if (psz_device)
free(psz_device);
else {
/* Unless we do the chdir, will fail. So don't set as an
* error. */
printf("Can't get default device\n");
}
drc = cdio_set_speed(p_cdio, 5);
}
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
it under the terms of the GNU General Public License as published by
@@ -19,11 +20,9 @@
Regression test for cdio_tocfile.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
# define __CDIO_CONFIG_H__ 1
#include "config.h"
#define __CDIO_CONFIG_H__ 1
#endif
#include <cdio/cdio.h>
#include <cdio/logging.h>
#ifdef HAVE_STDIO_H
#include <stdio.h>
@@ -37,7 +36,12 @@
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* chdir */
#endif
#include <cdio/cdio.h>
#include <cdio/logging.h>
#include "helper.h"
#ifndef DATA_DIR
@@ -89,60 +93,60 @@ main(int argc, const char *argv[])
if (0 == chdir(DATA_DIR))
#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;
for (i=0; i<NUM_GOOD_TOCS; i++) {
CdIo_t *p_cdio;
snprintf(psz_tocfile, sizeof(psz_tocfile)-1,
"%s/%s", DATA_DIR, toc_file[i]);
if (!cdio_is_tocfile(psz_tocfile) ||
!(p_cdio = cdio_open_cdrdao(psz_tocfile))) {
fprintf(stderr,
"Incorrect: %s doesn't parse as a cdrdao TOC file.\n", toc_file[i]);
ret=i+1;
} else {
cdio_destroy(p_cdio);
if (verbose)
printf("Correct: %s parses as a cdrdao TOC file.\n",
toc_file[i]);
}
}
for (i=0; i<NUM_BAD_TOCS; i++) {
snprintf(psz_tocfile, sizeof(psz_tocfile)-1,
"%s/%s", DATA_DIR, badtoc_file[i]);
if (!cdio_is_tocfile(psz_tocfile)) {
if (verbose)
printf("Correct: %s doesn't parse as a cdrdao TOC file.\n",
badtoc_file[i]);
} else {
fprintf(stderr,
"Incorrect: %s parses as a cdrdao TOC file.\n",
badtoc_file[i]);
ret+=50*i+1;
break;
}
}
cdio_loglevel_default = verbose ? CDIO_LOG_DEBUG : CDIO_LOG_WARN;
for (i=0; i<NUM_GOOD_TOCS; i++) {
CdIo_t *p_cdio;
snprintf(psz_tocfile, sizeof(psz_tocfile)-1,
"%s/%s", DATA_DIR, toc_file[i]);
if (!cdio_is_tocfile(psz_tocfile) ||
!(p_cdio = cdio_open_cdrdao(psz_tocfile))) {
fprintf(stderr,
"Incorrect: %s doesn't parse as a cdrdao TOC file.\n", toc_file[i]);
ret=i+1;
} else {
cdio_destroy(p_cdio);
if (verbose)
printf("Correct: %s parses as a cdrdao TOC file.\n",
toc_file[i]);
}
}
for (i=0; i<NUM_BAD_TOCS; i++) {
snprintf(psz_tocfile, sizeof(psz_tocfile)-1,
"%s/%s", DATA_DIR, badtoc_file[i]);
if (!cdio_is_tocfile(psz_tocfile)) {
if (verbose)
printf("Correct: %s doesn't parse as a cdrdao TOC file.\n",
badtoc_file[i]);
} else {
fprintf(stderr,
"Incorrect: %s parses as a cdrdao TOC file.\n",
badtoc_file[i]);
ret+=50*i+1;
break;
}
}
{
CdIo_t *p_cdio;
snprintf(psz_tocfile, sizeof(psz_tocfile)-1,
"%s/%s", DATA_DIR, "cdda.toc");
{
CdIo_t *p_cdio;
snprintf(psz_tocfile, sizeof(psz_tocfile)-1,
"%s/%s", DATA_DIR, "cdda.toc");
p_cdio = cdio_open (psz_tocfile, DRIVER_CDRDAO);
if (!p_cdio) {
fprintf(stderr, "Can't open %s as a cdrdao TOC file.\n",
psz_tocfile);
exit(5);
}
check_mmc_supported(p_cdio, 1);
check_access_mode(p_cdio, "image");
check_get_arg_source(p_cdio, psz_tocfile);
cdio_destroy(p_cdio);
}
p_cdio = cdio_open (psz_tocfile, DRIVER_CDRDAO);
if (!p_cdio) {
fprintf(stderr, "Can't open %s as a cdrdao TOC file.\n",
psz_tocfile);
exit(5);
}
check_mmc_supported(p_cdio, 1);
check_access_mode(p_cdio, "image");
check_get_arg_source(p_cdio, psz_tocfile);
cdio_destroy(p_cdio);
}
}

View File

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