configure.ac, lib/*, example/*.c, src/iso-read.c:

start to separate compiler/OS deficiencies into "portable.h"

configure.ac, lib/iso9660_fs.c:
  use AM_LANGINFO_CODESET rather than code in our ouwn langinfo.h and
  CODESET tests.
This commit is contained in:
rocky
2004-10-31 13:58:44 +00:00
parent 64f2ad383d
commit 465e0373ee
9 changed files with 78 additions and 37 deletions

9
NEWS
View File

@@ -2,20 +2,17 @@
- Make generic list routines and declarations and byte swapping - Make generic list routines and declarations and byte swapping
routines public. Eventually everything will use glib. routines public. Eventually everything will use glib.
- list-returning routines like iso9660_fs_readdir and - list-returning routines like iso9660_fs_readdir and
iso9660_ifs_readdir no longer return void * (and require casting) iso9660_ifs_readdir no longer return void * (and require casting)
but return the correct type. but return the correct type.
- Some exmaple programs have been renamed to more give meaningful - Some exmaple programs have been renamed to more give meaningful
names. names.
- Add iso9660_ifs_is_xa() a routine to determine if an iso image has - Add iso9660_ifs_is_xa() a routine to determine if an iso image has
XA attributes. XA attributes.
- iso-info now shows XA attributes if that is available. - iso-info now shows XA attributes if that is available.
- Some Joliet support. - Some Joliet support.
- Portability fixes for C++ and older C compilers.
- Work towards XBOX support.
0.70 0.70
@@ -155,4 +152,4 @@
0.1 0.1
Routines split off from VCDImager. Routines split off from VCDImager.
$Id: NEWS,v 1.54 2004/10/23 20:55:08 rocky Exp $ $Id: NEWS,v 1.55 2004/10/31 13:58:44 rocky Exp $

View File

@@ -19,7 +19,7 @@ define(RELEASE_NUM, 71)
define(CDIO_VERSION_STR, 0.$1cvs) define(CDIO_VERSION_STR, 0.$1cvs)
AC_PREREQ(2.52) AC_PREREQ(2.52)
AC_REVISION([$Id: configure.ac,v 1.105 2004/10/31 03:10:25 rocky Exp $])dnl AC_REVISION([$Id: configure.ac,v 1.106 2004/10/31 13:58:44 rocky Exp $])dnl
AC_INIT(libcdio, CDIO_VERSION_STR(RELEASE_NUM)) AC_INIT(libcdio, CDIO_VERSION_STR(RELEASE_NUM))
AC_CONFIG_SRCDIR(src/cd-info.c) AC_CONFIG_SRCDIR(src/cd-info.c)
AM_INIT_AUTOMAKE AM_INIT_AUTOMAKE
@@ -114,7 +114,7 @@ AM_PATH_LIBPOPT(,
dnl headers dnl headers
AC_HEADER_STDC AC_HEADER_STDC
AC_CHECK_HEADERS(glob.h stdbool.h langinfo.h) AC_CHECK_HEADERS(glob.h stdbool.h)
dnl compiler dnl compiler
AC_C_BIGENDIAN AC_C_BIGENDIAN
@@ -317,7 +317,8 @@ AC_DEFINE_UNQUOTED(LICDIO_SOURCE_PATH, "$LIBCDIO_SOURCE_PATH",
[Full path to libcdio top_sourcedir.]) [Full path to libcdio top_sourcedir.])
AC_SUBST(LIBCDIO_SOURCE_PATH) AC_SUBST(LIBCDIO_SOURCE_PATH)
AC_CHECK_FUNCS( memset bzero memcpy tzset nl_langinfo ) AC_CHECK_FUNCS( [bzero ftruncate memcpy memset snprintf \
tzset vsnprintf] )
AC_CHECK_MEMBER([struct tm.tm_gmtoff], AC_CHECK_MEMBER([struct tm.tm_gmtoff],
[AC_DEFINE(HAVE_TM_GMTOFF, 1, [AC_DEFINE(HAVE_TM_GMTOFF, 1,
@@ -370,6 +371,7 @@ AC_ARG_ENABLE(joliet,
fi fi
if test x$enable_joliet = xyes; then if test x$enable_joliet = xyes; then
AM_ICONV AM_ICONV
AM_LANGINFO_CODESET
if test "$am_cv_func_iconv" = yes ; then if test "$am_cv_func_iconv" = yes ; then
AC_DEFINE(HAVE_JOLIET, [1], AC_DEFINE(HAVE_JOLIET, [1],
[Define 1 if you want ISO-9660 Joliet extension support. [Define 1 if you want ISO-9660 Joliet extension support.

View File

@@ -1,5 +1,5 @@
/* /*
$Id: iso2.c,v 1.2 2004/10/24 23:42:39 rocky Exp $ $Id: iso2.c,v 1.3 2004/10/31 13:58:44 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -22,10 +22,6 @@
cue/bin CD-IMAGE. cue/bin CD-IMAGE.
*/ */
#if defined ( WIN32 )
#define ftruncate chsize
#endif
/* This is the CD-image with an ISO-9660 filesystem */ /* This is the CD-image with an ISO-9660 filesystem */
#define ISO9660_IMAGE_PATH "../" #define ISO9660_IMAGE_PATH "../"
#define ISO9660_IMAGE ISO9660_IMAGE_PATH "test/isofs-m1.cue" #define ISO9660_IMAGE ISO9660_IMAGE_PATH "test/isofs-m1.cue"
@@ -37,6 +33,8 @@
# include "config.h" # include "config.h"
#endif #endif
#include "portable.h"
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/iso9660.h> #include <cdio/iso9660.h>

View File

@@ -1,5 +1,5 @@
/* /*
$Id: iso3.c,v 1.1 2004/10/10 00:21:08 rocky Exp $ $Id: iso3.c,v 1.2 2004/10/31 13:58:44 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -22,10 +22,6 @@
ISO-9660 image. ISO-9660 image.
*/ */
#if defined ( WIN32 )
#define ftruncate chsize
#endif
/* This is the ISO 9660 image. */ /* This is the ISO 9660 image. */
#define ISO9660_IMAGE_PATH "../" #define ISO9660_IMAGE_PATH "../"
#define ISO9660_IMAGE ISO9660_IMAGE_PATH "test/copying.iso" #define ISO9660_IMAGE ISO9660_IMAGE_PATH "test/copying.iso"
@@ -35,6 +31,9 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#include "portable.h"
#include <sys/types.h> #include <sys/types.h>
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/iso9660.h> #include <cdio/iso9660.h>

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.am,v 1.51 2004/10/28 03:49:37 rocky Exp $ # $Id: Makefile.am,v 1.52 2004/10/31 13:58:44 rocky Exp $
# #
# Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> # Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
# #
@@ -50,7 +50,7 @@ libiso9660_la_AGE := 0
EXTRA_DIST = image/Makefile FreeBSD/Makefile MSWindows/Makefile EXTRA_DIST = image/Makefile FreeBSD/Makefile MSWindows/Makefile
noinst_HEADERS = cdio_assert.h cdio_private.h noinst_HEADERS = cdio_assert.h cdio_private.h portable.h
libcdio_sources = \ libcdio_sources = \
_cdio_bsdi.c \ _cdio_bsdi.c \
@@ -78,12 +78,12 @@ libcdio_sources = \
image_common.h \ image_common.h \
image/nrg.c \ image/nrg.c \
image/nrg.h \ image/nrg.h \
logging.c \
MSWindows/aspi32.c \ MSWindows/aspi32.c \
MSWindows/aspi32.h \ MSWindows/aspi32.h \
MSWindows/win32_ioctl.c \ MSWindows/win32_ioctl.c \
MSWindows/win32.c \ MSWindows/win32.c \
MSWindows/win32.h \ MSWindows/win32.h \
logging.c \
scsi_mmc.c \ scsi_mmc.c \
scsi_mmc_private.h \ scsi_mmc_private.h \
sector.c \ sector.c \

View File

@@ -1,8 +1,7 @@
/* /*
$Id: _cdio_generic.c,v 1.27 2004/10/24 23:42:39 rocky Exp $ $Id: _cdio_generic.c,v 1.28 2004/10/31 13:58:44 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -19,15 +18,14 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* This file contains Linux-specific code and implements low-level /* This file contains generic implementations of device-dirver routines.
control of the CD drive.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
static const char _rcsid[] = "$Id: _cdio_generic.c,v 1.27 2004/10/24 23:42:39 rocky Exp $"; static const char _rcsid[] = "$Id: _cdio_generic.c,v 1.28 2004/10/31 13:58:44 rocky Exp $";
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@@ -1,5 +1,5 @@
/* /*
$Id: iso9660_fs.c,v 1.40 2004/10/31 04:55:57 rocky Exp $ $Id: iso9660_fs.c,v 1.41 2004/10/31 13:58:44 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -35,7 +35,7 @@
# include <iconv.h> # include <iconv.h>
#endif #endif
#ifdef HAVE_LANGINFO_H #ifdef HAVE_LANGINFO_CODESET
#include <langinfo.h> #include <langinfo.h>
#endif #endif
@@ -51,7 +51,7 @@
#include <stdio.h> #include <stdio.h>
static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.40 2004/10/31 04:55:57 rocky Exp $"; static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.41 2004/10/31 13:58:44 rocky Exp $";
/* Implementation of iso9660_t type */ /* Implementation of iso9660_t type */
struct _iso9660 { struct _iso9660 {
@@ -146,7 +146,7 @@ static bool
ucs2be_to_locale(ICONV_CONST char *psz_ucs2be, size_t i_inlen, ucs2be_to_locale(ICONV_CONST char *psz_ucs2be, size_t i_inlen,
char **p_psz_out, size_t i_outlen) char **p_psz_out, size_t i_outlen)
{ {
#if defined(HAVE_NL_LANGINFO) && defined(HAVE_LANGINFO_H) #if defined(HAVE_LANGINFO_CODESET)
iconv_t ic = iconv_open(nl_langinfo(CODESET), "UCS-2BE"); iconv_t ic = iconv_open(nl_langinfo(CODESET), "UCS-2BE");
#else #else
iconv_t ic = iconv_open("ASCII", "UCS-2BE"); iconv_t ic = iconv_open("ASCII", "UCS-2BE");

50
lib/portable.h Normal file
View File

@@ -0,0 +1,50 @@
/*
$Id: portable.h,v 1.1 2004/10/31 13:58:44 rocky Exp $
Copyright (C) Rocky Bernstein <rocky@panix.com>
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 2 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, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
This file contains definitions to fill in for differences or
deficiencies to OS or compiler irregularities. If this file is
included other routines can be more portable.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
static const char _rcsid[] = "$Id: portable.h,v 1.1 2004/10/31 13:58:44 rocky Exp $";
#if !defined(HAVE_FTRUNCATE)
#if defined ( WIN32 )
#define ftruncate chsize
#endif
#endif /*HAVE_FTRUNCATE*/
#if !defined(HAVE_SNPRINTF)
#if defined ( MSVC )
#define snprintf _snprintf
#endif
#endif /*HAVE_SNPRINTF*/
#if !defined(HAVE_VSNPRINTF)
#if defined ( MSVC )
#define snprintf _vsnprintf
#endif
#endif /*HAVE_SNPRINTF*/

View File

@@ -1,5 +1,5 @@
/* /*
$Id: iso-read.c,v 1.5 2004/07/17 16:47:37 rocky Exp $ $Id: iso-read.c,v 1.6 2004/10/31 13:58:44 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -21,6 +21,7 @@
/* Program to read ISO-9660 images. */ /* Program to read ISO-9660 images. */
#include "util.h" #include "util.h"
#include "portable.h"
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
@@ -44,10 +45,6 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#if defined ( WIN32 )
#define ftruncate chsize
#endif
/* Used by `main' to communicate with `parse_opt'. And global options /* Used by `main' to communicate with `parse_opt'. And global options
*/ */
struct arguments struct arguments