Various portability fixes mosty for MSVC which doesn't have drand and
doesn't allow dynamic local arrays. v_fragment -> v_fragment_t libcdio.sym: more external symbols defined /lib/_cdio_linux.c: harmless type mismatch example/sample2.c -> example/device.c
This commit is contained in:
@@ -19,7 +19,7 @@ define(RELEASE_NUM, 73)
|
||||
define(CDIO_VERSION_STR, 0.$1cvs)
|
||||
|
||||
AC_PREREQ(2.52)
|
||||
AC_REVISION([$Id: configure.ac,v 1.141 2005/02/05 23:16:34 rocky Exp $])dnl
|
||||
AC_REVISION([$Id: configure.ac,v 1.142 2005/02/06 15:09:10 rocky Exp $])dnl
|
||||
AC_INIT(libcdio, CDIO_VERSION_STR(RELEASE_NUM))
|
||||
AC_CONFIG_SRCDIR(src/cd-info.c)
|
||||
|
||||
@@ -412,7 +412,7 @@ AC_DEFINE_UNQUOTED(LIBCDIO_SOURCE_PATH, "$LIBCDIO_SOURCE_PATH",
|
||||
[Full path to libcdio top_sourcedir.])
|
||||
AC_SUBST(LIBCDIO_SOURCE_PATH)
|
||||
|
||||
AC_CHECK_FUNCS( [bzero ftruncate lstat memcpy memset snprintf \
|
||||
AC_CHECK_FUNCS( [bzero drand48 rand ftruncate lstat memcpy memset snprintf \
|
||||
tzset vsnprintf getpwuid geteuid] )
|
||||
|
||||
AC_CHECK_MEMBER([struct tm.tm_gmtoff],
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# $Id: Makefile.am,v 1.16 2005/02/04 23:12:16 rocky Exp $
|
||||
# $Id: Makefile.am,v 1.17 2005/02/06 15:09:10 rocky Exp $
|
||||
#
|
||||
# Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||
#
|
||||
@@ -21,11 +21,11 @@
|
||||
####################################################
|
||||
#
|
||||
if DISABLE_CPP
|
||||
noinst_PROGRAMS = cdtext drives iso1 iso2 iso3 iso4 mmc1 mmc2 \
|
||||
paranoia paranoia2 tracks sample2 sample3 sample4
|
||||
noinst_PROGRAMS = cdtext device drives iso1 iso2 iso3 iso4 mmc1 mmc2 \
|
||||
paranoia paranoia2 tracks sample3 sample4
|
||||
else
|
||||
noinst_PROGRAMS = cdtext drives iso1 iso2 iso3 iso4 mmc1 mmc2 \
|
||||
paranoia paranoia2 tracks sample2 sample3 sample4 \
|
||||
noinst_PROGRAMS = cdtext device drives iso1 iso2 iso3 iso4 mmc1 mmc2 \
|
||||
paranoia paranoia2 tracks sample3 sample4 \
|
||||
iso1cpp iso2cpp iso3cpp
|
||||
endif
|
||||
|
||||
@@ -33,6 +33,8 @@ INCLUDES = -I$(top_srcdir) $(LIBCDIO_CFLAGS)
|
||||
|
||||
cdtext_LDADD = $(LIBCDIO_LIBS)
|
||||
|
||||
device_LDADD = $(LIBCDIO_LIBS)
|
||||
|
||||
drives_LDADD = $(LIBCDIO_LIBS)
|
||||
|
||||
paranoia_LDADD = $(LIBCDIO_PARANOIA_LIBS) $(LIBCDIO_CDDA_LIBS) $(LIBCDIO_LIBS)
|
||||
@@ -55,7 +57,6 @@ endif
|
||||
mmc1_LDADD = $(LIBCDIO_LIBS)
|
||||
mmc2_LDADD = $(LIBCDIO_LIBS)
|
||||
|
||||
sample2_LDADD = $(LIBCDIO_LIBS)
|
||||
sample3_LDADD = $(LIBCDIO_LIBS)
|
||||
sample4_LDADD = $(LIBCDIO_LIBS)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: README,v 1.13 2005/02/04 23:14:54 rocky Exp $
|
||||
$Id: README,v 1.14 2005/02/06 15:09:10 rocky Exp $
|
||||
|
||||
This directory contains some simple examples of the use of the libcdio
|
||||
library.
|
||||
@@ -29,6 +29,8 @@ iso2.c: A program to show using libiso9660 to extract a file
|
||||
iso3.c: A program to show using libiso9660 to extract a file from an
|
||||
ISO-9660 image.
|
||||
|
||||
iso4.c: A program showing fuzzy ISO-9660 detection/reading.
|
||||
|
||||
iso1cpp.cpp: iso1.c compiled via C++
|
||||
iso2cpp.cpp: iso2.c compiled via C++
|
||||
iso3cpp.cpp: iso3.c compiled via C++
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: sample2.c,v 1.13 2005/01/04 04:40:22 rocky Exp $
|
||||
$Id: device.c,v 1.1 2005/02/06 15:09:10 rocky Exp $
|
||||
|
||||
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: _cdio_linux.c,v 1.21 2005/02/06 11:13:37 rocky Exp $
|
||||
$Id: _cdio_linux.c,v 1.22 2005/02/06 15:09:10 rocky Exp $
|
||||
|
||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||
Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||
@@ -27,7 +27,7 @@
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.21 2005/02/06 11:13:37 rocky Exp $";
|
||||
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.22 2005/02/06 15:09:10 rocky Exp $";
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -294,7 +294,7 @@ get_drive_cap_linux (const void *p_user_data,
|
||||
return codes are the same as driver_return_code_t
|
||||
*/
|
||||
static int
|
||||
get_media_changed_linux (void *p_user_data) {
|
||||
get_media_changed_linux (const void *p_user_data) {
|
||||
const _img_private_t *p_env = p_user_data;
|
||||
return ioctl(p_env->gen.fd, CDROM_MEDIA_CHANGED, 0);
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@ cdio_is_binfile
|
||||
cdio_is_cuefile
|
||||
cdio_is_device
|
||||
cdio_is_discmode_cdrom
|
||||
cdio_is_discmode_dvd
|
||||
cdio_is_nrg
|
||||
cdio_is_tocfile
|
||||
cdio_lba_to_lsn
|
||||
@@ -122,6 +123,7 @@ cdio_open_nrg
|
||||
cdio_open_osx
|
||||
cdio_open_solaris
|
||||
cdio_open_win32
|
||||
cdio_os_driver
|
||||
cdio_read
|
||||
cdio_read_audio_sector
|
||||
cdio_read_audio_sectors
|
||||
@@ -148,3 +150,4 @@ discmode2str
|
||||
mmc_get_hwinfo
|
||||
mmc_run_cmd
|
||||
track_format2str
|
||||
CDIO_SECTOR_SYNC_HEADER
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: portable.h,v 1.1 2004/12/18 17:29:32 rocky Exp $
|
||||
$Id: portable.h,v 1.2 2005/02/06 15:09:10 rocky Exp $
|
||||
|
||||
Copyright (C) Rocky Bernstein <rocky@panix.com>
|
||||
|
||||
@@ -49,6 +49,10 @@
|
||||
# endif
|
||||
#endif /*HAVE_SNPRINTF*/
|
||||
|
||||
#if !defined(HAVE_DRAND48) && defined(HAVE_RAND)
|
||||
# define drand48() (rand() / (double)RAND_MAX)
|
||||
#endif
|
||||
|
||||
#ifdef MSVC
|
||||
# include <io.h>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: overlap.c,v 1.3 2005/01/07 02:42:29 rocky Exp $
|
||||
$Id: overlap.c,v 1.4 2005/02/06 15:09:10 rocky Exp $
|
||||
|
||||
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||
Copyright (C) 1998 Monty xiphmont@mit.edu
|
||||
@@ -46,7 +46,7 @@ void
|
||||
paranoia_resetcache(cdrom_paranoia_t *p)
|
||||
{
|
||||
c_block_t *c=c_first(p);
|
||||
v_fragment *v;
|
||||
v_fragment_t *v;
|
||||
|
||||
while(c){
|
||||
free_c_block(c);
|
||||
@@ -140,7 +140,7 @@ offset_adjust_settings(cdrom_paranoia_t *p,
|
||||
(potentially unstable) feedback loop */
|
||||
{
|
||||
c_block_t *c=c_first(p);
|
||||
v_fragment *v=v_first(p);
|
||||
v_fragment_t *v=v_first(p);
|
||||
|
||||
while(v && v->one){
|
||||
/* safeguard beginning bounds case with a hammer */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: p_block.c,v 1.6 2005/01/23 05:31:03 rocky Exp $
|
||||
$Id: p_block.c,v 1.7 2005/02/06 15:09:10 rocky Exp $
|
||||
|
||||
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||
Copyright (C) 1998 Monty xiphmont@mit.edu
|
||||
@@ -148,10 +148,10 @@ new_c_block(cdrom_paranoia_t *p)
|
||||
void free_c_block(c_block_t *c)
|
||||
{
|
||||
/* also rid ourselves of v_fragments that reference this block */
|
||||
v_fragment *v=v_first(c->p);
|
||||
v_fragment_t *v=v_first(c->p);
|
||||
|
||||
while(v){
|
||||
v_fragment *next=v_next(v);
|
||||
v_fragment_t *next=v_next(v);
|
||||
if(v->one==c)free_v_fragment(v);
|
||||
v=next;
|
||||
}
|
||||
@@ -159,25 +159,25 @@ void free_c_block(c_block_t *c)
|
||||
free_elem(c->e,1);
|
||||
}
|
||||
|
||||
static v_fragment *
|
||||
static v_fragment_t *
|
||||
i_vfragment_constructor(void)
|
||||
{
|
||||
v_fragment *ret=calloc(1,sizeof(v_fragment));
|
||||
v_fragment_t *ret=calloc(1,sizeof(v_fragment_t));
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static inline void
|
||||
i_v_fragment_destructor(v_fragment *v)
|
||||
i_v_fragment_destructor(v_fragment_t *v)
|
||||
{
|
||||
free(v);
|
||||
}
|
||||
|
||||
v_fragment *
|
||||
v_fragment_t *
|
||||
new_v_fragment(cdrom_paranoia_t *p, c_block_t *one,
|
||||
long int begin, long int end, int last)
|
||||
{
|
||||
linked_element *e=new_elem(p->fragments);
|
||||
v_fragment *b=e->ptr;
|
||||
v_fragment_t *b=e->ptr;
|
||||
|
||||
b->e=e;
|
||||
b->p=p;
|
||||
@@ -191,7 +191,7 @@ new_v_fragment(cdrom_paranoia_t *p, c_block_t *one,
|
||||
return(b);
|
||||
}
|
||||
|
||||
void free_v_fragment(v_fragment *v)
|
||||
void free_v_fragment(v_fragment_t *v)
|
||||
{
|
||||
free_elem(v->e,1);
|
||||
}
|
||||
@@ -228,7 +228,7 @@ c_prev(c_block_t *c)
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
v_fragment *
|
||||
v_fragment_t *
|
||||
v_first(cdrom_paranoia_t *p)
|
||||
{
|
||||
if(p->fragments->head){
|
||||
@@ -237,7 +237,7 @@ v_first(cdrom_paranoia_t *p)
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
v_fragment *
|
||||
v_fragment_t *
|
||||
v_last(cdrom_paranoia_t *p)
|
||||
{
|
||||
if(p->fragments->tail)
|
||||
@@ -245,16 +245,16 @@ v_last(cdrom_paranoia_t *p)
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
v_fragment *
|
||||
v_next(v_fragment *v)
|
||||
v_fragment_t *
|
||||
v_next(v_fragment_t *v)
|
||||
{
|
||||
if(v->e->next)
|
||||
return(v->e->next->ptr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
v_fragment *
|
||||
v_prev(v_fragment *v)
|
||||
v_fragment_t *
|
||||
v_prev(v_fragment_t *v)
|
||||
{
|
||||
if(v->e->prev)
|
||||
return(v->e->prev->ptr);
|
||||
@@ -274,7 +274,7 @@ recover_cache(cdrom_paranoia_t *p)
|
||||
}
|
||||
|
||||
int16_t *
|
||||
v_buffer(v_fragment *v)
|
||||
v_buffer(v_fragment_t *v)
|
||||
{
|
||||
if(!v->one)return(NULL);
|
||||
if(!cv(v->one))return(NULL);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: p_block.h,v 1.3 2005/01/07 02:42:29 rocky Exp $
|
||||
$Id: p_block.h,v 1.4 2005/02/06 15:09:10 rocky Exp $
|
||||
|
||||
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||
Copyright (C) by Monty (xiphmont@mit.edu)
|
||||
@@ -97,7 +97,7 @@ extern void free_c_block(c_block_t *c);
|
||||
extern void i_cblock_destructor(c_block_t *c);
|
||||
extern c_block_t *new_c_block(cdrom_paranoia_t *p);
|
||||
|
||||
typedef struct v_fragment{
|
||||
typedef struct v_fragment_s {
|
||||
c_block_t *one;
|
||||
|
||||
long begin;
|
||||
@@ -111,23 +111,23 @@ typedef struct v_fragment{
|
||||
cdrom_paranoia_t *p;
|
||||
struct linked_element *e;
|
||||
|
||||
} v_fragment;
|
||||
} v_fragment_t;
|
||||
|
||||
extern void free_v_fragment(v_fragment *c);
|
||||
extern v_fragment *new_v_fragment(cdrom_paranoia_t *p, c_block_t *one,
|
||||
extern void free_v_fragment(v_fragment_t *c);
|
||||
extern v_fragment_t *new_v_fragment(cdrom_paranoia_t *p, c_block_t *one,
|
||||
long int begin, long int end,
|
||||
int lastsector);
|
||||
extern int16_t *v_buffer(v_fragment *v);
|
||||
extern int16_t *v_buffer(v_fragment_t *v);
|
||||
|
||||
extern c_block_t *c_first(cdrom_paranoia_t *p);
|
||||
extern c_block_t *c_last(cdrom_paranoia_t *p);
|
||||
extern c_block_t *c_next(c_block_t *c);
|
||||
extern c_block_t *c_prev(c_block_t *c);
|
||||
|
||||
extern v_fragment *v_first(cdrom_paranoia_t *p);
|
||||
extern v_fragment *v_last(cdrom_paranoia_t *p);
|
||||
extern v_fragment *v_next(v_fragment *v);
|
||||
extern v_fragment *v_prev(v_fragment *v);
|
||||
extern v_fragment_t *v_first(cdrom_paranoia_t *p);
|
||||
extern v_fragment_t *v_last(cdrom_paranoia_t *p);
|
||||
extern v_fragment_t *v_next(v_fragment_t *v);
|
||||
extern v_fragment_t *v_prev(v_fragment_t *v);
|
||||
|
||||
typedef struct root_block{
|
||||
long returnedlimit;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: paranoia.c,v 1.9 2005/01/23 14:05:19 rocky Exp $
|
||||
$Id: paranoia.c,v 1.10 2005/02/06 15:09:10 rocky Exp $
|
||||
|
||||
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||
Copyright (C) 1998 Monty xiphmont@mit.edu
|
||||
@@ -452,7 +452,7 @@ typedef struct sync_result {
|
||||
/* do *not* match using zero posts */
|
||||
static long int
|
||||
i_iterate_stage2(cdrom_paranoia_t *p,
|
||||
v_fragment *v,
|
||||
v_fragment_t *v,
|
||||
sync_result *r,
|
||||
void(*callback)(long int, paranoia_cb_mode_t))
|
||||
{
|
||||
@@ -528,7 +528,7 @@ i_silence_test(root_block *root)
|
||||
also must be called with vectors in ascending begin order in case
|
||||
there are nonzero islands */
|
||||
static long int
|
||||
i_silence_match(root_block *root, v_fragment *v,
|
||||
i_silence_match(root_block *root, v_fragment_t *v,
|
||||
void(*callback)(long int, paranoia_cb_mode_t))
|
||||
{
|
||||
|
||||
@@ -547,10 +547,10 @@ i_silence_match(root_block *root, v_fragment *v,
|
||||
p->dynoverlap? */
|
||||
if(fb(v)>=re(root) && fb(v)-p->dynoverlap<re(root)){
|
||||
/* extend the zeroed area of root */
|
||||
long addto=fb(v)+MIN_SILENCE_BOUNDARY-re(root);
|
||||
int16_t vec[addto];
|
||||
memset(vec,0,sizeof(vec));
|
||||
c_append(rc(root),vec,addto);
|
||||
long addto = fb(v)+MIN_SILENCE_BOUNDARY-re(root);
|
||||
int16_t *vec = calloc(addto, sizeof(int16_t));
|
||||
c_append(rc(root), vec, addto);
|
||||
free(vec);
|
||||
}
|
||||
|
||||
/* do we have an 'effortless' overlap? */
|
||||
@@ -595,7 +595,7 @@ i_silence_match(root_block *root, v_fragment *v,
|
||||
}
|
||||
|
||||
static long int
|
||||
i_stage2_each(root_block *root, v_fragment *v,
|
||||
i_stage2_each(root_block *root, v_fragment_t *v,
|
||||
void(*callback)(long int, paranoia_cb_mode_t))
|
||||
{
|
||||
|
||||
@@ -855,7 +855,7 @@ i_stage2_each(root_block *root, v_fragment *v,
|
||||
}
|
||||
|
||||
static int
|
||||
i_init_root(root_block *root, v_fragment *v,long int begin,
|
||||
i_init_root(root_block *root, v_fragment_t *v,long int begin,
|
||||
void(*callback)(long int, paranoia_cb_mode_t))
|
||||
{
|
||||
if(fb(v)<=begin && fe(v)>begin){
|
||||
@@ -884,7 +884,7 @@ i_init_root(root_block *root, v_fragment *v,long int begin,
|
||||
static int
|
||||
vsort(const void *a,const void *b)
|
||||
{
|
||||
return((*(v_fragment **)a)->begin-(*(v_fragment **)b)->begin);
|
||||
return((*(v_fragment_t **)a)->begin-(*(v_fragment_t **)b)->begin);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -904,14 +904,14 @@ i_stage2(cdrom_paranoia_t *p, long int beginword, long int endword,
|
||||
matching in the event that there are still audio vectors with
|
||||
content to be sunk before the silence */
|
||||
|
||||
while(flag){
|
||||
while (flag) {
|
||||
/* loop through all the current fragments */
|
||||
v_fragment *first=v_first(p);
|
||||
v_fragment_t *first=v_first(p);
|
||||
long active=p->fragments->active,count=0;
|
||||
v_fragment *list[active];
|
||||
v_fragment_t **list = calloc(active, sizeof(v_fragment_t *));
|
||||
|
||||
while(first){
|
||||
v_fragment *next=v_next(first);
|
||||
v_fragment_t *next=v_next(first);
|
||||
list[count++]=first;
|
||||
first=next;
|
||||
}
|
||||
@@ -919,7 +919,7 @@ i_stage2(cdrom_paranoia_t *p, long int beginword, long int endword,
|
||||
flag=0;
|
||||
if(count){
|
||||
/* sorted in ascending order of beginning */
|
||||
qsort(list,active,sizeof(v_fragment *),&vsort);
|
||||
qsort(list,active,sizeof(v_fragment_t *),&vsort);
|
||||
|
||||
/* we try a nonzero based match even if in silent mode in
|
||||
the case that there are still cached vectors to sink
|
||||
@@ -958,6 +958,7 @@ i_stage2(cdrom_paranoia_t *p, long int beginword, long int endword,
|
||||
}
|
||||
}
|
||||
}
|
||||
free(list);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user