If a file name is encoded in a different encoding than default input, current
implementation make image generation to be cancelled. As this can happen quite
frequent, due to files from discs or Windows partitions incorrectly mounted,
the best we can do is just ignore this, replacing the wrong character with a
'_'.
At this time, nglibisofs is able to output an image!! Note that communication
between writer and read thread is done via a pipe. That will be replaced by a
ring buffer in the near future.
Due to a bug, when a file was ignored (for example, a dir whose deep
level was greater than 8), all its parents where ignored, what causes
root to be ignored!
This has to ensure that file names are unique among all files in an iso
directory. Current implementation can be improved by using a hash table
to keep the names, instead of iterate over all children. An alternative
method, keeping children sorted all the time, thus allowing binary
search, has been considered but discarded.
Current implementation support up to 9,999,999 equal files per
directory.
This only adds the tree creation functions, no sorting and name mangling
yet. Only plain ECMA-119 supported for now, nor RR, relaxed
restrictions, etc..
This also adds a little test program.
It happens that tsearch seems to not return a pointer to the inserted element,
but a pointer to a pointer to the inserted element (that makes sense, as we
are inserted pointers...). This bug, thus, was related to a wrong
understanding of the tsearch API!
Ecma119Image, defined for first time in this commit, is the context for image
written. It keeps the low level objects needed during image written.
IsoFileSrc is the low level object that takes care about the info needed to
write file contents to image. It takes care about reading from Stream in 2K
block chunks. To prevent the same file be written twice to image, we keep in
Ecma119Image a search tree, indexed by the triple key (fs, device, inode) that
uniquelly identifies a source.
This commit also to the following changes:
- create_node() on builder never frees the IsoFileSource, it is responsability
of the caller to free it.
- Recursive addition options added to IsoImage (not exposed to public API yet)
- create_node() takes care about follow_symlinks
- Added little demo program to test it.