mirror of https://github.com/pbatard/rufus.git
[iso] align to latest libcdio-pbatard
This commit is contained in:
parent
f55f31a166
commit
b376bd47ca
|
@ -26,7 +26,7 @@ x86_64
|
|||
autom4te.cache
|
||||
compile
|
||||
config.guess
|
||||
config.h
|
||||
./config.h
|
||||
config.log
|
||||
config.status
|
||||
config.sub
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#define __CDIO_BYTESEX_H__
|
||||
|
||||
#include <cdio/types.h>
|
||||
#include <cdio/bytesex_asm.h>
|
||||
#include <cdio/bytesex_asm.h> /* also defines CDIO_INLINE */
|
||||
#include <cdio/logging.h>
|
||||
|
||||
/** 16-bit big-endian to little-endian */
|
||||
|
@ -67,19 +67,19 @@
|
|||
# define UINT64_SWAP_LE_BE UINT64_SWAP_LE_BE_C
|
||||
#endif
|
||||
|
||||
inline static
|
||||
static CDIO_INLINE
|
||||
uint16_t uint16_swap_le_be (const uint16_t val)
|
||||
{
|
||||
return UINT16_SWAP_LE_BE (val);
|
||||
}
|
||||
|
||||
inline static
|
||||
static CDIO_INLINE
|
||||
uint32_t uint32_swap_le_be (const uint32_t val)
|
||||
{
|
||||
return UINT32_SWAP_LE_BE (val);
|
||||
}
|
||||
|
||||
inline static
|
||||
static CDIO_INLINE
|
||||
uint64_t uint64_swap_le_be (const uint64_t val)
|
||||
{
|
||||
return UINT64_SWAP_LE_BE (val);
|
||||
|
@ -119,10 +119,10 @@ uint64_t uint64_swap_le_be (const uint64_t val)
|
|||
|
||||
/** converter function template */
|
||||
#define CVT_TO_FUNC(bits) \
|
||||
static inline uint ## bits ## _t \
|
||||
static CDIO_INLINE uint ## bits ## _t \
|
||||
uint ## bits ## _to_be (uint ## bits ## _t val) \
|
||||
{ return UINT ## bits ## _TO_BE (val); } \
|
||||
static inline uint ## bits ## _t \
|
||||
static CDIO_INLINE uint ## bits ## _t \
|
||||
uint ## bits ## _to_le (uint ## bits ## _t val) \
|
||||
{ return UINT ## bits ## _TO_LE (val); } \
|
||||
|
||||
|
@ -163,14 +163,14 @@ CVT_TO_FUNC(64)
|
|||
#define from_722(i) uint16_from_be(i)
|
||||
|
||||
/** Convert from uint16_t to ISO 9669 7.2.3 format */
|
||||
static inline uint32_t
|
||||
static CDIO_INLINE uint32_t
|
||||
to_723(uint16_t i)
|
||||
{
|
||||
return uint32_swap_le_be(i) | i;
|
||||
}
|
||||
|
||||
/** Convert from ISO 9660 7.2.3 format to uint16_t */
|
||||
static inline uint16_t
|
||||
static CDIO_INLINE uint16_t
|
||||
from_723 (uint32_t p)
|
||||
{
|
||||
if (uint32_swap_le_be (p) != p)
|
||||
|
@ -192,14 +192,14 @@ from_723 (uint32_t p)
|
|||
#define from_732(i) uint32_from_be(i)
|
||||
|
||||
/** Convert from uint16_t to ISO 9669 7.3.3 format */
|
||||
static inline uint64_t
|
||||
static CDIO_INLINE uint64_t
|
||||
to_733(uint32_t i)
|
||||
{
|
||||
return uint64_swap_le_be(i) | i;
|
||||
}
|
||||
|
||||
/** Convert from ISO 9660 7.3.3 format to uint32_t */
|
||||
static inline uint32_t
|
||||
static CDIO_INLINE uint32_t
|
||||
from_733 (uint64_t p)
|
||||
{
|
||||
if (uint64_swap_le_be (p) != p)
|
||||
|
|
|
@ -32,9 +32,21 @@
|
|||
|
||||
#include <cdio/types.h>
|
||||
|
||||
#if !defined CDIO_INLINE
|
||||
#if defined(__cplusplus) || defined(inline)
|
||||
#define CDIO_INLINE inline
|
||||
#elif defined(__GNUC__)
|
||||
#define CDIO_INLINE __inline__
|
||||
#elif defined(_MSC_VER)
|
||||
#define CDIO_INLINE __inline
|
||||
#else
|
||||
#define CDIO_INLINE
|
||||
#endif
|
||||
#endif /* CDIO_INLINE */
|
||||
|
||||
#if defined(__powerpc__) && defined(__GNUC__)
|
||||
|
||||
inline static
|
||||
static CDIO_INLINE
|
||||
uint32_t uint32_swap_le_be_asm(const uint32_t a)
|
||||
{
|
||||
uint32_t b;
|
||||
|
@ -46,7 +58,7 @@ uint32_t uint32_swap_le_be_asm(const uint32_t a)
|
|||
return b;
|
||||
}
|
||||
|
||||
inline static
|
||||
static CDIO_INLINE
|
||||
uint16_t uint16_swap_le_be_asm(const uint16_t a)
|
||||
{
|
||||
uint32_t b;
|
||||
|
@ -63,7 +75,7 @@ uint16_t uint16_swap_le_be_asm(const uint16_t a)
|
|||
|
||||
#elif defined(__mc68000__) && defined(__STORMGCC__)
|
||||
|
||||
inline static
|
||||
static CDIO_INLINE
|
||||
uint32_t uint32_swap_le_be_asm(uint32_t a __asm__("d0"))
|
||||
{
|
||||
/* __asm__("rolw #8,%0; swap %0; rolw #8,%0" : "=d" (val) : "0" (val)); */
|
||||
|
@ -75,7 +87,7 @@ uint32_t uint32_swap_le_be_asm(uint32_t a __asm__("d0"))
|
|||
return(a);
|
||||
}
|
||||
|
||||
inline static
|
||||
static CDIO_INLINE
|
||||
uint16_t uint16_swap_le_be_asm(uint16_t a __asm__("d0"))
|
||||
{
|
||||
__asm__("move.l %1,d0;rol.w #8,d0;move.l d0,%0"
|
||||
|
@ -90,7 +102,7 @@ uint16_t uint16_swap_le_be_asm(uint16_t a __asm__("d0"))
|
|||
|
||||
#elif 0 && defined(__i386__) && defined(__GNUC__)
|
||||
|
||||
inline static
|
||||
static CDIO_INLINE
|
||||
uint32_t uint32_swap_le_be_asm(uint32_t a)
|
||||
{
|
||||
__asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */
|
||||
|
@ -102,7 +114,7 @@ uint32_t uint32_swap_le_be_asm(uint32_t a)
|
|||
return(a);
|
||||
}
|
||||
|
||||
inline static
|
||||
static CDIO_INLINE
|
||||
uint16_t uint16_swap_le_be_asm(uint16_t a)
|
||||
{
|
||||
__asm__("xchgb %b0,%h0" /* swap bytes */
|
||||
|
|
|
@ -33,13 +33,6 @@
|
|||
|
||||
#include <cdio/version.h>
|
||||
#include <cdio/types.h>
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <cdio/sector.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -72,7 +65,7 @@ extern "C" {
|
|||
#include <cdio/read.h>
|
||||
|
||||
/* CD-Text-related functions. */
|
||||
//#include <cdio/cdtext.h>
|
||||
#include <cdio/cdtext.h>
|
||||
|
||||
/* Track-related functions. */
|
||||
#include <cdio/track.h>
|
||||
|
|
|
@ -1,106 +0,0 @@
|
|||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* compiler does lsbf in struct bitfields */
|
||||
#undef BITFIELD_LSBF
|
||||
|
||||
/* what to put between the brackets for empty arrays */
|
||||
#define EMPTY_ARRAY_SIZE 0
|
||||
|
||||
/* Define to 1 if you have the `bzero' function. */
|
||||
#undef HAVE_BZERO
|
||||
|
||||
/* Define if time.h defines extern long timezone and int daylight vars. */
|
||||
#undef HAVE_DAYLIGHT
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the <errno.h> header file. */
|
||||
#define HAVE_ERRNO_H 1
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the <glob.h> header file. */
|
||||
#undef HAVE_GLOB_H
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
/* Supports ISO _Pragma() macro */
|
||||
#undef HAVE_ISOC99_PRAGMA
|
||||
|
||||
/* Define 1 if you want ISO-9660 Joliet extension support. You must have also
|
||||
libiconv installed to get Joliet extension support. */
|
||||
#define HAVE_JOLIET 1
|
||||
|
||||
/* Define to 1 if you have the `memcpy' function. */
|
||||
#define HAVE_MEMCPY 1
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define to 1 if you have the `memset' function. */
|
||||
#define HAVE_MEMSET 1
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* Define to 1 if you have the `nsl' library (-lnsl). */
|
||||
#define HAVE_LIMITS_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdbool.h> header file. */
|
||||
#undef HAVE_STDBOOL_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdio.h> header file. */
|
||||
#define HAVE_STDIO_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define if struct tm has the tm_gmtoff member. */
|
||||
#undef HAVE_TM_GMTOFF
|
||||
|
||||
/* Define if time.h defines extern extern char *tzname[2] variable */
|
||||
#undef HAVE_TZNAME
|
||||
|
||||
/* Define to 1 if you have the `tzset' function. */
|
||||
#undef HAVE_TZSET
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define to 1 if you have the `vsnprintf' function. */
|
||||
#undef HAVE_VSNPRINTF
|
||||
|
||||
/* Define 1 if you have MinGW CD-ROM support */
|
||||
#undef HAVE_WIN32_CDROM
|
||||
|
||||
/* Define as const if the declaration of iconv() needs const. */
|
||||
#undef ICONV_CONST
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
// TODO: should we use that for off64_t
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#define inline __inline
|
|
@ -0,0 +1 @@
|
|||
/* Empty placeholder */
|
|
@ -499,9 +499,11 @@ struct logvol_integrity_desc_s
|
|||
udf_Uint8_t logvol_contents_use[32];
|
||||
udf_Uint32_t i_partitions;
|
||||
udf_Uint32_t imp_use_len;
|
||||
// udf_Uint32_t freespace_table[0];
|
||||
// udf_Uint32_t size_table[0];
|
||||
udf_Uint8_t imp_use[0];
|
||||
union { /* MSVC workaround for multiple zero sized arrays */
|
||||
udf_Uint32_t freespace_table[0];
|
||||
udf_Uint32_t size_table[0];
|
||||
udf_Uint8_t imp_use[0];
|
||||
} u;
|
||||
} GNUC_PACKED;
|
||||
|
||||
/** Integrity Type (ECMA 167r3 3/10.10.3) */
|
||||
|
@ -571,9 +573,11 @@ struct udf_fileid_desc_s
|
|||
udf_Uint8_t i_file_id;
|
||||
udf_long_ad_t icb;
|
||||
udf_Uint16_t i_imp_use;
|
||||
udf_Uint8_t imp_use[0];
|
||||
// udf_Uint8_t file_id[0];
|
||||
// udf_Uint8_t padding[0];
|
||||
union { /* MSVC workaround for multiple zero sized arrays */
|
||||
udf_Uint8_t imp_use[0];
|
||||
udf_Uint8_t file_id[0];
|
||||
udf_Uint8_t padding[0];
|
||||
} u;
|
||||
} GNUC_PACKED;
|
||||
|
||||
typedef struct udf_fileid_desc_s udf_fileid_desc_t;
|
||||
|
@ -727,7 +731,7 @@ struct udf_file_entry_s
|
|||
udf_Uint64_t unique_ID;
|
||||
udf_Uint32_t i_extended_attr;
|
||||
udf_Uint32_t i_alloc_descs;
|
||||
/* The following union allows file entry reuse without worrying
|
||||
/* The following union allows file entry reuse without worrying
|
||||
about overflows, by ensuring the struct is always the
|
||||
maximum possible size allowed by the specs: one UDF block. */
|
||||
union {
|
||||
|
@ -991,8 +995,10 @@ struct extended_file_entry
|
|||
udf_Uint64_t unique_ID;
|
||||
udf_Uint32_t length_extended_attr;
|
||||
udf_Uint32_t length_alloc_descs;
|
||||
// udf_Uint8_t ext_attr[0];
|
||||
udf_Uint8_t ext_attr_alloc_descs[0];
|
||||
union { /* MSVC workaround for multiple zero sized arrays */
|
||||
udf_Uint8_t ext_attr[0];
|
||||
udf_Uint8_t alloc_descs[0];
|
||||
} u;
|
||||
} GNUC_PACKED;
|
||||
|
||||
PRAGMA_END_PACKED
|
||||
|
|
|
@ -60,7 +60,7 @@ typedef uint64_t iso733_t; /*! See section 7.3.3 */
|
|||
typedef char achar_t; /*! See section 7.4.1 */
|
||||
typedef char dchar_t; /*! See section 7.4.1 */
|
||||
|
||||
#ifndef EMPTY_ARRAY_SIZE
|
||||
#ifndef EMPTY_ARRAY_SIZE
|
||||
#define EMPTY_ARRAY_SIZE 0
|
||||
#endif
|
||||
|
||||
|
@ -233,20 +233,6 @@ typedef struct iso9660_stat_s iso9660_stat_t;
|
|||
|
||||
#include <cdio/rock.h>
|
||||
|
||||
/*! MSVC compilers cannot handle a zero sized array in the middle of a struct, and
|
||||
uct iso9660_dir_s is reused in the middle of iso9660_pvd_s, so instead of having
|
||||
iso711_t filename_len;
|
||||
char filename[];
|
||||
we use the fact that iso711_t and char are the same size and use an union.
|
||||
The only gotcha is that the actual string payload starts at 1, not 0
|
||||
*/
|
||||
union iso9660_filename_u {
|
||||
iso711_t len;
|
||||
char str[1];
|
||||
} GNUC_PACKED;
|
||||
|
||||
typedef union iso9660_filename_u iso9660_filename_t;
|
||||
|
||||
/*! \brief Format of an ISO-9660 directory record
|
||||
|
||||
Section 9.1 of ECMA 119.
|
||||
|
@ -287,7 +273,18 @@ struct iso9660_dir_s {
|
|||
the Extent described by this
|
||||
Directory Record is
|
||||
recorded. (9.1.9) */
|
||||
iso9660_filename_t filename;
|
||||
/*! MSVC compilers cannot handle a zero sized array in the middle
|
||||
of a struct, and iso9660_dir_s is reused within iso9660_pvd_s.
|
||||
Therefore, instead of defining:
|
||||
iso711_t filename_len;
|
||||
char filename[];
|
||||
we leverage the fact that iso711_t and char are the same size
|
||||
and use an union. The only gotcha is that the actual string
|
||||
payload of filename.str[] starts at 1, not 0. */
|
||||
union {
|
||||
iso711_t len;
|
||||
char str[1];
|
||||
} filename;
|
||||
} GNUC_PACKED;
|
||||
|
||||
/*!
|
||||
|
@ -989,7 +986,7 @@ uint8_t iso9660_ifs_get_joliet_level(iso9660_t *p_iso);
|
|||
|
||||
uint8_t iso9660_get_dir_len(const iso9660_dir_t *p_idr);
|
||||
|
||||
#ifdef FIXME
|
||||
#if FIXME
|
||||
uint8_t iso9660_get_dir_size(const iso9660_dir_t *p_idr);
|
||||
|
||||
lsn_t iso9660_get_dir_extent(const iso9660_dir_t *p_idr);
|
||||
|
|
|
@ -26,16 +26,7 @@
|
|||
#ifndef __CDIO_READ_H__
|
||||
#define __CDIO_READ_H__
|
||||
|
||||
#ifndef EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#define EXTERNAL_LIBCDIO_CONFIG_H
|
||||
/* Need for HAVE_SYS_TYPES_H */
|
||||
#include <cdio/cdio_config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
/* Some systems need this for off_t and ssize. */
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#include <cdio/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -35,18 +35,6 @@
|
|||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* MSYS 1.0.10 with MinGW 3.4.2 (and perhaps others) don't have
|
||||
S_ISSOCK() or S_ISLNK() macros, so we'll roll our own. */
|
||||
#if !defined(HAVE_S_ISSOCK) && !defined(S_ISSOCK)
|
||||
#define S_ISSOCK(st_mode) ((((st_mode)) & 0170000) == (0140000))
|
||||
#define HAVE_S_ISSOCK
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_S_ISLNK) && !defined(S_ISLNK)
|
||||
#define S_ISLNK(st_mode) ((((st_mode)) & 0170000) == (0010000))
|
||||
#define HAVE_S_ISLNK
|
||||
#endif
|
||||
|
||||
/*! An enumeration for some of the ISO_ROCK_* \#defines below. This isn't
|
||||
really an enumeration one would really use in a program it is to
|
||||
be helpful in debuggers where wants just to refer to the ISO_ROCK_*
|
||||
|
|
|
@ -29,42 +29,33 @@
|
|||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifndef EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#define EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#include <cdio/cdio_config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* provide some C99 definitions */
|
||||
|
||||
#if defined(HAVE_SYS_TYPES_H)
|
||||
/* If <sys/types.h> is not available on your platform please
|
||||
contact the libcdio mailing list so that we can fix it! */
|
||||
#if !defined(ARE_THERE_STILL_ENVS_WITHOUT_SYS_TYPES)
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_STDINT_H)
|
||||
# include <stdint.h>
|
||||
#elif defined(HAVE_INTTYPES_H)
|
||||
# include <inttypes.h>
|
||||
#elif defined(AMIGA) || defined(__linux__)
|
||||
typedef u_int8_t uint8_t;
|
||||
typedef u_int16_t uint16_t;
|
||||
typedef u_int32_t uint32_t;
|
||||
typedef u_int64_t uint64_t;
|
||||
#if defined(AMIGA)
|
||||
typedef u_int8_t uint8_t;
|
||||
typedef u_int16_t uint16_t;
|
||||
typedef u_int32_t uint32_t;
|
||||
typedef u_int64_t uint64_t;
|
||||
#else
|
||||
/* warning ISO/IEC 9899:1999 <stdint.h> was missing and even <inttypes.h> */
|
||||
/* fixme */
|
||||
#endif /* HAVE_STDINT_H */
|
||||
|
||||
typedef uint8_t ubyte;
|
||||
#if !defined(off64_t)
|
||||
typedef int64_t off64_t;
|
||||
/* If <stdint.h> is not available on your platform please
|
||||
contact the libcdio mailing list so that we can fix it!
|
||||
For MSVC, you can find both a public domain stdint.h and
|
||||
inttypes.h in the MSVC/missing directory of libcdio. */
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
typedef uint8_t ubyte;
|
||||
|
||||
/* MSVC does not define mode_t and ssize_t by default. The way
|
||||
to compensate for missing UNIX types is to include a custom
|
||||
unistd.h that defines them. Such a file is provided with
|
||||
the libcdio source, in the MSVC/missing directory */
|
||||
#if defined(_MSC_VER)
|
||||
#define fseeko64 _fseeki64
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* default HP/UX macros are broken */
|
||||
|
@ -113,15 +104,24 @@ typedef int64_t off64_t;
|
|||
#endif
|
||||
|
||||
#ifndef __cplusplus
|
||||
# if defined(HAVE_STDBOOL_H)
|
||||
# include <stdbool.h>
|
||||
# else
|
||||
/* ISO/IEC 9899:1999 <stdbool.h> missing -- enabling workaround */
|
||||
|
||||
# define false 0
|
||||
# define true 1
|
||||
# define bool uint8_t
|
||||
# endif /*HAVE_STDBOOL_H*/
|
||||
|
||||
/* All the stdbool.h seem to define those */
|
||||
#ifndef __bool_true_false_are_defined
|
||||
#define __bool_true_false_are_defined 1
|
||||
|
||||
#undef bool
|
||||
#undef true
|
||||
#undef false
|
||||
|
||||
#ifdef _Bool
|
||||
#define bool _Bool
|
||||
#else
|
||||
#define bool int
|
||||
#endif
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
#endif /* __bool_true_false_are_defined */
|
||||
#endif /*C++*/
|
||||
|
||||
/* some GCC optimizations -- gcc 2.5+ */
|
||||
|
@ -155,13 +155,13 @@ typedef int64_t off64_t;
|
|||
/* for GCC we try to use GNUC_PACKED */
|
||||
# define PRAGMA_BEGIN_PACKED
|
||||
# define PRAGMA_END_PACKED
|
||||
#elif defined(HAVE_ISOC99_PRAGMA)
|
||||
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
|
||||
/* should work with most EDG-frontend based compilers */
|
||||
# define PRAGMA_BEGIN_PACKED _Pragma("pack(1)")
|
||||
# define PRAGMA_END_PACKED _Pragma("pack()")
|
||||
#elif defined(_MSC_VER)
|
||||
# define PRAGMA_BEGIN_PACKED __pragma(pack(push, 1))
|
||||
# define PRAGMA_END_PACKED __pragma(pack(pop))
|
||||
# define PRAGMA_END_PACKED __pragma(pack(pop))
|
||||
#else /* neither gcc nor _Pragma() available... */
|
||||
/* ...so let's be naive and hope the regression testsuite is run... */
|
||||
# define PRAGMA_BEGIN_PACKED
|
||||
|
|
|
@ -29,6 +29,13 @@
|
|||
|
||||
#include <time.h>
|
||||
|
||||
#if defined(__MINGW32__) && !defined(__MINGW64__)
|
||||
struct timespec {
|
||||
time_t tv_sec; /* Seconds */
|
||||
long tv_nsec; /* Nanoseconds */
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
@ -70,13 +77,6 @@ extern "C" {
|
|||
time_t *udf_stamp_to_time(time_t *dest, long int *dest_usec,
|
||||
const udf_timestamp_t src);
|
||||
|
||||
#if defined(__MINGW32__) && !defined(__MINGW64__)
|
||||
struct timespec {
|
||||
time_t tv_sec; /* Seconds */
|
||||
long tv_nsec; /* Nanoseconds */
|
||||
};
|
||||
#endif
|
||||
|
||||
udf_timestamp_t *udf_timespec_to_stamp(const struct timespec ts,
|
||||
udf_timestamp_t *dest);
|
||||
|
||||
|
|
|
@ -28,6 +28,18 @@
|
|||
#include <stdlib.h>
|
||||
#include <cdio/types.h>
|
||||
|
||||
#if !defined CDIO_INLINE
|
||||
#if defined(__cplusplus) || defined(inline)
|
||||
#define CDIO_INLINE inline
|
||||
#elif defined(__GNUC__)
|
||||
#define CDIO_INLINE __inline__
|
||||
#elif defined(_MSC_VER)
|
||||
#define CDIO_INLINE __inline
|
||||
#else
|
||||
#define CDIO_INLINE
|
||||
#endif
|
||||
#endif /* CDIO_INLINE */
|
||||
|
||||
#undef MAX
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
|
@ -40,7 +52,7 @@
|
|||
#undef CLAMP
|
||||
#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
|
||||
|
||||
static inline uint32_t
|
||||
static CDIO_INLINE uint32_t
|
||||
_cdio_len2blocks (uint32_t i_len, uint16_t i_blocksize)
|
||||
{
|
||||
uint32_t i_blocks;
|
||||
|
@ -53,13 +65,13 @@ _cdio_len2blocks (uint32_t i_len, uint16_t i_blocksize)
|
|||
}
|
||||
|
||||
/* round up to next block boundary */
|
||||
static inline unsigned
|
||||
static CDIO_INLINE unsigned
|
||||
_cdio_ceil2block (unsigned offset, uint16_t i_blocksize)
|
||||
{
|
||||
return _cdio_len2blocks (offset, i_blocksize) * i_blocksize;
|
||||
}
|
||||
|
||||
static inline unsigned int
|
||||
static CDIO_INLINE unsigned int
|
||||
_cdio_ofs_add (unsigned offset, unsigned length, uint16_t i_blocksize)
|
||||
{
|
||||
if (i_blocksize - (offset % i_blocksize) < length)
|
||||
|
@ -70,7 +82,7 @@ _cdio_ofs_add (unsigned offset, unsigned length, uint16_t i_blocksize)
|
|||
return offset;
|
||||
}
|
||||
|
||||
static inline const char *
|
||||
static CDIO_INLINE const char *
|
||||
_cdio_bool_str (bool b)
|
||||
{
|
||||
return b ? "yes" : "no";
|
||||
|
|
|
@ -0,0 +1,402 @@
|
|||
/* config.h. Manually edited for MSVC compilers. */
|
||||
|
||||
/* Disable: warning C4996: The POSIX name for this item is deprecated. */
|
||||
#pragma warning(disable:4996)
|
||||
/* Disable: warning C4018: signed/unsigned mismatch */
|
||||
#pragma warning(disable:4018)
|
||||
|
||||
/* Define if building universal (internal helper macro) */
|
||||
/* #undef AC_APPLE_UNIVERSAL_BUILD */
|
||||
|
||||
/* Define 1 if you are compiling using cygwin */
|
||||
/* #undef CYGWIN */
|
||||
|
||||
/* what to put between the brackets for empty arrays */
|
||||
#define EMPTY_ARRAY_SIZE 0
|
||||
|
||||
/* Define 1 if you have BSDI-type CD-ROM support */
|
||||
/* #undef HAVE_BSDI_CDROM */
|
||||
|
||||
/* Define this if you have libcddb installed */
|
||||
/* #undef HAVE_CDDB */
|
||||
|
||||
/* Define to 1 if you have the `chdir' function. */
|
||||
/* #undef HAVE_CHDIR */
|
||||
|
||||
/* Define to 1 if you have the <CoreFoundation/CFBase.h> header file. */
|
||||
/* #undef HAVE_COREFOUNDATION_CFBASE_H */
|
||||
|
||||
/* Define to 1 if you have the <curses.h> header file. */
|
||||
/* #undef HAVE_CURSES_H */
|
||||
|
||||
/* Define 1 if you have Darwin OS X-type CD-ROM support */
|
||||
/* #undef HAVE_DARWIN_CDROM */
|
||||
|
||||
/* Define if time.h defines extern long timezone and int daylight vars. */
|
||||
#define HAVE_DAYLIGHT 1
|
||||
|
||||
/* Define to 1 if you have the Apple DiskArbitration framework */
|
||||
/* #undef HAVE_DISKARBITRATION */
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
/* #undef HAVE_DLFCN_H */
|
||||
|
||||
/* Define to 1 if you have the `drand48' function. */
|
||||
/* #undef HAVE_DRAND48 */
|
||||
|
||||
/* Define to 1 if you have the <dvd.h> header file. */
|
||||
/* #undef HAVE_DVD_H */
|
||||
|
||||
/* Define to 1 if you have the <errno.h> header file. */
|
||||
#define HAVE_ERRNO_H 1
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define 1 if you have FreeBSD CD-ROM support */
|
||||
/* #undef HAVE_FREEBSD_CDROM */
|
||||
|
||||
/* Define to 1 if you have the `fseeko' function. */
|
||||
/* #undef HAVE_FSEEKO */
|
||||
|
||||
/* Define to 1 if you have the `fseeko64' function. */
|
||||
#define HAVE_FSEEKO64 1
|
||||
/* The equivalent of fseeko64 for MSVC is _fseeki64 */
|
||||
#define fseeko64 _fseeki64
|
||||
|
||||
/* Define to 1 if you have the `ftruncate' function. */
|
||||
/* #undef HAVE_FTRUNCATE */
|
||||
|
||||
/* Define to 1 if you have the `geteuid' function. */
|
||||
/* #undef HAVE_GETEUID */
|
||||
|
||||
/* Define to 1 if you have the `getgid' function. */
|
||||
/* #undef HAVE_GETGID */
|
||||
|
||||
/* Define to 1 if you have the <getopt.h> header file. */
|
||||
/* #undef HAVE_GETOPT_H */
|
||||
|
||||
/* Define to 1 if you have the `getpwuid' function. */
|
||||
/* #undef HAVE_GETPWUID */
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
/* #undef HAVE_GETTIMEOFDAY */
|
||||
|
||||
/* Define to 1 if you have the `getuid' function. */
|
||||
/* #undef HAVE_GETUID */
|
||||
|
||||
/* Define to 1 if you have the <glob.h> header file. */
|
||||
/* #undef HAVE_GLOB_H */
|
||||
|
||||
/* Define to 1 if you have the `gmtime_r' function. */
|
||||
/* #undef HAVE_GMTIME_R */
|
||||
|
||||
/* Define if you have the iconv() function and it works. */
|
||||
/* #undef HAVE_ICONV */
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1 /* provided in MSVC/missing if needed */
|
||||
|
||||
/* Define to 1 if you have the <IOKit/IOKitLib.h> header file. */
|
||||
/* #undef HAVE_IOKIT_IOKITLIB_H */
|
||||
|
||||
/* Supports ISO _Pragma() macro */
|
||||
/* #undef HAVE_ISOC99_PRAGMA */
|
||||
|
||||
/* Define 1 if you want ISO-9660 Joliet extension support. You must have also
|
||||
libiconv installed to get Joliet extension support. */
|
||||
#define HAVE_JOLIET 1
|
||||
|
||||
/* Define this if your libcurses has keypad */
|
||||
/* #undef HAVE_KEYPAD */
|
||||
|
||||
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
|
||||
/* #undef HAVE_LANGINFO_CODESET */
|
||||
|
||||
/* Define to 1 if you have the `nsl' library (-lnsl). */
|
||||
/* #undef HAVE_LIBNSL */
|
||||
|
||||
/* Define to 1 if you have the `socket' library (-lsocket). */
|
||||
/* #undef HAVE_LIBSOCKET */
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#define HAVE_LIMITS_H 1
|
||||
|
||||
/* Define 1 if you have Linux-type CD-ROM support */
|
||||
/* #undef HAVE_LINUX_CDROM */
|
||||
|
||||
/* Define to 1 if you have the <linux/cdrom.h> header file. */
|
||||
/* #undef HAVE_LINUX_CDROM_H */
|
||||
|
||||
/* Define 1 if timeout is in cdrom_generic_command struct */
|
||||
/* #undef HAVE_LINUX_CDROM_TIMEOUT */
|
||||
|
||||
/* Define to 1 if you have the <linux/major.h> header file. */
|
||||
/* #undef HAVE_LINUX_MAJOR_H */
|
||||
|
||||
/* Define to 1 if you have the <linux/version.h> header file. */
|
||||
/* #undef HAVE_LINUX_VERSION_H */
|
||||
|
||||
/* Define to 1 if you have the `localtime_r' function. */
|
||||
/* #undef HAVE_LOCALTIME_R */
|
||||
|
||||
/* Define to 1 if you have the `lseek64' function. */
|
||||
#define HAVE_LSEEK64 1
|
||||
/* The equivalent of lseek64 on MSVC is _lseeki64 */
|
||||
#define lseek64 _lseeki64
|
||||
|
||||
/* Define to 1 if you have the `lstat' function. */
|
||||
/* #undef HAVE_LSTAT */
|
||||
|
||||
/* Define to 1 if you have the `memcpy' function. */
|
||||
#define HAVE_MEMCPY 1
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define to 1 if you have the `memset' function. */
|
||||
#define HAVE_MEMSET 1
|
||||
|
||||
/* Define to 1 if you have the <ncurses.h> header file. */
|
||||
/* #undef HAVE_NCURSES_H */
|
||||
|
||||
/* Define to 1 if you have the <ncurses/ncurses.h> header file. */
|
||||
/* #undef HAVE_NCURSES_NCURSES_H */
|
||||
|
||||
/* Define 1 if you have NetBSD CD-ROM support */
|
||||
/* #undef HAVE_NETBSD_CDROM */
|
||||
|
||||
/* Define 1 if you have OS/2 CD-ROM support */
|
||||
/* #undef HAVE_OS2_CDROM */
|
||||
|
||||
/* Define to 1 if you have the <pwd.h> header file. */
|
||||
/* #undef HAVE_PWD_H */
|
||||
|
||||
/* Define to 1 if you have the `rand' function. */
|
||||
#define HAVE_RAND 1
|
||||
|
||||
/* Define to 1 if you have the `readlink' function. */
|
||||
/* #undef HAVE_READLINK */
|
||||
|
||||
/* Define to 1 if you have the `realpath' function. */
|
||||
/* #undef HAVE_REALPATH */
|
||||
|
||||
/* Define 1 if you want ISO-9660 Rock-Ridge extension support. */
|
||||
#define HAVE_ROCK 1
|
||||
|
||||
/* Define to 1 if you have the `setegid' function. */
|
||||
/* #undef HAVE_SETEGID */
|
||||
|
||||
/* Define to 1 if you have the `setenv' function. */
|
||||
/* #undef HAVE_SETENV */
|
||||
|
||||
/* Define to 1 if you have the `seteuid' function. */
|
||||
/* #undef HAVE_SETEUID */
|
||||
|
||||
/* Define to 1 if you have the `sleep' function. */
|
||||
/* #undef HAVE_SLEEP */
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#define HAVE_SNPRINTF 1
|
||||
/* The equivalent of snprintf on MSVC is _snprintf */
|
||||
#define snprintf _snprintf
|
||||
|
||||
/* Define 1 if you have Solaris CD-ROM support */
|
||||
/* #undef HAVE_SOLARIS_CDROM */
|
||||
|
||||
/* Define to 1 if you have the <stdarg.h> header file. */
|
||||
#define HAVE_STDARG_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdbool.h> header file. */
|
||||
/* #undef HAVE_STDBOOL_H */
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HAVE_STDINT_H 1 /* provided in MSVC/missing if needed */
|
||||
|
||||
/* Define to 1 if you have the <stdio.h> header file. */
|
||||
#define HAVE_STDIO_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
/* #undef HAVE_STRINGS_H */
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the `strndup' function. */
|
||||
/* #undef HAVE_STRNDUP */
|
||||
|
||||
/* Define this if you have struct timespec */
|
||||
/* #undef HAVE_STRUCT_TIMESPEC */
|
||||
|
||||
/* Define to 1 if you have the <sys/cdio.h> header file. */
|
||||
/* #undef HAVE_SYS_CDIO_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
/* #undef HAVE_SYS_PARAM_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/timeb.h> header file. */
|
||||
/* #undef HAVE_SYS_TIMEB_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/utsname.h> header file. */
|
||||
/* #undef HAVE_SYS_UTSNAME_H */
|
||||
|
||||
/* Define this <sys/stat.h> defines S_ISLNK() */
|
||||
/* #undef HAVE_S_ISLNK */
|
||||
|
||||
/* Define this <sys/stat.h> defines S_ISSOCK() */
|
||||
/* #undef HAVE_S_ISSOCK */
|
||||
|
||||
/* Define to 1 if timegm is available */
|
||||
/* #undef HAVE_TIMEGM */
|
||||
|
||||
/* Define if you have an extern long timenzone variable. */
|
||||
#define HAVE_TIMEZONE_VAR 1
|
||||
|
||||
/* Define if struct tm has the tm_gmtoff member. */
|
||||
/* #undef HAVE_TM_GMTOFF */
|
||||
|
||||
/* Define if time.h defines extern extern char *tzname[2] variable */
|
||||
#define HAVE_TZNAME 1
|
||||
|
||||
/* Define to 1 if you have the `tzset' function. */
|
||||
#define HAVE_TZSET 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1 /* provided in MSVC/missing if needed */
|
||||
|
||||
/* Define to 1 if you have the `unsetenv' function. */
|
||||
/* #undef HAVE_UNSETENV */
|
||||
|
||||
/* Define to 1 if you have the `usleep' function. */
|
||||
/* #undef HAVE_USLEEP */
|
||||
|
||||
/* Define this if you have libvcdinfo installed */
|
||||
/* #undef #undef HAVE_VCDINFO */
|
||||
|
||||
/* Define to 1 if you have the `vsnprintf' function. */
|
||||
/* #undef HAVE_VSNPRINTF */
|
||||
|
||||
/* Define 1 if you have MinGW CD-ROM support */
|
||||
/* #undef HAVE_WIN32_CDROM */
|
||||
|
||||
/* Define to 1 if you have the <windows.h> header file. */
|
||||
#define HAVE_WINDOWS_H 1
|
||||
|
||||
/* Define to 1 if you have the `_stati64' function. */
|
||||
#define HAVE__STATI64 1
|
||||
|
||||
/* Define as const if the declaration of iconv() needs const. */
|
||||
/* #undef ICONV_CONST */
|
||||
|
||||
/* Is set when libcdio's config.h has been included. Applications wishing to
|
||||
sue their own config.h values (such as set by the application's configure
|
||||
script can define this before including any of libcdio's headers. */
|
||||
#define LIBCDIO_CONFIG_H 1
|
||||
|
||||
/* Full path to libcdio top_sourcedir. */
|
||||
/* #undef LIBCDIO_SOURCE_PATH */
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
/* #undef LT_OBJDIR */
|
||||
|
||||
/* Define 1 if you are compiling using MinGW */
|
||||
/* #undef MINGW32 */
|
||||
|
||||
/* Define 1 if you need timezone defined to get timzone defined as a variable.
|
||||
In cygwin it is a function too */
|
||||
/* #undef NEED_TIMEZONEVAR */
|
||||
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||
/* #undef NO_MINUS_C_MINUS_O */
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "libcdio"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT "libcdio-help@gnu.org"
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "libcdio"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "libcdio 0.84git"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "libcdio"
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "0.84git"
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Enable extensions on AIX 3, Interix. */
|
||||
/* #undef _ALL_SOURCE */
|
||||
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
/* #undef _GNU_SOURCE */
|
||||
|
||||
/* Enable threading extensions on Solaris. */
|
||||
/* #undef _POSIX_PTHREAD_SEMANTICS */
|
||||
|
||||
/* Enable extensions on HP NonStop. */
|
||||
/* #undef _TANDEM_SOURCE */
|
||||
|
||||
/* Enable general extensions on Solaris. */
|
||||
/* #undef __EXTENSIONS__ */
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "0.84git"
|
||||
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD
|
||||
# if defined __BIG_ENDIAN__
|
||||
# define WORDS_BIGENDIAN 1
|
||||
# endif
|
||||
#else
|
||||
# ifndef WORDS_BIGENDIAN
|
||||
/* # undef WORDS_BIGENDIAN */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
/* Note: This is defined as a preprocessor macro in the project files */
|
||||
/* #define _FILE_OFFSET_BITS 64 */
|
||||
|
||||
/* Define for large files, on AIX-style hosts. */
|
||||
/* #undef _LARGE_FILES */
|
||||
|
||||
/* Define to 1 if on MINIX. */
|
||||
/* #undef _MINIX */
|
||||
|
||||
/* Define to 2 if the system does not provide POSIX.1 features except with
|
||||
this defined. */
|
||||
/* #undef _POSIX_1_SOURCE */
|
||||
|
||||
/* Define to 1 if you need to in order for `stat' and other things to work. */
|
||||
/* #undef _POSIX_SOURCE */
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#define inline __inline
|
||||
|
|
@ -25,6 +25,7 @@
|
|||
<ClCompile Include="..\read.c" />
|
||||
<ClCompile Include="..\sector.c" />
|
||||
<ClCompile Include="..\track.c" />
|
||||
<ClCompile Include="..\utf8.c" />
|
||||
<ClCompile Include="..\util.c" />
|
||||
<ClCompile Include="..\_cdio_stdio.c" />
|
||||
<ClCompile Include="..\_cdio_stream.c" />
|
||||
|
@ -32,6 +33,7 @@
|
|||
<ItemGroup>
|
||||
<ClInclude Include="..\cdio_assert.h" />
|
||||
<ClInclude Include="..\cdio_private.h" />
|
||||
<ClInclude Include="..\filemode.h" />
|
||||
<ClInclude Include="..\_cdio_stdio.h" />
|
||||
<ClInclude Include="..\_cdio_stream.h" />
|
||||
</ItemGroup>
|
||||
|
@ -101,7 +103,7 @@
|
|||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..;..\..;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
|
@ -121,7 +123,7 @@
|
|||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..;..\..;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
|
@ -136,7 +138,7 @@
|
|||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..;..\..;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
|
@ -156,7 +158,7 @@
|
|||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..;..\..;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
|
|
|
@ -38,6 +38,9 @@
|
|||
<ClCompile Include="..\track.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\utf8.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\_cdio_stdio.h">
|
||||
|
@ -52,5 +55,8 @@
|
|||
<ClInclude Include="..\cdio_private.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\filemode.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -16,32 +16,55 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__)
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
# define __CDIO_CONFIG_H__ 1
|
||||
#else
|
||||
#ifndef EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#define EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#include <cdio/cdio_config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif /*HAVE_UNISTD_H*/
|
||||
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#ifdef HAVE_ERRNO_H
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#include <cdio/logging.h>
|
||||
#include <cdio/util.h>
|
||||
#include "_cdio_stream.h"
|
||||
#include "_cdio_stdio.h"
|
||||
|
||||
/* On 32 bit platforms, fseek can only access streams of 2 GB or less.
|
||||
Prefer fseeko/fseeko64, that take a 64 bit offset when LFS is enabled */
|
||||
#if defined(HAVE_FSEEKO64) && defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
|
||||
#define CDIO_FSEEK fseeko64
|
||||
#elif defined(HAVE_FSEEKO)
|
||||
#define CDIO_FSEEK fseeko
|
||||
#else
|
||||
#define CDIO_FSEEK fseek
|
||||
#endif
|
||||
|
||||
/* Use _stati64 if needed, on platforms that don't have transparent LFS support */
|
||||
#if defined(HAVE__STATI64) && defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
|
||||
#define CDIO_STAT _stati64
|
||||
#else
|
||||
#define CDIO_STAT stat
|
||||
#endif
|
||||
|
||||
#define _STRINGIFY(a) #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)
|
||||
|
@ -50,7 +73,7 @@ typedef struct {
|
|||
char *pathname;
|
||||
FILE *fd;
|
||||
char *fd_buf;
|
||||
int64_t st_size; /* used only for source */
|
||||
off_t st_size; /* used only for source */
|
||||
} _UserData;
|
||||
|
||||
static int
|
||||
|
@ -98,7 +121,7 @@ _stdio_free(void *user_data)
|
|||
}
|
||||
|
||||
/*!
|
||||
Like fseek64(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
|
||||
pointed to by stream. The new position, measured in bytes, is obtained
|
||||
|
@ -113,19 +136,28 @@ _stdio_free(void *user_data)
|
|||
DRIVER_OP_ERROR is returned and the global variable errno is set to
|
||||
indicate the error.
|
||||
*/
|
||||
static off64_t
|
||||
_stdio_seek(void *p_user_data, off64_t i_offset, int whence)
|
||||
static int
|
||||
_stdio_seek(void *p_user_data, off_t i_offset, int whence)
|
||||
{
|
||||
_UserData *const ud = (_UserData*)p_user_data;
|
||||
_UserData *const ud = p_user_data;
|
||||
int ret;
|
||||
#if !defined(HAVE_FSEEKO) && !defined(HAVE_FSEEKO64)
|
||||
/* Detect if off_t is lossy-truncated to long to avoid data corruption */
|
||||
if ( (sizeof(off_t) > sizeof(long)) && (i_offset != (off_t)((long)i_offset)) ) {
|
||||
cdio_error ( STRINGIFY(CDIO_FSEEK) " (): lossy truncation detected!");
|
||||
errno = EFBIG;
|
||||
return DRIVER_OP_ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( (i_offset=fseeko64 (ud->fd, i_offset, whence)) ) {
|
||||
cdio_error ("fseek (): %s", strerror (errno));
|
||||
if ( (ret=CDIO_FSEEK (ud->fd, i_offset, whence)) ) {
|
||||
cdio_error ( STRINGIFY(CDIO_FSEEK) " (): %s", strerror (errno));
|
||||
}
|
||||
|
||||
return i_offset;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static uint64_t
|
||||
static off_t
|
||||
_stdio_stat(void *p_user_data)
|
||||
{
|
||||
const _UserData *const ud = p_user_data;
|
||||
|
@ -150,15 +182,15 @@ _stdio_stat(void *p_user_data)
|
|||
We do not distinguish between end-of-file and error, and callers
|
||||
must use feof(3) and ferror(3) to determine which occurred.
|
||||
*/
|
||||
static long
|
||||
_stdio_read(void *user_data, void *buf, long int count)
|
||||
static ssize_t
|
||||
_stdio_read(void *user_data, void *buf, size_t count)
|
||||
{
|
||||
_UserData *const ud = user_data;
|
||||
long read_size;
|
||||
long read;
|
||||
|
||||
read_size = fread(buf, 1, count, ud->fd);
|
||||
read = fread(buf, 1, count, ud->fd);
|
||||
|
||||
if (read_size != count)
|
||||
if (read != count)
|
||||
{ /* fixme -- ferror/feof */
|
||||
if (feof (ud->fd))
|
||||
{
|
||||
|
@ -174,7 +206,7 @@ _stdio_read(void *user_data, void *buf, long int count)
|
|||
cdio_debug ("fread (): short read and no EOF?!?");
|
||||
}
|
||||
|
||||
return read_size;
|
||||
return read;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -192,9 +224,9 @@ cdio_stdio_new(const char pathname[])
|
|||
CdioDataSource_t *new_obj = NULL;
|
||||
cdio_stream_io_functions funcs = { NULL, NULL, NULL, NULL, NULL, NULL };
|
||||
_UserData *ud = NULL;
|
||||
struct _stati64 statbuf;
|
||||
struct CDIO_STAT statbuf;
|
||||
|
||||
if (_stati64 (pathname, &statbuf) == -1)
|
||||
if (CDIO_STAT (pathname, &statbuf) == -1)
|
||||
{
|
||||
cdio_warn ("could not retrieve file info for `%s': %s",
|
||||
pathname, strerror (errno));
|
||||
|
@ -203,7 +235,7 @@ cdio_stdio_new(const char pathname[])
|
|||
|
||||
ud = calloc (1, sizeof (_UserData));
|
||||
|
||||
ud->pathname = _strdup(pathname);
|
||||
ud->pathname = strdup(pathname);
|
||||
ud->st_size = statbuf.st_size; /* let's hope it doesn't change... */
|
||||
|
||||
funcs.open = _stdio_open;
|
||||
|
|
|
@ -16,25 +16,23 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__)
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
# define __CDIO_CONFIG_H__ 1
|
||||
#else
|
||||
#ifndef EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#define EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#include <cdio/cdio_config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif /*HAVE_UNISTD_H*/
|
||||
|
||||
#endif
|
||||
#include "cdio_assert.h"
|
||||
|
||||
/* #define STREAM_DEBUG */
|
||||
|
@ -53,7 +51,7 @@ struct _CdioDataSource {
|
|||
void* user_data;
|
||||
cdio_stream_io_functions op;
|
||||
int is_open;
|
||||
off64_t position;
|
||||
off_t position;
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -90,8 +88,8 @@ cdio_stream_destroy(CdioDataSource_t *p_obj)
|
|||
@return unpon successful completion, return value is positive, else,
|
||||
the global variable errno is set to indicate the error.
|
||||
*/
|
||||
off64_t
|
||||
cdio_stream_getpos(CdioDataSource_t* p_obj, /*out*/ off64_t *i_offset)
|
||||
off_t
|
||||
cdio_stream_getpos(CdioDataSource_t* p_obj, /*out*/ off_t *i_offset)
|
||||
{
|
||||
if (!p_obj || !p_obj->is_open) return DRIVER_OP_UNINIT;
|
||||
return *i_offset = p_obj->position;
|
||||
|
@ -150,7 +148,7 @@ _cdio_stream_open_if_necessary(CdioDataSource_t *p_obj)
|
|||
must use feof(3) and ferror(3) to determine which occurred.
|
||||
*/
|
||||
ssize_t
|
||||
cdio_stream_read(CdioDataSource_t* p_obj, void *ptr, long size, long nmemb)
|
||||
cdio_stream_read(CdioDataSource_t* p_obj, void *ptr, size_t size, size_t nmemb)
|
||||
{
|
||||
long read_bytes;
|
||||
|
||||
|
@ -178,8 +176,8 @@ cdio_stream_read(CdioDataSource_t* p_obj, void *ptr, long size, long nmemb)
|
|||
@return unpon successful completion, return value is positive, else,
|
||||
the global variable errno is set to indicate the error.
|
||||
*/
|
||||
off64_t
|
||||
cdio_stream_seek(CdioDataSource_t* p_obj, off64_t offset, int whence)
|
||||
int
|
||||
cdio_stream_seek(CdioDataSource_t* p_obj, off_t offset, int whence)
|
||||
{
|
||||
if (!p_obj) return DRIVER_OP_UNINIT;
|
||||
|
||||
|
@ -188,12 +186,13 @@ cdio_stream_seek(CdioDataSource_t* p_obj, off64_t offset, int whence)
|
|||
return DRIVER_OP_ERROR;
|
||||
|
||||
if (offset < 0) return DRIVER_OP_ERROR;
|
||||
if (p_obj->position < 0) return DRIVER_OP_ERROR;
|
||||
|
||||
if (p_obj->position != offset) {
|
||||
#ifdef STREAM_DEBUG
|
||||
cdio_warn("had to reposition DataSource from %ld to %ld!", obj->position, offset);
|
||||
cdio_warn("had to reposition DataSource from %ld to %ld!", p_obj->position, offset);
|
||||
#endif
|
||||
p_obj->position = (off64_t)offset;
|
||||
p_obj->position = offset;
|
||||
return p_obj->op.seek(p_obj->user_data, offset, whence);
|
||||
}
|
||||
|
||||
|
@ -204,7 +203,7 @@ cdio_stream_seek(CdioDataSource_t* p_obj, off64_t offset, int whence)
|
|||
Return whatever size of stream reports, I guess unit size is bytes.
|
||||
On error return -1;
|
||||
*/
|
||||
int64_t
|
||||
off_t
|
||||
cdio_stream_stat(CdioDataSource_t *p_obj)
|
||||
{
|
||||
if (!p_obj) return -1;
|
||||
|
|
|
@ -33,12 +33,12 @@ extern "C" {
|
|||
|
||||
typedef int(*cdio_data_open_t)(void *user_data);
|
||||
|
||||
typedef long(*cdio_data_read_t)(void *user_data, void *buf, long count);
|
||||
typedef ssize_t(*cdio_data_read_t)(void *user_data, void *buf, size_t count);
|
||||
|
||||
typedef off64_t(*cdio_data_seek_t)(void *user_data, off64_t offset,
|
||||
typedef int(*cdio_data_seek_t)(void *user_data, off_t offset,
|
||||
int whence);
|
||||
|
||||
typedef uint64_t(*cdio_data_stat_t)(void *user_data);
|
||||
typedef off_t(*cdio_data_stat_t)(void *user_data);
|
||||
|
||||
typedef int(*cdio_data_close_t)(void *user_data);
|
||||
|
||||
|
@ -65,8 +65,8 @@ extern "C" {
|
|||
@return unpon successful completion, return value is positive, else,
|
||||
the global variable errno is set to indicate the error.
|
||||
*/
|
||||
off64_t cdio_stream_getpos(CdioDataSource_t* p_obj,
|
||||
/*out*/ off64_t *i_offset);
|
||||
off_t cdio_stream_getpos(CdioDataSource_t* p_obj,
|
||||
/*out*/ off_t *i_offset);
|
||||
|
||||
CdioDataSource_t *
|
||||
cdio_stream_new(void *user_data, const cdio_stream_io_functions *funcs);
|
||||
|
@ -88,11 +88,11 @@ extern "C" {
|
|||
We do not distinguish between end-of-file and error, and callers
|
||||
must use feof(3) and ferror(3) to determine which occurred.
|
||||
*/
|
||||
ssize_t cdio_stream_read(CdioDataSource_t* p_obj, void *ptr, long i_size,
|
||||
long nmemb);
|
||||
ssize_t cdio_stream_read(CdioDataSource_t* p_obj, void *ptr, size_t i_size,
|
||||
size_t nmemb);
|
||||
|
||||
/**
|
||||
Like fseek64/_fseeki64 and in fact may be the same.
|
||||
Like fseek(3)/fseeko(3) and in fact may be the same.
|
||||
|
||||
This function sets the file position indicator for the stream
|
||||
pointed to by stream. The new position, measured in bytes, is obtained
|
||||
|
@ -107,14 +107,14 @@ extern "C" {
|
|||
DRIVER_OP_ERROR is returned and the global variable errno is set to
|
||||
indicate the error.
|
||||
*/
|
||||
off64_t cdio_stream_seek(CdioDataSource_t *p_obj, off64_t i_offset,
|
||||
int cdio_stream_seek(CdioDataSource_t *p_obj, off_t i_offset,
|
||||
int whence);
|
||||
|
||||
/**
|
||||
Return whatever size of stream reports, I guess unit size is bytes.
|
||||
On error return -1;
|
||||
*/
|
||||
int64_t cdio_stream_stat(CdioDataSource_t *p_obj);
|
||||
off_t cdio_stream_stat(CdioDataSource_t *p_obj);
|
||||
|
||||
/**
|
||||
Deallocate resources associated with p_obj. After this p_obj is unusable.
|
||||
|
|
|
@ -31,14 +31,15 @@
|
|||
|
||||
#define cdio_assert(expr) \
|
||||
{ \
|
||||
if (GNUC_UNLIKELY (!(expr))) cdio_assert_log ( \
|
||||
if (GNUC_UNLIKELY (!(expr))) cdio_log (CDIO_LOG_ASSERT, \
|
||||
"file %s: line %d (%s): assertion failed: (%s)", \
|
||||
__FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \
|
||||
}
|
||||
|
||||
#define cdio_assert_not_reached() \
|
||||
{ \
|
||||
cdio_assert_log ("file %s: line %d (%s): should not be reached", \
|
||||
cdio_log (CDIO_LOG_ASSERT, \
|
||||
"file %s: line %d (%s): should not be reached", \
|
||||
__FILE__, __LINE__, __PRETTY_FUNCTION__); \
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include <cdio/cdio.h>
|
||||
#include <cdio/audio.h>
|
||||
//#include <cdio/cdtext.h>
|
||||
#include <cdio/cdtext.h>
|
||||
//#include "mmc/mmc_private.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -16,15 +16,11 @@
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__)
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
# define __CDIO_CONFIG_H__ 1
|
||||
#else
|
||||
#ifndef EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#define EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#include <cdio/cdio_config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <cdio/cdio.h>
|
||||
|
|
|
@ -16,18 +16,17 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__)
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
# define __CDIO_CONFIG_H__ 1
|
||||
#else
|
||||
#ifndef EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#define EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#include <cdio/cdio_config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include <cdio/ds.h>
|
||||
#include <cdio/util.h>
|
||||
|
|
|
@ -1,119 +1,134 @@
|
|||
/*
|
||||
filemode.h -- file modes common definitions
|
||||
|
||||
Copyright (C) 2005, 2008, 2011 Rocky Bernstein <rocky@gnu.org>
|
||||
Copyright (C) 1985, 1990, 1993, 1998-2000 Free Software Foundation, Inc.
|
||||
|
||||
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
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __FILEMODE_H__
|
||||
#define __FILEMODE_H__
|
||||
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#ifndef S_IRUSR
|
||||
# ifdef S_IREAD
|
||||
# define S_IRUSR S_IREAD
|
||||
# else
|
||||
# define S_IRUSR 00400
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef S_IWUSR
|
||||
# ifdef S_IWRITE
|
||||
# define S_IWUSR S_IWRITE
|
||||
# else
|
||||
# define S_IWUSR 00200
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef S_IXUSR
|
||||
# ifdef S_IEXEC
|
||||
# define S_IXUSR S_IEXEC
|
||||
# else
|
||||
# define S_IXUSR 00100
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef S_IRGRP
|
||||
# define S_IRGRP (S_IRUSR >> 3)
|
||||
#endif
|
||||
#ifndef S_IWGRP
|
||||
# define S_IWGRP (S_IWUSR >> 3)
|
||||
#endif
|
||||
#ifndef S_IXGRP
|
||||
# define S_IXGRP (S_IXUSR >> 3)
|
||||
#endif
|
||||
#ifndef S_IROTH
|
||||
# define S_IROTH (S_IRUSR >> 6)
|
||||
#endif
|
||||
#ifndef S_IWOTH
|
||||
# define S_IWOTH (S_IWUSR >> 6)
|
||||
#endif
|
||||
#ifndef S_IXOTH
|
||||
# define S_IXOTH (S_IXUSR >> 6)
|
||||
#endif
|
||||
|
||||
#ifdef STAT_MACROS_BROKEN
|
||||
# undef S_ISBLK
|
||||
# undef S_ISCHR
|
||||
# undef S_ISDIR
|
||||
# undef S_ISFIFO
|
||||
# undef S_ISLNK
|
||||
# undef S_ISMPB
|
||||
# undef S_ISMPC
|
||||
# undef S_ISNWK
|
||||
# undef S_ISREG
|
||||
# undef S_ISSOCK
|
||||
#endif /* STAT_MACROS_BROKEN. */
|
||||
|
||||
#if !defined S_ISBLK && defined S_IFBLK
|
||||
# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
|
||||
#endif
|
||||
#if !defined S_ISCHR && defined S_IFCHR
|
||||
# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
|
||||
#endif
|
||||
#if !defined S_ISDIR && defined S_IFDIR
|
||||
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
#if !defined S_ISREG && defined S_IFREG
|
||||
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||
#endif
|
||||
#if !defined S_ISFIFO && defined S_IFIFO
|
||||
# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
|
||||
#endif
|
||||
#if !defined S_ISLNK && defined S_IFLNK
|
||||
# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
|
||||
#endif
|
||||
#if !defined S_ISSOCK && defined S_IFSOCK
|
||||
# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
|
||||
#endif
|
||||
#if !defined S_ISMPB && defined S_IFMPB /* V7 */
|
||||
# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
|
||||
# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
|
||||
#endif
|
||||
#if !defined S_ISNWK && defined S_IFNWK /* HP/UX */
|
||||
# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
|
||||
#endif
|
||||
#if !defined S_ISDOOR && defined S_IFDOOR /* Solaris 2.5 and up */
|
||||
# define S_ISDOOR(m) (((m) & S_IFMT) == S_IFDOOR)
|
||||
#endif
|
||||
#if !defined S_ISCTG && defined S_IFCTG /* MassComp */
|
||||
# define S_ISCTG(m) (((m) & S_IFMT) == S_IFCTG)
|
||||
#endif
|
||||
|
||||
#endif /* __FILEMODE_H__ */
|
||||
/*
|
||||
filemode.h -- file modes common definitions
|
||||
|
||||
Copyright (C) 2005, 2008, 2011 Rocky Bernstein <rocky@gnu.org>
|
||||
Copyright (C) 1985, 1990, 1993, 1998-2000 Free Software Foundation, Inc.
|
||||
|
||||
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
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __FILEMODE_H__
|
||||
#define __FILEMODE_H__
|
||||
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#ifndef S_IRUSR
|
||||
# ifdef S_IREAD
|
||||
# define S_IRUSR S_IREAD
|
||||
# else
|
||||
# define S_IRUSR 00400
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef S_IWUSR
|
||||
# ifdef S_IWRITE
|
||||
# define S_IWUSR S_IWRITE
|
||||
# else
|
||||
# define S_IWUSR 00200
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef S_IXUSR
|
||||
# ifdef S_IEXEC
|
||||
# define S_IXUSR S_IEXEC
|
||||
# else
|
||||
# define S_IXUSR 00100
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef S_IRGRP
|
||||
# define S_IRGRP (S_IRUSR >> 3)
|
||||
#endif
|
||||
#ifndef S_IWGRP
|
||||
# define S_IWGRP (S_IWUSR >> 3)
|
||||
#endif
|
||||
#ifndef S_IXGRP
|
||||
# define S_IXGRP (S_IXUSR >> 3)
|
||||
#endif
|
||||
#ifndef S_IROTH
|
||||
# define S_IROTH (S_IRUSR >> 6)
|
||||
#endif
|
||||
#ifndef S_IWOTH
|
||||
# define S_IWOTH (S_IWUSR >> 6)
|
||||
#endif
|
||||
#ifndef S_IXOTH
|
||||
# define S_IXOTH (S_IXUSR >> 6)
|
||||
#endif
|
||||
|
||||
#ifdef STAT_MACROS_BROKEN
|
||||
# undef S_ISBLK
|
||||
# undef S_ISCHR
|
||||
# undef S_ISDIR
|
||||
# undef S_ISFIFO
|
||||
# undef S_ISLNK
|
||||
# undef S_ISMPB
|
||||
# undef S_ISMPC
|
||||
# undef S_ISNWK
|
||||
# undef S_ISREG
|
||||
# undef S_ISSOCK
|
||||
#endif /* STAT_MACROS_BROKEN. */
|
||||
|
||||
#if !defined S_IFBLK && defined _WIN32
|
||||
# define S_IFBLK 0x3000
|
||||
#endif
|
||||
#if !defined S_IFIFO && defined _WIN32
|
||||
# define S_IFIFO 0x1000
|
||||
#endif
|
||||
|
||||
#if !defined S_ISBLK && defined S_IFBLK
|
||||
# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
|
||||
#endif
|
||||
#if !defined S_ISCHR && defined S_IFCHR
|
||||
# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
|
||||
#endif
|
||||
#if !defined S_ISDIR && defined S_IFDIR
|
||||
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
#if !defined S_ISREG && defined S_IFREG
|
||||
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||
#endif
|
||||
#if !defined S_ISFIFO && defined S_IFIFO
|
||||
# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
|
||||
#endif
|
||||
#if !defined HAVE_S_ISLNK
|
||||
# if !defined S_ISLNK && defined S_IFLNK
|
||||
# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
|
||||
# else
|
||||
# define S_ISLNK(m) ((void)m, 0)
|
||||
# endif
|
||||
#endif
|
||||
#if !defined HAVE_S_ISSOCK
|
||||
# if !defined S_ISSOCK && defined S_IFSOCK
|
||||
# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
|
||||
# else
|
||||
# define S_ISSOCK(m) ((void)m, 0)
|
||||
# endif
|
||||
#endif
|
||||
#if !defined S_ISMPB && defined S_IFMPB /* V7 */
|
||||
# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
|
||||
# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
|
||||
#endif
|
||||
#if !defined S_ISNWK && defined S_IFNWK /* HP/UX */
|
||||
# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
|
||||
#endif
|
||||
#if !defined S_ISDOOR && defined S_IFDOOR /* Solaris 2.5 and up */
|
||||
# define S_ISDOOR(m) (((m) & S_IFMT) == S_IFDOOR)
|
||||
#endif
|
||||
#if !defined S_ISCTG && defined S_IFCTG /* MassComp */
|
||||
# define S_ISCTG(m) (((m) & S_IFMT) == S_IFCTG)
|
||||
#endif
|
||||
|
||||
#endif /* __FILEMODE_H__ */
|
|
@ -26,7 +26,7 @@
|
|||
#endif
|
||||
|
||||
#include <cdio/cdio.h>
|
||||
//#include <cdio/cdtext.h>
|
||||
#include <cdio/cdtext.h>
|
||||
#include <cdio/iso9660.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -62,7 +62,7 @@ extern "C" {
|
|||
iso9660_svd_t svd;
|
||||
CdIo_t *cdio; /**< a way to call general cdio routines. */
|
||||
cdtext_t *cdtext; /**< CD-Text for disc. */
|
||||
// track_flags_t track_flags[CDIO_CD_MAX_TRACKS+1];
|
||||
track_flags_t track_flags[CDIO_CD_MAX_TRACKS+1];
|
||||
|
||||
/* Memorized sense reply of the most recent SCSI command.
|
||||
Recorded by driver implementations of cdio_funcs_t.run_mmc_cmd().
|
||||
|
|
|
@ -16,19 +16,20 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__)
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
# define __CDIO_CONFIG_H__ 1
|
||||
#else
|
||||
#ifndef EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#define EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#include <cdio/cdio_config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include <cdio/logging.h>
|
||||
#include "cdio_assert.h"
|
||||
|
@ -103,7 +104,7 @@ cdio_logv (cdio_log_level_t level, const char format[], va_list args)
|
|||
|
||||
in_recursion = 1;
|
||||
|
||||
_vsnprintf(buf, sizeof(buf)-1, format, args);
|
||||
vsnprintf(buf, sizeof(buf)-1, format, args);
|
||||
|
||||
_handler(level, buf);
|
||||
|
||||
|
@ -119,18 +120,6 @@ cdio_log (cdio_log_level_t level, const char format[], ...)
|
|||
va_end (args);
|
||||
}
|
||||
|
||||
#if defined(__GNUC__)
|
||||
void
|
||||
cdio_assert_log (const char format[], ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start (args, format);
|
||||
cdio_logv (CDIO_LOG_ASSERT, format, args);
|
||||
va_end (args);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define CDIO_LOG_TEMPLATE(level, LEVEL) \
|
||||
void \
|
||||
cdio_ ## level (const char format[], ...) \
|
||||
|
|
|
@ -27,11 +27,6 @@
|
|||
#if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__)
|
||||
# include "config.h"
|
||||
# define __CDIO_CONFIG_H__ 1
|
||||
#else
|
||||
#ifndef EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#define EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#include <cdio/cdio_config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_FTRUNCATE)
|
||||
|
@ -46,30 +41,14 @@
|
|||
# endif
|
||||
#endif /*HAVE_SNPRINTF*/
|
||||
|
||||
#if !defined(HAVE_VSNPRINTF)
|
||||
# if defined (_MSC_VER)
|
||||
# define vsnprintf _vsnprintf
|
||||
# endif
|
||||
#endif /*HAVE_SNPRINTF*/
|
||||
|
||||
#if !defined(HAVE_DRAND48) && defined(HAVE_RAND)
|
||||
# define drand48() (rand() / (double)RAND_MAX)
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# include <io.h>
|
||||
|
||||
# ifndef S_ISBLK
|
||||
# define _S_IFBLK 0060000 /* Block Special */
|
||||
# define S_ISBLK(x) (x & _S_IFBLK)
|
||||
# endif
|
||||
|
||||
# ifndef S_ISCHR
|
||||
# define _S_IFCHR 0020000 /* character special */
|
||||
# define S_ISCHR(x) (x & _S_IFCHR)
|
||||
# endif
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#if defined(HAVE_MEMSET)
|
||||
# define BZERO(ptr, size) memset(ptr, 0, size)
|
||||
#elif defined(HAVE_BZERO)
|
||||
# define BZERO(ptr, size) bzero(ptr, size)
|
||||
#else
|
||||
#error You need either memset or bzero
|
||||
#endif
|
||||
|
||||
#endif /* __CDIO_PORTABLE_H__ */
|
||||
|
|
|
@ -19,14 +19,10 @@
|
|||
* \brief sector (block, frame)-related libcdio routines.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__)
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
# define __CDIO_CONFIG_H__ 1
|
||||
#else
|
||||
#ifndef EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#define EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#include <cdio/cdio_config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <cdio/cdio.h>
|
||||
|
@ -132,8 +128,7 @@ driver_return_code_t
|
|||
cdio_read_audio_sectors (const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn,
|
||||
uint32_t i_blocks)
|
||||
{
|
||||
lsn_t _i_blocks = (lsn_t)i_blocks;
|
||||
check_lsn_blocks(i_lsn, _i_blocks);
|
||||
check_lsn_blocks(i_lsn, i_blocks);
|
||||
|
||||
if (0 == i_blocks) return DRIVER_OP_SUCCESS;
|
||||
|
||||
|
@ -206,8 +201,7 @@ driver_return_code_t
|
|||
cdio_read_mode1_sectors (const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn,
|
||||
bool b_form2, uint32_t i_blocks)
|
||||
{
|
||||
lsn_t _i_blocks = (lsn_t)i_blocks;
|
||||
check_lsn_blocks(i_lsn, _i_blocks);
|
||||
check_lsn_blocks(i_lsn, i_blocks);
|
||||
|
||||
if (0 == i_blocks) return DRIVER_OP_SUCCESS;
|
||||
|
||||
|
@ -254,8 +248,7 @@ driver_return_code_t
|
|||
cdio_read_mode2_sectors (const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn,
|
||||
bool b_form2, uint32_t i_blocks)
|
||||
{
|
||||
lsn_t _i_blocks = (lsn_t)i_blocks;
|
||||
check_lsn_blocks(i_lsn, _i_blocks);
|
||||
check_lsn_blocks(i_lsn, i_blocks);
|
||||
|
||||
if (0 == i_blocks) return DRIVER_OP_SUCCESS;
|
||||
|
||||
|
|
|
@ -17,14 +17,9 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__)
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
# define __CDIO_CONFIG_H__ 1
|
||||
#else
|
||||
#ifndef EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#define EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#include <cdio/cdio_config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <cdio/sector.h>
|
||||
|
@ -33,7 +28,9 @@
|
|||
#include "cdio_assert.h"
|
||||
#include "portable.h"
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
@ -89,9 +86,9 @@ cdio_lsn_to_msf (lsn_t lsn, msf_t *msf)
|
|||
m = 99;
|
||||
}
|
||||
|
||||
msf->m = cdio_to_bcd8 ((uint8_t)m);
|
||||
msf->s = cdio_to_bcd8 ((uint8_t)s);
|
||||
msf->f = cdio_to_bcd8 ((uint8_t)f);
|
||||
msf->m = cdio_to_bcd8 (m);
|
||||
msf->s = cdio_to_bcd8 (s);
|
||||
msf->f = cdio_to_bcd8 (f);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -102,7 +99,7 @@ cdio_lba_to_msf_str (lba_t lba)
|
|||
{
|
||||
|
||||
if (CDIO_INVALID_LBA == lba) {
|
||||
return _strdup("*INVALID");
|
||||
return strdup("*INVALID");
|
||||
} else {
|
||||
msf_t msf;
|
||||
msf.m = msf.s = msf.f = 0;
|
||||
|
@ -173,7 +170,7 @@ cdio_msf_to_str (const msf_t *msf)
|
|||
char buf[16];
|
||||
|
||||
snprintf (buf, sizeof (buf), "%2.2x:%2.2x:%2.2x", msf->m, msf->s, msf->f);
|
||||
return _strdup (buf);
|
||||
return strdup (buf);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
@ -17,14 +17,10 @@
|
|||
*/
|
||||
/*! Track-related routines. */
|
||||
|
||||
#if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__)
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
# define __CDIO_CONFIG_H__ 1
|
||||
#else
|
||||
#ifndef EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#define EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#include <cdio/cdio_config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <cdio/cdio.h>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2006, 2008 Burkhard Plaum <plaum@ipf.uni-stuttgart.de>
|
||||
Copyright (C) 2011 Rocky Bernstein <rocky@gnu.org>
|
||||
Copyright (C) 2012 Pete Batard <pete@akeo.ie>
|
||||
|
||||
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
|
||||
|
@ -17,14 +18,9 @@
|
|||
*/
|
||||
/* UTF-8 support */
|
||||
|
||||
#if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__)
|
||||
# include <config.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# define __CDIO_CONFIG_H__ 1
|
||||
#else
|
||||
#ifndef EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#define EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#include <cdio/cdio_config.h>
|
||||
#endif
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_JOLIET
|
||||
|
@ -41,9 +37,13 @@
|
|||
#endif
|
||||
|
||||
#include <cdio/utf8.h>
|
||||
#include <cdio/logging.h>
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
// TODO: also remove the need for iconv on MinGW
|
||||
#ifdef HAVE_ICONV
|
||||
#include <iconv.h>
|
||||
struct cdio_charset_coverter_s
|
||||
|
@ -144,13 +144,13 @@ do_convert(iconv_t cd, char * src, int src_len,
|
|||
ret = realloc(ret, alloc_size);
|
||||
if (ret == NULL)
|
||||
{
|
||||
fprintf(stderr, "Can't realloc(%d).\n", alloc_size);
|
||||
cdio_warn("Can't realloc(%d).", alloc_size);
|
||||
return false;
|
||||
}
|
||||
outbuf = ret + output_pos;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Iconv failed: %s\n", strerror(errno));
|
||||
cdio_warn("Iconv failed: %s", strerror(errno));
|
||||
if (ret != NULL)
|
||||
free(ret);
|
||||
return false;
|
||||
|
@ -226,7 +226,7 @@ static __inline char* wchar_to_utf8(const wchar_t* wstr)
|
|||
int size = 0;
|
||||
char* str = NULL;
|
||||
|
||||
// Find out the size we need to allocate for our converted string
|
||||
/* Find out the size we need to allocate for our converted string */
|
||||
size = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL);
|
||||
if (size <= 1) // An empty string would be size 1
|
||||
return NULL;
|
||||
|
@ -251,7 +251,7 @@ static __inline wchar_t* utf8_to_wchar(const char* str)
|
|||
int size = 0;
|
||||
wchar_t* wstr = NULL;
|
||||
|
||||
// Find out the size we need to allocate for our converted string
|
||||
/* Find out the size we need to allocate for our converted string */
|
||||
size = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
|
||||
if (size <= 1) // An empty string would be size 1
|
||||
return NULL;
|
||||
|
@ -279,8 +279,8 @@ bool cdio_charset_to_utf8(char *src, size_t src_len, cdio_utf8_t **dst,
|
|||
src_len <<=2;
|
||||
}
|
||||
|
||||
// zero lenght is a headache (LCMapString doesn't support it)
|
||||
// => eliminate this case first
|
||||
/* zero lenght is a headache (LCMapString doesn't support it)
|
||||
=> eliminate this case first */
|
||||
if (src_len == 0) {
|
||||
*dst = (cdio_utf8_t*)malloc(1);
|
||||
*dst[0] = 0;
|
||||
|
@ -288,8 +288,8 @@ bool cdio_charset_to_utf8(char *src, size_t src_len, cdio_utf8_t **dst,
|
|||
}
|
||||
|
||||
le_src = (wchar_t*)malloc(src_len+2);
|
||||
// WideCharToMultiByte only takes UCS-2LE, and we are fed UCS-2BE
|
||||
// => perform byte reversal
|
||||
/* WideCharToMultiByte only takes UCS-2LE, and we are fed UCS-2BE
|
||||
=> perform byte reversal */
|
||||
LCMapStringW(0, LCMAP_BYTEREV, (LPCWSTR)src, src_len, le_src, src_len);
|
||||
*dst = wchar_to_utf8(le_src);
|
||||
free(le_src);
|
|
@ -17,21 +17,18 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__)
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
# define __CDIO_CONFIG_H__ 1
|
||||
#else
|
||||
#ifndef EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#define EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#include <cdio/cdio_config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
|
@ -82,7 +79,7 @@ _cdio_strsplit(const char str[], char delim) /* fixme -- non-reentrant */
|
|||
|
||||
cdio_assert (str != NULL);
|
||||
|
||||
_str = _strdup(str);
|
||||
_str = strdup(str);
|
||||
_delim[0] = delim;
|
||||
|
||||
cdio_assert (_str != NULL);
|
||||
|
@ -97,7 +94,7 @@ _cdio_strsplit(const char str[], char delim) /* fixme -- non-reentrant */
|
|||
|
||||
n = 0;
|
||||
while((p = strtok(n ? NULL : _str, _delim)) != NULL)
|
||||
strv[n++] = _strdup(p);
|
||||
strv[n++] = strdup(p);
|
||||
|
||||
free(_str);
|
||||
|
||||
|
@ -127,11 +124,11 @@ _cdio_strdup_upper (const char str[])
|
|||
{
|
||||
char *p;
|
||||
|
||||
p = new_str = _strdup (str);
|
||||
p = new_str = strdup (str);
|
||||
|
||||
while (*p)
|
||||
{
|
||||
*p = (char)toupper (*p);
|
||||
*p = toupper (*p);
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
<ClCompile Include="..\iso9660.c" />
|
||||
<ClCompile Include="..\iso9660_fs.c" />
|
||||
<ClCompile Include="..\rock.c" />
|
||||
<ClCompile Include="..\utf8.c" />
|
||||
<ClCompile Include="..\xa.c" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
|
@ -95,7 +94,7 @@
|
|||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..;..\..;..\..\driver;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
|
@ -115,7 +114,7 @@
|
|||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..;..\..;..\..\driver;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
|
@ -130,7 +129,7 @@
|
|||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..;..\..;..\..\driver;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
|
@ -150,7 +149,7 @@
|
|||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..;..\..;..\..\driver;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
|
|
|
@ -31,8 +31,5 @@
|
|||
<ClCompile Include="..\iso9660.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\utf8.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -80,13 +80,13 @@ timegm(struct tm *tm)
|
|||
|
||||
tz = getenv("TZ");
|
||||
setenv("TZ", "UTC", 1);
|
||||
_tzset();
|
||||
tzset();
|
||||
ret = mktime(tm);
|
||||
if (tz)
|
||||
setenv("TZ", tz, 1);
|
||||
else
|
||||
unsetenv("TZ");
|
||||
_tzset();
|
||||
tzset();
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
@ -301,23 +301,23 @@ iso9660_get_ltime (const iso9660_ltime_t *p_ldate,
|
|||
*/
|
||||
void
|
||||
iso9660_set_dtime_with_timezone (const struct tm *p_tm,
|
||||
int time_zone,
|
||||
int timezone,
|
||||
/*out*/ iso9660_dtime_t *p_idr_date)
|
||||
{
|
||||
memset (p_idr_date, 0, 7);
|
||||
|
||||
if (!p_tm) return;
|
||||
|
||||
p_idr_date->dt_year = (iso711_t)p_tm->tm_year;
|
||||
p_idr_date->dt_month = (iso711_t)p_tm->tm_mon + 1;
|
||||
p_idr_date->dt_day = (iso711_t)p_tm->tm_mday;
|
||||
p_idr_date->dt_hour = (iso711_t)p_tm->tm_hour;
|
||||
p_idr_date->dt_minute = (iso711_t)p_tm->tm_min;
|
||||
p_idr_date->dt_second = (iso711_t)p_tm->tm_sec;
|
||||
p_idr_date->dt_year = p_tm->tm_year;
|
||||
p_idr_date->dt_month = p_tm->tm_mon + 1;
|
||||
p_idr_date->dt_day = p_tm->tm_mday;
|
||||
p_idr_date->dt_hour = p_tm->tm_hour;
|
||||
p_idr_date->dt_minute = p_tm->tm_min;
|
||||
p_idr_date->dt_second = p_tm->tm_sec;
|
||||
|
||||
/* The ISO 9660 timezone is in the range -48..+52 and each unit
|
||||
represents a 15-minute interval. */
|
||||
p_idr_date->dt_gmtoff = time_zone / 15;
|
||||
p_idr_date->dt_gmtoff = timezone / 15;
|
||||
|
||||
if (p_idr_date->dt_gmtoff < -48 ) {
|
||||
|
||||
|
@ -337,14 +337,14 @@ iso9660_set_dtime_with_timezone (const struct tm *p_tm,
|
|||
void
|
||||
iso9660_set_dtime (const struct tm *p_tm, /*out*/ iso9660_dtime_t *p_idr_date)
|
||||
{
|
||||
int time_zone;
|
||||
int timezone;
|
||||
#ifdef HAVE_TM_GMTOFF
|
||||
/* Convert seconds to minutes */
|
||||
time_zone = p_tm->tm_gmtoff / 60;
|
||||
timezone = p_tm->tm_gmtoff / 60;
|
||||
#else
|
||||
time_zone = (p_tm->tm_isdst > 0) ? -60 : 0;
|
||||
timezone = (p_tm->tm_isdst > 0) ? -60 : 0;
|
||||
#endif
|
||||
iso9660_set_dtime_with_timezone (p_tm, time_zone, p_idr_date);
|
||||
iso9660_set_dtime_with_timezone (p_tm, timezone, p_idr_date);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -354,7 +354,7 @@ iso9660_set_dtime (const struct tm *p_tm, /*out*/ iso9660_dtime_t *p_idr_date)
|
|||
*/
|
||||
void
|
||||
iso9660_set_ltime_with_timezone (const struct tm *p_tm,
|
||||
int time_zone,
|
||||
int timezone,
|
||||
/*out*/ iso9660_ltime_t *pvd_date)
|
||||
{
|
||||
char *_pvd_date = (char *) pvd_date;
|
||||
|
@ -364,14 +364,14 @@ iso9660_set_ltime_with_timezone (const struct tm *p_tm,
|
|||
|
||||
if (!p_tm) return;
|
||||
|
||||
_snprintf(_pvd_date, 17,
|
||||
snprintf(_pvd_date, 17,
|
||||
"%4.4d%2.2d%2.2d" "%2.2d%2.2d%2.2d" "%2.2d",
|
||||
p_tm->tm_year + 1900, p_tm->tm_mon + 1, p_tm->tm_mday,
|
||||
p_tm->tm_hour, p_tm->tm_min, p_tm->tm_sec,
|
||||
0 /* 1/100 secs */ );
|
||||
|
||||
/* Set time zone in 15-minute interval encoding. */
|
||||
pvd_date->lt_gmtoff -= (time_zone / 15);
|
||||
pvd_date->lt_gmtoff -= (timezone / 15);
|
||||
if (pvd_date->lt_gmtoff < -48 ) {
|
||||
|
||||
cdio_warn ("Converted ISO 9660 timezone %d is less than -48. Adjusted",
|
||||
|
@ -390,14 +390,14 @@ iso9660_set_ltime_with_timezone (const struct tm *p_tm,
|
|||
void
|
||||
iso9660_set_ltime (const struct tm *p_tm, /*out*/ iso9660_ltime_t *pvd_date)
|
||||
{
|
||||
int time_zone;
|
||||
int timezone;
|
||||
#ifdef HAVE_TM_GMTOFF
|
||||
/* Set time zone in 15-minute interval encoding. */
|
||||
time_zone = p_tm->tm_gmtoff / 60;
|
||||
timezone = p_tm->tm_gmtoff / 60;
|
||||
#else
|
||||
time_zone = (p_tm->tm_isdst > 0) ? -60 : 0;
|
||||
timezone = (p_tm->tm_isdst > 0) ? -60 : 0;
|
||||
#endif
|
||||
iso9660_set_ltime_with_timezone (p_tm, time_zone, pvd_date);
|
||||
iso9660_set_ltime_with_timezone (p_tm, timezone, pvd_date);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -447,7 +447,7 @@ iso9660_name_translate_ext(const char *psz_oldname, char *psz_newname,
|
|||
break;
|
||||
|
||||
/* Lower case, unless we have Joliet extensions. */
|
||||
if (!i_joliet_level && isupper(c)) c = (unsigned char)tolower(c);
|
||||
if (!i_joliet_level && isupper(c)) c = tolower(c);
|
||||
|
||||
/* Drop trailing '.;1' (ISO 9660:1988 7.5.1 requires period) */
|
||||
if (c == '.' && i == len - 3
|
||||
|
@ -647,7 +647,7 @@ iso9660_set_pvd(void *pd,
|
|||
memcpy(&(ipd.root_directory_record), root_dir,
|
||||
sizeof(ipd.root_directory_record));
|
||||
ipd.root_directory_filename='\0';
|
||||
ipd.root_directory_record.length = (iso711_t)(sizeof(ipd.root_directory_record)+1);
|
||||
ipd.root_directory_record.length = sizeof(ipd.root_directory_record)+1;
|
||||
iso9660_strncpy_pad (ipd.volume_set_id, VOLUME_SET_ID,
|
||||
ISO_MAX_VOLUMESET_ID, ISO9660_DCHARS);
|
||||
|
||||
|
@ -760,7 +760,7 @@ iso9660_dir_add_entry_su(void *dir,
|
|||
|
||||
memset(idr, 0, length);
|
||||
|
||||
idr->length = to_711((uint8_t)length);
|
||||
idr->length = to_711(length);
|
||||
idr->extent = to_733(extent);
|
||||
idr->size = to_733(size);
|
||||
|
||||
|
@ -841,7 +841,7 @@ iso9660_get_posix_filemode(const iso9660_stat_t *p_iso_dirent)
|
|||
} else
|
||||
#endif
|
||||
if (p_iso_dirent->b_xa) {
|
||||
return (mode_t)iso9660_get_posix_filemode_from_xa(p_iso_dirent->xa.attributes);
|
||||
return iso9660_get_posix_filemode_from_xa(p_iso_dirent->xa.attributes);
|
||||
}
|
||||
return mode;
|
||||
}
|
||||
|
@ -927,7 +927,7 @@ iso9660_pathtable_l_add_entry (void *pt,
|
|||
|
||||
memset (ipt, 0, sizeof (iso_path_table_t) + name_len); /* paranoia */
|
||||
|
||||
ipt->name_len = to_711 ((uint8_t)name_len);
|
||||
ipt->name_len = to_711 (name_len);
|
||||
ipt->extent = to_731 (extent);
|
||||
ipt->parent = to_721 (parent);
|
||||
memcpy (ipt->name, name, name_len);
|
||||
|
@ -944,7 +944,7 @@ iso9660_pathtable_l_add_entry (void *pt,
|
|||
cdio_assert (from_721 (ipt2->parent) <= parent);
|
||||
}
|
||||
|
||||
return (uint16_t)entrynum;
|
||||
return entrynum;
|
||||
}
|
||||
|
||||
uint16_t
|
||||
|
@ -962,7 +962,7 @@ iso9660_pathtable_m_add_entry (void *pt,
|
|||
|
||||
memset(ipt, 0, sizeof (iso_path_table_t) + name_len); /* paranoia */
|
||||
|
||||
ipt->name_len = to_711 ((uint8_t)name_len);
|
||||
ipt->name_len = to_711 (name_len);
|
||||
ipt->extent = to_732 (extent);
|
||||
ipt->parent = to_722 (parent);
|
||||
memcpy (ipt->name, name, name_len);
|
||||
|
@ -979,7 +979,7 @@ iso9660_pathtable_m_add_entry (void *pt,
|
|||
cdio_assert (from_722 (ipt2->parent) <= parent);
|
||||
}
|
||||
|
||||
return (uint16_t)entrynum;
|
||||
return entrynum;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -1048,7 +1048,7 @@ iso9660_pathname_valid_p (const char pathname[])
|
|||
if ((p = strrchr (pathname, '/')))
|
||||
{
|
||||
bool rc;
|
||||
char *_tmp = _strdup (pathname);
|
||||
char *_tmp = strdup (pathname);
|
||||
|
||||
*strrchr (_tmp, '/') = '\0';
|
||||
|
||||
|
@ -1110,9 +1110,9 @@ iso9660_pathname_isofy (const char pathname[], uint16_t version)
|
|||
|
||||
cdio_assert (strlen (pathname) < (sizeof (tmpbuf) - sizeof (";65535")));
|
||||
|
||||
_snprintf (tmpbuf, sizeof(tmpbuf), "%s;%d", pathname, version);
|
||||
snprintf (tmpbuf, sizeof(tmpbuf), "%s;%d", pathname, version);
|
||||
|
||||
return _strdup (tmpbuf);
|
||||
return strdup (tmpbuf);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -1123,10 +1123,10 @@ char *
|
|||
iso9660_get_application_id(iso9660_pvd_t *p_pvd)
|
||||
{
|
||||
if (NULL==p_pvd) return NULL;
|
||||
return _strdup(strip_trail(p_pvd->application_id, ISO_MAX_APPLICATION_ID));
|
||||
return strdup(strip_trail(p_pvd->application_id, ISO_MAX_APPLICATION_ID));
|
||||
}
|
||||
|
||||
#ifdef FIXME
|
||||
#if FIXME
|
||||
lsn_t
|
||||
iso9660_get_dir_extent(const iso9660_dir_t *idr)
|
||||
{
|
||||
|
@ -1142,7 +1142,7 @@ iso9660_get_dir_len(const iso9660_dir_t *idr)
|
|||
return idr->length;
|
||||
}
|
||||
|
||||
#ifdef FIXME
|
||||
#if FIXME
|
||||
uint8_t
|
||||
iso9660_get_dir_size(const iso9660_dir_t *idr)
|
||||
{
|
||||
|
@ -1212,7 +1212,7 @@ char *
|
|||
iso9660_get_preparer_id(const iso9660_pvd_t *pvd)
|
||||
{
|
||||
if (NULL==pvd) return NULL;
|
||||
return _strdup(strip_trail(pvd->preparer_id, ISO_MAX_PREPARER_ID));
|
||||
return strdup(strip_trail(pvd->preparer_id, ISO_MAX_PREPARER_ID));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -1223,7 +1223,7 @@ char *
|
|||
iso9660_get_publisher_id(const iso9660_pvd_t *pvd)
|
||||
{
|
||||
if (NULL==pvd) return NULL;
|
||||
return _strdup(strip_trail(pvd->publisher_id, ISO_MAX_PUBLISHER_ID));
|
||||
return strdup(strip_trail(pvd->publisher_id, ISO_MAX_PUBLISHER_ID));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -1234,7 +1234,7 @@ char *
|
|||
iso9660_get_system_id(const iso9660_pvd_t *pvd)
|
||||
{
|
||||
if (NULL==pvd) return NULL;
|
||||
return _strdup(strip_trail(pvd->system_id, ISO_MAX_SYSTEM_ID));
|
||||
return strdup(strip_trail(pvd->system_id, ISO_MAX_SYSTEM_ID));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -1244,7 +1244,7 @@ char *
|
|||
iso9660_get_volume_id(const iso9660_pvd_t *pvd)
|
||||
{
|
||||
if (NULL == pvd) return NULL;
|
||||
return _strdup(strip_trail(pvd->volume_id, ISO_MAX_VOLUME_ID));
|
||||
return strdup(strip_trail(pvd->volume_id, ISO_MAX_VOLUME_ID));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -1255,7 +1255,7 @@ char *
|
|||
iso9660_get_volumeset_id(const iso9660_pvd_t *pvd)
|
||||
{
|
||||
if ( NULL == pvd ) return NULL;
|
||||
return _strdup(strip_trail(pvd->volume_set_id, ISO_MAX_VOLUMESET_ID));
|
||||
return strdup(strip_trail(pvd->volume_set_id, ISO_MAX_VOLUMESET_ID));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,11 +21,6 @@
|
|||
#if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__)
|
||||
# include "config.h"
|
||||
# define __CDIO_CONFIG_H__ 1
|
||||
#else
|
||||
#ifndef EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#define EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#include <cdio/cdio_config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
|
@ -112,12 +107,10 @@ adjust_fuzzy_pvd( iso9660_t *p_iso )
|
|||
frame and a header.
|
||||
*/
|
||||
if (CDIO_CD_FRAMESIZE_RAW == p_iso->i_framesize) {
|
||||
const int pre_user_data=CDIO_CD_SYNC_SIZE + CDIO_CD_HEADER_SIZE
|
||||
+ CDIO_CD_SUBHEADER_SIZE;
|
||||
char buf[CDIO_CD_SYNC_SIZE + CDIO_CD_HEADER_SIZE + CDIO_CD_SUBHEADER_SIZE];
|
||||
|
||||
i_byte_offset -= pre_user_data;
|
||||
|
||||
char buf[CDIO_CD_SYNC_SIZE + CDIO_CD_HEADER_SIZE + CDIO_CD_SUBHEADER_SIZE];
|
||||
|
||||
i_byte_offset -= CDIO_CD_SYNC_SIZE + CDIO_CD_HEADER_SIZE + CDIO_CD_SUBHEADER_SIZE;
|
||||
|
||||
if ( DRIVER_OP_SUCCESS != cdio_stream_seek (p_iso->stream, i_byte_offset,
|
||||
SEEK_SET) )
|
||||
return;
|
||||
|
@ -577,7 +570,7 @@ iso9660_ifs_fuzzy_read_superblock (iso9660_t *p_iso,
|
|||
0 : CDIO_CD_SYNC_SIZE;
|
||||
p_iso->i_fuzzy_offset = 0;
|
||||
if (0 == iso9660_seek_read_framesize (p_iso, frame, lsn, 1,
|
||||
(uint16_t)p_iso->i_framesize)) {
|
||||
p_iso->i_framesize)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -590,8 +583,8 @@ iso9660_ifs_fuzzy_read_superblock (iso9660_t *p_iso,
|
|||
|
||||
if (pvd) {
|
||||
/* Yay! Found something */
|
||||
p_iso->i_fuzzy_offset = (int) ((pvd - frame - 1) -
|
||||
((ISO_PVD_SECTOR-lsn)*p_iso->i_framesize)) ;
|
||||
p_iso->i_fuzzy_offset = (pvd - frame - 1) -
|
||||
((ISO_PVD_SECTOR-lsn)*p_iso->i_framesize) ;
|
||||
/* But is it *really* a PVD? */
|
||||
if ( iso9660_ifs_read_pvd_loglevel(p_iso, &(p_iso->pvd),
|
||||
CDIO_LOG_DEBUG) ) {
|
||||
|
@ -716,9 +709,9 @@ iso9660_seek_read_framesize (const iso9660_t *p_iso, void *ptr,
|
|||
i_byte_offset = (start * p_iso->i_framesize) + p_iso->i_fuzzy_offset
|
||||
+ p_iso->i_datastart;
|
||||
|
||||
ret = (long)cdio_stream_seek (p_iso->stream, i_byte_offset, SEEK_SET);
|
||||
ret = cdio_stream_seek (p_iso->stream, i_byte_offset, SEEK_SET);
|
||||
if (ret!=0) return 0;
|
||||
return (long)cdio_stream_read (p_iso->stream, ptr, i_framesize, size);
|
||||
return cdio_stream_read (p_iso->stream, ptr, i_framesize, size);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -780,7 +773,7 @@ _iso9660_dir_to_statbuf (iso9660_dir_t *p_iso9660_dir, bool_3way_t b_xa,
|
|||
calloc(1, sizeof(iso9660_stat_t)+i_rr_fname+2);
|
||||
if (!p_stat_new)
|
||||
{
|
||||
cdio_warn("Couldn't calloc(1, %u)", (unsigned int)(sizeof(iso9660_stat_t)+i_rr_fname+2));
|
||||
cdio_warn("Couldn't calloc(1, %d)", (int)(sizeof(iso9660_stat_t)+i_rr_fname+2));
|
||||
return NULL;
|
||||
}
|
||||
memcpy(p_stat_new, p_stat, stat_len);
|
||||
|
@ -884,11 +877,11 @@ iso9660_dir_to_name (const iso9660_dir_t *iso9660_dir)
|
|||
/* (iso9660_dir->file_flags & ISO_DIRECTORY) */
|
||||
|
||||
if (iso9660_dir->filename.str[1] == '\0')
|
||||
return _strdup(".");
|
||||
return strdup(".");
|
||||
else if (iso9660_dir->filename.str[1] == '\1')
|
||||
return _strdup("..");
|
||||
return strdup("..");
|
||||
else {
|
||||
return _strdup(&iso9660_dir->filename.str[1]);
|
||||
return strdup(&iso9660_dir->filename.str[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -973,7 +966,7 @@ _fs_stat_traverse (const CdIo_t *p_cdio, const iso9660_stat_t *_root,
|
|||
|
||||
if (!splitpath[0])
|
||||
{
|
||||
size_t len=sizeof(iso9660_stat_t) + strlen(_root->filename)+1;
|
||||
unsigned int len=sizeof(iso9660_stat_t) + strlen(_root->filename)+1;
|
||||
p_stat = calloc(1, len);
|
||||
memcpy(p_stat, _root, len);
|
||||
p_stat->rr.psz_symlink = calloc(1, p_stat->rr.i_symlink_max);
|
||||
|
@ -1001,6 +994,7 @@ _fs_stat_traverse (const CdIo_t *p_cdio, const iso9660_stat_t *_root,
|
|||
while (offset < (_root->secsize * ISO_BLOCKSIZE))
|
||||
{
|
||||
iso9660_dir_t *p_iso9660_dir = (void *) &_dirbuf[offset];
|
||||
iso9660_stat_t *p_stat;
|
||||
int cmp;
|
||||
|
||||
if (!iso9660_get_dir_len(p_iso9660_dir))
|
||||
|
@ -1017,7 +1011,7 @@ _fs_stat_traverse (const CdIo_t *p_cdio, const iso9660_stat_t *_root,
|
|||
if ( 0 != cmp && 0 == p_env->i_joliet_level
|
||||
&& yep != p_stat->rr.b3_rock ) {
|
||||
char *trans_fname = NULL;
|
||||
size_t i_trans_fname=strlen(p_stat->filename);
|
||||
unsigned int i_trans_fname=strlen(p_stat->filename);
|
||||
|
||||
if (i_trans_fname) {
|
||||
trans_fname = calloc(1, i_trans_fname+1);
|
||||
|
@ -1028,7 +1022,7 @@ _fs_stat_traverse (const CdIo_t *p_cdio, const iso9660_stat_t *_root,
|
|||
return NULL;
|
||||
}
|
||||
iso9660_name_translate_ext(p_stat->filename, trans_fname,
|
||||
p_env->i_joliet_level);
|
||||
p_env->i_joliet_level);
|
||||
cmp = strcmp(splitpath[0], trans_fname);
|
||||
free(trans_fname);
|
||||
}
|
||||
|
@ -1067,11 +1061,11 @@ _fs_iso_stat_traverse (iso9660_t *p_iso, const iso9660_stat_t *_root,
|
|||
if (!splitpath[0])
|
||||
{
|
||||
iso9660_stat_t *p_stat;
|
||||
size_t len=sizeof(iso9660_stat_t) + strlen(_root->filename)+1;
|
||||
unsigned int len=sizeof(iso9660_stat_t) + strlen(_root->filename)+1;
|
||||
p_stat = calloc(1, len);
|
||||
if (!p_stat)
|
||||
{
|
||||
cdio_warn("Couldn't calloc(1, %u)", (unsigned int)len);
|
||||
cdio_warn("Couldn't calloc(1, %d)", len);
|
||||
return NULL;
|
||||
}
|
||||
memcpy(p_stat, _root, len);
|
||||
|
@ -1085,7 +1079,7 @@ _fs_iso_stat_traverse (iso9660_t *p_iso, const iso9660_stat_t *_root,
|
|||
return NULL;
|
||||
|
||||
cdio_assert (_root->type == _STAT_DIR);
|
||||
|
||||
|
||||
_dirbuf = calloc(1, _root->secsize * ISO_BLOCKSIZE);
|
||||
if (!_dirbuf)
|
||||
{
|
||||
|
@ -1116,8 +1110,8 @@ _fs_iso_stat_traverse (iso9660_t *p_iso, const iso9660_stat_t *_root,
|
|||
if ( 0 != cmp && 0 == p_iso->i_joliet_level
|
||||
&& yep != p_stat->rr.b3_rock ) {
|
||||
char *trans_fname = NULL;
|
||||
size_t i_trans_fname=strlen(p_stat->filename);
|
||||
|
||||
unsigned int i_trans_fname=strlen(p_stat->filename);
|
||||
|
||||
if (i_trans_fname) {
|
||||
trans_fname = calloc(1, i_trans_fname+1);
|
||||
if (!trans_fname) {
|
||||
|
@ -1127,7 +1121,7 @@ _fs_iso_stat_traverse (iso9660_t *p_iso, const iso9660_stat_t *_root,
|
|||
return NULL;
|
||||
}
|
||||
iso9660_name_translate_ext(p_stat->filename, trans_fname,
|
||||
p_iso->i_joliet_level);
|
||||
p_iso->i_joliet_level);
|
||||
cmp = strcmp(splitpath[0], trans_fname);
|
||||
free(trans_fname);
|
||||
}
|
||||
|
@ -1398,7 +1392,7 @@ iso9660_ifs_readdir (iso9660_t *p_iso, const char psz_path[])
|
|||
return NULL;
|
||||
}
|
||||
|
||||
free(p_stat->rr.psz_symlink);
|
||||
free (p_stat->rr.psz_symlink);
|
||||
free (p_stat);
|
||||
return retval;
|
||||
}
|
||||
|
@ -1424,25 +1418,24 @@ find_lsn_recurse (void *p_image, iso9660_readdir_t iso9660_readdir,
|
|||
{
|
||||
iso9660_stat_t *statbuf = _cdio_list_node_data (entnode);
|
||||
const char *psz_filename = (char *) statbuf->filename;
|
||||
size_t len = strlen(psz_path) + strlen(psz_filename)+2;
|
||||
iso9660_stat_t *ret_stat;
|
||||
const unsigned int len = strlen(psz_path) + strlen(psz_filename)+2;
|
||||
|
||||
if (*ppsz_full_filename != NULL) free(*ppsz_full_filename);
|
||||
*ppsz_full_filename = calloc(1, len);
|
||||
_snprintf (*ppsz_full_filename, len, "%s%s/", psz_path, psz_filename);
|
||||
snprintf (*ppsz_full_filename, len, "%s%s/", psz_path, psz_filename);
|
||||
|
||||
if (statbuf->type == _STAT_DIR
|
||||
&& strcmp ((char *) statbuf->filename, ".")
|
||||
&& strcmp ((char *) statbuf->filename, "..")) {
|
||||
_cdio_list_append (dirlist, _strdup(*ppsz_full_filename));
|
||||
_cdio_list_append (dirlist, strdup(*ppsz_full_filename));
|
||||
}
|
||||
|
||||
if (statbuf->lsn == lsn) {
|
||||
len=sizeof(iso9660_stat_t)+strlen(statbuf->filename)+1;
|
||||
ret_stat = calloc(1, len);
|
||||
unsigned int len=sizeof(iso9660_stat_t)+strlen(statbuf->filename)+1;
|
||||
iso9660_stat_t *ret_stat = calloc(1, len);
|
||||
if (!ret_stat)
|
||||
{
|
||||
cdio_warn("Couldn't calloc(1, %u)", (unsigned int)len);
|
||||
cdio_warn("Couldn't calloc(1, %d)", len);
|
||||
return NULL;
|
||||
}
|
||||
memcpy(ret_stat, statbuf, len);
|
||||
|
|
|
@ -18,14 +18,8 @@
|
|||
/* Rock Ridge Extensions to iso9660 */
|
||||
|
||||
|
||||
#if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__)
|
||||
# include <config.h>
|
||||
# define __CDIO_CONFIG_H__ 1
|
||||
#else
|
||||
#ifndef EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#define EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#include <cdio/cdio_config.h>
|
||||
#endif
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
|
@ -43,16 +37,7 @@
|
|||
#include <cdio/iso9660.h>
|
||||
#include <cdio/logging.h>
|
||||
#include <cdio/bytesex.h>
|
||||
#include <cdio/filemode.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#ifndef HAVE_S_ISLNK
|
||||
# define S_ISLNK(s) ((void)s,0)
|
||||
#endif
|
||||
#ifndef HAVE_S_ISSOCK
|
||||
# define S_ISSOCK(s) ((void)s,0)
|
||||
#endif
|
||||
|
||||
#include "filemode.h"
|
||||
|
||||
#define CDIO_MKDEV(ma,mi) ((ma)<<16 | (mi))
|
||||
|
||||
|
@ -74,7 +59,7 @@ realloc_symlink(/*in/out*/ iso9660_stat_t *p_stat, uint8_t i_grow)
|
|||
p_stat->rr.i_symlink_max = i_max;
|
||||
return (NULL != p_stat->rr.psz_symlink);
|
||||
} else {
|
||||
int i_needed = p_stat->rr.i_symlink + i_grow ;
|
||||
unsigned int i_needed = p_stat->rr.i_symlink + i_grow ;
|
||||
if ( i_needed <= p_stat->rr.i_symlink_max)
|
||||
return true;
|
||||
else {
|
||||
|
@ -116,8 +101,7 @@ realloc_symlink(/*in/out*/ iso9660_stat_t *p_stat, uint8_t i_grow)
|
|||
#define CHECK_CE \
|
||||
{ cont_extent = from_733(*rr->u.CE.extent); \
|
||||
cont_offset = from_733(*rr->u.CE.offset); \
|
||||
cont_size = from_733(*rr->u.CE.size); \
|
||||
(void)cont_extent; (void)cont_offset, (void)cont_size; }
|
||||
cont_size = from_733(*rr->u.CE.size); }
|
||||
|
||||
#define SETUP_ROCK_RIDGE(DE,CHR,LEN) \
|
||||
{ \
|
||||
|
@ -474,7 +458,7 @@ parse_rock_ridge_stat_internal(iso9660_dir_t *p_iso9660_dir,
|
|||
case SIG('R','E'):
|
||||
cdio_warn("Attempt to read p_stat for relocated directory");
|
||||
goto out;
|
||||
#ifdef FINISHED
|
||||
#if FINISHED
|
||||
case SIG('C','L'):
|
||||
{
|
||||
iso9660_stat_t * reloc;
|
||||
|
@ -581,16 +565,16 @@ iso9660_get_rock_attr_str(posix_mode_t st_mode)
|
|||
{
|
||||
char *result = _getbuf();
|
||||
|
||||
if (S_ISDIR(st_mode))
|
||||
if (S_ISBLK(st_mode))
|
||||
result[ 0] = 'b';
|
||||
else if (S_ISDIR(st_mode))
|
||||
result[ 0] = 'd';
|
||||
// else if (S_ISBLK(st_mode))
|
||||
// result[ 0] = 'b';
|
||||
else if (S_ISCHR(st_mode))
|
||||
result[ 0] = 'c';
|
||||
else if (S_ISLNK(st_mode))
|
||||
result[ 0] = 'l';
|
||||
// else if (S_ISFIFO(st_mode))
|
||||
// result[ 0] = 'p';
|
||||
else if (S_ISFIFO(st_mode))
|
||||
result[ 0] = 'p';
|
||||
else if (S_ISSOCK(st_mode))
|
||||
result[ 0] = 's';
|
||||
/* May eventually fill in others.. */
|
||||
|
|
|
@ -17,14 +17,9 @@
|
|||
*/
|
||||
|
||||
|
||||
#if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__)
|
||||
# include <config.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
# define __CDIO_CONFIG_H__ 1
|
||||
#else
|
||||
#ifndef EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#define EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#include <cdio/cdio_config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
|
@ -45,10 +40,10 @@ const char ISO_XA_MARKER_STRING[] = {'C', 'D', '-', 'X', 'A', '0', '0', '1'};
|
|||
#include <cdio/iso9660.h>
|
||||
#include <cdio/util.h>
|
||||
#include <cdio/bytesex.h>
|
||||
#include <cdio/filemode.h>
|
||||
|
||||
/* Private headers */
|
||||
#include "cdio_assert.h"
|
||||
#include "filemode.h"
|
||||
|
||||
/** The below variable is trickery to force enum symbol values to be
|
||||
recorded in debug symbol tables. It is used to allow one to refer
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..;..\..;..\..\driver;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
|
@ -117,7 +117,7 @@
|
|||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..;..\..;..\..\driver;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
|
@ -132,7 +132,7 @@
|
|||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..;..\..;..\..\driver;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
|
@ -152,7 +152,7 @@
|
|||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..;..\..;..\..\driver;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
|
|
|
@ -18,18 +18,17 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__)
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
# define __CDIO_CONFIG_H__ 1
|
||||
#else
|
||||
#ifndef EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#define EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#include <cdio/cdio_config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include <cdio/udf.h>
|
||||
#include <cdio/filemode.h>
|
||||
#include "filemode.h"
|
||||
|
||||
|
||||
/* Set the 's' and 't' flags in file attributes string CHARS,
|
||||
|
|
|
@ -20,12 +20,16 @@
|
|||
say opensolaris. */
|
||||
#include "udf_private.h"
|
||||
#include <cdio/bytesex.h>
|
||||
#include <cdio/filemode.h>
|
||||
#include "filemode.h"
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
/** The below variables are trickery to force enum symbol values to be
|
||||
recorded in debug symbol tables. They are used to allow one to refer
|
||||
to the enumeration value names in the typedefs above in a debugger
|
||||
|
@ -49,17 +53,19 @@ udf_get_posix_filemode(const udf_dirent_t *p_udf_dirent)
|
|||
udf_file_entry_t udf_fe;
|
||||
mode_t mode = 0;
|
||||
|
||||
// FIXME: what's the point of the fe dupe? This is the only
|
||||
// place that seems to use udf_get_file_entry...
|
||||
if (udf_get_file_entry(p_udf_dirent, &udf_fe)) {
|
||||
uint32_t i_perms;
|
||||
#ifdef S_ISUID
|
||||
uint16_t i_flags;
|
||||
|
||||
i_flags = uint16_from_le(udf_fe.icb_tag.flags);
|
||||
#endif
|
||||
i_perms = uint32_from_le(udf_fe.permissions);
|
||||
|
||||
if (i_perms & FE_PERM_U_READ) mode |= S_IRUSR;
|
||||
if (i_perms & FE_PERM_U_WRITE) mode |= S_IWUSR;
|
||||
if (i_perms & FE_PERM_U_EXEC) mode |= S_IXUSR;
|
||||
|
||||
|
||||
#ifdef S_IRGRP
|
||||
if (i_perms & FE_PERM_G_READ) mode |= S_IRGRP;
|
||||
if (i_perms & FE_PERM_G_WRITE) mode |= S_IWGRP;
|
||||
|
@ -92,18 +98,13 @@ udf_get_posix_filemode(const udf_dirent_t *p_udf_dirent)
|
|||
mode |= S_IFSOCK;
|
||||
break;
|
||||
#endif
|
||||
#ifdef S_IFBLK
|
||||
case ICBTAG_FILE_TYPE_BLOCK:
|
||||
mode |= S_IFBLK;
|
||||
break;
|
||||
#endif
|
||||
default: ;
|
||||
};
|
||||
|
||||
#ifdef S_ISUID
|
||||
uint16_t i_flags;
|
||||
i_flags = uint16_from_le(udf_fe.icb_tag.flags);
|
||||
|
||||
if (i_flags & ICBTAG_FLAG_SETUID) mode |= S_ISUID;
|
||||
if (i_flags & ICBTAG_FLAG_SETGID) mode |= S_ISGID;
|
||||
if (i_flags & ICBTAG_FLAG_STICKY) mode |= S_ISVTX;
|
||||
|
|
|
@ -26,7 +26,9 @@
|
|||
# include <string.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h> /* Remove when adding cdio/logging.h */
|
||||
#endif
|
||||
|
||||
/* Useful defines */
|
||||
|
||||
|
@ -90,7 +92,6 @@ uint64_t udf_get_file_length(const udf_dirent_t *p_udf_dirent)
|
|||
if (p_udf_dirent) {
|
||||
return uint64_from_le(p_udf_dirent->fe.info_len);
|
||||
}
|
||||
// TODO: use INT64MAX
|
||||
return 2147483647L; /* Error. Non-error case handled above. */
|
||||
}
|
||||
|
||||
|
@ -108,7 +109,7 @@ udf_is_dir(const udf_dirent_t *p_udf_dirent)
|
|||
* block.
|
||||
*/
|
||||
static lba_t
|
||||
offset_to_lba(const udf_dirent_t *p_udf_dirent, off64_t i_offset,
|
||||
offset_to_lba(const udf_dirent_t *p_udf_dirent, off_t i_offset,
|
||||
/*out*/ lba_t *pi_lba, /*out*/ uint32_t *pi_max_size)
|
||||
{
|
||||
udf_t *p_udf = p_udf_dirent->p_udf;
|
||||
|
@ -116,18 +117,22 @@ offset_to_lba(const udf_dirent_t *p_udf_dirent, off64_t i_offset,
|
|||
&p_udf_dirent->fe;
|
||||
const udf_icbtag_t *p_icb_tag = &p_udf_fe->icb_tag;
|
||||
const uint16_t strat_type= uint16_from_le(p_icb_tag->strat_type);
|
||||
|
||||
|
||||
if (i_offset < 0) {
|
||||
cdio_warn("Negative offset value");
|
||||
return CDIO_INVALID_LBA;
|
||||
}
|
||||
|
||||
switch (strat_type) {
|
||||
case 4096:
|
||||
printf("Cannot deal with strategy4096 yet!\n");
|
||||
cdio_warn("Cannot deal with strategy4096 yet!");
|
||||
return CDIO_INVALID_LBA;
|
||||
break;
|
||||
case ICBTAG_STRATEGY_TYPE_4:
|
||||
{
|
||||
off64_t icblen = 0;
|
||||
off_t icblen = 0;
|
||||
uint64_t lsector;
|
||||
uint32_t ad_offset;
|
||||
int ad_num = 0;
|
||||
int ad_offset, ad_num = 0;
|
||||
uint16_t addr_ilk = uint16_from_le(p_icb_tag->flags&ICBTAG_FLAG_AD_MASK);
|
||||
|
||||
switch (addr_ilk) {
|
||||
|
@ -143,7 +148,7 @@ offset_to_lba(const udf_dirent_t *p_udf_dirent, off64_t i_offset,
|
|||
i_offset -= icblen;
|
||||
ad_offset = sizeof(udf_short_ad_t) * ad_num;
|
||||
if (ad_offset > uint32_from_le(p_udf_fe->i_alloc_descs)) {
|
||||
printf("File offset out of bounds\n");
|
||||
cdio_warn("File offset out of bounds");
|
||||
return CDIO_INVALID_LBA;
|
||||
}
|
||||
p_icb = (udf_short_ad_t *)
|
||||
|
@ -170,7 +175,7 @@ offset_to_lba(const udf_dirent_t *p_udf_dirent, off64_t i_offset,
|
|||
i_offset -= icblen;
|
||||
ad_offset = sizeof(udf_long_ad_t) * ad_num;
|
||||
if (ad_offset > uint32_from_le(p_udf_fe->i_alloc_descs)) {
|
||||
printf("File offset out of bounds\n");
|
||||
cdio_warn("File offset out of bounds");
|
||||
return CDIO_INVALID_LBA;
|
||||
}
|
||||
p_icb = (udf_long_ad_t *)
|
||||
|
@ -178,7 +183,7 @@ offset_to_lba(const udf_dirent_t *p_udf_dirent, off64_t i_offset,
|
|||
+ ad_offset );
|
||||
icblen = p_icb->len;
|
||||
ad_num++;
|
||||
} while(i_offset >= (off_t)icblen);
|
||||
} while(i_offset >= icblen);
|
||||
|
||||
lsector = (i_offset / UDF_BLOCKSIZE) +
|
||||
uint32_from_le(((udf_long_ad_t *)(p_icb))->loc.lba);
|
||||
|
@ -192,21 +197,25 @@ offset_to_lba(const udf_dirent_t *p_udf_dirent, off64_t i_offset,
|
|||
* allocation descriptor field of the file entry.
|
||||
*/
|
||||
*pi_max_size = 0;
|
||||
printf("Don't know how to data in ICB handle yet\n");
|
||||
cdio_warn("Don't know how to data in ICB handle yet");
|
||||
return CDIO_INVALID_LBA;
|
||||
case ICBTAG_FLAG_AD_EXTENDED:
|
||||
printf("Don't know how to handle extended addresses yet\n");
|
||||
cdio_warn("Don't know how to handle extended addresses yet");
|
||||
return CDIO_INVALID_LBA;
|
||||
default:
|
||||
printf("Unsupported allocation descriptor %d\n", addr_ilk);
|
||||
cdio_warn("Unsupported allocation descriptor %d", addr_ilk);
|
||||
return CDIO_INVALID_LBA;
|
||||
}
|
||||
|
||||
|
||||
*pi_lba = (lba_t)lsector + p_udf->i_part_start;
|
||||
if (*pi_lba < 0) {
|
||||
cdio_warn("Negative LBA value");
|
||||
return CDIO_INVALID_LBA;
|
||||
}
|
||||
return *pi_lba;
|
||||
}
|
||||
default:
|
||||
printf("Unknown strategy type %d\n", strat_type);
|
||||
cdio_warn("Unknown strategy type %d", strat_type);
|
||||
return DRIVER_OP_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -239,12 +248,12 @@ udf_read_block(const udf_dirent_t *p_udf_dirent, void * buf, size_t count)
|
|||
if (i_lba != CDIO_INVALID_LBA) {
|
||||
uint32_t i_max_blocks = CEILING(i_max_size, UDF_BLOCKSIZE);
|
||||
if ( i_max_blocks < count ) {
|
||||
fprintf(stderr, "Warning: read count %u is larger than %u extent size.\n",
|
||||
cdio_warn("read count %u is larger than %u extent size.",
|
||||
(unsigned int)count, i_max_blocks);
|
||||
fprintf(stderr, "Warning: read count truncated to %u\n", (unsigned int)count);
|
||||
cdio_warn("read count truncated to %u", (unsigned int)count);
|
||||
count = i_max_blocks;
|
||||
}
|
||||
ret = udf_read_sectors(p_udf, buf, i_lba, (long)count);
|
||||
ret = udf_read_sectors(p_udf, buf, i_lba, count);
|
||||
if (DRIVER_OP_SUCCESS == ret) {
|
||||
ssize_t i_read_len = MIN(i_max_size, count * UDF_BLOCKSIZE);
|
||||
p_udf->i_position += i_read_len;
|
||||
|
|
|
@ -41,14 +41,13 @@
|
|||
*/
|
||||
|
||||
|
||||
#if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__)
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
# define __CDIO_CONFIG_H__ 1
|
||||
#else
|
||||
#ifndef EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#define EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#include <cdio/cdio_config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
|
@ -59,14 +58,6 @@
|
|||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
#include "cdio_assert.h"
|
||||
|
||||
#ifndef min
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
/* These definitions are also to make debugging easy. Note that they
|
||||
have to come *before* #include <cdio/ecma_167.h> which sets
|
||||
#defines for these.
|
||||
|
@ -81,11 +72,12 @@ const char VSD_STD_ID_TEA01[] = {'T', 'E', 'A', '0', '1'};
|
|||
#include <cdio/bytesex.h>
|
||||
#include "udf_private.h"
|
||||
#include "udf_fs.h"
|
||||
#include "cdio_assert.h"
|
||||
|
||||
/*
|
||||
* The UDF specs are pretty clear on how each data structure is made
|
||||
* up, but not very clear on how they relate to each other. Here is
|
||||
* the skinny... This demonstrates a filesystem with one file in the
|
||||
* the skinny... This demostrates a filesystem with one file in the
|
||||
* root directory. Subdirectories are treated just as normal files,
|
||||
* but they have File Id Descriptors of their children as their file
|
||||
* data. As for the Anchor Volume Descriptor Pointer, it can exist in
|
||||
|
@ -256,6 +248,10 @@ udf_fopen(udf_dirent_t *p_udf_root, const char *psz_name)
|
|||
strncpy(tokenline, psz_name, udf_MAX_PATHLEN);
|
||||
psz_token = strtok(tokenline, udf_PATH_DELIMITERS);
|
||||
if (psz_token) {
|
||||
/*** FIXME??? udf_dirent can be variable size due to the
|
||||
extended attributes and descriptors. Given that, is this
|
||||
correct?
|
||||
*/
|
||||
udf_dirent_t *p_udf_dirent =
|
||||
udf_new_dirent(&p_udf_root->fe, p_udf_root->p_udf,
|
||||
p_udf_root->psz_name, p_udf_root->b_dir,
|
||||
|
@ -300,7 +296,7 @@ udf_new_dirent(udf_file_entry_t *p_udf_fe, udf_t *p_udf,
|
|||
calloc(1, sizeof(udf_dirent_t));
|
||||
if (!p_udf_dirent) return NULL;
|
||||
|
||||
p_udf_dirent->psz_name = _strdup(psz_name);
|
||||
p_udf_dirent->psz_name = strdup(psz_name);
|
||||
p_udf_dirent->b_dir = b_dir;
|
||||
p_udf_dirent->b_parent = b_parent;
|
||||
p_udf_dirent->p_udf = p_udf;
|
||||
|
@ -316,20 +312,25 @@ udf_new_dirent(udf_file_entry_t *p_udf_fe, udf_t *p_udf,
|
|||
|
||||
/*!
|
||||
Seek to a position i_start and then read i_blocks. Number of blocks read is
|
||||
returned. One normally expects the return to be equal to i_blocks.#
|
||||
NB: 32 bit lsn_t and i_blocks means the UDF media should not be larger than 4TB
|
||||
returned. One normally expects the return to be equal to i_blocks.
|
||||
*/
|
||||
driver_return_code_t
|
||||
udf_read_sectors (const udf_t *p_udf, void *ptr, lsn_t i_start,
|
||||
long int i_blocks)
|
||||
long i_blocks)
|
||||
{
|
||||
driver_return_code_t ret;
|
||||
ssize_t i_read;
|
||||
off64_t i_byte_offset;
|
||||
long i_read;
|
||||
off_t i_byte_offset;
|
||||
|
||||
if (!p_udf) return 0;
|
||||
/* i_start * UDF_BLOCKSIZE is evaluated as 32 bit by default */
|
||||
i_byte_offset = ((off64_t)i_start) * UDF_BLOCKSIZE;
|
||||
/* Without the cast, i_start * UDF_BLOCKSIZE may be evaluated as 32 bit */
|
||||
i_byte_offset = ((off_t)i_start) * UDF_BLOCKSIZE;
|
||||
/* Since we're using SEEK_SET, the value must be positive */
|
||||
if (i_byte_offset < 0) {
|
||||
if (sizeof(off_t) <= 4) /* probably missing LFS */
|
||||
cdio_warn("Large File Support is required to access streams of 2 GB or more");
|
||||
return DRIVER_OP_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
if (p_udf->b_stream) {
|
||||
ret = cdio_stream_seek (p_udf->stream, i_byte_offset, SEEK_SET);
|
||||
|
@ -355,11 +356,11 @@ udf_open (const char *psz_path)
|
|||
udf_t *p_udf = (udf_t *) calloc(1, sizeof(udf_t)) ;
|
||||
uint8_t data[UDF_BLOCKSIZE];
|
||||
|
||||
if (!p_udf) return NULL;
|
||||
|
||||
/* Sanity check */
|
||||
cdio_assert(sizeof(udf_file_entry_t) == UDF_BLOCKSIZE);
|
||||
|
||||
if (!p_udf) return NULL;
|
||||
|
||||
p_udf->cdio = cdio_open(psz_path, DRIVER_UNKNOWN);
|
||||
if (!p_udf->cdio) {
|
||||
/* Not a CD-ROM drive or CD Image. Maybe it's a UDF file not
|
||||
|
@ -509,6 +510,7 @@ udf_get_root (udf_t *p_udf, bool b_any_partition, partition_num_t i_partition)
|
|||
Directory File Entry.
|
||||
*/
|
||||
for (i_lba = mvds_start; i_lba < mvds_end; i_lba++) {
|
||||
uint8_t data[UDF_BLOCKSIZE];
|
||||
|
||||
partition_desc_t *p_partition = (partition_desc_t *) &data;
|
||||
|
||||
|
@ -679,7 +681,7 @@ udf_readdir(udf_dirent_t *p_udf_dirent)
|
|||
p_udf_dirent->psz_name = (char *)
|
||||
realloc(p_udf_dirent->psz_name, sizeof(char)*i_len+1);
|
||||
|
||||
unicode16_decode(p_udf_dirent->fid->imp_use
|
||||
unicode16_decode(p_udf_dirent->fid->u.imp_use
|
||||
+ p_udf_dirent->fid->i_imp_use,
|
||||
i_len, p_udf_dirent->psz_name);
|
||||
}
|
||||
|
|
|
@ -31,13 +31,12 @@
|
|||
/* Implementation of opaque types */
|
||||
|
||||
struct udf_s {
|
||||
bool b_stream; /* Use stream pointer, else use
|
||||
p_cdio. */
|
||||
off64_t i_position; /* Position in file if positive. */
|
||||
CdioDataSource_t *stream; /* Stream pointer if stream */
|
||||
CdIo_t *cdio; /* Cdio pointer if read device */
|
||||
bool b_stream; /* Use stream pointer, else use p_cdio */
|
||||
off_t i_position; /* Position in file if positive */
|
||||
CdioDataSource_t *stream; /* Stream pointer if stream */
|
||||
CdIo_t *cdio; /* Cdio pointer if read device */
|
||||
anchor_vol_desc_ptr_t anchor_vol_desc_ptr;
|
||||
uint32_t pvd_lba; /* sector of Primary Volume Descriptor */
|
||||
uint32_t pvd_lba; /* sector of Primary Volume Descriptor */
|
||||
partition_num_t i_partition; /* partition number */
|
||||
uint32_t i_part_start; /* start of Partition Descriptor */
|
||||
uint32_t lvd_lba; /* sector of Logical Volume Descriptor */
|
||||
|
|
|
@ -38,14 +38,9 @@
|
|||
* http://www.boulder.nist.gov/timefreq/pubs/bulletin/leapsecond.htm
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__)
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
# define __CDIO_CONFIG_H__ 1
|
||||
#else
|
||||
#ifndef EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#define EXTERNAL_LIBCDIO_CONFIG_H
|
||||
#include <cdio/cdio_config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_TIMEZONEVAR
|
||||
|
@ -108,7 +103,7 @@ static time_t year_seconds[MAX_YEAR_SECONDS]= {
|
|||
/*2038*/ SPY(68,17,0)
|
||||
};
|
||||
|
||||
#ifdef HAVE_TIMEZONE_VAR
|
||||
#if defined(HAVE_TIMEZONE_VAR) && !defined(__MINGW32__)
|
||||
extern long timezone;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
/*
|
||||
* THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
*
|
||||
* Modified for libusb/MSVC: Pete Batard <pbatard@gmail.com>
|
||||
* Modified for libusb/MSVC: Pete Batard <pete@akeo.com>
|
||||
*
|
||||
* This source code is offered for use in the public domain. You may
|
||||
* use, modify or distribute it freely.
|
||||
|
@ -23,11 +23,6 @@
|
|||
#error This header should only be used with Microsoft compilers
|
||||
#endif
|
||||
|
||||
/* It's convenient to hijack this header to also define 'inline' on MS environments */
|
||||
#ifndef inline
|
||||
#define inline __inline
|
||||
#endif
|
||||
|
||||
/* 7.8 Format conversion of integer types <inttypes.h> */
|
||||
|
||||
#ifndef _INTTYPES_H_
|
||||
|
|
|
@ -1,24 +1,33 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file was originally part of the w64 mingw-runtime package.
|
||||
*/
|
||||
|
||||
/* Workaround unistd.h for MS compilers */
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#error This header should only be used with Microsoft compilers
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* Workaround unisdt.h for MS compilers */
|
||||
|
||||
#ifndef _UNISTD_H_
|
||||
#define _UNISTD_H_
|
||||
|
||||
/* mode_t is used in the libcdio headers */
|
||||
#ifndef _MODE_T_DEFINED
|
||||
#define _MODE_T_DEFINED
|
||||
typedef unsigned short mode_t;
|
||||
#endif /* _MODE_T_DEFINED */
|
||||
|
||||
/* ssize_t is also not available (copy/paste from MinGW) */
|
||||
#ifndef _SSIZE_T_DEFINED
|
||||
#define _SSIZE_T_DEFINED
|
||||
#undef ssize_t
|
||||
#ifdef _WIN64
|
||||
typedef __int64 ssize_t;
|
||||
typedef __int64 ssize_t;
|
||||
#else
|
||||
typedef int ssize_t;
|
||||
typedef int ssize_t;
|
||||
#endif /* _WIN64 */
|
||||
#endif /* _SSIZE_T_DEFINED */
|
||||
|
||||
|
|
12
src/rufus.rc
12
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
|
|||
IDD_DIALOG DIALOGEX 12, 12, 206, 278
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_APPWINDOW
|
||||
CAPTION "Rufus v1.0.7.144"
|
||||
CAPTION "Rufus v1.0.7.145"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Start",IDC_START,94,236,50,14
|
||||
|
@ -70,7 +70,7 @@ BEGIN
|
|||
DEFPUSHBUTTON "OK",IDOK,231,175,50,14,WS_GROUP
|
||||
CONTROL "<a href=""http://rufus.akeo.ie"">http://rufus.akeo.ie</a>",IDC_ABOUT_RUFUS_URL,
|
||||
"SysLink",WS_TABSTOP,46,47,114,9
|
||||
LTEXT "Version 1.0.7 (Build 144)",IDC_STATIC,46,19,78,8
|
||||
LTEXT "Version 1.0.7 (Build 145)",IDC_STATIC,46,19,78,8
|
||||
PUSHBUTTON "License...",IDC_ABOUT_LICENSE,46,175,50,14,WS_GROUP
|
||||
EDITTEXT IDC_ABOUT_COPYRIGHTS,46,107,235,63,ES_MULTILINE | ES_READONLY | WS_VSCROLL
|
||||
LTEXT "Report bugs or request enhancements at:",IDC_STATIC,46,66,187,8
|
||||
|
@ -208,8 +208,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,7,144
|
||||
PRODUCTVERSION 1,0,7,144
|
||||
FILEVERSION 1,0,7,145
|
||||
PRODUCTVERSION 1,0,7,145
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -226,13 +226,13 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "akeo.ie"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "1.0.7.144"
|
||||
VALUE "FileVersion", "1.0.7.145"
|
||||
VALUE "InternalName", "Rufus"
|
||||
VALUE "LegalCopyright", "© 2011 Pete Batard (GPL v3)"
|
||||
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
|
||||
VALUE "OriginalFilename", "rufus.exe"
|
||||
VALUE "ProductName", "Rufus"
|
||||
VALUE "ProductVersion", "1.0.7.144"
|
||||
VALUE "ProductVersion", "1.0.7.145"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
Loading…
Reference in New Issue