Subject: | Device-Cdio doesn't work with libcdio 0.78 |
Date: | Tue, 17 Jul 2007 07:32:11 +0100 |
To: | bug-Device-Cdio [...] rt.cpan.org |
From: | "Martín Ferrari" <martin.ferrari [...] gmail.com> |
Hi, I've tried building the modules with the latest libcdio and it
doesn't work correctly, because you're using incorrectly the SWIG
language.
From http://www.swig.org/Doc1.1/HTML/SWIG.html#n8:
The C preprocessor version supports any constant integral expression
as an argument to #if, but SWIG does not yet contain an expression
evaluator so this is not currently supported.
So, constructs like this doesn't work:
#if LIBCDIO_VERSION_NUM > 76
#if DEBUGGING
Also, there is a mistake with this new function (it seems that the
error is in libcdio, but anyway...): iso9660_find_ifs_lsn doesn't
exist, its name is iso9660_ifs_find_lsn
Below is the patch I've used to build with 0.78, but is no good for
older versions,.
--- libdevice-cdio-perl-0.2.4.orig/device.swg
+++ libdevice-cdio-perl-0.2.4/device.swg
@@ -81,7 +81,6 @@
*/
void cdio_destroy(CdIo_t *p_cdio);
-#if LIBCDIO_VERSION_NUM > 76
/* cdio_driver_errmsg first appears in 0.77 code
*/
%rename cdio_driver_errmsg driver_errmsg;
@@ -90,35 +89,6 @@
@return the string information about drc
*/
const char *cdio_driver_errmsg(driver_return_code_t drc);
-#else
-const char *driver_errmsg(driver_return_code_t drc);
-%inline %{
-const char *
-driver_errmsg(driver_return_code_t drc)
-{
- switch(drc) {
- case DRIVER_OP_SUCCESS:
- return "driver operation was successful";
- case DRIVER_OP_ERROR:
- return "driver I/O error";
- case DRIVER_OP_UNSUPPORTED:
- return "driver operatation not supported";
- case DRIVER_OP_UNINIT:
- return "driver not initialized";
- case DRIVER_OP_NOT_PERMITTED:
- return "driver operatation not permitted";
- case DRIVER_OP_BAD_PARAMETER:
- return "bad parameter passed";
- case DRIVER_OP_BAD_POINTER:
- return "bad pointer to memory area";
- case DRIVER_OP_NO_DRIVER:
- return "driver not available";
- default:
- return "unknown or bad driver return status";
- }
-}
-%}
-#endif /* LIBCDIO_VERSION_NUM > 76 */
/*
eject_media(cdio)->return_code
--- libdevice-cdio-perl-0.2.4.orig/read.swg
+++ libdevice-cdio-perl-0.2.4/read.swg
@@ -148,13 +148,13 @@
}
p_buf = calloc(1, i_size);
-#if DEBUGGING
+#ifdef DEBUGGING
printf("p_cdio: %x, i_size: %d, lsn: %d, blocksize %d, blocks %d\n",
p_cdio, i_size, i_lsn, i_blocksize, i_blocks);
#endif
*drc = cdio_read_data_sectors (p_cdio, p_buf, i_lsn,
i_blocksize, i_blocks);
-#if DEBUGGING
+#ifdef DEBUGGING
printf("drc: %d\n", drc);
#endif
if (*drc < 0) {
--- libdevice-cdio-perl-0.2.4.orig/perliso9660.swg
+++ libdevice-cdio-perl-0.2.4/perliso9660.swg
@@ -60,11 +60,7 @@
%constant long int RECORD = ISO_RECORD;
/* When version 0.77 comes out, require it and fix this fix this. */
-#if 0
%constant long int PROTECTION = ISO_PROTECTION;
-#else
-%constant long int PROTECTION = 16;
-#endif
%constant long int DRESERVED1 = ISO_DRESERVED1;
%constant long int DRESERVED2 = ISO_DRESERVED2;
@@ -557,16 +553,14 @@
IsoStat_t *iso9660_find_fs_lsn(CdIo_t *p_cdio, lsn_t i_lsn);
-#if LIBCDIO_VERSION_NUM > 76
/*!
Given a directory pointer, find the filesystem entry that contains
lsn and return information about it.
Returns stat_t of entry if we found lsn, or NULL otherwise.
*/
-%rename iso9660_find_ifs_lsn ifs_find_lsn;
-IsoStat_t *iso9660_find_ifs_lsn(const iso9660_t *p_iso, lsn_t i_lsn);
-#endif
+%rename iso9660_ifs_find_lsn ifs_find_lsn;
+IsoStat_t *iso9660_ifs_find_lsn(const iso9660_t *p_iso, lsn_t i_lsn);
/*!
@@ -673,13 +667,11 @@
%newobject iso9660_dir_to_name; // free malloc'd return value
char * iso9660_dir_to_name (const iso9660_dir_t *p_iso9660_dir);
-#if LIBCDIO_VERSION_NUM > 76
/*!
Returns a POSIX mode for a given p_iso_dirent.
*/
%rename iso9660_get_posix_filemode get_posix_filemode;
mode_t iso9660_get_posix_filemode(const iso9660_stat_t *p_iso_dirent);
-#endif
/*!
Return a string containing the preparer id with trailing
--
Martín Ferrari