Compare commits
15 Commits
release-1.
...
release-1.
Author | SHA1 | Date | |
---|---|---|---|
8a752b50fa | |||
c38b1a3a3a | |||
73c9c7f244 | |||
0b9f03bb23 | |||
d1c3a017e3 | |||
b200feceed | |||
7958b2ea22 | |||
c0bdf4d3b5 | |||
71efc996e3 | |||
61383dea2d | |||
270cd1cad5 | |||
559e9b564d | |||
d8a56f60ef | |||
10e3b2939a | |||
ba67523278 |
@ -1,7 +1,7 @@
|
||||
Vreixo Formoso <metalpain2002@yahoo.es>,
|
||||
Mario Danic <mario.danic@gmail.com>,
|
||||
Thomas Schmitt <scdbackup@gmx.net>
|
||||
Copyright (C) 2007-2010 Vreixo Formoso, Mario Danic, Thomas Schmitt
|
||||
Copyright (C) 2007-2011 Vreixo Formoso, Mario Danic, Thomas Schmitt
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
|
@ -1,6 +1,8 @@
|
||||
bzr branch lp:libisofs/for-libisoburn (to become libisofs-1.0.6.tar.gz)
|
||||
|
||||
libisofs-1.0.6.tar.gz Sat Apr 09 2011
|
||||
===============================================================================
|
||||
- no novelties yet
|
||||
* New API call iso_write_opts_set_joliet_long_names()
|
||||
* New error codes for oversized file addresses
|
||||
|
||||
libisofs-1.0.4.tar.gz Thu Mar 10 2011
|
||||
===============================================================================
|
||||
|
1
README
1
README
@ -54,6 +54,7 @@ applications which use it. This dependency can be avoided by configure options
|
||||
--disable-libacl avoid use of ACL functions like acl_to_text()
|
||||
--disable-xattr avoid use of xattr functions like listxattr()
|
||||
--disable-zlib avoid use of zlib functions like compress2()
|
||||
--disable-libjte avoid use of libjte functions
|
||||
|
||||
See INSTALL file for general options of ./configure.
|
||||
|
||||
|
12
configure.ac
12
configure.ac
@ -1,4 +1,4 @@
|
||||
AC_INIT([libisofs], [1.0.4], [http://libburnia-project.org])
|
||||
AC_INIT([libisofs], [1.0.6], [http://libburnia-project.org])
|
||||
AC_PREREQ([2.50])
|
||||
dnl AC_CONFIG_HEADER([config.h])
|
||||
|
||||
@ -40,7 +40,7 @@ dnl If LIBISOFS_*_VERSION changes, be sure to change AC_INIT above to match.
|
||||
dnl
|
||||
LIBISOFS_MAJOR_VERSION=1
|
||||
LIBISOFS_MINOR_VERSION=0
|
||||
LIBISOFS_MICRO_VERSION=4
|
||||
LIBISOFS_MICRO_VERSION=6
|
||||
LIBISOFS_VERSION=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION.$LIBISOFS_MICRO_VERSION
|
||||
|
||||
AC_SUBST(LIBISOFS_MAJOR_VERSION)
|
||||
@ -50,10 +50,10 @@ AC_SUBST(LIBISOFS_VERSION)
|
||||
|
||||
dnl Libtool versioning
|
||||
LT_RELEASE=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION
|
||||
# 2011.03.10 development jump has not yet happened
|
||||
# SONAME = 48 - 42 = 6 . Library name = libisofs.6.42.0
|
||||
LT_CURRENT=48
|
||||
LT_AGE=42
|
||||
# 2011.04.09 development jump has not yet happened
|
||||
# SONAME = 50 - 44 = 6 . Library name = libisofs.6.44.0
|
||||
LT_CURRENT=50
|
||||
LT_AGE=44
|
||||
LT_REVISION=0
|
||||
LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
|
||||
|
||||
|
27
demo/demo.c
27
demo/demo.c
@ -50,6 +50,7 @@ static char helptext[][80] = {
|
||||
#include <fcntl.h>
|
||||
#include <err.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
#ifndef PATH_MAX
|
||||
@ -372,7 +373,11 @@ int gesture_iso(int argc, char **argv)
|
||||
iso_write_opts_free(opts);
|
||||
|
||||
while (burn_src->read_xt(burn_src, buf, 2048) == 2048) {
|
||||
fwrite(buf, 1, 2048, fp);
|
||||
result = fwrite(buf, 1, 2048, fp);
|
||||
if (result < 2048) {
|
||||
printf ("Cannot write block. errno= %d\n", errno);
|
||||
goto ex;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
burn_src->free_data(burn_src);
|
||||
@ -537,7 +542,7 @@ int gesture_iso_read(int argc, char **argv)
|
||||
|
||||
int gesture_iso_cat(int argc, char **argv)
|
||||
{
|
||||
int res;
|
||||
int res, write_ret;
|
||||
IsoFilesystem *fs;
|
||||
IsoFileSource *file;
|
||||
struct stat info;
|
||||
@ -596,7 +601,11 @@ int gesture_iso_cat(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
while ((res = iso_file_source_read(file, buf, 1024)) > 0) {
|
||||
fwrite(buf, 1, res, stdout);
|
||||
write_ret = fwrite(buf, 1, res, stdout);
|
||||
if (write_ret < res) {
|
||||
printf ("Cannot write block to stdout. errno= %d\n", errno);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (res < 0) {
|
||||
fprintf(stderr, "Error reading, err = %d\n", res);
|
||||
@ -700,7 +709,11 @@ int gesture_iso_modify(int argc, char **argv)
|
||||
iso_write_opts_free(opts);
|
||||
|
||||
while (burn_src->read_xt(burn_src, buf, 2048) == 2048) {
|
||||
fwrite(buf, 1, 2048, fp);
|
||||
result = fwrite(buf, 1, 2048, fp);
|
||||
if (result < 2048) {
|
||||
printf ("Cannot write block. errno= %d\n", errno);
|
||||
goto ex;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
burn_src->free_data(burn_src);
|
||||
@ -814,7 +827,11 @@ int gesture_iso_ms(int argc, char **argv)
|
||||
iso_write_opts_free(opts);
|
||||
|
||||
while (burn_src->read_xt(burn_src, buf, 2048) == 2048) {
|
||||
fwrite(buf, 1, 2048, fp);
|
||||
result = fwrite(buf, 1, 2048, fp);
|
||||
if (result < 2048) {
|
||||
printf ("Cannot write block. errno= %d\n", errno);
|
||||
goto ex;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
burn_src->free_data(burn_src);
|
||||
|
@ -26,10 +26,6 @@
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX Libisofs_default_path_maX
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void iso_node_builder_ref(IsoNodeBuilder *builder)
|
||||
@ -75,6 +71,8 @@ int default_create_file(IsoNodeBuilder *builder, IsoImage *image,
|
||||
iso_file_source_ref(src);
|
||||
|
||||
name = iso_file_source_get_name(src);
|
||||
if (strlen(name) > LIBISOFS_NODE_NAME_MAX)
|
||||
name[LIBISOFS_NODE_NAME_MAX] = 0;
|
||||
ret = iso_node_new_file(name, stream, &node);
|
||||
if (ret < 0) {
|
||||
iso_stream_unref(stream);
|
||||
@ -122,6 +120,8 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
|
||||
}
|
||||
|
||||
name = iso_file_source_get_name(src);
|
||||
if (strlen(name) > LIBISOFS_NODE_NAME_MAX)
|
||||
name[LIBISOFS_NODE_NAME_MAX] = 0;
|
||||
fs = iso_file_source_get_filesystem(src);
|
||||
new = NULL;
|
||||
|
||||
@ -157,10 +157,10 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
|
||||
case S_IFLNK:
|
||||
{
|
||||
/* source is a symbolic link */
|
||||
char dest[PATH_MAX];
|
||||
char dest[LIBISOFS_NODE_PATH_MAX];
|
||||
IsoSymlink *link;
|
||||
|
||||
ret = iso_file_source_readlink(src, dest, PATH_MAX);
|
||||
ret = iso_file_source_readlink(src, dest, LIBISOFS_NODE_PATH_MAX);
|
||||
if (ret < 0) {
|
||||
break;
|
||||
}
|
||||
|
@ -1650,6 +1650,7 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||
target->allow_full_ascii = opts->allow_full_ascii;
|
||||
target->relaxed_vol_atts = opts->relaxed_vol_atts;
|
||||
target->joliet_longer_paths = opts->joliet_longer_paths;
|
||||
target->joliet_long_names = opts->joliet_long_names;
|
||||
target->rrip_version_1_10 = opts->rrip_version_1_10;
|
||||
target->rrip_1_10_px_ino = opts->rrip_1_10_px_ino;
|
||||
target->aaip_susp_1_10 = opts->aaip_susp_1_10;
|
||||
@ -2641,6 +2642,15 @@ int iso_write_opts_set_joliet_longer_paths(IsoWriteOpts *opts, int allow)
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
int iso_write_opts_set_joliet_long_names(IsoWriteOpts *opts, int allow)
|
||||
{
|
||||
if (opts == NULL) {
|
||||
return ISO_NULL_POINTER;
|
||||
}
|
||||
opts->joliet_long_names = allow ? 1 : 0;
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
int iso_write_opts_set_rrip_version_1_10(IsoWriteOpts *opts, int oldvers)
|
||||
{
|
||||
if (opts == NULL) {
|
||||
|
@ -161,6 +161,11 @@ struct iso_write_opts {
|
||||
*/
|
||||
unsigned int joliet_longer_paths :1;
|
||||
|
||||
/**
|
||||
* Allow Joliet names up to 103 characters rather than 64.
|
||||
*/
|
||||
unsigned int joliet_long_names :1;
|
||||
|
||||
/**
|
||||
* Write Rock Ridge info as of specification RRIP-1.10 rather than
|
||||
* RRIP-1.12: signature "RRIP_1991A" rather than "IEEE_1282",
|
||||
@ -459,6 +464,9 @@ struct ecma119_image
|
||||
/** Allow paths on Joliet tree to be larger than 240 bytes */
|
||||
unsigned int joliet_longer_paths :1;
|
||||
|
||||
/** Allow Joliet names up to 103 characters rather than 64 */
|
||||
unsigned int joliet_long_names :1;
|
||||
|
||||
/** Write old fashioned RRIP-1.10 rather than RRIP-1.12 */
|
||||
unsigned int rrip_version_1_10 :1;
|
||||
|
||||
|
@ -239,6 +239,7 @@ int iso_tree_add_boot_node(IsoDir *parent, const char *name, IsoBoot **boot)
|
||||
IsoBoot *node;
|
||||
IsoNode **pos;
|
||||
time_t now;
|
||||
int ret;
|
||||
|
||||
if (parent == NULL || name == NULL || boot == NULL) {
|
||||
return ISO_NULL_POINTER;
|
||||
@ -248,9 +249,9 @@ int iso_tree_add_boot_node(IsoDir *parent, const char *name, IsoBoot **boot)
|
||||
}
|
||||
|
||||
/* check if the name is valid */
|
||||
if (!iso_node_is_valid_name(name)) {
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
}
|
||||
ret = iso_node_is_valid_name(name);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* find place where to insert */
|
||||
pos = &(parent->children);
|
||||
|
@ -35,11 +35,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX Libisofs_default_path_maX
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Options for image reading.
|
||||
* There are four kind of options:
|
||||
@ -953,6 +948,7 @@ int ifs_readlink(IsoFileSource *src, char *buf, size_t bufsiz)
|
||||
{
|
||||
char *dest;
|
||||
size_t len;
|
||||
int ret;
|
||||
ImageFileSourceData *data;
|
||||
|
||||
if (src == NULL || buf == NULL || src->data == NULL) {
|
||||
@ -971,14 +967,15 @@ int ifs_readlink(IsoFileSource *src, char *buf, size_t bufsiz)
|
||||
|
||||
dest = (char*)data->data.content;
|
||||
len = strlen(dest);
|
||||
if (bufsiz <= len) {
|
||||
|
||||
ret = ISO_SUCCESS;
|
||||
if (len >= bufsiz) {
|
||||
ret = ISO_RR_PATH_TOO_LONG;
|
||||
len = bufsiz - 1;
|
||||
}
|
||||
|
||||
strncpy(buf, dest, len);
|
||||
buf[len] = '\0';
|
||||
|
||||
return ISO_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static
|
||||
@ -2926,10 +2923,10 @@ int image_builder_create_node(IsoNodeBuilder *builder, IsoImage *image,
|
||||
case S_IFLNK:
|
||||
{
|
||||
/* source is a symbolic link */
|
||||
char dest[PATH_MAX];
|
||||
char dest[LIBISOFS_NODE_PATH_MAX];
|
||||
IsoSymlink *link;
|
||||
|
||||
ret = iso_file_source_readlink(src, dest, PATH_MAX);
|
||||
ret = iso_file_source_readlink(src, dest, LIBISOFS_NODE_PATH_MAX);
|
||||
if (ret < 0) {
|
||||
free(name);
|
||||
return ret;
|
||||
|
@ -412,7 +412,7 @@ int lfs_readdir(IsoFileSource *src, IsoFileSource **child)
|
||||
static
|
||||
int lfs_readlink(IsoFileSource *src, char *buf, size_t bufsiz)
|
||||
{
|
||||
int size;
|
||||
int size, ret;
|
||||
_LocalFsFileSource *data;
|
||||
char *path;
|
||||
|
||||
@ -431,7 +431,7 @@ int lfs_readlink(IsoFileSource *src, char *buf, size_t bufsiz)
|
||||
* invoke readlink, with bufsiz -1 to reserve an space for
|
||||
* the NULL character
|
||||
*/
|
||||
size = readlink(path, buf, bufsiz - 1);
|
||||
size = readlink(path, buf, bufsiz);
|
||||
free(path);
|
||||
if (size < 0) {
|
||||
/* error */
|
||||
@ -455,8 +455,13 @@ int lfs_readlink(IsoFileSource *src, char *buf, size_t bufsiz)
|
||||
}
|
||||
|
||||
/* NULL-terminate the buf */
|
||||
ret = ISO_SUCCESS;
|
||||
if (size >= bufsiz) {
|
||||
ret = ISO_RR_PATH_TOO_LONG;
|
||||
size = bufsiz - 1;
|
||||
}
|
||||
buf[size] = '\0';
|
||||
return ISO_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -32,7 +32,7 @@
|
||||
* @param image
|
||||
* Location where the image pointer will be stored.
|
||||
* @return
|
||||
* 1 sucess, < 0 error
|
||||
* 1 success, < 0 error
|
||||
*/
|
||||
int iso_image_new(const char *name, IsoImage **image)
|
||||
{
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "filesrc.h"
|
||||
#include "eltorito.h"
|
||||
#include "libisofs.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -42,12 +43,11 @@ int get_joliet_name(Ecma119Image *t, IsoNode *iso, uint16_t **name)
|
||||
iso_msg_debug(t->image->id, "Can't convert %s", iso->name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* TODO #00022 : support relaxed constraints in joliet filenames */
|
||||
if (iso->type == LIBISO_DIR) {
|
||||
jname = iso_j_dir_id(ucs_name);
|
||||
jname = iso_j_dir_id(ucs_name, t->joliet_long_names << 1);
|
||||
} else {
|
||||
jname = iso_j_file_id(ucs_name, !!(t->no_force_dots & 2));
|
||||
jname = iso_j_file_id(ucs_name,
|
||||
(t->joliet_long_names << 1) | !!(t->no_force_dots & 2));
|
||||
}
|
||||
free(ucs_name);
|
||||
if (jname != NULL) {
|
||||
@ -303,8 +303,15 @@ int joliet_create_mangled_name(uint16_t *dest, uint16_t *src, int digits,
|
||||
int ret, pos;
|
||||
uint16_t *ucsnumber;
|
||||
char fmt[16];
|
||||
char nstr[72]; /* The only caller of this function allocates dest with 66
|
||||
elements and limits digits to < 8 */
|
||||
char nstr[72];
|
||||
/* was: The only caller of this function allocates dest
|
||||
with 66 elements and limits digits to < 8
|
||||
But this does not match the usage of nstr which has to take
|
||||
the decimal representation of an int.
|
||||
*/
|
||||
|
||||
if (digits >= 8)
|
||||
return ISO_ASSERT_FAILURE;
|
||||
|
||||
sprintf(fmt, "%%0%dd", digits);
|
||||
sprintf(nstr, fmt, number);
|
||||
@ -337,7 +344,7 @@ static
|
||||
int mangle_single_dir(Ecma119Image *t, JolietNode *dir)
|
||||
{
|
||||
int ret;
|
||||
int i, nchildren;
|
||||
int i, nchildren, maxchar = 64;
|
||||
JolietNode **children;
|
||||
IsoHTable *table;
|
||||
int need_sort = 0;
|
||||
@ -345,6 +352,9 @@ int mangle_single_dir(Ecma119Image *t, JolietNode *dir)
|
||||
nchildren = dir->info.dir->nchildren;
|
||||
children = dir->info.dir->children;
|
||||
|
||||
if (t->joliet_long_names)
|
||||
maxchar = 103;
|
||||
|
||||
/* a hash table will temporary hold the names, for fast searching */
|
||||
ret = iso_htable_create((nchildren * 100) / 80, iso_str_hash,
|
||||
(compare_function_t)ucscmp, &table);
|
||||
@ -361,7 +371,7 @@ int mangle_single_dir(Ecma119Image *t, JolietNode *dir)
|
||||
|
||||
for (i = 0; i < nchildren; ++i) {
|
||||
uint16_t *name, *ext;
|
||||
uint16_t full_name[66];
|
||||
uint16_t full_name[LIBISO_JOLIET_NAME_MAX];
|
||||
int max; /* computed max len for name, without extension */
|
||||
int j = i;
|
||||
int digits = 1; /* characters to change per name */
|
||||
@ -380,7 +390,7 @@ int mangle_single_dir(Ecma119Image *t, JolietNode *dir)
|
||||
* A max of 7 characters is good enought, it allows handling up to
|
||||
* 9,999,999 files with same name.
|
||||
*/
|
||||
/* Important: joliet_create_mangled_name() relies on digits < 72 */
|
||||
/* Important: joliet_create_mangled_name() relies on digits < 8 */
|
||||
|
||||
while (digits < 8) {
|
||||
int ok, k;
|
||||
@ -403,7 +413,7 @@ int mangle_single_dir(Ecma119Image *t, JolietNode *dir)
|
||||
ext = dot + 1;
|
||||
|
||||
extlen = ucslen(ext);
|
||||
max = 65 - extlen - 1 - digits;
|
||||
max = maxchar + 1 - extlen - 1 - digits;
|
||||
if (max <= 0) {
|
||||
/* this can happen if extension is too long */
|
||||
if (extlen + max > 3) {
|
||||
@ -413,7 +423,7 @@ int mangle_single_dir(Ecma119Image *t, JolietNode *dir)
|
||||
*/
|
||||
extlen = extlen + max - 1;
|
||||
ext[extlen] = 0;
|
||||
max = 66 - extlen - 1 - digits;
|
||||
max = maxchar + 2 - extlen - 1 - digits;
|
||||
} else {
|
||||
/*
|
||||
* error, we don't support extensions < 3
|
||||
@ -430,10 +440,10 @@ int mangle_single_dir(Ecma119Image *t, JolietNode *dir)
|
||||
} else {
|
||||
/* Directory, or file without extension */
|
||||
if (children[i]->type == JOLIET_DIR) {
|
||||
max = 65 - digits;
|
||||
max = maxchar + 1 - digits;
|
||||
dot = NULL; /* dots have no meaning in dirs */
|
||||
} else {
|
||||
max = 65 - digits;
|
||||
max = maxchar + 1 - digits;
|
||||
}
|
||||
name = full_name;
|
||||
if (max < ucslen(name)) {
|
||||
@ -446,7 +456,7 @@ int mangle_single_dir(Ecma119Image *t, JolietNode *dir)
|
||||
ok = 1;
|
||||
/* change name of each file */
|
||||
for (k = i; k <= j; ++k) {
|
||||
uint16_t tmp[66];
|
||||
uint16_t tmp[LIBISO_JOLIET_NAME_MAX];
|
||||
while (1) {
|
||||
ret = joliet_create_mangled_name(tmp, name, digits,
|
||||
change, ext);
|
||||
|
@ -18,6 +18,10 @@
|
||||
#include "libisofs.h"
|
||||
#include "ecma119.h"
|
||||
|
||||
/* was formerly 66 = 64 + 2. Now 105 = 103 + 2.
|
||||
*/
|
||||
#define LIBISO_JOLIET_NAME_MAX 105
|
||||
|
||||
enum joliet_node_type {
|
||||
JOLIET_FILE,
|
||||
JOLIET_DIR
|
||||
|
@ -1207,7 +1207,7 @@ int iso_lib_is_compatible(int major, int minor, int micro);
|
||||
*/
|
||||
#define iso_lib_header_version_major 1
|
||||
#define iso_lib_header_version_minor 0
|
||||
#define iso_lib_header_version_micro 4
|
||||
#define iso_lib_header_version_micro 6
|
||||
|
||||
/**
|
||||
* Usage discussion:
|
||||
@ -1585,6 +1585,15 @@ int iso_write_opts_set_relaxed_vol_atts(IsoWriteOpts *opts, int allow);
|
||||
*/
|
||||
int iso_write_opts_set_joliet_longer_paths(IsoWriteOpts *opts, int allow);
|
||||
|
||||
/**
|
||||
* Allow leaf names in the Joliet tree to have up to 103 characters.
|
||||
* Normal limit is 64.
|
||||
* This breaks Joliet specification. Use with caution.
|
||||
*
|
||||
* @since 1.0.6
|
||||
*/
|
||||
int iso_write_opts_set_joliet_long_names(IsoWriteOpts *opts, int allow);
|
||||
|
||||
/**
|
||||
* Write Rock Ridge info as of specification RRIP-1.10 rather than RRIP-1.12:
|
||||
* signature "RRIP_1991A" rather than "IEEE_1282", field PX without file
|
||||
@ -2075,9 +2084,9 @@ int iso_write_opts_set_part_offset(IsoWriteOpts *opts,
|
||||
tests. It can be prevented by ./configure option --disable-libjte .
|
||||
@since 0.6.38
|
||||
*/
|
||||
#define iso_libjte_req_major 0
|
||||
#define iso_libjte_req_minor 1
|
||||
#define iso_libjte_req_micro 1
|
||||
#define iso_libjte_req_major 1
|
||||
#define iso_libjte_req_minor 0
|
||||
#define iso_libjte_req_micro 0
|
||||
|
||||
/**
|
||||
* Associate a libjte environment object to the upcomming write run.
|
||||
@ -5172,11 +5181,12 @@ int iso_file_source_readdir(IsoFileSource *src, IsoFileSource **child);
|
||||
* @param src
|
||||
* An IsoFileSource corresponding to a symbolic link.
|
||||
* @param buf
|
||||
* allocated buffer of at least bufsiz bytes.
|
||||
* The dest. will be copied there, and it will be NULL-terminated
|
||||
* Allocated buffer of at least bufsiz bytes.
|
||||
* The destination string will be copied there, and it will be 0-terminated
|
||||
* if the return value indicates success or ISO_RR_PATH_TOO_LONG.
|
||||
* @param bufsiz
|
||||
* characters to be copied. Destination link will be truncated if
|
||||
* it is larger than given size. This includes the 0x0 character.
|
||||
* Maximum number of buf characters + 1. The string will be truncated if
|
||||
* it is larger than bufsiz - 1 and ISO_RR_PATH_TOO_LONG. will be returned.
|
||||
* @return
|
||||
* 1 on success, < 0 on error
|
||||
* Error codes:
|
||||
@ -5187,6 +5197,7 @@ int iso_file_source_readdir(IsoFileSource *src, IsoFileSource **child);
|
||||
* ISO_OUT_OF_MEM
|
||||
* ISO_FILE_BAD_PATH
|
||||
* ISO_FILE_DOESNT_EXIST
|
||||
* ISO_RR_PATH_TOO_LONG (@since 1.0.6)
|
||||
*
|
||||
* @since 0.6.2
|
||||
*/
|
||||
@ -6819,6 +6830,16 @@ int iso_md5_match(char first_md5[16], char second_md5[16]);
|
||||
/** Found copied superblock checksum tag (WARNING, HIGH, -376) */
|
||||
#define ISO_MD5_TAG_COPIED 0xD030FE88
|
||||
|
||||
/** Rock Ridge leaf name too long (FAILURE, HIGH, -377) */
|
||||
#define ISO_RR_NAME_TOO_LONG 0xE830FE87
|
||||
|
||||
/** Reserved Rock Ridge leaf name (FAILURE, HIGH, -378) */
|
||||
#define ISO_RR_NAME_RESERVED 0xE830FE86
|
||||
|
||||
/** Rock Ridge path too long (FAILURE, HIGH, -379) */
|
||||
#define ISO_RR_PATH_TOO_LONG 0xE830FE85
|
||||
|
||||
|
||||
|
||||
/* Internal developer note:
|
||||
Place new error codes directly above this comment.
|
||||
|
@ -282,6 +282,7 @@ iso_write_opts_set_hardlinks;
|
||||
iso_write_opts_set_iso1999;
|
||||
iso_write_opts_set_iso_level;
|
||||
iso_write_opts_set_joliet;
|
||||
iso_write_opts_set_joliet_long_names;
|
||||
iso_write_opts_set_joliet_longer_paths;
|
||||
iso_write_opts_set_max_37_char_filenames;
|
||||
iso_write_opts_set_ms_block;
|
||||
|
@ -455,6 +455,12 @@ const char *iso_error_to_msg(int errcode)
|
||||
return "Extended information class offers no cloning method";
|
||||
case ISO_MD5_TAG_COPIED:
|
||||
return "Found copied superblock checksum tag";
|
||||
case ISO_RR_NAME_TOO_LONG:
|
||||
return "Rock Ridge leaf name too long";
|
||||
case ISO_RR_NAME_RESERVED:
|
||||
return "Reserved Rock Ridge leaf name";
|
||||
case ISO_RR_PATH_TOO_LONG:
|
||||
return "Rock Ridge path too long";
|
||||
default:
|
||||
return "Unknown error";
|
||||
}
|
||||
|
@ -28,11 +28,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX Libisofs_default_path_maX
|
||||
#endif
|
||||
|
||||
|
||||
struct dir_iter_data
|
||||
{
|
||||
/* points to the last visited child, to NULL before start */
|
||||
@ -325,6 +320,7 @@ enum IsoNodeType iso_node_get_type(IsoNode *node)
|
||||
int iso_node_set_name(IsoNode *node, const char *name)
|
||||
{
|
||||
char *new;
|
||||
int ret;
|
||||
|
||||
if ((IsoNode*)node->parent == node) {
|
||||
/* you can't change name of the root node */
|
||||
@ -332,9 +328,9 @@ int iso_node_set_name(IsoNode *node, const char *name)
|
||||
}
|
||||
|
||||
/* check if the name is valid */
|
||||
if (!iso_node_is_valid_name(name)) {
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
}
|
||||
ret = iso_node_is_valid_name(name);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (node->parent != NULL) {
|
||||
/* check if parent already has a node with same name */
|
||||
@ -1005,10 +1001,11 @@ const char *iso_symlink_get_dest(const IsoSymlink *link)
|
||||
int iso_symlink_set_dest(IsoSymlink *link, const char *dest)
|
||||
{
|
||||
char *d;
|
||||
if (!iso_node_is_valid_link_dest(dest)) {
|
||||
/* guard against null or empty dest */
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
}
|
||||
int ret;
|
||||
|
||||
ret = iso_node_is_valid_link_dest(dest);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
d = strdup(dest);
|
||||
if (d == NULL) {
|
||||
return ISO_OUT_OF_MEM;
|
||||
@ -1159,22 +1156,23 @@ int iso_node_is_valid_name(const char *name)
|
||||
{
|
||||
/* a name can't be NULL */
|
||||
if (name == NULL) {
|
||||
return 0;
|
||||
return ISO_NULL_POINTER;
|
||||
}
|
||||
|
||||
/* guard against the empty string or big names... */
|
||||
if (name[0] == '\0' || strlen(name) > 255) {
|
||||
return 0;
|
||||
}
|
||||
if (name[0] == '\0')
|
||||
return ISO_RR_NAME_RESERVED;
|
||||
if (strlen(name) > LIBISOFS_NODE_NAME_MAX)
|
||||
return ISO_RR_NAME_TOO_LONG;
|
||||
|
||||
/* ...against "." and ".." names... */
|
||||
if (!strcmp(name, ".") || !strcmp(name, "..")) {
|
||||
return 0;
|
||||
return ISO_RR_NAME_RESERVED;
|
||||
}
|
||||
|
||||
/* ...and against names with '/' */
|
||||
if (strchr(name, '/') != NULL) {
|
||||
return 0;
|
||||
return ISO_RR_NAME_RESERVED;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -1192,13 +1190,14 @@ int iso_node_is_valid_link_dest(const char *dest)
|
||||
|
||||
/* a dest can't be NULL */
|
||||
if (dest == NULL) {
|
||||
return 0;
|
||||
return ISO_NULL_POINTER;
|
||||
}
|
||||
|
||||
/* guard against the empty string or big dest... */
|
||||
if (dest[0] == '\0' || strlen(dest) > PATH_MAX) {
|
||||
return 0;
|
||||
}
|
||||
if (dest[0] == '\0')
|
||||
return ISO_RR_NAME_RESERVED;
|
||||
if (strlen(dest) > LIBISOFS_NODE_PATH_MAX)
|
||||
return ISO_RR_PATH_TOO_LONG;
|
||||
|
||||
/* check that all components are valid */
|
||||
if (!strcmp(dest, "/")) {
|
||||
@ -1208,7 +1207,7 @@ int iso_node_is_valid_link_dest(const char *dest)
|
||||
|
||||
ptr = strdup(dest);
|
||||
if (ptr == NULL) {
|
||||
return 0;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
@ -1216,7 +1215,7 @@ int iso_node_is_valid_link_dest(const char *dest)
|
||||
while (component) {
|
||||
if (strcmp(component, ".") && strcmp(component, "..")) {
|
||||
ret = iso_node_is_valid_name(component);
|
||||
if (ret == 0) {
|
||||
if (ret < 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1375,15 +1374,16 @@ int iso_node_new_root(IsoDir **root)
|
||||
int iso_node_new_dir(char *name, IsoDir **dir)
|
||||
{
|
||||
IsoDir *new;
|
||||
int ret;
|
||||
|
||||
if (dir == NULL || name == NULL) {
|
||||
return ISO_NULL_POINTER;
|
||||
}
|
||||
|
||||
/* check if the name is valid */
|
||||
if (!iso_node_is_valid_name(name)) {
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
}
|
||||
ret = iso_node_is_valid_name(name);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
new = calloc(1, sizeof(IsoDir));
|
||||
if (new == NULL) {
|
||||
@ -1400,15 +1400,16 @@ int iso_node_new_dir(char *name, IsoDir **dir)
|
||||
int iso_node_new_file(char *name, IsoStream *stream, IsoFile **file)
|
||||
{
|
||||
IsoFile *new;
|
||||
int ret;
|
||||
|
||||
if (file == NULL || name == NULL || stream == NULL) {
|
||||
return ISO_NULL_POINTER;
|
||||
}
|
||||
|
||||
/* check if the name is valid */
|
||||
if (!iso_node_is_valid_name(name)) {
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
}
|
||||
ret = iso_node_is_valid_name(name);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
new = calloc(1, sizeof(IsoFile));
|
||||
if (new == NULL) {
|
||||
@ -1428,21 +1429,21 @@ int iso_node_new_file(char *name, IsoStream *stream, IsoFile **file)
|
||||
int iso_node_new_symlink(char *name, char *dest, IsoSymlink **link)
|
||||
{
|
||||
IsoSymlink *new;
|
||||
int ret;
|
||||
|
||||
if (link == NULL || name == NULL || dest == NULL) {
|
||||
return ISO_NULL_POINTER;
|
||||
}
|
||||
|
||||
/* check if the name is valid */
|
||||
if (!iso_node_is_valid_name(name)) {
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
}
|
||||
ret = iso_node_is_valid_name(name);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* check if destination is valid */
|
||||
if (!iso_node_is_valid_link_dest(dest)) {
|
||||
/* guard against null or empty dest */
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
}
|
||||
ret = iso_node_is_valid_link_dest(dest);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
new = calloc(1, sizeof(IsoSymlink));
|
||||
if (new == NULL) {
|
||||
@ -1464,6 +1465,7 @@ int iso_node_new_special(char *name, mode_t mode, dev_t dev,
|
||||
IsoSpecial **special)
|
||||
{
|
||||
IsoSpecial *new;
|
||||
int ret;
|
||||
|
||||
if (special == NULL || name == NULL) {
|
||||
return ISO_NULL_POINTER;
|
||||
@ -1473,9 +1475,9 @@ int iso_node_new_special(char *name, mode_t mode, dev_t dev,
|
||||
}
|
||||
|
||||
/* check if the name is valid */
|
||||
if (!iso_node_is_valid_name(name)) {
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
}
|
||||
ret = iso_node_is_valid_name(name);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
new = calloc(1, sizeof(IsoSpecial));
|
||||
if (new == NULL) {
|
||||
|
@ -30,6 +30,29 @@
|
||||
#endif
|
||||
|
||||
|
||||
/* Maximum length of a leaf name in the libisofs node tree. This is currently
|
||||
restricted by the implemented maximum length of a Rock Ridge name.
|
||||
This might later become larger and may then be limited to smaller values.
|
||||
|
||||
Rock Ridge specs do not impose an explicit limit on name length.
|
||||
But 255 is also specified by
|
||||
http://pubs.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html
|
||||
which says
|
||||
NAME_MAX >= _XOPEN_NAME_MAX = 255
|
||||
*/
|
||||
#define LIBISOFS_NODE_NAME_MAX 255
|
||||
|
||||
|
||||
/* Maximum length of a path in the libisofs node tree.
|
||||
Rock Ridge specs do not impose an explicit limit on path length.
|
||||
|
||||
http://pubs.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html
|
||||
says
|
||||
PATH_MAX >= _XOPEN_PATH_MAX = 1024
|
||||
*/
|
||||
#define LIBISOFS_NODE_PATH_MAX 1024
|
||||
|
||||
|
||||
/**
|
||||
* The extended information is a way to attach additional information to each
|
||||
* IsoNode. External applications may want to use this extension system to
|
||||
@ -286,7 +309,7 @@ int iso_node_new_special(char *name, mode_t mode, dev_t dev,
|
||||
* Check if a given name is valid for an iso node.
|
||||
*
|
||||
* @return
|
||||
* 1 if yes, 0 if not
|
||||
* 1 if yes, <0 if not. The value is a specific ISO_* error code.
|
||||
*/
|
||||
int iso_node_is_valid_name(const char *name);
|
||||
|
||||
|
@ -337,7 +337,12 @@ static
|
||||
int rrip_add_NM(Ecma119Image *t, struct susp_info *susp, char *name, int size,
|
||||
int flags, int ce)
|
||||
{
|
||||
uint8_t *NM = malloc(size + 5);
|
||||
uint8_t *NM;
|
||||
|
||||
if (size > 250)
|
||||
return ISO_ASSERT_FAILURE;
|
||||
|
||||
NM = malloc(size + 5);
|
||||
if (NM == NULL) {
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
@ -945,6 +950,7 @@ int aaip_xinfo_cloner(void *old_data, void **new_data, int flag)
|
||||
* (*su_size and *ce stay unaltered in this case)
|
||||
* <0= error:
|
||||
* -1= not enough SUA space for 28 bytes of CE entry
|
||||
* -2= out of memory
|
||||
*/
|
||||
static
|
||||
int susp_calc_nm_sl_al(Ecma119Image *t, Ecma119Node *n, size_t space,
|
||||
@ -981,6 +987,9 @@ int susp_calc_nm_sl_al(Ecma119Image *t, Ecma119Node *n, size_t space,
|
||||
if (!(flag & 1))
|
||||
goto unannounced_ca;
|
||||
namelen = namelen - (space - *su_size - 5);
|
||||
|
||||
/* >>> Need to handle lengths > 250 */;
|
||||
|
||||
*ce = 5 + namelen;
|
||||
*su_size = space;
|
||||
}
|
||||
@ -993,6 +1002,8 @@ int susp_calc_nm_sl_al(Ecma119Image *t, Ecma119Node *n, size_t space,
|
||||
int cew = (*ce != 0); /* are we writing to CA ? */
|
||||
|
||||
dest = get_rr_fname(t, ((IsoSymlink*)n->node)->dest);
|
||||
if (dest == NULL)
|
||||
return -2;
|
||||
prev = dest;
|
||||
cur = strchr(prev, '/');
|
||||
while (1) {
|
||||
@ -1021,8 +1032,10 @@ int susp_calc_nm_sl_al(Ecma119Image *t, Ecma119Node *n, size_t space,
|
||||
* TODO this can be handled better, but for now SL
|
||||
* will be completelly moved into the CA
|
||||
*/
|
||||
if (!(flag & 1))
|
||||
if (!(flag & 1)) {
|
||||
free(dest);
|
||||
goto unannounced_ca;
|
||||
}
|
||||
cew = 1;
|
||||
} else {
|
||||
sl_len += clen;
|
||||
@ -1236,7 +1249,9 @@ size_t rrip_calc_len(Ecma119Image *t, Ecma119Node *n, int type, size_t used_up,
|
||||
/* Try without CE */
|
||||
ret = susp_calc_nm_sl_al(t, n, space, &su_size, ce, 0);
|
||||
if (ret == 0) /* Retry with CE */
|
||||
susp_calc_nm_sl_al(t, n, space, &su_size, ce, 1);
|
||||
ret = susp_calc_nm_sl_al(t, n, space, &su_size, ce, 1);
|
||||
if (ret == -2)
|
||||
return ISO_OUT_OF_MEM;
|
||||
|
||||
} else {
|
||||
|
||||
@ -1447,10 +1462,14 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type,
|
||||
ce_len_pd = ce_len;
|
||||
ret = susp_calc_nm_sl_al(t, n, space, &su_size_pd, &ce_len_pd, 0);
|
||||
if (ret == 0) { /* Have to use CA. 28 bytes of CE are necessary */
|
||||
susp_calc_nm_sl_al(t, n, space, &su_size_pd, &ce_len_pd, 1);
|
||||
ret = susp_calc_nm_sl_al(t, n, space, &su_size_pd, &ce_len_pd, 1);
|
||||
sua_free -= 28;
|
||||
ce_is_predicted = 1;
|
||||
}
|
||||
if (ret == -2) {
|
||||
ret = ISO_OUT_OF_MEM;
|
||||
goto add_susp_cleanup;
|
||||
}
|
||||
|
||||
/* NM entry */
|
||||
if (5 + namelen <= sua_free) {
|
||||
@ -1648,6 +1667,9 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type,
|
||||
/*
|
||||
* ..and the part that goes to continuation area.
|
||||
*/
|
||||
|
||||
/* >>> Need a loop to handle lengths > 250 */;
|
||||
|
||||
ret = rrip_add_NM(t, info, name + namelen, strlen(name + namelen),
|
||||
0, 1);
|
||||
if (ret < 0) {
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "stream.h"
|
||||
#include "fsource.h"
|
||||
#include "util.h"
|
||||
#include "node.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -769,7 +770,7 @@ IsoStreamIface mem_stream_class = {
|
||||
* When the Stream refcount reach 0, the buffer is free(3).
|
||||
*
|
||||
* @return
|
||||
* 1 sucess, < 0 error
|
||||
* 1 success, < 0 error
|
||||
*/
|
||||
int iso_memory_stream_new(unsigned char *buf, size_t size, IsoStream **stream)
|
||||
{
|
||||
@ -868,7 +869,8 @@ void iso_stream_get_file_name(IsoStream *stream, char *name)
|
||||
if (!strncmp(type, "fsrc", 4)) {
|
||||
FSrcStreamData *data = stream->data;
|
||||
char *path = iso_file_source_get_path(data->src);
|
||||
strncpy(name, path, PATH_MAX);
|
||||
strncpy(name, path, PATH_MAX - 1);
|
||||
name[PATH_MAX - 1] = 0;
|
||||
free(path);
|
||||
} else if (!strncmp(type, "boot", 4)) {
|
||||
strcpy(name, "BOOT CATALOG");
|
||||
|
@ -29,7 +29,8 @@ typedef struct
|
||||
/**
|
||||
* Get an identifier for the file of the source, for debug purposes
|
||||
* @param name
|
||||
* Should provide at least PATH_MAX bytes
|
||||
* Must provide at least PATH_MAX bytes. If no PATH_MAX is defined
|
||||
* then assume PATH_MAX = Libisofs_default_path_maX from libisofs.h
|
||||
*/
|
||||
void iso_stream_get_file_name(IsoStream *stream, char *name);
|
||||
|
||||
|
@ -32,11 +32,6 @@
|
||||
#include <fnmatch.h>
|
||||
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX Libisofs_default_path_maX
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Add a new directory to the iso tree.
|
||||
*
|
||||
@ -980,18 +975,24 @@ char *iso_tree_get_node_path(IsoNode *node)
|
||||
if ((IsoNode*)node->parent == node) {
|
||||
return strdup("/");
|
||||
} else {
|
||||
char path[PATH_MAX];
|
||||
char *parent_path = iso_tree_get_node_path((IsoNode*)node->parent);
|
||||
char *path = NULL, *parent_path;
|
||||
parent_path = iso_tree_get_node_path((IsoNode*)node->parent);
|
||||
if (parent_path == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (strlen(parent_path) == 1) {
|
||||
snprintf(path, PATH_MAX, "/%s", node->name);
|
||||
path = calloc(1, strlen(node->name) + 2);
|
||||
if (path == NULL)
|
||||
return NULL;
|
||||
sprintf(path, "/%s", node->name);
|
||||
} else {
|
||||
snprintf(path, PATH_MAX, "%s/%s", parent_path, node->name);
|
||||
path = calloc(1, strlen(parent_path) + strlen(node->name) + 2);
|
||||
if (path == NULL)
|
||||
return NULL;
|
||||
sprintf(path, "%s/%s", parent_path, node->name);
|
||||
}
|
||||
free(parent_path);
|
||||
return strdup(path);
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "util.h"
|
||||
#include "libisofs.h"
|
||||
#include "messages.h"
|
||||
#include "joliet.h"
|
||||
#include "../version.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -916,16 +917,20 @@ ex:;
|
||||
|
||||
/*
|
||||
bit0= no_force_dots
|
||||
bit1= allow 103 characters rather than 64
|
||||
*/
|
||||
uint16_t *iso_j_file_id(const uint16_t *src, int flag)
|
||||
{
|
||||
uint16_t *dot;
|
||||
size_t lname, lext, lnname, lnext, pos, i;
|
||||
uint16_t dest[66]; /* 66 = 64 (name + ext) + 1 (.) + 1 (\0) */
|
||||
size_t lname, lext, lnname, lnext, pos, i, maxchar = 64;
|
||||
uint16_t dest[LIBISO_JOLIET_NAME_MAX];
|
||||
/* was: 66 = 64 (name + ext) + 1 (.) + 1 (\0) */
|
||||
|
||||
if (src == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (flag & 2)
|
||||
maxchar = 103;
|
||||
|
||||
dot = ucsrchr(src, '.');
|
||||
|
||||
@ -937,14 +942,15 @@ uint16_t *iso_j_file_id(const uint16_t *src, int flag)
|
||||
*/
|
||||
if (dot == NULL || cmp_ucsbe(dot + 1, '\0') == 0) {
|
||||
lname = ucslen(src);
|
||||
lnname = (lname > 64) ? 64 : lname;
|
||||
lnname = (lname > maxchar) ? maxchar : lname;
|
||||
lext = lnext = 0;
|
||||
} else {
|
||||
lext = ucslen(dot + 1);
|
||||
lname = ucslen(src) - lext - 1;
|
||||
lnext = (ucslen(src) > 65 && lext > 3) ? (lname < 61 ? 64 - lname : 3)
|
||||
lnext = (ucslen(src) > maxchar + 1 && lext > 3)
|
||||
? (lname < maxchar - 3 ? maxchar - lname : 3)
|
||||
: lext;
|
||||
lnname = (ucslen(src) > 65) ? 64 - lnext : lname;
|
||||
lnname = (ucslen(src) > maxchar + 1) ? maxchar - lnext : lname;
|
||||
}
|
||||
|
||||
if (lnname == 0 && lnext == 0) {
|
||||
@ -986,18 +992,22 @@ is_done:;
|
||||
return ucsdup(dest);
|
||||
}
|
||||
|
||||
uint16_t *iso_j_dir_id(const uint16_t *src)
|
||||
/* @param flag bit1= allow 103 characters rather than 64
|
||||
*/
|
||||
uint16_t *iso_j_dir_id(const uint16_t *src, int flag)
|
||||
{
|
||||
size_t len, i;
|
||||
uint16_t dest[65]; /* 65 = 64 + 1 (\0) */
|
||||
size_t len, i, maxchar = 64;
|
||||
uint16_t dest[LIBISO_JOLIET_NAME_MAX]; /* was: 65 = 64 + 1 (\0) */
|
||||
|
||||
if (src == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (flag & 2)
|
||||
maxchar = 103;
|
||||
|
||||
len = ucslen(src);
|
||||
if (len > 64) {
|
||||
len = 64;
|
||||
if (len > maxchar) {
|
||||
len = maxchar;
|
||||
}
|
||||
for (i = 0; i < len; i++) {
|
||||
uint16_t c = src[i];
|
||||
|
@ -153,13 +153,15 @@ char *iso_r_fileid(const char *src, size_t len, int relaxed, int forcedot);
|
||||
|
||||
/**
|
||||
* Create a Joliet file identifier that consists of name and extension. The
|
||||
* combined name and extension length will not exceed 128 bytes, and the
|
||||
* name and extension will be separated (.). All characters consist of
|
||||
* 2 bytes and the resulting string is NULL-terminated by a 2-byte NULL.
|
||||
* combined name and extension length will normally not exceed 64 characters
|
||||
* (= 128 bytes). The name and the extension will be separated (.).
|
||||
* All characters consist of 2 bytes and the resulting string is
|
||||
* NULL-terminated by a 2-byte NULL.
|
||||
*
|
||||
* Note that version number and (;1) is not appended.
|
||||
* @param flag
|
||||
* bit0= no_force_dots
|
||||
* bit1= allow 103 characters rather than 64
|
||||
* @return
|
||||
* NULL if the original name and extension both are of length 0.
|
||||
*/
|
||||
@ -171,10 +173,12 @@ uint16_t *iso_j_file_id(const uint16_t *src, int flag);
|
||||
* and the name and extension will be separated (.). All characters consist of
|
||||
* 2 bytes and the resulting string is NULL-terminated by a 2-byte NULL.
|
||||
*
|
||||
* @param flag
|
||||
* bit1= allow 103 characters rather than 64
|
||||
* @return
|
||||
* NULL if the original name and extension both are of length 0.
|
||||
*/
|
||||
uint16_t *iso_j_dir_id(const uint16_t *src);
|
||||
uint16_t *iso_j_dir_id(const uint16_t *src, int flag);
|
||||
|
||||
/**
|
||||
* Like strlen, but for Joliet strings.
|
||||
|
Reference in New Issue
Block a user