[iso] update libcdio to latest

* Also update .gitignore for VS2017 files
This commit is contained in:
Pete Batard 2017-03-09 15:34:37 +01:00
parent 8a491e9877
commit 97b4e623cd
23 changed files with 372 additions and 280 deletions

5
.gitignore vendored
View File

@ -1,9 +1,13 @@
*.a *.a
*.aps *.aps
*.db
*.db-shm
*.db-wal
*.dep *.dep
*.exe *.exe
*.htm *.htm
*.idb *.idb
*.ipch
*.la *.la
*.lib *.lib
*.lo *.lo
@ -12,6 +16,7 @@
*.ncb *.ncb
*.o *.o
*.obj *.obj
*.opendb
*.opt *.opt
*.pc *.pc
*.pdb *.pdb

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2000, 2004 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000, 2004 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2005, 2008, 2012 Rocky Bernstein <rocky@gnu.org> Copyright (C) 2005, 2008, 2012, 2015 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
@ -16,7 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/** \file bytesex.h /** \file bytesex.h
* \brief Generic Byte-swapping routines. * \brief Generic Byte-swapping routines.
* *
* Note: this header will is slated to get removed and libcdio will * Note: this header will is slated to get removed and libcdio will
@ -168,7 +168,7 @@ to_723(uint16_t i)
} }
/** Convert from ISO 9660 7.2.3 format to uint16_t */ /** Convert from ISO 9660 7.2.3 format to uint16_t */
static CDIO_INLINE uint16_t static CDIO_INLINE uint16_t
from_723 (uint32_t p) from_723 (uint32_t p)
{ {
if (uint32_swap_le_be (p) != p) if (uint32_swap_le_be (p) != p)
@ -197,19 +197,31 @@ to_733(uint32_t i)
} }
/** Convert from ISO 9660 7.3.3 format to uint32_t */ /** Convert from ISO 9660 7.3.3 format to uint32_t */
static CDIO_INLINE uint32_t static CDIO_INLINE uint32_t
from_733 (uint64_t p) from_733 (uint64_t p)
{ {
if (uint64_swap_le_be (p) != p) if (uint64_swap_le_be (p) != p)
cdio_warn ("from_733: broken byte order"); cdio_warn ("from_733: broken byte order");
return (UINT32_C(0xFFFFFFFF) & p);
}
static CDIO_INLINE uint32_t
from_733_with_err (uint64_t p, bool *err)
{
if (uint64_swap_le_be (p) != p) {
cdio_warn ("from_733: broken byte order");
*err = true;
} else {
*err = false;
}
return (UINT32_C(0xFFFFFFFF) & p); return (UINT32_C(0xFFFFFFFF) & p);
} }
#endif /* CDIO_BYTESEX_H_ */ #endif /* CDIO_BYTESEX_H_ */
/* /*
* Local variables: * Local variables:
* c-file-style: "gnu" * c-file-style: "gnu"
* tab-width: 8 * tab-width: 8

View File

@ -17,7 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/** \file types.h /** \file types.h
* \brief Common type definitions used pervasively in libcdio. * \brief Common type definitions used pervasively in libcdio.
*/ */
@ -31,9 +31,9 @@ extern "C" {
/* If <sys/types.h> is not available on your platform please /* If <sys/types.h> is not available on your platform please
contact the libcdio mailing list so that we can fix it! */ contact the libcdio mailing list so that we can fix it! */
#if !defined(ARE_THERE_STILL_ENVS_WITHOUT_SYS_TYPES) #if !defined(ARE_THERE_STILL_ENVS_WITHOUT_SYS_TYPES)
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#if defined(AMIGA) #if defined(AMIGA)
typedef u_int8_t uint8_t; typedef u_int8_t uint8_t;
@ -68,11 +68,11 @@ typedef uint8_t ubyte;
/* if it's still not defined, take a good guess... should work for /* if it's still not defined, take a good guess... should work for
most 32bit and 64bit archs */ most 32bit and 64bit archs */
#ifndef UINT16_C #ifndef UINT16_C
# define UINT16_C(c) c ## U # define UINT16_C(c) c ## U
#endif #endif
#ifndef UINT32_C #ifndef UINT32_C
# if defined (SIZEOF_INT) && SIZEOF_INT == 4 # if defined (SIZEOF_INT) && SIZEOF_INT == 4
# define UINT32_C(c) c ## U # define UINT32_C(c) c ## U
@ -82,7 +82,7 @@ typedef uint8_t ubyte;
# define UINT32_C(c) c ## U # define UINT32_C(c) c ## U
# endif # endif
#endif #endif
#ifndef UINT64_C #ifndef UINT64_C
# if defined (SIZEOF_LONG) && SIZEOF_LONG == 8 # if defined (SIZEOF_LONG) && SIZEOF_LONG == 8
# define UINT64_C(c) c ## UL # define UINT64_C(c) c ## UL
@ -92,17 +92,17 @@ typedef uint8_t ubyte;
# define UINT64_C(c) c ## ULL # define UINT64_C(c) c ## ULL
# endif # endif
#endif #endif
#ifndef INT64_C #ifndef INT64_C
# if defined (SIZEOF_LONG) && SIZEOF_LONG == 8 # if defined (SIZEOF_LONG) && SIZEOF_LONG == 8
# define INT64_C(c) c ## L # define INT64_C(c) c ## L
# elif defined (SIZEOF_INT) && SIZEOF_INT == 8 # elif defined (SIZEOF_INT) && SIZEOF_INT == 8
# define INT64_C(c) c # define INT64_C(c) c
# else # else
# define INT64_C(c) c ## LL # define INT64_C(c) c ## LL
# endif # endif
#endif #endif
#ifndef __cplusplus #ifndef __cplusplus
/* All the stdbool.h seem to define those */ /* All the stdbool.h seem to define those */
@ -123,10 +123,10 @@ typedef uint8_t ubyte;
#endif /* __bool_true_false_are_defined */ #endif /* __bool_true_false_are_defined */
#endif /*C++*/ #endif /*C++*/
/* some GCC optimizations -- gcc 2.5+ */ /* some GCC optimizations -- gcc 2.5+ */
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) || __clang__ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
#define GNUC_PRINTF( format_idx, arg_idx ) \ #define GNUC_PRINTF( format_idx, arg_idx ) \
__attribute__((format (printf, format_idx, arg_idx))) __attribute__((format (printf, format_idx, arg_idx)))
#define GNUC_SCANF( format_idx, arg_idx ) \ #define GNUC_SCANF( format_idx, arg_idx ) \
@ -150,13 +150,14 @@ typedef uint8_t ubyte;
#define GNUC_UNUSED #define GNUC_UNUSED
#define GNUC_PACKED #define GNUC_PACKED
#endif /* !__GNUC__ */ #endif /* !__GNUC__ */
#if defined(__MINGW32__) #if defined(__MINGW32__)
# define PRAGMA_BEGIN_PACKED _Pragma("pack(push)") \ # define PRAGMA_BEGIN_PACKED _Pragma("pack(push)") \
_Pragma("pack(1)") _Pragma("pack(1)")
# define PRAGMA_END_PACKED _Pragma("pack(pop)") # define PRAGMA_END_PACKED _Pragma("pack(pop)")
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) #elif __GNUC__ > 4 || (__STDC_VERSION__ >= 199901)
/* should work with most EDG-frontend based compilers */ /* should work with GCC > 4.0 clang and most EDG-frontend based C
and C++ compilers */
# define PRAGMA_BEGIN_PACKED _Pragma("pack(1)") # define PRAGMA_BEGIN_PACKED _Pragma("pack(1)")
# define PRAGMA_END_PACKED _Pragma("pack()") # define PRAGMA_END_PACKED _Pragma("pack()")
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
@ -167,18 +168,18 @@ typedef uint8_t ubyte;
# define PRAGMA_BEGIN_PACKED # define PRAGMA_BEGIN_PACKED
# define PRAGMA_END_PACKED # define PRAGMA_END_PACKED
#endif #endif
/* /*
* user directed static branch prediction gcc 2.96+ * user directed static branch prediction gcc 2.96+
*/ */
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 95) #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 95)
# define GNUC_LIKELY(x) __builtin_expect((x),true) # define GNUC_LIKELY(x) __builtin_expect((x),true)
# define GNUC_UNLIKELY(x) __builtin_expect((x),false) # define GNUC_UNLIKELY(x) __builtin_expect((x),false)
#else #else
# define GNUC_LIKELY(x) (x) # define GNUC_LIKELY(x) (x)
# define GNUC_UNLIKELY(x) (x) # define GNUC_UNLIKELY(x) (x)
#endif #endif
#ifndef NULL #ifndef NULL
# define NULL ((void*) 0) # define NULL ((void*) 0)
#endif #endif
@ -199,9 +200,9 @@ typedef uint8_t ubyte;
/** our own offsetof()-like macro */ /** our own offsetof()-like macro */
#define __cd_offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #define __cd_offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
/*! /*!
\brief MSF (minute/second/frame) structure \brief MSF (minute/second/frame) structure
One CD-ROMs addressing scheme especially used in audio formats One CD-ROMs addressing scheme especially used in audio formats
(Red Book) is an address by minute, sector and frame which (Red Book) is an address by minute, sector and frame which
@ -211,7 +212,7 @@ typedef uint8_t ubyte;
cdio_to_bcd8() or cdio_from_bcd8() to convert an integer into or cdio_to_bcd8() or cdio_from_bcd8() to convert an integer into or
out of this format. The format specifier %x (not %d) can be used out of this format. The format specifier %x (not %d) can be used
if you need to format or print values in this structure. if you need to format or print values in this structure.
@see lba_t @see lba_t
*/ */
PRAGMA_BEGIN_PACKED PRAGMA_BEGIN_PACKED
@ -219,13 +220,13 @@ typedef uint8_t ubyte;
uint8_t m, s, f; /* BCD encoded! */ uint8_t m, s, f; /* BCD encoded! */
} GNUC_PACKED; } GNUC_PACKED;
PRAGMA_END_PACKED PRAGMA_END_PACKED
typedef struct msf_s msf_t; typedef struct msf_s msf_t;
#define msf_t_SIZEOF 3 #define msf_t_SIZEOF 3
/*! /*!
\brief UTF-8 char definition \brief UTF-8 char definition
Type to denote UTF-8 strings. Type to denote UTF-8 strings.
*/ */
@ -237,7 +238,7 @@ typedef uint8_t ubyte;
yep = 1, yep = 1,
dunno = 2 dunno = 2
} bool_3way_t; } bool_3way_t;
/* type used for bit-fields in structs (1 <= bits <= 8) */ /* type used for bit-fields in structs (1 <= bits <= 8) */
#if defined(__GNUC__) #if defined(__GNUC__)
/* this is strict ISO C99 which allows only 'unsigned int', 'signed /* this is strict ISO C99 which allows only 'unsigned int', 'signed
@ -249,23 +250,23 @@ typedef uint8_t ubyte;
be pragma'ed on non-gcc compilers */ be pragma'ed on non-gcc compilers */
typedef uint8_t bitfield_t; typedef uint8_t bitfield_t;
#endif #endif
/*! The type of a Logical Block Address. We allow for an lba to be /*! The type of a Logical Block Address. We allow for an lba to be
negative to be consistent with an lba, although I'm not sure this negative to be consistent with an lba, although I'm not sure this
this is possible. this is possible.
*/ */
typedef int32_t lba_t; typedef int32_t lba_t;
/*! The type of a Logical Sector Number. Note that an lba can be negative /*! The type of a Logical Sector Number. Note that an lba can be negative
and the MMC3 specs allow for a conversion of a negative lba. and the MMC3 specs allow for a conversion of a negative lba.
@see msf_t @see msf_t
*/ */
typedef int32_t lsn_t; typedef int32_t lsn_t;
/* Address in either MSF or logical format */ /* Address in either MSF or logical format */
union cdio_cdrom_addr union cdio_cdrom_addr
{ {
msf_t msf; msf_t msf;
lba_t lba; lba_t lba;
@ -273,46 +274,46 @@ typedef uint8_t ubyte;
/*! The type of a track number 0..99. */ /*! The type of a track number 0..99. */
typedef uint8_t track_t; typedef uint8_t track_t;
/*! The type of a session number 0..99. */ /*! The type of a session number 0..99. */
typedef uint8_t session_t; typedef uint8_t session_t;
/*! /*!
Constant for invalid session number Constant for invalid session number
*/ */
#define CDIO_INVALID_SESSION 0xFF #define CDIO_INVALID_SESSION 0xFF
/*! /*!
Constant for invalid LBA. It is 151 less than the most negative Constant for invalid LBA. It is 151 less than the most negative
LBA -45150. This provide slack for the 150-frame offset in LBA -45150. This provide slack for the 150-frame offset in
LBA to LSN 150 conversions LBA to LSN 150 conversions
*/ */
#define CDIO_INVALID_LBA -45301 #define CDIO_INVALID_LBA -45301
/*! /*!
Constant for invalid LSN Constant for invalid LSN
*/ */
#define CDIO_INVALID_LSN CDIO_INVALID_LBA #define CDIO_INVALID_LSN CDIO_INVALID_LBA
/*! /*!
Number of ASCII bytes in a media catalog number (MCN). Number of ASCII bytes in a media catalog number (MCN).
We include an extra 0 byte so these can be used as C strings. We include an extra 0 byte so these can be used as C strings.
*/ */
#define CDIO_MCN_SIZE 13 #define CDIO_MCN_SIZE 13
/*! /*!
Type to hold ASCII bytes in a media catalog number (MCN). Type to hold ASCII bytes in a media catalog number (MCN).
We include an extra 0 byte so these can be used as C strings. We include an extra 0 byte so these can be used as C strings.
*/ */
typedef char cdio_mcn_t[CDIO_MCN_SIZE+1]; typedef char cdio_mcn_t[CDIO_MCN_SIZE+1];
/*!
/*!
Number of ASCII bytes in International Standard Recording Codes (ISRC) Number of ASCII bytes in International Standard Recording Codes (ISRC)
*/ */
#define CDIO_ISRC_SIZE 12 #define CDIO_ISRC_SIZE 12
/*! /*!
Type to hold ASCII bytes in a ISRC. Type to hold ASCII bytes in a ISRC.
We include an extra 0 byte so these can be used as C strings. We include an extra 0 byte so these can be used as C strings.
*/ */
@ -320,7 +321,7 @@ typedef uint8_t ubyte;
typedef int cdio_fs_anal_t; typedef int cdio_fs_anal_t;
/*! /*!
track flags track flags
Q Sub-channel Control Field (4.2.3.3) Q Sub-channel Control Field (4.2.3.3)
*/ */
@ -341,7 +342,7 @@ typedef uint8_t ubyte;
#endif /* CDIO_TYPES_H_ */ #endif /* CDIO_TYPES_H_ */
/* /*
* Local variables: * Local variables:
* c-file-style: "gnu" * c-file-style: "gnu"
* tab-width: 8 * tab-width: 8

View File

@ -1,20 +1,19 @@
/* $Id: version.h.in,v 1.6 2005/01/29 20:54:20 rocky Exp $ */ /** \file version.h
/** \file version.h
* *
* \brief A file containing the libcdio package version * \brief A file containing the libcdio package version
* number (90) and OS build name. * number (94) and OS build name.
*/ */
/*! CDIO_VERSION is a C-Preprocessor macro of a string that shows what /*! CDIO_VERSION is a C-Preprocessor macro of a string that shows what
version is used. cdio_version_string has the same value, but it is a version is used. cdio_version_string has the same value, but it is a
constant variable that can be accessed at run time. */ constant variable that can be accessed at run time. */
#define CDIO_VERSION "0.93 i686-pc-mingw32" #define CDIO_VERSION "0.94 i686-w64-mingw32"
extern const char *cdio_version_string; /**< = CDIO_VERSION */ extern const char *cdio_version_string; /**< = CDIO_VERSION */
/*! LIBCDIO_VERSION_NUM is a C-Preprocessor macro that can be used for /*! LIBCDIO_VERSION_NUM is a C-Preprocessor macro that can be used for
testing in the C preprocessor. libcdio_version_num has the same testing in the C preprocessor. libcdio_version_num has the same
value, but it is a constant variable that can be accessed at run value, but it is a constant variable that can be accessed at run
time. */ time. */
#define LIBCDIO_VERSION_NUM 93 #define LIBCDIO_VERSION_NUM 94
extern const unsigned int libcdio_version_num; /**< = LIBCDIO_VERSION_NUM */ extern const unsigned int libcdio_version_num; /**< = LIBCDIO_VERSION_NUM */

View File

@ -134,7 +134,9 @@
#define HAVE_STRING_H 1 #define HAVE_STRING_H 1
/* Define to 1 if you have the `strndup' function. */ /* Define to 1 if you have the `strndup' function. */
/* #undef HAVE_STRNDUP */ #if defined(__MINGW32__)
#define HAVE_STRNDUP 1
#endif
/* Define this if you have struct timespec */ /* Define this if you have struct timespec */
/* #undef HAVE_STRUCT_TIMESPEC */ /* #undef HAVE_STRUCT_TIMESPEC */

View File

@ -36,7 +36,6 @@
<ClInclude Include="..\..\cdio\ds.h" /> <ClInclude Include="..\..\cdio\ds.h" />
<ClInclude Include="..\..\cdio\logging.h" /> <ClInclude Include="..\..\cdio\logging.h" />
<ClInclude Include="..\..\cdio\memory.h" /> <ClInclude Include="..\..\cdio\memory.h" />
<ClInclude Include="..\..\cdio\portable.h" />
<ClInclude Include="..\..\cdio\sector.h" /> <ClInclude Include="..\..\cdio\sector.h" />
<ClInclude Include="..\..\cdio\types.h" /> <ClInclude Include="..\..\cdio\types.h" />
<ClInclude Include="..\..\cdio\util.h" /> <ClInclude Include="..\..\cdio\util.h" />
@ -45,6 +44,7 @@
<ClInclude Include="..\cdio_assert.h" /> <ClInclude Include="..\cdio_assert.h" />
<ClInclude Include="..\cdio_private.h" /> <ClInclude Include="..\cdio_private.h" />
<ClInclude Include="..\filemode.h" /> <ClInclude Include="..\filemode.h" />
<ClInclude Include="..\portable.h" />
<ClInclude Include="..\_cdio_stdio.h" /> <ClInclude Include="..\_cdio_stdio.h" />
<ClInclude Include="..\_cdio_stream.h" /> <ClInclude Include="..\_cdio_stream.h" />
</ItemGroup> </ItemGroup>

View File

@ -88,7 +88,7 @@
<ClInclude Include="..\..\cdio\memory.h"> <ClInclude Include="..\..\cdio\memory.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\cdio\portable.h"> <ClInclude Include="..\portable.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>

View File

@ -36,7 +36,6 @@
<ClInclude Include="..\..\cdio\ds.h" /> <ClInclude Include="..\..\cdio\ds.h" />
<ClInclude Include="..\..\cdio\logging.h" /> <ClInclude Include="..\..\cdio\logging.h" />
<ClInclude Include="..\..\cdio\memory.h" /> <ClInclude Include="..\..\cdio\memory.h" />
<ClInclude Include="..\..\cdio\portable.h" />
<ClInclude Include="..\..\cdio\sector.h" /> <ClInclude Include="..\..\cdio\sector.h" />
<ClInclude Include="..\..\cdio\types.h" /> <ClInclude Include="..\..\cdio\types.h" />
<ClInclude Include="..\..\cdio\util.h" /> <ClInclude Include="..\..\cdio\util.h" />
@ -45,6 +44,7 @@
<ClInclude Include="..\cdio_assert.h" /> <ClInclude Include="..\cdio_assert.h" />
<ClInclude Include="..\cdio_private.h" /> <ClInclude Include="..\cdio_private.h" />
<ClInclude Include="..\filemode.h" /> <ClInclude Include="..\filemode.h" />
<ClInclude Include="..\portable.h" />
<ClInclude Include="..\_cdio_stdio.h" /> <ClInclude Include="..\_cdio_stdio.h" />
<ClInclude Include="..\_cdio_stream.h" /> <ClInclude Include="..\_cdio_stream.h" />
</ItemGroup> </ItemGroup>

View File

@ -88,7 +88,7 @@
<ClInclude Include="..\..\cdio\memory.h"> <ClInclude Include="..\..\cdio\memory.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\cdio\portable.h"> <ClInclude Include="..\portable.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>

View File

@ -31,7 +31,7 @@
#include <string.h> #include <string.h>
#endif #endif
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef HAVE_SYS_STAT_H #ifdef HAVE_SYS_STAT_H
#include <sys/stat.h> #include <sys/stat.h>
@ -88,8 +88,6 @@ static inline int _stati64_utf8(const char *path, struct _stati64 *buffer) {
#define _STRINGIFY(a) #a #define _STRINGIFY(a) #a
#define STRINGIFY(a) _STRINGIFY(a) #define STRINGIFY(a) _STRINGIFY(a)
// static const char _rcsid[] = "$Id: _cdio_stdio.c,v 1.6 2008/04/22 15:29:11 karl Exp $";
#define CDIO_STDIO_BUFSIZE (128*1024) #define CDIO_STDIO_BUFSIZE (128*1024)
typedef struct { typedef struct {
@ -100,7 +98,7 @@ typedef struct {
} _UserData; } _UserData;
static int static int
_stdio_open (void *user_data) _stdio_open (void *user_data)
{ {
_UserData *const ud = user_data; _UserData *const ud = user_data;
@ -120,7 +118,7 @@ _stdio_close(void *user_data)
if (fclose (ud->fd)) if (fclose (ud->fd))
cdio_error ("fclose (): %s", strerror (errno)); cdio_error ("fclose (): %s", strerror (errno));
ud->fd = NULL; ud->fd = NULL;
free (ud->fd_buf); free (ud->fd_buf);
@ -138,14 +136,14 @@ _stdio_free(void *user_data)
free(ud->pathname); free(ud->pathname);
if (ud->fd) /* should be NULL anyway... */ if (ud->fd) /* should be NULL anyway... */
_stdio_close(user_data); _stdio_close(user_data);
free(ud); free(ud);
} }
/*! /*!
Like fseek/fseeko(3) and in fact may be the same. Like fseek/fseeko(3) and in fact may be the same.
This function sets the file position indicator for the stream This function sets the file position indicator for the stream
pointed to by stream. The new position, measured in bytes, is obtained pointed to by stream. The new position, measured in bytes, is obtained
by adding offset bytes to the position specified by whence. If whence by adding offset bytes to the position specified by whence. If whence
@ -154,12 +152,12 @@ _stdio_free(void *user_data)
respectively. A successful call to the fseek function clears the end- respectively. A successful call to the fseek function clears the end-
of-file indicator for the stream and undoes any effects of the of-file indicator for the stream and undoes any effects of the
ungetc(3) function on the same stream. ungetc(3) function on the same stream.
@return upon successful completion, DRIVER_OP_SUCCESS, else, @return upon successful completion, DRIVER_OP_SUCCESS, else,
DRIVER_OP_ERROR is returned and the global variable errno is set to DRIVER_OP_ERROR is returned and the global variable errno is set to
indicate the error. indicate the error.
*/ */
static int static int
_stdio_seek(void *p_user_data, off_t i_offset, int whence) _stdio_seek(void *p_user_data, off_t i_offset, int whence)
{ {
_UserData *const ud = p_user_data; _UserData *const ud = p_user_data;
@ -190,18 +188,18 @@ _stdio_stat(void *p_user_data)
/*! /*!
Like fread(3) and in fact is about the same. Like fread(3) and in fact is about the same.
DESCRIPTION: DESCRIPTION:
The function fread reads nmemb elements of data, each size bytes long, The function fread reads nmemb elements of data, each size bytes long,
from the stream pointed to by stream, storing them at the location from the stream pointed to by stream, storing them at the location
given by ptr. given by ptr.
RETURN VALUE: RETURN VALUE:
return the number of items successfully read or written (i.e., return the number of items successfully read or written (i.e.,
not the number of characters). If an error occurs, or the not the number of characters). If an error occurs, or the
end-of-file is reached, the return value is a short item count end-of-file is reached, the return value is a short item count
(or zero). (or zero).
We do not distinguish between end-of-file and error, and callers We do not distinguish between end-of-file and error, and callers
must use feof(3) and ferror(3) to determine which occurred. must use feof(3) and ferror(3) to determine which occurred.
*/ */
@ -258,9 +256,9 @@ cdio_stdio_new(const char pathname[])
if (pathdup == NULL) if (pathdup == NULL)
return NULL; return NULL;
if (CDIO_STAT_CALL (pathdup, &statbuf) == -1) if (CDIO_STAT_CALL (pathdup, &statbuf) == -1)
{ {
cdio_warn ("could not retrieve file info for `%s': %s", cdio_warn ("could not retrieve file info for `%s': %s",
pathdup, strerror (errno)); pathdup, strerror (errno));
cdio_free(pathdup); cdio_free(pathdup);
return NULL; return NULL;
@ -283,9 +281,8 @@ cdio_stdio_new(const char pathname[])
return new_obj; return new_obj;
} }
/*
/*
* Local variables: * Local variables:
* c-file-style: "gnu" * c-file-style: "gnu"
* tab-width: 8 * tab-width: 8

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2005, 2006, 2008, 2011 Rocky Bernstein <rocky@gnu.org> Copyright (C) 2005, 2006, 2008, 2011, 2016 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2000, 2004, 2005 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000, 2004, 2005 Herbert Valerio Riedel <hvr@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
@ -41,9 +41,7 @@
#include <cdio/util.h> #include <cdio/util.h>
#include "_cdio_stream.h" #include "_cdio_stream.h"
// static const char _rcsid[] = "$Id: _cdio_stream.c,v 1.9 2008/04/22 15:29:11 karl Exp $"; /*
/*
* DataSource implementations * DataSource implementations
*/ */
@ -81,10 +79,10 @@ cdio_stream_destroy(CdioDataSource_t *p_obj)
/** /**
Like 3 fgetpos. Like 3 fgetpos.
This function gets the current file position indicator for the stream This function gets the current file position indicator for the stream
pointed to by stream. pointed to by stream.
@return unpon successful completion, return value is positive, else, @return unpon successful completion, return value is positive, else,
the global variable errno is set to indicate the error. the global variable errno is set to indicate the error.
*/ */
@ -108,8 +106,8 @@ cdio_stream_new(void *user_data, const cdio_stream_io_functions *funcs)
return new_obj; return new_obj;
} }
/* /*
Open if not already open. Open if not already open.
Return false if we hit an error. Errno should be set for that error. Return false if we hit an error. Errno should be set for that error.
*/ */
static bool static bool
@ -132,18 +130,18 @@ _cdio_stream_open_if_necessary(CdioDataSource_t *p_obj)
/** /**
Like fread(3) and in fact may be the same. Like fread(3) and in fact may be the same.
DESCRIPTION: DESCRIPTION:
The function fread reads nmemb elements of data, each size bytes long, The function fread reads nmemb elements of data, each size bytes long,
from the stream pointed to by stream, storing them at the location from the stream pointed to by stream, storing them at the location
given by ptr. given by ptr.
RETURN VALUE: RETURN VALUE:
return the number of items successfully read or written (i.e., return the number of items successfully read or written (i.e.,
not the number of characters). If an error occurs, or the not the number of characters). If an error occurs, or the
end-of-file is reached, the return value is a short item count end-of-file is reached, the return value is a short item count
(or zero). (or zero).
We do not distinguish between end-of-file and error, and callers We do not distinguish between end-of-file and error, and callers
must use feof(3) and ferror(3) to determine which occurred. must use feof(3) and ferror(3) to determine which occurred.
*/ */
@ -163,7 +161,7 @@ cdio_stream_read(CdioDataSource_t* p_obj, void *ptr, size_t size, size_t nmemb)
/** /**
Like 3 fseek and in fact may be the same. Like 3 fseek and in fact may be the same.
This function sets the file position indicator for the stream This function sets the file position indicator for the stream
pointed to by stream. The new position, measured in bytes, is obtained pointed to by stream. The new position, measured in bytes, is obtained
by adding offset bytes to the position specified by whence. If whence by adding offset bytes to the position specified by whence. If whence
@ -172,7 +170,7 @@ cdio_stream_read(CdioDataSource_t* p_obj, void *ptr, size_t size, size_t nmemb)
respectively. A successful call to the fseek function clears the end- respectively. A successful call to the fseek function clears the end-
of-file indicator for the stream and undoes any effects of the of-file indicator for the stream and undoes any effects of the
ungetc(3) function on the same stream. ungetc(3) function on the same stream.
@return unpon successful completion, return value is positive, else, @return unpon successful completion, return value is positive, else,
the global variable errno is set to indicate the error. the global variable errno is set to indicate the error.
*/ */
@ -181,7 +179,7 @@ cdio_stream_seek(CdioDataSource_t* p_obj, off_t offset, int whence)
{ {
if (!p_obj) return DRIVER_OP_UNINIT; if (!p_obj) return DRIVER_OP_UNINIT;
if (!_cdio_stream_open_if_necessary(p_obj)) if (!_cdio_stream_open_if_necessary(p_obj))
/* errno is set by _cdio_stream_open_if necessary. */ /* errno is set by _cdio_stream_open_if necessary. */
return DRIVER_OP_ERROR; return DRIVER_OP_ERROR;
@ -200,7 +198,7 @@ cdio_stream_seek(CdioDataSource_t* p_obj, off_t offset, int whence)
} }
/** /**
Return whatever size of stream reports, I guess unit size is bytes. Return whatever size of stream reports, I guess unit size is bytes.
On error return -1; On error return -1;
*/ */
off_t off_t
@ -212,9 +210,8 @@ cdio_stream_stat(CdioDataSource_t *p_obj)
return p_obj->op.stat(p_obj->user_data); return p_obj->op.stat(p_obj->user_data);
} }
/*
/*
* Local variables: * Local variables:
* c-file-style: "gnu" * c-file-style: "gnu"
* tab-width: 8 * tab-width: 8

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2003, 2004, 2005, 2008, 2009, 2011, 2012 Copyright (C) 2003-2005, 2008-2009, 2011-2012, 2016
Rocky Bernstein <rocky@gnu.org> 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
@ -26,15 +26,37 @@
# include "config.h" # include "config.h"
#endif #endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/audio.h> #include <cdio/audio.h>
#include <cdio/cdtext.h> #include <cdio/cdtext.h>
//#include "mmc/mmc_private.h" #include "mmc/mmc_private.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
#ifndef HAVE_STRNDUP
static inline char *strndup(const char *s, size_t n)
{
char *result;
size_t len = strlen (s);
if (n < len)
len = n;
result = (char *) malloc (len + 1);
if (!result)
return 0;
result[len] = '\0';
return (char *) strncpy (result, s, len);
}
#endif /*HAVE_STRNDUP*/
/*! /*!
Get directory name from file name. Get directory name from file name.
@ -65,101 +87,101 @@ extern "C" {
typedef struct { typedef struct {
/*! /*!
Get volume of an audio CD. Get volume of an audio CD.
@param p_env the CD object to be acted upon. @param p_env the CD object to be acted upon.
*/ */
driver_return_code_t (*audio_get_volume) driver_return_code_t (*audio_get_volume)
(void *p_env, /*out*/ cdio_audio_volume_t *p_volume); (void *p_env, /*out*/ cdio_audio_volume_t *p_volume);
/*! /*!
Pause playing CD through analog output Pause playing CD through analog output
@param p_env the CD object to be acted upon. @param p_env the CD object to be acted upon.
*/ */
driver_return_code_t (*audio_pause) (void *p_env); driver_return_code_t (*audio_pause) (void *p_env);
/*! /*!
Playing CD through analog output Playing CD through analog output
@param p_env the CD object to be acted upon. @param p_env the CD object to be acted upon.
*/ */
driver_return_code_t (*audio_play_msf) ( void *p_env, driver_return_code_t (*audio_play_msf) ( void *p_env,
msf_t *p_start_msf, msf_t *p_start_msf,
msf_t *p_end_msf ); msf_t *p_end_msf );
/*! /*!
Playing CD through analog output Playing CD through analog output
@param p_env the CD object to be acted upon. @param p_env the CD object to be acted upon.
*/ */
driver_return_code_t (*audio_play_track_index) driver_return_code_t (*audio_play_track_index)
( void *p_env, cdio_track_index_t *p_track_index ); ( void *p_env, cdio_track_index_t *p_track_index );
/*! /*!
Get subchannel information. Get subchannel information.
@param p_env the CD object to be acted upon. @param p_env the CD object to be acted upon.
*/ */
driver_return_code_t (*audio_read_subchannel) driver_return_code_t (*audio_read_subchannel)
( void *p_env, cdio_subchannel_t *subchannel ); ( void *p_env, cdio_subchannel_t *subchannel );
/*! /*!
Resume playing an audio CD. Resume playing an audio CD.
@param p_env the CD object to be acted upon. @param p_env the CD object to be acted upon.
*/ */
driver_return_code_t (*audio_resume) ( void *p_env ); driver_return_code_t (*audio_resume) ( void *p_env );
/*! /*!
Set volume of an audio CD. Set volume of an audio CD.
@param p_env the CD object to be acted upon. @param p_env the CD object to be acted upon.
*/ */
driver_return_code_t (*audio_set_volume) driver_return_code_t (*audio_set_volume)
( void *p_env, cdio_audio_volume_t *p_volume ); ( void *p_env, cdio_audio_volume_t *p_volume );
/*! /*!
Stop playing an audio CD. Stop playing an audio CD.
@param p_env the CD object to be acted upon. @param p_env the CD object to be acted upon.
*/ */
driver_return_code_t (*audio_stop) ( void *p_env ); driver_return_code_t (*audio_stop) ( void *p_env );
/*! /*!
Eject media in CD drive. If successful, as a side effect we Eject media in CD drive. If successful, as a side effect we
also free p_env. also free p_env.
@param p_env the CD object to be acted upon. @param p_env the CD object to be acted upon.
If the CD is ejected *p_env is freed and p_env set to NULL. If the CD is ejected *p_env is freed and p_env set to NULL.
*/ */
driver_return_code_t (*eject_media) ( void *p_env ); driver_return_code_t (*eject_media) ( void *p_env );
/*! /*!
Release and free resources associated with cd. Release and free resources associated with cd.
*/ */
void (*free) (void *p_env); void (*free) (void *p_env);
/*! /*!
Return the value associated with the key "arg". Return the value associated with the key "arg".
*/ */
const char * (*get_arg) (void *p_env, const char key[]); const char * (*get_arg) (void *p_env, const char key[]);
/*! /*!
Get the block size for subsequest read requests, via a SCSI MMC Get the block size for subsequest read requests, via a SCSI MMC
MODE_SENSE 6 command. MODE_SENSE 6 command.
*/ */
int (*get_blocksize) ( void *p_env ); int (*get_blocksize) ( void *p_env );
/*! /*!
Get cdtext information for a CdIo object. Get cdtext information for a CdIo object.
@param obj the CD object that may contain CD-TEXT information. @param obj the CD object that may contain CD-TEXT information.
@return the CD-TEXT object or NULL if obj is NULL @return the CD-TEXT object or NULL if obj is NULL
or CD-TEXT information does not exist. or CD-TEXT information does not exist.
@ -176,16 +198,16 @@ extern "C" {
free when done and not NULL. free when done and not NULL.
*/ */
uint8_t * (*get_cdtext_raw) ( void *p_env ); uint8_t * (*get_cdtext_raw) ( void *p_env );
/*! /*!
Return an array of device names. if CdIo is NULL (we haven't Return an array of device names. if CdIo is NULL (we haven't
initialized a specific device driver), then find a suitable device initialized a specific device driver), then find a suitable device
driver. driver.
NULL is returned if we couldn't return a list of devices. NULL is returned if we couldn't return a list of devices.
*/ */
char ** (*get_devices) ( void ); char ** (*get_devices) ( void );
/*! /*!
Get the default CD device. Get the default CD device.
@ -197,21 +219,21 @@ extern "C" {
NULL even though there may be a hardware CD-ROM. NULL even though there may be a hardware CD-ROM.
*/ */
char * (*get_default_device) ( void ); char * (*get_default_device) ( void );
/*! /*!
Return the size of the CD in logical block address (LBA) units. Return the size of the CD in logical block address (LBA) units.
@return the lsn. On error 0 or CDIO_INVALD_LSN. @return the lsn. On error 0 or CDIO_INVALD_LSN.
*/ */
lsn_t (*get_disc_last_lsn) ( void *p_env ); lsn_t (*get_disc_last_lsn) ( void *p_env );
/*! /*!
Get disc mode associated with cd_obj. Get disc mode associated with cd_obj.
*/ */
discmode_t (*get_discmode) ( void *p_env ); discmode_t (*get_discmode) ( void *p_env );
/*! /*!
Return the what kind of device we've got. Return the what kind of device we've got.
See cd_types.h for a list of bitmasks for the drive type; See cd_types.h for a list of bitmasks for the drive type;
*/ */
void (*get_drive_cap) (const void *p_env, void (*get_drive_cap) (const void *p_env,
@ -219,28 +241,28 @@ extern "C" {
cdio_drive_write_cap_t *p_write_cap, cdio_drive_write_cap_t *p_write_cap,
cdio_drive_misc_cap_t *p_misc_cap); cdio_drive_misc_cap_t *p_misc_cap);
/*! /*!
Return the number of of the first track. Return the number of of the first track.
CDIO_INVALID_TRACK is returned on error. CDIO_INVALID_TRACK is returned on error.
*/ */
track_t (*get_first_track_num) ( void *p_env ); track_t (*get_first_track_num) ( void *p_env );
/*! /*!
Get the CD-ROM hardware info via a SCSI MMC INQUIRY command. Get the CD-ROM hardware info via a SCSI MMC INQUIRY command.
False is returned if we had an error getting the information. False is returned if we had an error getting the information.
*/ */
bool (*get_hwinfo) bool (*get_hwinfo)
( const CdIo_t *p_cdio, /* out*/ cdio_hwinfo_t *p_hw_info ); ( const CdIo_t *p_cdio, /* out*/ cdio_hwinfo_t *p_hw_info );
/*! Get the LSN of the first track of the last session of /*! Get the LSN of the first track of the last session of
on the CD. on the CD.
@param p_cdio the CD object to be acted upon. @param p_cdio the CD object to be acted upon.
@param i_last_session pointer to the session number to be returned. @param i_last_session pointer to the session number to be returned.
*/ */
driver_return_code_t (*get_last_session) driver_return_code_t (*get_last_session)
( void *p_env, /*out*/ lsn_t *i_last_session ); ( void *p_env, /*out*/ lsn_t *i_last_session );
/*! /*!
Find out if media has changed since the last call. Find out if media has changed since the last call.
@param p_env the CD object to be acted upon. @param p_env the CD object to be acted upon.
@return 1 if media has changed since last call, 0 if not. Error @return 1 if media has changed since last call, 0 if not. Error
@ -248,31 +270,31 @@ extern "C" {
*/ */
int (*get_media_changed) ( const void *p_env ); int (*get_media_changed) ( const void *p_env );
/*! /*!
Return the media catalog number MCN from the CD or NULL if Return the media catalog number MCN from the CD or NULL if
there is none or we don't have the ability to get it. there is none or we don't have the ability to get it.
*/ */
char * (*get_mcn) ( const void *p_env ); char * (*get_mcn) ( const void *p_env );
/*! /*!
Return the number of tracks in the current medium. Return the number of tracks in the current medium.
CDIO_INVALID_TRACK is returned on error. CDIO_INVALID_TRACK is returned on error.
*/ */
track_t (*get_num_tracks) ( void *p_env ); track_t (*get_num_tracks) ( void *p_env );
/*! Return number of channels in track: 2 or 4; -2 if not /*! Return number of channels in track: 2 or 4; -2 if not
implemented or -1 for error. implemented or -1 for error.
Not meaningful if track is not an audio track. Not meaningful if track is not an audio track.
*/ */
int (*get_track_channels) ( const void *p_env, track_t i_track ); int (*get_track_channels) ( const void *p_env, track_t i_track );
/*! Return 0 if track is copy protected, 1 if not, or -1 for error /*! Return 0 if track is copy protected, 1 if not, or -1 for error
or -2 if not implimented (yet). Is this meaningful if not an or -2 if not implimented (yet). Is this meaningful if not an
audio track? audio track?
*/ */
track_flag_t (*get_track_copy_permit) ( void *p_env, track_t i_track ); track_flag_t (*get_track_copy_permit) ( void *p_env, track_t i_track );
/*! /*!
Return the starting LBA for track number Return the starting LBA for track number
i_track in p_env. Tracks numbers start at 1. i_track in p_env. Tracks numbers start at 1.
The "leadout" track is specified either by The "leadout" track is specified either by
@ -281,7 +303,7 @@ extern "C" {
*/ */
lba_t (*get_track_lba) ( void *p_env, track_t i_track ); lba_t (*get_track_lba) ( void *p_env, track_t i_track );
/*! /*!
Return the starting LBA for the pregap for track number Return the starting LBA for the pregap for track number
i_track in p_env. Tracks numbers start at 1. i_track in p_env. Tracks numbers start at 1.
CDIO_INVALID_LBA is returned on error. CDIO_INVALID_LBA is returned on error.
@ -296,23 +318,23 @@ extern "C" {
string when done with it. string when done with it.
*/ */
char * (*get_track_isrc) ( const void *p_env, track_t i_track ); char * (*get_track_isrc) ( const void *p_env, track_t i_track );
/*! /*!
Get format of track. Get format of track.
*/ */
track_format_t (*get_track_format) ( void *p_env, track_t i_track ); track_format_t (*get_track_format) ( void *p_env, track_t i_track );
/*! /*!
Return true if we have XA data (green, mode2 form1) or Return true if we have XA data (green, mode2 form1) or
XA data (green, mode2 form2). That is track begins: XA data (green, mode2 form2). That is track begins:
sync - header - subheader sync - header - subheader
12 4 - 8 12 4 - 8
FIXME: there's gotta be a better design for this and get_track_format? FIXME: there's gotta be a better design for this and get_track_format?
*/ */
bool (*get_track_green) ( void *p_env, track_t i_track ); bool (*get_track_green) ( void *p_env, track_t i_track );
/*! /*!
Return the starting MSF (minutes/secs/frames) for track number Return the starting MSF (minutes/secs/frames) for track number
i_track in p_env. Tracks numbers start at 1. i_track in p_env. Tracks numbers start at 1.
The "leadout" track is specified either by The "leadout" track is specified either by
@ -320,122 +342,122 @@ extern "C" {
False is returned on error. False is returned on error.
*/ */
bool (*get_track_msf) ( void *p_env, track_t i_track, msf_t *p_msf ); bool (*get_track_msf) ( void *p_env, track_t i_track, msf_t *p_msf );
/*! Return 1 if track has pre-emphasis, 0 if not, or -1 for error /*! Return 1 if track has pre-emphasis, 0 if not, or -1 for error
or -2 if not implimented (yet). Is this meaningful if not an or -2 if not implimented (yet). Is this meaningful if not an
audio track? audio track?
*/ */
track_flag_t (*get_track_preemphasis) track_flag_t (*get_track_preemphasis)
( const void *p_env, track_t i_track ); ( const void *p_env, track_t i_track );
/*! /*!
lseek - reposition read/write file offset lseek - reposition read/write file offset
Returns (off_t) -1 on error. Returns (off_t) -1 on error.
Similar to libc's lseek() Similar to libc's lseek()
*/ */
off_t (*lseek) ( void *p_env, off_t offset, int whence ); off_t (*lseek) ( void *p_env, off_t offset, int whence );
/*! /*!
Reads into buf the next size bytes. Reads into buf the next size bytes.
Returns -1 on error. Returns -1 on error.
Similar to libc's read() Similar to libc's read()
*/ */
ssize_t (*read) ( void *p_env, void *p_buf, size_t i_size ); ssize_t (*read) ( void *p_env, void *p_buf, size_t i_size );
/*! /*!
Reads a single mode2 sector from cd device into buf starting Reads a single mode2 sector from cd device into buf starting
from lsn. Returns 0 if no error. from lsn. Returns 0 if no error.
*/ */
int (*read_audio_sectors) ( void *p_env, void *p_buf, lsn_t i_lsn, int (*read_audio_sectors) ( void *p_env, void *p_buf, lsn_t i_lsn,
unsigned int i_blocks ); unsigned int i_blocks );
/*! /*!
Read a data sector Read a data sector
@param p_env environment to read from @param p_env environment to read from
@param p_buf place to read data into. The caller should make sure @param p_buf place to read data into. The caller should make sure
this location can store at least CDIO_CD_FRAMESIZE, this location can store at least CDIO_CD_FRAMESIZE,
M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE depending M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE depending
on the kind of sector getting read. If you don't on the kind of sector getting read. If you don't
know whether you have a Mode 1/2, Form 1/ Form 2/Formless know whether you have a Mode 1/2, Form 1/ Form 2/Formless
sector best to reserve space for the maximum, sector best to reserve space for the maximum,
M2RAW_SECTOR_SIZE. M2RAW_SECTOR_SIZE.
@param i_lsn sector to read @param i_lsn sector to read
@param i_blocksize size of block. Should be either CDIO_CD_FRAMESIZE, @param i_blocksize size of block. Should be either CDIO_CD_FRAMESIZE,
M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE. See comment above under p_buf. M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE. See comment above under p_buf.
*/ */
driver_return_code_t (*read_data_sectors) driver_return_code_t (*read_data_sectors)
( void *p_env, void *p_buf, lsn_t i_lsn, uint16_t i_blocksize, ( void *p_env, void *p_buf, lsn_t i_lsn, uint16_t i_blocksize,
uint32_t i_blocks ); uint32_t i_blocks );
/*! /*!
Reads a single mode2 sector from cd device into buf starting Reads a single mode2 sector from cd device into buf starting
from lsn. Returns 0 if no error. from lsn. Returns 0 if no error.
*/ */
int (*read_mode2_sector) int (*read_mode2_sector)
( void *p_env, void *p_buf, lsn_t i_lsn, bool b_mode2_form2 ); ( void *p_env, void *p_buf, lsn_t i_lsn, bool b_mode2_form2 );
/*! /*!
Reads i_blocks of mode2 sectors from cd device into data starting Reads i_blocks of mode2 sectors from cd device into data starting
from lsn. from lsn.
Returns 0 if no error. Returns 0 if no error.
*/ */
int (*read_mode2_sectors) int (*read_mode2_sectors)
( void *p_env, void *p_buf, lsn_t i_lsn, bool b_mode2_form2, ( void *p_env, void *p_buf, lsn_t i_lsn, bool b_mode2_form2,
unsigned int i_blocks ); unsigned int i_blocks );
/*! /*!
Reads a single mode1 sector from cd device into buf starting Reads a single mode1 sector from cd device into buf starting
from lsn. Returns 0 if no error. from lsn. Returns 0 if no error.
*/ */
int (*read_mode1_sector) int (*read_mode1_sector)
( void *p_env, void *p_buf, lsn_t i_lsn, bool mode1_form2 ); ( void *p_env, void *p_buf, lsn_t i_lsn, bool mode1_form2 );
/*! /*!
Reads i_blocks of mode1 sectors from cd device into data starting Reads i_blocks of mode1 sectors from cd device into data starting
from lsn. from lsn.
Returns 0 if no error. Returns 0 if no error.
*/ */
int (*read_mode1_sectors) int (*read_mode1_sectors)
( void *p_env, void *p_buf, lsn_t i_lsn, bool mode1_form2, ( void *p_env, void *p_buf, lsn_t i_lsn, bool mode1_form2,
unsigned int i_blocks ); unsigned int i_blocks );
bool (*read_toc) ( void *p_env ) ; bool (*read_toc) ( void *p_env ) ;
/*! /*!
Run a SCSI MMC command. Run a SCSI MMC command.
cdio CD structure set by cdio_open(). cdio CD structure set by cdio_open().
i_timeout_ms time in milliseconds we will wait for the command i_timeout_ms time in milliseconds we will wait for the command
to complete. to complete.
cdb_len number of bytes in cdb (6, 10, or 12). cdb_len number of bytes in cdb (6, 10, or 12).
cdb CDB bytes. All values that are needed should be set on cdb CDB bytes. All values that are needed should be set on
input. input.
b_return_data TRUE if the command expects data to be returned in b_return_data TRUE if the command expects data to be returned in
the buffer the buffer
len Size of buffer len Size of buffer
buf Buffer for data, both sending and receiving buf Buffer for data, both sending and receiving
Returns 0 if command completed successfully. Returns 0 if command completed successfully.
*/ */
// mmc_run_cmd_fn_t run_mmc_cmd; mmc_run_cmd_fn_t run_mmc_cmd;
/*! /*!
Set the arg "key" with "value" in the source device. Set the arg "key" with "value" in the source device.
*/ */
int (*set_arg) ( void *p_env, const char key[], const char value[] ); int (*set_arg) ( void *p_env, const char key[], const char value[] );
/*! /*!
Set the blocksize for subsequent reads. Set the blocksize for subsequent reads.
*/ */
driver_return_code_t (*set_blocksize) ( void *p_env, driver_return_code_t (*set_blocksize) ( void *p_env,
uint16_t i_blocksize ); uint16_t i_blocksize );
/*! /*!
Set the drive speed. Set the drive speed.
@return 0 if everything went okay, -1 if we had an error. is -2 @return 0 if everything went okay, -1 if we had an error. is -2
returned if this is not implemented for the current driver. returned if this is not implemented for the current driver.
*/ */
@ -452,51 +474,51 @@ extern "C" {
void *env; /**< environment. Passed to routine above. */ void *env; /**< environment. Passed to routine above. */
}; };
/* This is used in drivers that must keep their own internal /* This is used in drivers that must keep their own internal
position pointer for doing seeks. Stream-based drivers (like bincue, position pointer for doing seeks. Stream-based drivers (like bincue,
nrg, toc, network) would use this. nrg, toc, network) would use this.
*/ */
typedef struct typedef struct
{ {
off_t buff_offset; /* buffer offset in disk-image seeks. */ off_t buff_offset; /* buffer offset in disk-image seeks. */
track_t index; /* Current track index in tocent. */ track_t index; /* Current track index in tocent. */
lba_t lba; /* Current LBA */ lba_t lba; /* Current LBA */
} internal_position_t; } internal_position_t;
CdIo_t * cdio_new (generic_img_private_t *p_env, cdio_funcs_t *p_funcs); CdIo_t * cdio_new (generic_img_private_t *p_env, cdio_funcs_t *p_funcs);
/* The below structure describes a specific CD Input driver */ /* The below structure describes a specific CD Input driver */
typedef struct typedef struct
{ {
driver_id_t id; driver_id_t id;
unsigned int flags; unsigned int flags;
const char *name; const char *name;
const char *describe; const char *describe;
bool (*have_driver) (void); bool (*have_driver) (void);
CdIo_t *(*driver_open) (const char *psz_source_name); CdIo_t *(*driver_open) (const char *psz_source_name);
CdIo_t *(*driver_open_am) (const char *psz_source_name, CdIo_t *(*driver_open_am) (const char *psz_source_name,
const char *psz_access_mode); const char *psz_access_mode);
char *(*get_default_device) (void); char *(*get_default_device) (void);
bool (*is_device) (const char *psz_source_name); bool (*is_device) (const char *psz_source_name);
char **(*get_devices) (void); char **(*get_devices) (void);
driver_return_code_t (*close_tray) (const char *psz_device); driver_return_code_t (*close_tray) (const char *psz_device);
} CdIo_driver_t; } CdIo_driver_t;
/* The below array gives of the drivers that are currently available for /* The below array gives of the drivers that are currently available for
on a particular host. */ on a particular host. */
extern CdIo_driver_t CdIo_driver[]; extern CdIo_driver_t CdIo_driver[];
/* The last valid entry of Cdio_driver. -1 means uninitialzed. -2 /* The last valid entry of Cdio_driver. -1 means uninitialzed. -2
means some sort of error. means some sort of error.
*/ */
extern int CdIo_last_driver; extern int CdIo_last_driver;
/* The below array gives all drivers that can possibly appear. /* The below array gives all drivers that can possibly appear.
on a particular host. */ on a particular host. */
extern CdIo_driver_t CdIo_all_drivers[]; extern CdIo_driver_t CdIo_all_drivers[];
/*! /*!
Add/allocate a drive to the end of drives. Add/allocate a drive to the end of drives.
Use cdio_free_device_list() to free this device_list. Use cdio_free_device_list() to free this device_list.
*/ */
void cdio_add_device_list(char **device_list[], const char *psz_drive, void cdio_add_device_list(char **device_list[], const char *psz_drive,

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2005, 2008, 2011 Rocky Bernstein <rocky@gnu.org> Copyright (C) 2005, 2008, 2011, 2016 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000 Herbert Valerio Riedel <hvr@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
@ -33,8 +33,6 @@
#include <cdio/types.h> #include <cdio/types.h>
#include "cdio_assert.h" #include "cdio_assert.h"
// static const char _rcsid[] = "$Id: ds.c,v 1.4 2008/04/22 15:29:12 karl Exp $";
struct _CdioList struct _CdioList
{ {
unsigned length; unsigned length;
@ -87,7 +85,7 @@ _cdio_list_prepend (CdioList_t *p_list, void *p_data)
cdio_assert (p_list != NULL); cdio_assert (p_list != NULL);
p_new_node = calloc (1, sizeof (CdioListNode_t)); p_new_node = calloc (1, sizeof (CdioListNode_t));
p_new_node->list = p_list; p_new_node->list = p_list;
p_new_node->next = p_list->begin; p_new_node->next = p_list->begin;
p_new_node->data = p_data; p_new_node->data = p_data;
@ -111,7 +109,7 @@ _cdio_list_append (CdioList_t *p_list, void *p_data)
else else
{ {
CdioListNode_t *p_new_node = calloc (1, sizeof (CdioListNode_t)); CdioListNode_t *p_new_node = calloc (1, sizeof (CdioListNode_t));
p_new_node->list = p_list; p_new_node->list = p_list;
p_new_node->next = NULL; p_new_node->next = NULL;
p_new_node->data = p_data; p_new_node->data = p_data;
@ -123,15 +121,15 @@ _cdio_list_append (CdioList_t *p_list, void *p_data)
} }
} }
void void
_cdio_list_foreach (CdioList_t *p_list, _cdio_list_iterfunc_t func, _cdio_list_foreach (CdioList_t *p_list, _cdio_list_iterfunc_t func,
void *p_user_data) void *p_user_data)
{ {
CdioListNode_t *node; CdioListNode_t *node;
cdio_assert (p_list != NULL); cdio_assert (p_list != NULL);
cdio_assert (func != 0); cdio_assert (func != 0);
for (node = _cdio_list_begin (p_list); for (node = _cdio_list_begin (p_list);
node != NULL; node != NULL;
node = _cdio_list_node_next (node)) node = _cdio_list_node_next (node))
@ -139,14 +137,14 @@ _cdio_list_foreach (CdioList_t *p_list, _cdio_list_iterfunc_t func,
} }
CdioListNode_t * CdioListNode_t *
_cdio_list_find (CdioList_t *p_list, _cdio_list_iterfunc_t cmp_func, _cdio_list_find (CdioList_t *p_list, _cdio_list_iterfunc_t cmp_func,
void *p_user_data) void *p_user_data)
{ {
CdioListNode_t *p_node; CdioListNode_t *p_node;
cdio_assert (p_list != NULL); cdio_assert (p_list != NULL);
cdio_assert (cmp_func != 0); cdio_assert (cmp_func != 0);
for (p_node = _cdio_list_begin (p_list); for (p_node = _cdio_list_begin (p_list);
p_node != NULL; p_node != NULL;
p_node = _cdio_list_node_next (p_node)) p_node = _cdio_list_node_next (p_node))
@ -181,14 +179,14 @@ _cdio_list_node_next (CdioListNode_t *p_node)
return NULL; return NULL;
} }
void void
_cdio_list_node_free (CdioListNode_t *p_node, int free_data) _cdio_list_node_free (CdioListNode_t *p_node, int free_data)
{ {
CdioList_t *p_list; CdioList_t *p_list;
CdioListNode_t *prev_node; CdioListNode_t *prev_node;
cdio_assert (p_node != NULL); cdio_assert (p_node != NULL);
p_list = p_node->list; p_list = p_node->list;
cdio_assert (_cdio_list_length (p_list) > 0); cdio_assert (_cdio_list_length (p_list) > 0);
@ -243,13 +241,11 @@ _cdio_list_node_data (CdioListNode_t *p_node)
/* eof */ /* eof */
/*
/*
* Local variables: * Local variables:
* c-file-style: "gnu" * c-file-style: "gnu"
* tab-width: 8 * tab-width: 8
* indent-tabs-mode: nil * indent-tabs-mode: nil
* End: * End:
*/ */

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2003, 2004, 2008, 2011, 2012 Copyright (C) 2003, 2004, 2008, 2011, 2012, 2015
Rocky Bernstein <rocky@gnu.org> Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
@ -33,8 +33,9 @@
#endif #endif
#include <cdio/logging.h> #include <cdio/logging.h>
#include <cdio/portable.h>
#include "cdio_assert.h" #include "cdio_assert.h"
#include "portable.h"
#include <assert.h>
cdio_log_level_t cdio_loglevel_default = CDIO_LOG_WARN; cdio_log_level_t cdio_loglevel_default = CDIO_LOG_WARN;
@ -96,10 +97,24 @@ static void
cdio_logv(cdio_log_level_t level, const char format[], va_list args) cdio_logv(cdio_log_level_t level, const char format[], va_list args)
{ {
char buf[1024] = { 0, }; char buf[1024] = { 0, };
static int in_recursion = 0;
if (in_recursion) /* _handler() is user defined and we want to make sure _handler()
cdio_assert_not_reached (); doesn't call us, cdio_logv. in_recursion is used for that, however
it has a problem in multi-threaded programs. I'm not sure how to
handle multi-threading and recursion checking both. For now, we'll
leave in the recursion checking, at the expense of handling
multi-threaded log calls. To ameliorate this, we'll check the log
level and handle calls where there is no output, before the
recursion check.
*/
static int in_recursion = 0;
if (level < cdio_loglevel_default) return;
if (in_recursion) {
/* Can't use cdio_assert_not_reached() as that may call cdio_logv */
assert(0);
}
in_recursion = 1; in_recursion = 1;

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2014 Robert Kausch <robert.kausch@freac.org> Copyright (C) 2014-2015 Robert Kausch <robert.kausch@freac.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
@ -36,7 +36,6 @@
void void
cdio_free (void *p_memory) cdio_free (void *p_memory)
{ {
if (p_memory == NULL) return; if (p_memory != NULL)
free(p_memory);
free(p_memory);
} }

View File

@ -1,5 +1,6 @@
/* /*
Copyright (C) 2004, 2005, 2011, 2012, 2014 Rocky Bernstein <rocky@gnu.org> Copyright (C) 2004, 2005, 2011, 2012, 2014, 2016
Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000 Herbert Valerio Riedel <hvr@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
@ -24,8 +25,8 @@
#include <cdio/sector.h> #include <cdio/sector.h>
#include <cdio/util.h> #include <cdio/util.h>
#include <cdio/logging.h> #include <cdio/logging.h>
#include <cdio/portable.h>
#include "cdio_assert.h" #include "cdio_assert.h"
#include "portable.h"
#ifdef HAVE_STDIO_H #ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
@ -36,8 +37,6 @@
#include <ctype.h> #include <ctype.h>
// static const char _rcsid[] = "$Id: sector.c,v 1.5 2005/02/06 04:20:25 rocky Exp $";
/*! String of bytes used to identify the beginning of a Mode 1 or /*! String of bytes used to identify the beginning of a Mode 1 or
Mode 2 sector. */ Mode 2 sector. */
const uint8_t CDIO_SECTOR_SYNC_HEADER[CDIO_CD_SYNC_SIZE] = const uint8_t CDIO_SECTOR_SYNC_HEADER[CDIO_CD_SYNC_SIZE] =

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2003-2009, 2013-2014 Rocky Bernstein <rocky@gnu.org> Copyright (C) 2003-2009, 2013-2014, 2016 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000 Herbert Valerio Riedel <hvr@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
@ -31,7 +31,6 @@ const char ISO_STANDARD_ID[] = {'C', 'D', '0', '0', '1'};
#include <cdio/bytesex.h> #include <cdio/bytesex.h>
#include <cdio/iso9660.h> #include <cdio/iso9660.h>
#include <cdio/util.h> #include <cdio/util.h>
#include <cdio/portable.h>
#include <time.h> #include <time.h>
#include <ctype.h> #include <ctype.h>
@ -92,7 +91,7 @@ timegm(struct tm *tm)
#endif #endif
#ifndef HAVE_GMTIME_R #ifndef HAVE_GMTIME_R
struct tm * static struct tm *
gmtime_r(const time_t *timer, struct tm *result) gmtime_r(const time_t *timer, struct tm *result)
{ {
struct tm *tmp = gmtime(timer); struct tm *tmp = gmtime(timer);
@ -106,7 +105,7 @@ gmtime_r(const time_t *timer, struct tm *result)
#endif #endif
#ifndef HAVE_LOCALTIME_R #ifndef HAVE_LOCALTIME_R
struct tm * static struct tm *
localtime_r(const time_t *timer, struct tm *result) localtime_r(const time_t *timer, struct tm *result)
{ {
struct tm *tmp = localtime(timer); struct tm *tmp = localtime(timer);
@ -119,8 +118,6 @@ localtime_r(const time_t *timer, struct tm *result)
} }
#endif #endif
// static const char _rcsid[] = "$Id: iso9660.c,v 1.41 2008/06/25 08:01:54 rocky Exp $";
/* Variables to hold debugger-helping enumerations */ /* Variables to hold debugger-helping enumerations */
enum iso_enum1_s iso_enums1; enum iso_enum1_s iso_enums1;
enum iso_flag_enum_s iso_flag_enums; enum iso_flag_enum_s iso_flag_enums;

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2003-2008, 2011-2014 Rocky Bernstein <rocky@gnu.org> Copyright (C) 2003-2008, 2011-2015 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001 Herbert Valerio Riedel <hvr@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
@ -16,7 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* iso9660 filesystem-based routines */ /* iso9660 filesystem-based routines */
#if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__) #if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__)
#include "config.h" #include "config.h"
#define __CDIO_CONFIG_H__ 1 #define __CDIO_CONFIG_H__ 1
@ -47,7 +47,6 @@
#include <cdio/iso9660.h> #include <cdio/iso9660.h>
#include <cdio/util.h> #include <cdio/util.h>
#include <cdio/utf8.h> #include <cdio/utf8.h>
#include <cdio/portable.h>
/* Private headers */ /* Private headers */
#include "cdio_assert.h" #include "cdio_assert.h"
@ -264,6 +263,7 @@ static bool
check_pvd (const iso9660_pvd_t *p_pvd, cdio_log_level_t log_level) check_pvd (const iso9660_pvd_t *p_pvd, cdio_log_level_t log_level)
{ {
if ( ISO_VD_PRIMARY != from_711(p_pvd->type) ) { if ( ISO_VD_PRIMARY != from_711(p_pvd->type) ) {
// Commented out for Rufus usage
// cdio_log (log_level, "unexpected PVD type %d", p_pvd->type); // cdio_log (log_level, "unexpected PVD type %d", p_pvd->type);
return false; return false;
} }
@ -443,6 +443,7 @@ iso9660_ifs_read_pvd_loglevel (const iso9660_t *p_iso,
cdio_log_level_t log_level) cdio_log_level_t log_level)
{ {
if (0 == iso9660_iso_seek_read (p_iso, p_pvd, ISO_PVD_SECTOR, 1)) { if (0 == iso9660_iso_seek_read (p_iso, p_pvd, ISO_PVD_SECTOR, 1)) {
// Commented out for Rufus usage
// cdio_log ( log_level, "error reading PVD sector (%d)", ISO_PVD_SECTOR ); // cdio_log ( log_level, "error reading PVD sector (%d)", ISO_PVD_SECTOR );
return false; return false;
} }
@ -715,6 +716,7 @@ _iso9660_dir_to_statbuf (iso9660_dir_t *p_iso9660_dir, bool_3way_t b_xa,
iso711_t i_fname; iso711_t i_fname;
unsigned int stat_len; unsigned int stat_len;
iso9660_stat_t *p_stat; iso9660_stat_t *p_stat;
bool err;
if (!dir_len) return NULL; if (!dir_len) return NULL;
@ -731,8 +733,16 @@ _iso9660_dir_to_statbuf (iso9660_dir_t *p_iso9660_dir, bool_3way_t b_xa,
} }
p_stat->type = (p_iso9660_dir->file_flags & ISO_DIRECTORY) p_stat->type = (p_iso9660_dir->file_flags & ISO_DIRECTORY)
? _STAT_DIR : _STAT_FILE; ? _STAT_DIR : _STAT_FILE;
p_stat->lsn = from_733 (p_iso9660_dir->extent); p_stat->lsn = from_733_with_err (p_iso9660_dir->extent, &err);
p_stat->size = from_733 (p_iso9660_dir->size); if (err) {
free(p_stat);
return NULL;
}
p_stat->size = from_733_with_err (p_iso9660_dir->size, &err);
if (err) {
free(p_stat);
return NULL;
}
p_stat->secsize = _cdio_len2blocks (p_stat->size, ISO_BLOCKSIZE); p_stat->secsize = _cdio_len2blocks (p_stat->size, ISO_BLOCKSIZE);
p_stat->rr.b3_rock = dunno; /*FIXME should do based on mask */ p_stat->rr.b3_rock = dunno; /*FIXME should do based on mask */
p_stat->b_xa = false; p_stat->b_xa = false;
@ -1087,6 +1097,12 @@ _fs_iso_stat_traverse (iso9660_t *p_iso, const iso9660_stat_t *_root,
p_stat = _iso9660_dir_to_statbuf (p_iso9660_dir, p_iso->b_xa, p_stat = _iso9660_dir_to_statbuf (p_iso9660_dir, p_iso->b_xa,
p_iso->u_joliet_level); p_iso->u_joliet_level);
if (!p_stat) {
cdio_warn("Bad directory information for %s", splitpath[0]);
free(_dirbuf);
return NULL;
}
cmp = strcmp(splitpath[0], p_stat->filename); cmp = strcmp(splitpath[0], p_stat->filename);
if ( 0 != cmp && 0 == p_iso->u_joliet_level if ( 0 != cmp && 0 == p_iso->u_joliet_level
@ -1334,24 +1350,38 @@ iso9660_ifs_readdir (iso9660_t *p_iso, const char psz_path[])
unsigned offset = 0; unsigned offset = 0;
uint8_t *_dirbuf = NULL; uint8_t *_dirbuf = NULL;
CdioList_t *retval = _cdio_list_new (); CdioList_t *retval = _cdio_list_new ();
const size_t dirbuf_len = p_stat->secsize * ISO_BLOCKSIZE;
_dirbuf = calloc(1, p_stat->secsize * ISO_BLOCKSIZE);
if (!dirbuf_len)
{
cdio_warn("Invalid directory buffer sector size %u", p_stat->secsize);
free(p_stat->rr.psz_symlink);
free(p_stat);
_cdio_list_free (retval, true);
return NULL;
}
_dirbuf = calloc(1, dirbuf_len);
if (!_dirbuf) if (!_dirbuf)
{ {
cdio_warn("Couldn't calloc(1, %d)", p_stat->secsize * ISO_BLOCKSIZE); cdio_warn("Couldn't calloc(1, %lu)", (unsigned long)dirbuf_len);
_cdio_list_free (retval, true); free(p_stat->rr.psz_symlink);
free(p_stat);
_cdio_list_free (retval, true);
return NULL; return NULL;
} }
ret = iso9660_iso_seek_read (p_iso, _dirbuf, p_stat->lsn, p_stat->secsize); ret = iso9660_iso_seek_read (p_iso, _dirbuf, p_stat->lsn, p_stat->secsize);
if (ret != ISO_BLOCKSIZE*p_stat->secsize) if (ret != dirbuf_len) {
{ _cdio_list_free (retval, true);
_cdio_list_free (retval, true); free(p_stat->rr.psz_symlink);
free (_dirbuf); free(p_stat);
return NULL; free (_dirbuf);
} return NULL;
}
while (offset < (p_stat->secsize * ISO_BLOCKSIZE)) while (offset < (dirbuf_len))
{ {
iso9660_dir_t *p_iso9660_dir = (void *) &_dirbuf[offset]; iso9660_dir_t *p_iso9660_dir = (void *) &_dirbuf[offset];
iso9660_stat_t *p_iso9660_stat; iso9660_stat_t *p_iso9660_stat;
@ -1372,15 +1402,14 @@ iso9660_ifs_readdir (iso9660_t *p_iso, const char psz_path[])
} }
free (_dirbuf); free (_dirbuf);
free(p_stat->rr.psz_symlink);
free (p_stat);
if (offset != (p_stat->secsize * ISO_BLOCKSIZE)) { if (offset != dirbuf_len) {
free (p_stat);
_cdio_list_free (retval, true); _cdio_list_free (retval, true);
return NULL; return NULL;
} }
free (p_stat->rr.psz_symlink);
free (p_stat);
return retval; return retval;
} }
} }

View File

@ -168,8 +168,27 @@ get_rock_ridge_filename(iso9660_dir_t * p_iso9660_dir,
while (len > 1){ /* There may be one byte for padding somewhere */ while (len > 1){ /* There may be one byte for padding somewhere */
rr = (iso_extension_record_t *) chr; rr = (iso_extension_record_t *) chr;
if (rr->len == 0) goto out; /* Something got screwed up here */
sig = *chr+(*(chr+1) << 8); sig = *chr+(*(chr+1) << 8);
switch(sig){
case SIG('S','P'):
case SIG('C','E'):
case SIG('E','R'):
case SIG('R','R'):
case SIG('P','X'):
case SIG('P','N'):
case SIG('S','L'):
case SIG('N','M'):
case SIG('C','L'):
case SIG('P','L'):
case SIG('T','F'):
case SIG('Z','F'):
break;
default:
/* Something got screwed up here */
goto out;
}
if (rr->len == 0) goto out; /* Something got screwed up here */
chr += rr->len; chr += rr->len;
len -= rr->len; len -= rr->len;

View File

@ -0,0 +1,3 @@
/* placeholder for unused MMC helper routines. */
typedef driver_return_code_t (*mmc_run_cmd_fn_t) ( void );

View File

@ -167,7 +167,7 @@ udf_get_lba(const udf_file_entry_t *p_udf_fe,
{ {
/* The allocation descriptor field is filled with short_ad's. */ /* The allocation descriptor field is filled with short_ad's. */
udf_short_ad_t *p_ad = (udf_short_ad_t *) udf_short_ad_t *p_ad = (udf_short_ad_t *)
(p_udf_fe->u.ext_attr + p_udf_fe->i_extended_attr); (p_udf_fe->u.ext_attr + uint32_from_le(p_udf_fe->i_extended_attr));
*start = uint32_from_le(p_ad->pos); *start = uint32_from_le(p_ad->pos);
*end = *start + *end = *start +
@ -179,7 +179,7 @@ udf_get_lba(const udf_file_entry_t *p_udf_fe,
{ {
/* The allocation descriptor field is filled with long_ad's */ /* The allocation descriptor field is filled with long_ad's */
udf_long_ad_t *p_ad = (udf_long_ad_t *) udf_long_ad_t *p_ad = (udf_long_ad_t *)
(p_udf_fe->u.ext_attr + p_udf_fe->i_extended_attr); (p_udf_fe->u.ext_attr + uint32_from_le(p_udf_fe->i_extended_attr));
*start = uint32_from_le(p_ad->loc.lba); /* ignore partition number */ *start = uint32_from_le(p_ad->loc.lba); /* ignore partition number */
*end = *start + *end = *start +
@ -190,7 +190,7 @@ udf_get_lba(const udf_file_entry_t *p_udf_fe,
case ICBTAG_FLAG_AD_EXTENDED: case ICBTAG_FLAG_AD_EXTENDED:
{ {
udf_ext_ad_t *p_ad = (udf_ext_ad_t *) udf_ext_ad_t *p_ad = (udf_ext_ad_t *)
(p_udf_fe->u.ext_attr + p_udf_fe->i_extended_attr); (p_udf_fe->u.ext_attr + uint32_from_le(p_udf_fe->i_extended_attr));
*start = uint32_from_le(p_ad->ext_loc.lba); /* ignore partition number */ *start = uint32_from_le(p_ad->ext_loc.lba); /* ignore partition number */
*end = *start + *end = *start +
@ -739,7 +739,7 @@ udf_readdir(udf_dirent_t *p_udf_dirent)
const unsigned int i_len = p_udf_dirent->fid->i_file_id; const unsigned int i_len = p_udf_dirent->fid->i_file_id;
if (DRIVER_OP_SUCCESS != udf_read_sectors(p_udf, &p_udf_dirent->fe, p_udf->i_part_start if (DRIVER_OP_SUCCESS != udf_read_sectors(p_udf, &p_udf_dirent->fe, p_udf->i_part_start
+ p_udf_dirent->fid->icb.loc.lba, 1)) { + uint32_from_le(p_udf_dirent->fid->icb.loc.lba), 1)) {
udf_dirent_free(p_udf_dirent); udf_dirent_free(p_udf_dirent);
return NULL; return NULL;
} }

View File

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 242, 376 IDD_DIALOG DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 2.13.1069" CAPTION "Rufus 2.13.1070"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0 FONT 8, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8 LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -334,8 +334,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,13,1069,0 FILEVERSION 2,13,1070,0
PRODUCTVERSION 2,13,1069,0 PRODUCTVERSION 2,13,1070,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -352,13 +352,13 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.13.1069" VALUE "FileVersion", "2.13.1070"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe" VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "2.13.1069" VALUE "ProductVersion", "2.13.1070"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"