Browse Source

Enhance support for relaxe ISO constraints.

release-1.5.4.branch
Vreixo Formoso 15 years ago
parent
commit
9a66c6cd33
  1. 3
      demo/ecma119_tree.c
  2. 1
      demo/iso.c
  3. 1
      demo/iso_grow.c
  4. 1
      demo/iso_modify.c
  5. 1
      demo/iso_ms.c
  6. 1
      src/ecma119.c
  7. 1
      src/ecma119.h
  8. 14
      src/ecma119_tree.c
  9. 46
      src/libisofs.h

3
demo/ecma119_tree.c

@ -12,6 +12,7 @@
#include "filesrc.h"
#include "node.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -41,7 +42,7 @@ static void
print_dir(Ecma119Node *dir, int level)
{
int i;
char sp[level * 2 + 1];
char *sp = alloca(level * 2 + 1);
for (i = 0; i < level * 2; i += 2) {
sp[i] = '|';

1
demo/iso.c

@ -55,6 +55,7 @@ int main(int argc, char **argv)
0, /* joliet */
0, /* omit_version_numbers */
0, /* allow_deep_paths */
0, /* allow_longer_paths */
0, /* max_37_char_filenames */
0, /* no_force_dots */
0, /* allow_lowercase */

1
demo/iso_grow.c

@ -38,6 +38,7 @@ int main(int argc, char **argv)
0, /* joliet */
0, /* omit_version_numbers */
0, /* allow_deep_paths */
0, /* allow_longer_paths */
0, /* max_37_char_filenames */
0, /* no_force_dots */
0, /* allow_lowercase */

1
demo/iso_modify.c

@ -33,6 +33,7 @@ int main(int argc, char **argv)
0, /* joliet */
0, /* omit_version_numbers */
0, /* allow_deep_paths */
0, /* allow_longer_paths */
0, /* max_37_char_filenames */
0, /* no_force_dots */
0, /* allow_lowercase */

1
demo/iso_ms.c

@ -33,6 +33,7 @@ int main(int argc, char **argv)
0, /* joliet */
0, /* omit_version_numbers */
0, /* allow_deep_paths */
0, /* allow_longer_paths */
0, /* max_37_char_filenames */
0, /* no_force_dots */
0, /* allow_lowercase */

1
src/ecma119.c

@ -847,6 +847,7 @@ int ecma119_image_new(IsoImage *src, Ecma119WriteOpts *opts, Ecma119Image **img)
target->omit_version_numbers = opts->omit_version_numbers
| opts->max_37_char_filenames;
target->allow_deep_paths = opts->allow_deep_paths;
target->allow_longer_paths = opts->allow_longer_paths;
target->max_37_char_filenames = opts->max_37_char_filenames;
target->no_force_dots = opts->no_force_dots;
target->allow_lowercase = opts->allow_lowercase;

1
src/ecma119.h

@ -39,6 +39,7 @@ struct ecma119_image
/* relaxed constraints */
unsigned int omit_version_numbers :1;
unsigned int allow_deep_paths :1;
unsigned int allow_longer_paths :1;
unsigned int max_37_char_filenames :1;
unsigned int no_force_dots :1;
unsigned int allow_lowercase :1;

14
src/ecma119_tree.c

@ -296,11 +296,17 @@ int create_tree(Ecma119Image *image, IsoNode *iso, Ecma119Node **tree,
return ret;
}
max_path = pathlen + 1 + (iso_name ? strlen(iso_name) : 0);
if (!image->rockridge && !image->allow_deep_paths) {
if ((iso->type == LIBISO_DIR && depth > 8) || max_path > 255) {
if (!image->rockridge) {
if ((iso->type == LIBISO_DIR && depth > 8) && !image->allow_deep_paths) {
iso_msg_note(image->image->messenger, LIBISO_FILE_IGNORED,
"File \"%s\" can't be added, because depth > 8 "
"or path length over 255", iso->name);
"File \"%s\" can't be added, because directory depth "
"is greater than 8.", iso->name);
free(iso_name);
return 0;
} else if (max_path > 255 && !image->allow_longer_paths) {
iso_msg_note(image->image->messenger, LIBISO_FILE_IGNORED,
"File \"%s\" can't be added, because path length "
"is greater than 255 characters", iso->name);
free(iso_name);
return 0;
}

46
src/libisofs.h

@ -100,13 +100,57 @@ typedef struct
unsigned int rockridge :1;
unsigned int joliet :1;
/* relaxed constraints */
/*
* Relaxed constraints. Setting any of these to 1 break the specifications,
* but it is supposed to work on most moderns systems. Use with caution.
*/
/**
* Omit the version number (";1") at the end of the ISO-9660 identifiers.
* Version numbers are usually not used.
*/
unsigned int omit_version_numbers :1;
/**
* Allow ISO-9660 directory hierarchy to be deeper than 8 levels.
*/
unsigned int allow_deep_paths :1;
/**
* Allow path in the ISO-9660 tree to have more than 255 characters.
*/
unsigned int allow_longer_paths :1;
/**
* Allow a single file or directory hierarchy to have up to 37 characters.
* This is larger than the 31 characters allowed by ISO level 2, and the
* extra space is taken from the version number, so this also forces
* omit_version_numbers.
*/
unsigned int max_37_char_filenames :1;
/**
* ISO-9660 forces filenames to have a ".", that separates file name from
* extension. libisofs adds it if original filename doesn't has one. Set
* this to 1 to prevent this behavior
*/
unsigned int no_force_dots :1;
/**
* Allow lowercase characters in ISO-9660 filenames. By default, only
* uppercase characters, numbers and a few other characters are allowed.
*/
unsigned int allow_lowercase :1;
/**
* Allow all ASCII characters to be appear on an ISO-9660 filename. Note
* that "/" and "\0" characters are never allowed, even in RR names.
*/
unsigned int allow_full_ascii :1;
/**
* Allow paths in the Joliet tree to have more than 240 characters.
*/
unsigned int joliet_longer_paths :1;
/**< If files should be sorted based on their weight. */

Loading…
Cancel
Save