iso9660.hpp, iso1.cpp get list iterators working.
rest: add _ to isachar and isadchar
This commit is contained in:
@@ -46,7 +46,7 @@ development.''
|
|||||||
|
|
||||||
@titlepage
|
@titlepage
|
||||||
@title GNU libcdio library
|
@title GNU libcdio library
|
||||||
@subtitle $Id: libcdio.texi,v 1.48 2006/02/16 20:11:14 rocky Exp $
|
@subtitle $Id: libcdio.texi,v 1.49 2006/03/06 19:39:35 rocky Exp $
|
||||||
@author Rocky Bernstein et al.
|
@author Rocky Bernstein et al.
|
||||||
@page
|
@page
|
||||||
|
|
||||||
@@ -2187,7 +2187,7 @@ CD-ROM device names
|
|||||||
There are a some other naming conventions. Generally if a routine
|
There are a some other naming conventions. Generally if a routine
|
||||||
name starts @code{cdio_}, e.g. @code{cdio_open}, then it is an
|
name starts @code{cdio_}, e.g. @code{cdio_open}, then it is an
|
||||||
externally visible routine in @code{libcdio}. If a name starts
|
externally visible routine in @code{libcdio}. If a name starts
|
||||||
@code{iso9660_}, e.g. @code{iso9660_isdchar} then it is an externally
|
@code{iso9660_}, e.g. @code{iso9660_is_dchar} then it is an externally
|
||||||
visible routine in @code{libiso9660}. If a name starts
|
visible routine in @code{libiso9660}. If a name starts
|
||||||
@code{scsi_mmc_}, e.g. @code{scsi_mmc_get_discmode}, then it is an
|
@code{scsi_mmc_}, e.g. @code{scsi_mmc_get_discmode}, then it is an
|
||||||
externally visible MMC routine. (We don't have a separate library for
|
externally visible MMC routine. (We don't have a separate library for
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: iso1.cpp,v 1.1 2006/03/06 04:48:38 rocky Exp $
|
$Id: iso1.cpp,v 1.2 2006/03/06 19:39:35 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2006 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2006 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
int
|
int
|
||||||
main(int argc, const char *argv[])
|
main(int argc, const char *argv[])
|
||||||
{
|
{
|
||||||
list < ISO9660::Stat > entlist;
|
list < ISO9660::Stat *> stat_list;
|
||||||
ISO9660::IFS *p_iso = new ISO9660::IFS;
|
ISO9660::IFS *p_iso = new ISO9660::IFS;
|
||||||
char const *psz_fname;
|
char const *psz_fname;
|
||||||
const char *psz_path="/";
|
const char *psz_path="/";
|
||||||
@@ -94,25 +94,23 @@ main(int argc, const char *argv[])
|
|||||||
print_vd_info("Volume Set ", get_volumeset_id);
|
print_vd_info("Volume Set ", get_volumeset_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
if (p_iso->readdir (psz_path, stat_list))
|
||||||
entlist = p_iso->readdir (psz_path);
|
|
||||||
|
|
||||||
/* Iterate over the list of nodes that iso9660_ifs_readdir gives */
|
|
||||||
|
|
||||||
{
|
{
|
||||||
ISO9660::Stat *p_stat;
|
/* Iterate over the list of files. */
|
||||||
for(p_stat=entlist.begin(); p_stat != entlist.end(); ++p_stat)
|
list <ISO9660::Stat *>::iterator i;
|
||||||
|
for(i=stat_list.begin(); i != stat_list.end(); ++i)
|
||||||
{
|
{
|
||||||
char filename[4096];
|
char filename[4096];
|
||||||
p_stat->iso9660_name_translate(p_statbuf->filename, filename);
|
ISO9660::Stat *p_s = *i;
|
||||||
|
iso9660_name_translate(p_s->p_stat->filename, filename);
|
||||||
printf ("%s [LSN %6d] %8u %s%s\n",
|
printf ("%s [LSN %6d] %8u %s%s\n",
|
||||||
2 == p_statbuf->type ? "d" : "-",
|
2 == p_s->p_stat->type ? "d" : "-",
|
||||||
p_statbuf->lsn, p_statbuf->size, psz_path, filename);
|
p_s->p_stat->lsn, p_s->p_stat->size, psz_path, filename);
|
||||||
|
delete(p_s);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(stat);
|
stat_list.clear();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
delete(p_iso);
|
delete(p_iso);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* -*- C++ -*-
|
/* -*- C++ -*-
|
||||||
$Id: iso9660.hpp,v 1.4 2006/03/06 04:48:38 rocky Exp $
|
$Id: iso9660.hpp,v 1.5 2006/03/06 19:39:35 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2006 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2006 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -39,6 +39,24 @@ class ISO9660
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Convert an ISO-9660 file name which is in the format usually stored
|
||||||
|
in a ISO 9660 directory entry into what's usually listed as the
|
||||||
|
file name in a listing. Lowercase name, and remove trailing ;1's
|
||||||
|
or .;1's and turn the other ;'s into version numbers.
|
||||||
|
|
||||||
|
@param psz_oldname the ISO-9660 filename to be translated.
|
||||||
|
@param psz_newname returned string. The caller allocates this and
|
||||||
|
it should be at least the size of psz_oldname.
|
||||||
|
@return length of the translated string is returned.
|
||||||
|
*/
|
||||||
|
int name_translate(const char *psz_oldname,
|
||||||
|
/*out*/ char *psz_newname)
|
||||||
|
{
|
||||||
|
return iso9660_name_translate(psz_oldname, psz_newname);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class Stat
|
class Stat
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -377,19 +395,23 @@ public:
|
|||||||
pointers for the files inside that directory. The caller must free
|
pointers for the files inside that directory. The caller must free
|
||||||
the returned result.
|
the returned result.
|
||||||
*/
|
*/
|
||||||
list< ISO9660::Stat *> readdir (const char psz_path[])
|
bool
|
||||||
|
readdir (const char psz_path[], list< ISO9660::Stat *>& stat_list)
|
||||||
{
|
{
|
||||||
CdioList_t *p_stat_list = iso9660_ifs_readdir (p_iso9660, psz_path);
|
CdioList_t *p_stat_list = iso9660_ifs_readdir (p_iso9660, psz_path);
|
||||||
|
|
||||||
|
if (p_stat_list) {
|
||||||
CdioListNode_t *p_entnode;
|
CdioListNode_t *p_entnode;
|
||||||
list< ISO9660::Stat *> stat_list;
|
|
||||||
_CDIO_LIST_FOREACH (p_entnode, p_stat_list) {
|
_CDIO_LIST_FOREACH (p_entnode, p_stat_list) {
|
||||||
iso9660_stat_t *p_statbuf =
|
iso9660_stat_t *p_statbuf =
|
||||||
(iso9660_stat_t *) _cdio_list_node_data (p_entnode);
|
(iso9660_stat_t *) _cdio_list_node_data (p_entnode);
|
||||||
stat_list.push_back(new ISO9660::Stat(p_statbuf));
|
stat_list.push_back(new ISO9660::Stat(p_statbuf));
|
||||||
}
|
}
|
||||||
_cdio_list_free (p_stat_list, false);
|
_cdio_list_free (p_stat_list, false);
|
||||||
|
return true;
|
||||||
return stat_list;
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: iso9660.h,v 1.85 2006/03/05 08:31:03 rocky Exp $
|
$Id: iso9660.h,v 1.86 2006/03/06 19:39:35 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
Copyright (C) 2003, 2004, 2005, 2006 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004, 2005, 2006 Rocky Bernstein <rocky@panix.com>
|
||||||
@@ -679,14 +679,14 @@ typedef struct _iso9660_s iso9660_t;
|
|||||||
ISO-9600 level 1 directory name. These are the ASCII capital
|
ISO-9600 level 1 directory name. These are the ASCII capital
|
||||||
letters A-Z, the digits 0-9 and an underscore.
|
letters A-Z, the digits 0-9 and an underscore.
|
||||||
*/
|
*/
|
||||||
bool iso9660_isdchar (int c);
|
bool iso9660_is_dchar (int c);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Return true if c is an ACHAR -
|
Return true if c is an ACHAR -
|
||||||
These are the DCHAR's plus some ASCII symbols including the space
|
These are the DCHAR's plus some ASCII symbols including the space
|
||||||
symbol.
|
symbol.
|
||||||
*/
|
*/
|
||||||
bool iso9660_isachar (int c);
|
bool iso9660_is_achar (int c);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Convert an ISO-9660 file name which is in the format usually stored
|
Convert an ISO-9660 file name which is in the format usually stored
|
||||||
@@ -1012,6 +1012,12 @@ lsn_t iso9660_get_dir_extent(const iso9660_dir_t *p_idr);
|
|||||||
bool iso9660_ifs_is_xa (const iso9660_t * p_iso);
|
bool iso9660_ifs_is_xa (const iso9660_t * p_iso);
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef DO_NOT_WANT_PARANOIA_COMPATIBILITY
|
||||||
|
/** For compatibility with good ol' paranoia */
|
||||||
|
#define iso9660_isdchar iso9660_is_dchar
|
||||||
|
#define iso9660_isachar iso9660_is_achar
|
||||||
|
#endif /*DO_NOT_WANT_PARANOIA_COMPATIBILITY*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: iso9660.c,v 1.19 2006/03/02 18:59:13 rocky Exp $
|
$Id: iso9660.c,v 1.20 2006/03/06 19:39:35 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
Copyright (C) 2003, 2004, 2005, 2006 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004, 2005, 2006 Rocky Bernstein <rocky@panix.com>
|
||||||
@@ -51,7 +51,7 @@ const char ISO_STANDARD_ID[] = {'C', 'D', '0', '0', '1'};
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: iso9660.c,v 1.19 2006/03/02 18:59:13 rocky Exp $";
|
static const char _rcsid[] = "$Id: iso9660.c,v 1.20 2006/03/06 19:39:35 rocky Exp $";
|
||||||
|
|
||||||
/* Variables to hold debugger-helping enumerations */
|
/* Variables to hold debugger-helping enumerations */
|
||||||
enum iso_enum1_s iso_enums1;
|
enum iso_enum1_s iso_enums1;
|
||||||
@@ -388,7 +388,7 @@ iso9660_strncpy_pad(char dst[], const char src[], size_t len,
|
|||||||
|
|
||||||
case ISO9660_ACHARS:
|
case ISO9660_ACHARS:
|
||||||
for (idx = 0; src[idx]; idx++)
|
for (idx = 0; src[idx]; idx++)
|
||||||
if (!iso9660_isachar (src[idx]))
|
if (!iso9660_is_achar (src[idx]))
|
||||||
{
|
{
|
||||||
cdio_warn ("string '%s' fails a-character constraint (pos = %d)",
|
cdio_warn ("string '%s' fails a-character constraint (pos = %d)",
|
||||||
src, idx);
|
src, idx);
|
||||||
@@ -398,7 +398,7 @@ iso9660_strncpy_pad(char dst[], const char src[], size_t len,
|
|||||||
|
|
||||||
case ISO9660_DCHARS:
|
case ISO9660_DCHARS:
|
||||||
for (idx = 0; src[idx]; idx++)
|
for (idx = 0; src[idx]; idx++)
|
||||||
if (!iso9660_isdchar (src[idx]))
|
if (!iso9660_is_dchar (src[idx]))
|
||||||
{
|
{
|
||||||
cdio_warn ("string '%s' fails d-character constraint (pos = %d)",
|
cdio_warn ("string '%s' fails d-character constraint (pos = %d)",
|
||||||
src, idx);
|
src, idx);
|
||||||
@@ -429,7 +429,7 @@ iso9660_strncpy_pad(char dst[], const char src[], size_t len,
|
|||||||
underscore.
|
underscore.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
iso9660_isdchar (int c)
|
iso9660_is_dchar (int c)
|
||||||
{
|
{
|
||||||
if (!IN (c, 0x30, 0x5f)
|
if (!IN (c, 0x30, 0x5f)
|
||||||
|| IN (c, 0x3a, 0x40)
|
|| IN (c, 0x3a, 0x40)
|
||||||
@@ -446,7 +446,7 @@ iso9660_isdchar (int c)
|
|||||||
symbol.
|
symbol.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
iso9660_isachar (int c)
|
iso9660_is_achar (int c)
|
||||||
{
|
{
|
||||||
if (!IN (c, 0x20, 0x5f)
|
if (!IN (c, 0x20, 0x5f)
|
||||||
|| IN (c, 0x23, 0x24)
|
|| IN (c, 0x23, 0x24)
|
||||||
@@ -874,7 +874,7 @@ iso9660_dirname_valid_p (const char pathname[])
|
|||||||
|
|
||||||
len = 0;
|
len = 0;
|
||||||
for (; *p; p++)
|
for (; *p; p++)
|
||||||
if (iso9660_isdchar (*p))
|
if (iso9660_is_dchar (*p))
|
||||||
{
|
{
|
||||||
len++;
|
len++;
|
||||||
if (len > 8)
|
if (len > 8)
|
||||||
@@ -940,7 +940,7 @@ iso9660_pathname_valid_p (const char pathname[])
|
|||||||
int dots = 0;
|
int dots = 0;
|
||||||
|
|
||||||
for (; *p; p++)
|
for (; *p; p++)
|
||||||
if (iso9660_isdchar (*p))
|
if (iso9660_is_dchar (*p))
|
||||||
{
|
{
|
||||||
len++;
|
len++;
|
||||||
if (dots == 0 ? len > 8 : len > 3)
|
if (dots == 0 ? len > 8 : len > 3)
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ iso9660_ifs_read_superblock
|
|||||||
iso9660_ifs_readdir
|
iso9660_ifs_readdir
|
||||||
iso9660_ifs_stat
|
iso9660_ifs_stat
|
||||||
iso9660_ifs_stat_translate
|
iso9660_ifs_stat_translate
|
||||||
iso9660_isachar
|
iso9660_is_achar
|
||||||
iso9660_isdchar
|
iso9660_is_dchar
|
||||||
iso9660_iso_seek_read
|
iso9660_iso_seek_read
|
||||||
iso9660_name_translate
|
iso9660_name_translate
|
||||||
iso9660_name_translate_ext
|
iso9660_name_translate_ext
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: testischar.c,v 1.1 2003/08/17 05:31:19 rocky Exp $
|
$Id: testischar.c,v 1.2 2006/03/06 19:39:35 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ main (int argc, const char *argv[])
|
|||||||
{
|
{
|
||||||
int c = (j << 4) + i;
|
int c = (j << 4) + i;
|
||||||
|
|
||||||
printf (" %c", iso9660_isdchar (c) ? c : ' ');
|
printf (" %c", iso9660_is_dchar (c) ? c : ' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
printf (" |");
|
printf (" |");
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: testiso9660.c,v 1.7 2006/02/25 12:10:53 rocky Exp $
|
$Id: testiso9660.c,v 1.8 2006/03/06 19:39:35 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2006 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2006 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -51,12 +51,12 @@ main (int argc, const char *argv[])
|
|||||||
*********************************************/
|
*********************************************/
|
||||||
|
|
||||||
for (c='A'; c<='Z'; c++ ) {
|
for (c='A'; c<='Z'; c++ ) {
|
||||||
if (!iso9660_isdchar(c)) {
|
if (!iso9660_is_dchar(c)) {
|
||||||
printf("Failed iso9660_isdchar test on %c\n", c);
|
printf("Failed iso9660_is_dchar test on %c\n", c);
|
||||||
i_bad++;
|
i_bad++;
|
||||||
}
|
}
|
||||||
if (!iso9660_isachar(c)) {
|
if (!iso9660_is_achar(c)) {
|
||||||
printf("Failed iso9660_isachar test on %c\n", c);
|
printf("Failed iso9660_is_achar test on %c\n", c);
|
||||||
i_bad++;
|
i_bad++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -64,12 +64,12 @@ main (int argc, const char *argv[])
|
|||||||
if (i_bad) return i_bad;
|
if (i_bad) return i_bad;
|
||||||
|
|
||||||
for (c='0'; c<='9'; c++ ) {
|
for (c='0'; c<='9'; c++ ) {
|
||||||
if (!iso9660_isdchar(c)) {
|
if (!iso9660_is_dchar(c)) {
|
||||||
printf("Failed iso9660_isdchar test on %c\n", c);
|
printf("Failed iso9660_is_dchar test on %c\n", c);
|
||||||
i_bad++;
|
i_bad++;
|
||||||
}
|
}
|
||||||
if (!iso9660_isachar(c)) {
|
if (!iso9660_is_achar(c)) {
|
||||||
printf("Failed iso9660_isachar test on %c\n", c);
|
printf("Failed iso9660_is_achar test on %c\n", c);
|
||||||
i_bad++;
|
i_bad++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,12 +78,12 @@ main (int argc, const char *argv[])
|
|||||||
|
|
||||||
for (i=0; i<=13; i++ ) {
|
for (i=0; i<=13; i++ ) {
|
||||||
c=achars[i];
|
c=achars[i];
|
||||||
if (iso9660_isdchar(c)) {
|
if (iso9660_is_dchar(c)) {
|
||||||
printf("Should not pass iso9660_isdchar test on %c\n", c);
|
printf("Should not pass iso9660_is_dchar test on %c\n", c);
|
||||||
i_bad++;
|
i_bad++;
|
||||||
}
|
}
|
||||||
if (!iso9660_isachar(c)) {
|
if (!iso9660_is_achar(c)) {
|
||||||
printf("Failed iso9660_isachar test on symbol %c\n", c);
|
printf("Failed iso9660_is_achar test on symbol %c\n", c);
|
||||||
i_bad++;
|
i_bad++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user