Add support for ISO-9660:1999.

This commit is contained in:
Vreixo Formoso
2008-01-16 21:51:41 +01:00
parent 46507e68aa
commit 5ed68d20e9
12 changed files with 924 additions and 24 deletions

View File

@ -10,6 +10,7 @@
#include "libisofs.h"
#include "ecma119.h"
#include "joliet.h"
#include "iso1999.h"
#include "eltorito.h"
#include "ecma119_tree.h"
#include "error.h"
@ -291,27 +292,6 @@ void write_one_dir_record(Ecma119Image *t, Ecma119Node *node, int file_id,
}
}
/**
* Copy up to \p max characters from \p src to \p dest. If \p src has less than
* \p max characters, we pad dest with " " characters.
*/
static
void strncpy_pad(char *dest, const char *src, size_t max)
{
size_t len, i;
if (src != NULL) {
len = MIN(strlen(src), max);
} else {
len = 0;
}
for (i = 0; i < len; ++i)
dest[i] = src[i];
for (i = len; i < max; ++i)
dest[i] = ' ';
}
/**
* Write the Primary Volume Descriptor (ECMA-119, 8.4)
*/
@ -843,6 +823,7 @@ int ecma119_image_new(IsoImage *src, Ecma119WriteOpts *opts, Ecma119Image **img)
target->iso_level = opts->level;
target->rockridge = opts->rockridge;
target->joliet = opts->joliet;
target->iso1999 = opts->iso1999;
target->ino = 0;
target->omit_version_numbers = opts->omit_version_numbers
| opts->max_37_char_filenames;
@ -912,6 +893,9 @@ int ecma119_image_new(IsoImage *src, Ecma119WriteOpts *opts, Ecma119Image **img)
if (target->joliet) {
nwriters++;
}
if (target->iso1999) {
nwriters++;
}
target->writers = malloc(nwriters * sizeof(void*));
if (target->writers == NULL) {
@ -941,6 +925,14 @@ int ecma119_image_new(IsoImage *src, Ecma119WriteOpts *opts, Ecma119Image **img)
goto target_cleanup;
}
}
/* create writer for ISO 9660:1999 structure */
if (target->iso1999) {
ret = iso1999_writer_create(target);
if (ret < 0) {
goto target_cleanup;
}
}
voldesc_size = target->curblock - target->ms_block - 16;