Mostly portability issues from or inspired by mog's changes for XBOX.
image/*.c: initialize func structure to 0 (NULL). include/cdio/*.h: add "extern C" for C++ compilations where appropriate.
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
$Id: logging.h,v 1.9 2004/09/04 23:49:47 rocky Exp $
|
$Id: logging.h,v 1.10 2004/10/31 06:07:26 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2000, Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2000, Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
Copyright (C) 2003, Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
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
|
||||||
@@ -29,6 +29,10 @@
|
|||||||
|
|
||||||
#include <cdio/types.h>
|
#include <cdio/types.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The different log levels supported.
|
* The different log levels supported.
|
||||||
*/
|
*/
|
||||||
@@ -117,6 +121,10 @@ void cdio_warn (const char format[], ...) GNUC_PRINTF(1,2);
|
|||||||
*/
|
*/
|
||||||
void cdio_error (const char format[], ...) GNUC_PRINTF(1,2);
|
void cdio_error (const char format[], ...) GNUC_PRINTF(1,2);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __LOGGING_H__ */
|
#endif /* __LOGGING_H__ */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
$Id: util.h,v 1.2 2003/11/18 03:35:19 rocky Exp $
|
$Id: util.h,v 1.3 2004/10/31 06:07:26 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
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
|
||||||
@@ -71,6 +72,16 @@ _cdio_ofs_add (unsigned offset, unsigned length, int blocksize)
|
|||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline const char *
|
||||||
|
_cdio_bool_str (bool b)
|
||||||
|
{
|
||||||
|
return b ? "yes" : "no";
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
void *
|
void *
|
||||||
_cdio_malloc (size_t size);
|
_cdio_malloc (size_t size);
|
||||||
|
|
||||||
@@ -92,17 +103,13 @@ _cdio_strlenv(char **str_array);
|
|||||||
char **
|
char **
|
||||||
_cdio_strsplit(const char str[], char delim);
|
_cdio_strsplit(const char str[], char delim);
|
||||||
|
|
||||||
static inline const char *
|
|
||||||
_cdio_bool_str (bool b)
|
|
||||||
{
|
|
||||||
return b ? "yes" : "no";
|
|
||||||
}
|
|
||||||
|
|
||||||
/* BCD */
|
|
||||||
|
|
||||||
uint8_t to_bcd8(uint8_t n);
|
uint8_t to_bcd8(uint8_t n);
|
||||||
uint8_t from_bcd8(uint8_t p);
|
uint8_t from_bcd8(uint8_t p);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __CDIO_UTIL_H__ */
|
#endif /* __CDIO_UTIL_H__ */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: bincue.c,v 1.45 2004/10/26 01:21:05 rocky Exp $
|
$Id: bincue.c,v 1.46 2004/10/31 06:07:26 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
(*.cue).
|
(*.cue).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: bincue.c,v 1.45 2004/10/26 01:21:05 rocky Exp $";
|
static const char _rcsid[] = "$Id: bincue.c,v 1.46 2004/10/31 06:07:26 rocky Exp $";
|
||||||
|
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
#include "cdio_assert.h"
|
#include "cdio_assert.h"
|
||||||
@@ -1151,66 +1151,68 @@ cdio_open_cue (const char *psz_cue_name)
|
|||||||
CdIo *ret;
|
CdIo *ret;
|
||||||
_img_private_t *_data;
|
_img_private_t *_data;
|
||||||
char *psz_bin_name;
|
char *psz_bin_name;
|
||||||
|
|
||||||
cdio_funcs _funcs;
|
cdio_funcs _funcs;
|
||||||
|
|
||||||
_funcs.eject_media = _eject_media_image;
|
memset( &_funcs, 0, sizeof(_funcs) );
|
||||||
_funcs.free = _free_image;
|
|
||||||
_funcs.get_arg = _get_arg_image;
|
_funcs.eject_media = _eject_media_image;
|
||||||
_funcs.get_cdtext = get_cdtext_generic;
|
_funcs.free = _free_image;
|
||||||
_funcs.get_devices = cdio_get_devices_bincue;
|
_funcs.get_arg = _get_arg_image;
|
||||||
_funcs.get_default_device = cdio_get_default_device_bincue;
|
_funcs.get_cdtext = get_cdtext_generic;
|
||||||
_funcs.get_discmode = _get_discmode_image;
|
_funcs.get_devices = cdio_get_devices_bincue;
|
||||||
_funcs.get_drive_cap = _get_drive_cap_image;
|
_funcs.get_default_device = cdio_get_default_device_bincue;
|
||||||
_funcs.get_first_track_num= _get_first_track_num_image;
|
_funcs.get_discmode = _get_discmode_image;
|
||||||
_funcs.get_hwinfo = get_hwinfo_bincue;
|
_funcs.get_drive_cap = _get_drive_cap_image;
|
||||||
_funcs.get_mcn = _get_mcn_image;
|
_funcs.get_first_track_num= _get_first_track_num_image;
|
||||||
_funcs.get_num_tracks = _get_num_tracks_image;
|
_funcs.get_hwinfo = get_hwinfo_bincue;
|
||||||
_funcs.get_track_format = _get_track_format_bincue;
|
_funcs.get_mcn = _get_mcn_image;
|
||||||
_funcs.get_track_green = _get_track_green_bincue;
|
_funcs.get_num_tracks = _get_num_tracks_image;
|
||||||
_funcs.get_track_lba = _get_lba_track_bincue;
|
_funcs.get_track_format = _get_track_format_bincue;
|
||||||
_funcs.get_track_msf = _get_track_msf_image;
|
_funcs.get_track_green = _get_track_green_bincue;
|
||||||
_funcs.lseek = _lseek_bincue;
|
_funcs.get_track_lba = _get_lba_track_bincue;
|
||||||
_funcs.read = _read_bincue;
|
_funcs.get_track_msf = _get_track_msf_image;
|
||||||
_funcs.read_audio_sectors = _read_audio_sectors_bincue;
|
_funcs.lseek = _lseek_bincue;
|
||||||
_funcs.read_mode1_sector = _read_mode1_sector_bincue;
|
_funcs.read = _read_bincue;
|
||||||
_funcs.read_mode1_sectors = _read_mode1_sectors_bincue;
|
_funcs.read_audio_sectors = _read_audio_sectors_bincue;
|
||||||
_funcs.read_mode2_sector = _read_mode2_sector_bincue;
|
_funcs.read_mode1_sector = _read_mode1_sector_bincue;
|
||||||
_funcs.read_mode2_sectors = _read_mode2_sectors_bincue;
|
_funcs.read_mode1_sectors = _read_mode1_sectors_bincue;
|
||||||
_funcs.set_arg = _set_arg_image;
|
_funcs.read_mode2_sector = _read_mode2_sector_bincue;
|
||||||
_funcs.stat_size = _stat_size_bincue;
|
_funcs.read_mode2_sectors = _read_mode2_sectors_bincue;
|
||||||
|
_funcs.set_arg = _set_arg_image;
|
||||||
if (NULL == psz_cue_name) return NULL;
|
_funcs.stat_size = _stat_size_bincue;
|
||||||
|
|
||||||
_data = _cdio_malloc (sizeof (_img_private_t));
|
if (NULL == psz_cue_name) return NULL;
|
||||||
_data->gen.init = false;
|
|
||||||
_data->psz_cue_name = NULL;
|
_data = _cdio_malloc (sizeof (_img_private_t));
|
||||||
|
_data->gen.init = false;
|
||||||
ret = cdio_new ((void *)_data, &_funcs);
|
_data->psz_cue_name = NULL;
|
||||||
|
|
||||||
if (ret == NULL) {
|
ret = cdio_new ((void *)_data, &_funcs);
|
||||||
free(_data);
|
|
||||||
return NULL;
|
if (ret == NULL) {
|
||||||
}
|
free(_data);
|
||||||
|
return NULL;
|
||||||
psz_bin_name = cdio_is_cuefile(psz_cue_name);
|
}
|
||||||
|
|
||||||
if (NULL == psz_bin_name) {
|
psz_bin_name = cdio_is_cuefile(psz_cue_name);
|
||||||
cdio_error ("source name %s is not recognized as a CUE file",
|
|
||||||
psz_cue_name);
|
if (NULL == psz_bin_name) {
|
||||||
}
|
cdio_error ("source name %s is not recognized as a CUE file",
|
||||||
|
psz_cue_name);
|
||||||
_set_arg_image (_data, "cue", psz_cue_name);
|
}
|
||||||
_set_arg_image (_data, "source", psz_bin_name);
|
|
||||||
free(psz_bin_name);
|
_set_arg_image (_data, "cue", psz_cue_name);
|
||||||
|
_set_arg_image (_data, "source", psz_bin_name);
|
||||||
if (_init_bincue(_data)) {
|
free(psz_bin_name);
|
||||||
return ret;
|
|
||||||
} else {
|
if (_init_bincue(_data)) {
|
||||||
_free_image(_data);
|
return ret;
|
||||||
free(ret);
|
} else {
|
||||||
return NULL;
|
_free_image(_data);
|
||||||
}
|
free(ret);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cdrdao.c,v 1.28 2004/09/04 00:06:50 rocky Exp $
|
$Id: cdrdao.c,v 1.29 2004/10/31 06:07:26 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
toc reading routine adapted from cuetools
|
toc reading routine adapted from cuetools
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
(*.cue).
|
(*.cue).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: cdrdao.c,v 1.28 2004/09/04 00:06:50 rocky Exp $";
|
static const char _rcsid[] = "$Id: cdrdao.c,v 1.29 2004/10/31 06:07:26 rocky Exp $";
|
||||||
|
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
#include "cdio_assert.h"
|
#include "cdio_assert.h"
|
||||||
@@ -1135,34 +1135,36 @@ cdio_open_cdrdao (const char *psz_cue_name)
|
|||||||
CdIo *ret;
|
CdIo *ret;
|
||||||
_img_private_t *_data;
|
_img_private_t *_data;
|
||||||
|
|
||||||
cdio_funcs _funcs;
|
cdio_funcs _funcs;
|
||||||
|
|
||||||
|
memset( &_funcs, 0, sizeof(_funcs) );
|
||||||
|
|
||||||
|
_funcs.eject_media = _eject_media_image;
|
||||||
|
_funcs.free = _free_image;
|
||||||
|
_funcs.get_arg = _get_arg_image;
|
||||||
|
_funcs.get_cdtext = get_cdtext_generic;
|
||||||
|
_funcs.get_devices = cdio_get_devices_cdrdao;
|
||||||
|
_funcs.get_default_device = cdio_get_default_device_cdrdao;
|
||||||
|
_funcs.get_discmode = _get_discmode_image;
|
||||||
|
_funcs.get_drive_cap = _get_drive_cap_image;
|
||||||
|
_funcs.get_first_track_num= _get_first_track_num_image;
|
||||||
|
_funcs.get_hwinfo = get_hwinfo_cdrdao;
|
||||||
|
_funcs.get_mcn = _get_mcn_image;
|
||||||
|
_funcs.get_num_tracks = _get_num_tracks_image;
|
||||||
|
_funcs.get_track_format = _get_track_format_cdrdao;
|
||||||
|
_funcs.get_track_green = _get_track_green_cdrdao;
|
||||||
|
_funcs.get_track_lba = _get_lba_track_cdrdao;
|
||||||
|
_funcs.get_track_msf = _get_track_msf_image;
|
||||||
|
_funcs.lseek = _lseek_cdrdao;
|
||||||
|
_funcs.read = _read_cdrdao;
|
||||||
|
_funcs.read_audio_sectors = _read_audio_sectors_cdrdao;
|
||||||
|
_funcs.read_mode1_sector = _read_mode1_sector_cdrdao;
|
||||||
|
_funcs.read_mode1_sectors = _read_mode1_sectors_cdrdao;
|
||||||
|
_funcs.read_mode2_sector = _read_mode2_sector_cdrdao;
|
||||||
|
_funcs.read_mode2_sectors = _read_mode2_sectors_cdrdao;
|
||||||
|
_funcs.set_arg = _set_arg_image;
|
||||||
|
_funcs.stat_size = _stat_size_cdrdao;
|
||||||
|
|
||||||
_funcs.eject_media = _eject_media_image;
|
|
||||||
_funcs.free = _free_image;
|
|
||||||
_funcs.get_arg = _get_arg_image;
|
|
||||||
_funcs.get_cdtext = get_cdtext_generic;
|
|
||||||
_funcs.get_devices = cdio_get_devices_cdrdao;
|
|
||||||
_funcs.get_default_device = cdio_get_default_device_cdrdao;
|
|
||||||
_funcs.get_discmode = _get_discmode_image;
|
|
||||||
_funcs.get_drive_cap = _get_drive_cap_image;
|
|
||||||
_funcs.get_first_track_num= _get_first_track_num_image;
|
|
||||||
_funcs.get_hwinfo = get_hwinfo_cdrdao;
|
|
||||||
_funcs.get_mcn = _get_mcn_image;
|
|
||||||
_funcs.get_num_tracks = _get_num_tracks_image;
|
|
||||||
_funcs.get_track_format = _get_track_format_cdrdao;
|
|
||||||
_funcs.get_track_green = _get_track_green_cdrdao;
|
|
||||||
_funcs.get_track_lba = _get_lba_track_cdrdao;
|
|
||||||
_funcs.get_track_msf = _get_track_msf_image;
|
|
||||||
_funcs.lseek = _lseek_cdrdao;
|
|
||||||
_funcs.read = _read_cdrdao;
|
|
||||||
_funcs.read_audio_sectors = _read_audio_sectors_cdrdao;
|
|
||||||
_funcs.read_mode1_sector = _read_mode1_sector_cdrdao;
|
|
||||||
_funcs.read_mode1_sectors = _read_mode1_sectors_cdrdao;
|
|
||||||
_funcs.read_mode2_sector = _read_mode2_sector_cdrdao;
|
|
||||||
_funcs.read_mode2_sectors = _read_mode2_sectors_cdrdao;
|
|
||||||
_funcs.set_arg = _set_arg_image;
|
|
||||||
_funcs.stat_size = _stat_size_cdrdao;
|
|
||||||
|
|
||||||
if (NULL == psz_cue_name) return NULL;
|
if (NULL == psz_cue_name) return NULL;
|
||||||
|
|
||||||
_data = _cdio_malloc (sizeof (_img_private_t));
|
_data = _cdio_malloc (sizeof (_img_private_t));
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: nrg.c,v 1.42 2004/10/22 01:13:38 rocky Exp $
|
$Id: nrg.c,v 1.43 2004/10/31 06:07:26 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 2001, 2003 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2001, 2003 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
#include "_cdio_stdio.h"
|
#include "_cdio_stdio.h"
|
||||||
#include "nrg.h"
|
#include "nrg.h"
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: nrg.c,v 1.42 2004/10/22 01:13:38 rocky Exp $";
|
static const char _rcsid[] = "$Id: nrg.c,v 1.43 2004/10/31 06:07:26 rocky Exp $";
|
||||||
|
|
||||||
|
|
||||||
/* reader */
|
/* reader */
|
||||||
@@ -1198,6 +1198,8 @@ cdio_open_nrg (const char *psz_source)
|
|||||||
|
|
||||||
cdio_funcs _funcs;
|
cdio_funcs _funcs;
|
||||||
|
|
||||||
|
memset( &_funcs, 0, sizeof(_funcs) );
|
||||||
|
|
||||||
_funcs.eject_media = _eject_media_nrg;
|
_funcs.eject_media = _eject_media_nrg;
|
||||||
_funcs.free = _free_nrg;
|
_funcs.free = _free_nrg;
|
||||||
_funcs.get_arg = _get_arg_image;
|
_funcs.get_arg = _get_arg_image;
|
||||||
|
|||||||
Reference in New Issue
Block a user