Compare commits
22 Commits
ZeroSevenS
...
ZeroTwoTwo
Author | SHA1 | Date | |
---|---|---|---|
6f52cc391b | |||
76fc21ec73 | |||
6d2d764fc7 | |||
3b5cc599e6 | |||
086154e9e2 | |||
4b9c45e86d | |||
a0b5f33654 | |||
13b562a273 | |||
26c64e5a45 | |||
e18b16149c | |||
1d006990d1 | |||
e2fa483126 | |||
a52eb43dc6 | |||
101c06d4b4 | |||
037fdfb8bf | |||
640cdaff1f | |||
a25c13ec62 | |||
810f13db1e | |||
5f1f2187f2 | |||
6f9c08e089 | |||
3eedf0327b | |||
bf4545e803 |
@ -1,2 +0,0 @@
|
||||
Note: this is a libburn-0.2.2 release candidate
|
||||
|
2
CONTRIBUTORS
Normal file
2
CONTRIBUTORS
Normal file
@ -0,0 +1,2 @@
|
||||
Joe Neeman
|
||||
Philippe Rouquier
|
24
Makefile.am
24
Makefile.am
@ -90,11 +90,8 @@ libinclude_HEADERS = \
|
||||
## Build test applications
|
||||
noinst_PROGRAMS = \
|
||||
test/libburner \
|
||||
test/burn \
|
||||
test/iso \
|
||||
test/master \
|
||||
test/poll \
|
||||
test/rip \
|
||||
test/toc \
|
||||
test/structest
|
||||
|
||||
@ -110,15 +107,6 @@ test_poll_SOURCES = test/poll.c
|
||||
test_toc_CPPFLAGS = -Ilibburn
|
||||
test_toc_LDADD = $(libburn_libburn_la_OBJECTS) $(THREAD_LIBS)
|
||||
test_toc_SOURCES = test/toc.c
|
||||
test_rip_CPPFLAGS = -Ilibburn
|
||||
test_rip_LDADD = $(libburn_libburn_la_OBJECTS) $(THREAD_LIBS)
|
||||
test_rip_SOURCES = test/rip.c
|
||||
test_burn_CPPFLAGS = -Ilibburn
|
||||
test_burn_LDADD = $(libburn_libburn_la_OBJECTS) $(THREAD_LIBS)
|
||||
test_burn_SOURCES = test/burn.c
|
||||
test_master_CPPFLAGS = -Ilibburn
|
||||
test_master_LDADD = $(libburn_libburn_la_OBJECTS) $(THREAD_LIBS)
|
||||
test_master_SOURCES = test/master.c
|
||||
test_structest_CPPFLAGS = -Ilibburn
|
||||
test_structest_LDADD = $(libburn_libburn_la_OBJECTS) $(THREAD_LIBS)
|
||||
test_structest_SOURCES = test/structest.c
|
||||
@ -173,15 +161,11 @@ indent_files = \
|
||||
$(libisofs_libisofs_la_SOURCES) \
|
||||
$(libburn_libburn_la_SOURCES) \
|
||||
$(test_libburner_SOURCES) \
|
||||
$(test_devices_SOURCES) \
|
||||
$(test_poll_SOURCES) \
|
||||
$(test_toc_SOURCES) \
|
||||
$(test_rip_SOURCES) \
|
||||
$(test_burn_SOURCES) \
|
||||
$(test_burniso_SOURCES) \
|
||||
$(test_master_SOURCES) \
|
||||
$(test_structest_SOURCES) \
|
||||
$(test_blank_SOURCES)
|
||||
$(test_iso_SOURCES)
|
||||
|
||||
|
||||
indent: $(indent_files)
|
||||
indent -bad -bap -nbbb -nbbo -nbc -bli0 -br -bls \
|
||||
@ -203,8 +187,12 @@ EXTRA_DIST = \
|
||||
libburn-1.pc.in \
|
||||
libisofs-1.pc.in \
|
||||
version.h.in \
|
||||
doc/comments \
|
||||
doc/doxygen.conf.in \
|
||||
README \
|
||||
AUTHORS \
|
||||
CONTRIBUTORS \
|
||||
COPYRIGHT \
|
||||
cdrskin/README \
|
||||
cdrskin/cdrecord_spy.sh \
|
||||
cdrskin/compile_cdrskin.sh \
|
||||
|
@ -2576,7 +2576,7 @@ int Cdrskin_driveno_of_location(struct CdrskiN *skin, char *devicename,
|
||||
for(i=0;i<skin->n_drives;i++) {
|
||||
|
||||
#ifdef Cdrskin_libburn_has_drive_get_adR
|
||||
ret= burn_drive_get_adr(&(skin->drives[skin->driveno]), adr);
|
||||
ret= burn_drive_get_adr(&(skin->drives[i]), adr);
|
||||
if(ret<=0)
|
||||
continue;
|
||||
#else
|
||||
@ -3669,10 +3669,15 @@ int Cdrskin_eject(struct CdrskiN *skin, int flag)
|
||||
|
||||
if(!skin->do_eject)
|
||||
return(1);
|
||||
if(Cdrskin_grab_drive(skin,2)>0)
|
||||
if(Cdrskin_grab_drive(skin,2)>0) {
|
||||
Cdrskin_release_drive(skin,1);
|
||||
if(skin->verbosity>=Cdrskin_verbose_debuG)
|
||||
ClN(fprintf(stderr,"cdrskin_debug: supposing drive eject to have worked\n"));
|
||||
if(skin->verbosity>=Cdrskin_verbose_debuG)
|
||||
ClN(fprintf(stderr,
|
||||
"cdrskin_debug: supposing drive eject to have worked\n"));
|
||||
} else {
|
||||
fprintf(stderr,"cdrskin: SORRY : Failed to finally eject tray.\n");
|
||||
return(0);
|
||||
}
|
||||
return(1);
|
||||
|
||||
#else /* Cdrskin_burn_drive_eject_brokeN */
|
||||
@ -3939,11 +3944,12 @@ set_blank:;
|
||||
} else if(strncmp(argv[i],"driveropts=",11)==0) {
|
||||
value_pt= argv[i]+11;
|
||||
set_driveropts:;
|
||||
if(strcmp(value_pt,"burnfree")==0) {
|
||||
if(strcmp(value_pt,"burnfree")==0 || strcmp(value_pt,"burnproof")==0) {
|
||||
skin->burnfree= 1;
|
||||
if(skin->verbosity>=Cdrskin_verbose_cmD)
|
||||
printf("cdrskin: burnfree : on\n");
|
||||
} else if(strcmp(argv[i]+11,"noburnfree")==0) {
|
||||
} else if(strcmp(argv[i]+11,"noburnfree")==0 ||
|
||||
strcmp(argv[i]+11,"noburnproof")==0 ) {
|
||||
skin->burnfree= 0;
|
||||
if(skin->verbosity>=Cdrskin_verbose_cmD)
|
||||
printf("cdrskin: burnfree : off\n");
|
||||
|
@ -1 +1 @@
|
||||
#define Cdrskin_timestamP "2006.09.16.194730"
|
||||
#define Cdrskin_timestamP "2006.09.20.134219"
|
||||
|
19
configure.ac
19
configure.ac
@ -19,7 +19,7 @@ dnl if MAJOR or MINOR version changes, be sure to change AC_INIT above to match
|
||||
dnl
|
||||
BURN_MAJOR_VERSION=0
|
||||
BURN_MINOR_VERSION=2
|
||||
BURN_MICRO_VERSION=1
|
||||
BURN_MICRO_VERSION=2
|
||||
BURN_INTERFACE_AGE=0
|
||||
BURN_BINARY_AGE=0
|
||||
BURN_VERSION=$BURN_MAJOR_VERSION.$BURN_MINOR_VERSION.$BURN_MICRO_VERSION
|
||||
@ -93,23 +93,6 @@ else
|
||||
CFLAGS="$CFLAGS -DDEBUG"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if we build the HTML documentation])
|
||||
AC_ARG_ENABLE(docs,
|
||||
[ --enable-docs Use doxygen to build HTML documentation],
|
||||
[case "${enableval}" in
|
||||
yes) build_docs=true ;;
|
||||
no) build_docs=false ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-docs) ;;
|
||||
esac],[build_docs=false])
|
||||
|
||||
if test "x$build_docs" = "xtrue"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
touch doc/doc.lock
|
||||
else
|
||||
AC_MSG_RESULT([no (use --enable-docs to enable)])
|
||||
rm -f doc/doc.lock
|
||||
fi
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
doc/doxygen.conf
|
||||
|
@ -320,8 +320,8 @@ void burn_disc_erase_sync(struct burn_drive *d, int fast)
|
||||
/* read the initial 0 stage */
|
||||
while (!d->test_unit_ready(d) && d->get_erase_progress(d) == 0)
|
||||
sleep(1);
|
||||
while (!d->test_unit_ready(d) &&
|
||||
(d->progress.sector = d->get_erase_progress(d)) > 0)
|
||||
while ((d->progress.sector = d->get_erase_progress(d)) > 0 ||
|
||||
!d->test_unit_ready(d))
|
||||
sleep(1);
|
||||
d->progress.sector = 0x10000;
|
||||
d->busy = BURN_DRIVE_IDLE;
|
||||
|
@ -319,6 +319,8 @@ ecma119_target_new(struct iso_volset *volset,
|
||||
if (t->joliet)
|
||||
joliet_calc_dir_pos(t, t->joliet_root);
|
||||
calc_file_pos(t, t->root);
|
||||
if (t->joliet)
|
||||
joliet_update_file_pos (t, t->joliet_root);
|
||||
|
||||
if (t->rockridge) {
|
||||
susp_finalize(t, t->root);
|
||||
@ -429,10 +431,10 @@ write_pri_vol_desc(struct ecma119_write_target *t, uint8_t *buf)
|
||||
{
|
||||
struct ecma119_pri_vol_desc *vol = (struct ecma119_pri_vol_desc*)buf;
|
||||
struct iso_volume *volume = t->volset->volume[t->volnum];
|
||||
char *vol_id = wcstoascii(volume->volume_id);
|
||||
char *pub_id = wcstoascii(volume->publisher_id);
|
||||
char *data_id = wcstoascii(volume->data_preparer_id);
|
||||
char *volset_id = wcstoascii(t->volset->volset_id);
|
||||
char *vol_id = str2ascii(volume->volume_id);
|
||||
char *pub_id = str2ascii(volume->publisher_id);
|
||||
char *data_id = str2ascii(volume->data_preparer_id);
|
||||
char *volset_id = str2ascii(t->volset->volset_id);
|
||||
|
||||
vol->vol_desc_type[0] = 1;
|
||||
memcpy(vol->std_identifier, "CD001", 5);
|
||||
|
@ -129,6 +129,7 @@ joliet_calc_dir_pos(struct ecma119_write_target *t,
|
||||
|
||||
root->block = t->curblock;
|
||||
t->curblock += div_up(root->len, t->block_size);
|
||||
|
||||
t->dirlist_joliet[t->curfile++] = root;
|
||||
for (i = 0; i < root->nchildren; i++) {
|
||||
ch = root->children[i];
|
||||
@ -141,6 +142,30 @@ joliet_calc_dir_pos(struct ecma119_write_target *t,
|
||||
t->curfile = 0;
|
||||
}
|
||||
|
||||
void
|
||||
joliet_update_file_pos(struct ecma119_write_target *t,
|
||||
struct joliet_tree_node *dir)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
assert(dir && ISO_ISDIR(dir->iso_self));
|
||||
for (i = 0; i < dir->nchildren; i++) {
|
||||
struct joliet_tree_node *ch;
|
||||
ch = dir->children[i];
|
||||
|
||||
if (!ISO_ISDIR (ch->iso_self)) {
|
||||
struct iso_tree_node *iso = ch->iso_self;
|
||||
ch->block = iso->block;
|
||||
}
|
||||
else
|
||||
joliet_update_file_pos(t, ch);
|
||||
}
|
||||
|
||||
/* reset curfile when we're finished */
|
||||
if (!dir->parent)
|
||||
t->curfile = 0;
|
||||
}
|
||||
|
||||
struct joliet_tree_node*
|
||||
joliet_tree_create(struct ecma119_write_target *t,
|
||||
struct iso_tree_node *iso_root)
|
||||
@ -231,10 +256,10 @@ write_sup_vol_desc(struct ecma119_write_target *t, uint8_t *buf)
|
||||
{
|
||||
struct ecma119_sup_vol_desc *vol = (struct ecma119_sup_vol_desc*)buf;
|
||||
struct iso_volume *volume = t->volset->volume[t->volnum];
|
||||
uint16_t *vol_id = wcstoucs(volume->volume_id);
|
||||
uint16_t *pub_id = wcstoucs(volume->publisher_id);
|
||||
uint16_t *data_id = wcstoucs(volume->data_preparer_id);
|
||||
uint16_t *volset_id = wcstoucs(t->volset->volset_id);
|
||||
uint16_t *vol_id = str2ucs(volume->volume_id);
|
||||
uint16_t *pub_id = str2ucs(volume->publisher_id);
|
||||
uint16_t *data_id = str2ucs(volume->data_preparer_id);
|
||||
uint16_t *volset_id = str2ucs(t->volset->volset_id);
|
||||
int vol_id_len = MIN(32, ucslen(vol_id) * 2);
|
||||
int pub_id_len = MIN(128, ucslen(pub_id) * 2);
|
||||
int data_id_len = MIN(128, ucslen(data_id) * 2);
|
||||
|
@ -52,6 +52,13 @@ joliet_calc_dir_size(struct ecma119_write_target *t, struct joliet_tree_node*);
|
||||
void
|
||||
joliet_calc_dir_pos(struct ecma119_write_target *t, struct joliet_tree_node*);
|
||||
|
||||
/**
|
||||
* Update the position of each file in the joliet hierarchy (to be called
|
||||
* AFTER the file positions in the iso tree have been set).
|
||||
*/
|
||||
void
|
||||
joliet_update_file_pos(struct ecma119_write_target *t, struct joliet_tree_node*);
|
||||
|
||||
/**
|
||||
* Calculate the size of the joliet path table and fill in the list of
|
||||
* directories.
|
||||
|
@ -86,7 +86,7 @@ iso_tree_add_new_file(struct iso_tree_node *parent, const char *name)
|
||||
|
||||
f->volume = parent ? parent->volume : NULL;
|
||||
f->parent = parent;
|
||||
f->name = parent ? towcs(name) : NULL;
|
||||
f->name = parent ? strdup(name) : NULL;
|
||||
f->attrib = get_attrib(parent);
|
||||
f->attrib.st_mode = 0777 | S_IFREG;
|
||||
f->loc.type = LIBISO_NONE;
|
||||
@ -192,7 +192,7 @@ iso_tree_print(const struct iso_tree_node *root, int spaces)
|
||||
memset(sp, ' ', spaces);
|
||||
sp[spaces] = '\0';
|
||||
|
||||
printf("%s%ls\n", sp, root->name);
|
||||
printf("%s%sn", sp, root->name);
|
||||
for (i=0; i < root->nchildren; i++) {
|
||||
iso_tree_print(root->children[i], spaces+2);
|
||||
}
|
||||
@ -219,5 +219,5 @@ void
|
||||
iso_tree_node_set_name(struct iso_tree_node *file, const char *name)
|
||||
{
|
||||
free(file->name);
|
||||
file->name = towcs(name);
|
||||
file->name = strdup(name);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ struct iso_tree_node
|
||||
{
|
||||
struct iso_volume *volume;
|
||||
struct iso_tree_node *parent;
|
||||
wchar_t *name;
|
||||
char *name;
|
||||
struct stat attrib; /**< The POSIX attributes of this node as
|
||||
* documented in "man 2 stat". */
|
||||
struct iso_file_location loc;
|
||||
|
215
libisofs/util.c
215
libisofs/util.c
@ -13,9 +13,15 @@
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <locale.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
/* avoids warning and names in iso, joliet and rockridge can't be > 255 bytes
|
||||
* anyway. There are at most 31 characters in iso level 1, 255 for rockridge,
|
||||
* 64 characters (* 2 since UCS) for joliet. */
|
||||
#define NAME_BUFFER_SIZE 255
|
||||
|
||||
int div_up(int n, int div)
|
||||
{
|
||||
return (n + div - 1) / div;
|
||||
@ -26,85 +32,162 @@ int round_up(int n, int mul)
|
||||
return div_up(n, mul) * mul;
|
||||
}
|
||||
|
||||
wchar_t *towcs(const char *str)
|
||||
/* this function must always return a name
|
||||
* since the caller never checks if a NULL
|
||||
* is returned. It also avoids some warnings. */
|
||||
char *str2ascii(const char *src_arg)
|
||||
{
|
||||
size_t len = strlen(str);
|
||||
wchar_t *ret = malloc(sizeof(wchar_t) * (len + 1));
|
||||
mbstate_t ps;
|
||||
wchar_t wsrc_[NAME_BUFFER_SIZE];
|
||||
char *src = (char*)wsrc_;
|
||||
char *ret_;
|
||||
char *ret;
|
||||
mbstate_t state;
|
||||
iconv_t conv;
|
||||
size_t numchars;
|
||||
size_t outbytes;
|
||||
size_t inbytes;
|
||||
size_t n;
|
||||
|
||||
memset(&ps, 0, sizeof(ps));
|
||||
n = mbsrtowcs(ret, &str, len, &ps);
|
||||
ret[len] = '\0';
|
||||
|
||||
if (n != len) {
|
||||
free(ret);
|
||||
return NULL;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *wcstoascii(const wchar_t *wsrc)
|
||||
{
|
||||
if (!wsrc)
|
||||
if (!src_arg)
|
||||
return NULL;
|
||||
|
||||
iconv_t conv = iconv_open("ASCII", "WCHAR_T");
|
||||
size_t outbytes = wcslen(wsrc);
|
||||
size_t inbytes = outbytes * sizeof(wchar_t);
|
||||
char src_[inbytes + sizeof(wchar_t)];
|
||||
char *src = src_;
|
||||
char *ret_, *ret;
|
||||
size_t n;
|
||||
/* convert the string to a wide character string. Note: outbytes
|
||||
* is in fact the number of characters in the string and doesn't
|
||||
* include the last NULL character. */
|
||||
memset(&state, 0, sizeof(state));
|
||||
numchars = mbsrtowcs(wsrc_, &src_arg, NAME_BUFFER_SIZE-1, &state);
|
||||
if (numchars < 0)
|
||||
return NULL;
|
||||
|
||||
inbytes = numchars * sizeof(wchar_t);
|
||||
|
||||
ret_ = malloc(numchars+1);
|
||||
outbytes = numchars;
|
||||
ret = ret_;
|
||||
|
||||
/* initialize iconv */
|
||||
conv = iconv_open("ASCII", "WCHAR_T");
|
||||
if (conv == (iconv_t)-1)
|
||||
return NULL;
|
||||
|
||||
memcpy(src, wsrc, inbytes + sizeof(wchar_t));
|
||||
ret = malloc(outbytes+1);
|
||||
ret[outbytes] = '\0';
|
||||
ret_ = ret;
|
||||
|
||||
n = iconv(conv, &src, &inbytes, &ret, &outbytes);
|
||||
if (n == -1) {
|
||||
free(ret_);
|
||||
return NULL;
|
||||
while(n == -1) {
|
||||
/* The destination buffer is too small. Stops here. */
|
||||
if(errno == E2BIG)
|
||||
break;
|
||||
|
||||
/* An incomplete multi bytes sequence was found. We
|
||||
* can't do anything here. That's quite unlikely. */
|
||||
if(errno == EINVAL)
|
||||
break;
|
||||
|
||||
/* The last possible error is an invalid multi bytes
|
||||
* sequence. Just replace the character with a "_".
|
||||
* Probably the character doesn't exist in ascii like
|
||||
* "é, è, à, ç, ..." in French. */
|
||||
*ret++ = '_';
|
||||
outbytes--;
|
||||
|
||||
if(!outbytes)
|
||||
break;
|
||||
|
||||
/* There was an error with one character but some other remain
|
||||
* to be converted. That's probably a multibyte character.
|
||||
* See above comment. */
|
||||
src += sizeof(wchar_t);
|
||||
inbytes -= sizeof(wchar_t);
|
||||
|
||||
if(!inbytes)
|
||||
break;
|
||||
|
||||
n = iconv(conv, &src, &inbytes, &ret, &outbytes);
|
||||
}
|
||||
|
||||
iconv_close(conv);
|
||||
|
||||
*ret='\0';
|
||||
return ret_;
|
||||
}
|
||||
|
||||
/* FIXME: C&P */
|
||||
uint16_t *wcstoucs(const wchar_t *wsrc)
|
||||
uint16_t *str2ucs(const char *src_arg)
|
||||
{
|
||||
if (!wsrc)
|
||||
return calloc(2, 1); /* empty UCS string */
|
||||
|
||||
iconv_t conv = iconv_open("UCS-2BE", "WCHAR_T");
|
||||
size_t outbytes = wcslen(wsrc) * 2;
|
||||
size_t inbytes = outbytes * sizeof(wchar_t) / 2;
|
||||
char src_[inbytes + sizeof(wchar_t)];
|
||||
char *src = src_;
|
||||
char *ret_, *ret;
|
||||
wchar_t wsrc_[NAME_BUFFER_SIZE];
|
||||
char *src = (char*)wsrc_;
|
||||
char *ret_;
|
||||
char *ret;
|
||||
mbstate_t state;
|
||||
iconv_t conv;
|
||||
size_t outbytes;
|
||||
size_t numchars;
|
||||
size_t inbytes;
|
||||
size_t n;
|
||||
|
||||
if (conv == (iconv_t)-1)
|
||||
return calloc(2, 1);
|
||||
if (!src_arg)
|
||||
return calloc(2, 1); /* empty UCS string */
|
||||
|
||||
memcpy(src, wsrc, inbytes + sizeof(wchar_t));
|
||||
ret = malloc(outbytes + sizeof(wchar_t));
|
||||
ret[outbytes] = 0;
|
||||
ret[outbytes+1] = 0;
|
||||
ret_ = ret;
|
||||
/* convert the string to a wide character string. Note: outbytes
|
||||
* is in fact the number of characters in the string and doesn't
|
||||
* include the last NULL character. */
|
||||
memset(&state, 0, sizeof(state));
|
||||
numchars = mbsrtowcs(wsrc_, &src_arg, NAME_BUFFER_SIZE-1, &state);
|
||||
if (numchars < 0)
|
||||
return calloc(2, 1); /* empty UCS string */
|
||||
|
||||
inbytes = numchars * sizeof(wchar_t);
|
||||
|
||||
outbytes = numchars * sizeof(uint16_t);
|
||||
ret_ = malloc ((numchars+1) * sizeof(uint16_t));
|
||||
ret = ret_;
|
||||
|
||||
/* initialize iconv */
|
||||
conv = iconv_open("UCS-2BE", "WCHAR_T");
|
||||
if (conv == (iconv_t)-1)
|
||||
return calloc(2, 1); /* empty UCS string */
|
||||
|
||||
n = iconv(conv, &src, &inbytes, &ret, &outbytes);
|
||||
if (n == -1) {
|
||||
perror ("error in iconv conversion");
|
||||
free(ret_);
|
||||
return calloc(2, 1);
|
||||
while(n == -1) {
|
||||
/* The destination buffer is too small. Stops here. */
|
||||
if(errno == E2BIG)
|
||||
break;
|
||||
|
||||
/* An incomplete multi bytes sequence was found. We
|
||||
* can't do anything here. That's quite unlikely. */
|
||||
if(errno == EINVAL)
|
||||
break;
|
||||
|
||||
/* The last possible error is an invalid multi bytes
|
||||
* sequence. Just replace the character with a "_".
|
||||
* Probably the character doesn't exist in ascii like
|
||||
* "é, è, à, ç, ..." in French. */
|
||||
*((uint16_t*) ret) = '_';
|
||||
ret += sizeof(uint16_t);
|
||||
outbytes -= sizeof(uint16_t);
|
||||
|
||||
if(!outbytes)
|
||||
break;
|
||||
|
||||
/* There was an error with one character but some other remain
|
||||
* to be converted. That's probably a multibyte character.
|
||||
* See above comment. */
|
||||
src += sizeof(wchar_t);
|
||||
inbytes -= sizeof(wchar_t);
|
||||
|
||||
if(!inbytes)
|
||||
break;
|
||||
|
||||
n = iconv(conv, &src, &inbytes, &ret, &outbytes);
|
||||
}
|
||||
|
||||
iconv_close(conv);
|
||||
|
||||
/* close the ucs string */
|
||||
*((uint16_t*) ret) = 0;
|
||||
|
||||
return (uint16_t*)ret_;
|
||||
}
|
||||
|
||||
|
||||
static int valid_d_char(char c)
|
||||
{
|
||||
return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c == '_');
|
||||
@ -132,9 +215,9 @@ static int valid_p_char(char c)
|
||||
|| (c == '.') || (c == '_') || (c == '-');
|
||||
}
|
||||
|
||||
static char *iso_dirid(const wchar_t *src, int size)
|
||||
static char *iso_dirid(const char *src, int size)
|
||||
{
|
||||
char *ret = wcstoascii(src);
|
||||
char *ret = str2ascii(src);
|
||||
size_t len, i;
|
||||
|
||||
if (!ret)
|
||||
@ -153,19 +236,19 @@ static char *iso_dirid(const wchar_t *src, int size)
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *iso_1_dirid(const wchar_t *src)
|
||||
char *iso_1_dirid(const char *src)
|
||||
{
|
||||
return iso_dirid(src, 8);
|
||||
}
|
||||
|
||||
char *iso_2_dirid(const wchar_t *src)
|
||||
char *iso_2_dirid(const char *src)
|
||||
{
|
||||
return iso_dirid(src, 31);
|
||||
}
|
||||
|
||||
char *iso_1_fileid(const wchar_t *wsrc)
|
||||
char *iso_1_fileid(const char *src_arg)
|
||||
{
|
||||
char *src = wcstoascii(wsrc);
|
||||
char *src = str2ascii(src_arg);
|
||||
char *dest;
|
||||
char *dot; /* Position of the last dot in the
|
||||
filename, will be used to calculate
|
||||
@ -214,9 +297,9 @@ char *iso_1_fileid(const wchar_t *wsrc)
|
||||
return dest;
|
||||
}
|
||||
|
||||
char *iso_2_fileid(const wchar_t *wsrc)
|
||||
char *iso_2_fileid(const char *src_arg)
|
||||
{
|
||||
char *src = wcstoascii(wsrc);
|
||||
char *src = str2ascii(src_arg);
|
||||
char *dest;
|
||||
char *dot;
|
||||
int lname, lext, lnname, lnext, pos, i;
|
||||
@ -274,9 +357,9 @@ char *iso_2_fileid(const wchar_t *wsrc)
|
||||
}
|
||||
|
||||
char *
|
||||
iso_p_fileid(const wchar_t *src)
|
||||
iso_p_fileid(const char *src)
|
||||
{
|
||||
char *ret = wcstoascii(src);
|
||||
char *ret = str2ascii(src);
|
||||
size_t i, len;
|
||||
|
||||
if (!ret)
|
||||
@ -291,9 +374,9 @@ iso_p_fileid(const wchar_t *src)
|
||||
}
|
||||
|
||||
uint16_t *
|
||||
iso_j_id(const wchar_t *src)
|
||||
iso_j_id(const char *src_arg)
|
||||
{
|
||||
uint16_t *j_str = wcstoucs(src);
|
||||
uint16_t *j_str = str2ucs(src_arg);
|
||||
size_t len = ucslen(j_str);
|
||||
size_t n;
|
||||
|
||||
|
@ -31,18 +31,18 @@ extern inline int round_up(int n, int mul)
|
||||
}
|
||||
|
||||
wchar_t *towcs(const char *);
|
||||
char *wcstoascii(const wchar_t *);
|
||||
uint16_t *wcstoucs(const wchar_t*);
|
||||
char *str2ascii(const char*);
|
||||
uint16_t *str2ucs(const char*);
|
||||
|
||||
/**
|
||||
* Create a level 1 directory identifier.
|
||||
*/
|
||||
char *iso_1_dirid(const wchar_t *src);
|
||||
char *iso_1_dirid(const char *src);
|
||||
|
||||
/**
|
||||
* Create a level 2 directory identifier.
|
||||
*/
|
||||
char *iso_2_dirid(const wchar_t *src);
|
||||
char *iso_2_dirid(const char *src);
|
||||
|
||||
/**
|
||||
* Create a level 1 file identifier that consists of a name, extension and
|
||||
@ -51,7 +51,7 @@ char *iso_2_dirid(const wchar_t *src);
|
||||
* length 3, followed by a separator (;) and a version number (digit 1).
|
||||
* @return NULL if the original name and extension both are of length 0.
|
||||
*/
|
||||
char *iso_1_fileid(const wchar_t *src);
|
||||
char *iso_1_fileid(const char *src);
|
||||
|
||||
/**
|
||||
* Create a level 2 file identifier that consists of a name, extension and
|
||||
@ -60,7 +60,7 @@ char *iso_1_fileid(const wchar_t *src);
|
||||
* followed by a separator (;) and a version number (digit 1).
|
||||
* @return NULL if the original name and extension both are of length 0.
|
||||
*/
|
||||
char *iso_2_fileid(const wchar_t *src);
|
||||
char *iso_2_fileid(const char *src);
|
||||
|
||||
/**
|
||||
* Create a Joliet file or directory identifier that consists of a name,
|
||||
@ -73,7 +73,7 @@ char *iso_2_fileid(const wchar_t *src);
|
||||
* @param size will be set to the size (in bytes) of the identifier.
|
||||
* @return NULL if the original name and extension both are of length 0 or the conversion from the current codeset to UCS-2BE is not available.
|
||||
*/
|
||||
uint16_t *iso_j_id(const wchar_t *src);
|
||||
uint16_t *iso_j_id(const char *src);
|
||||
|
||||
/**
|
||||
* FIXME: what are the requirements for these next two? Is this for RR?
|
||||
@ -82,14 +82,14 @@ uint16_t *iso_j_id(const wchar_t *src);
|
||||
* The resulting file name will not exceed 250 characters.
|
||||
* @return NULL if the original name and extension both are of length 0.
|
||||
*/
|
||||
char *iso_p_fileid(const wchar_t *src);
|
||||
char *iso_p_fileid(const char *src);
|
||||
|
||||
/**
|
||||
* Create a POSIX portable directory name.
|
||||
* The resulting directory name will not exceed 250 characters.
|
||||
* @return NULL if the original name is of length 0.
|
||||
*/
|
||||
char *iso_p_dirid(const wchar_t *src);
|
||||
char *iso_p_dirid(const char *src);
|
||||
|
||||
void iso_lsb(uint8_t *buf, uint32_t num, int bytes);
|
||||
void iso_msb(uint8_t *buf, uint32_t num, int bytes);
|
||||
|
@ -19,7 +19,7 @@ iso_volset_new(struct iso_volume *vol, const char *id)
|
||||
volset->refcount = 1;
|
||||
volset->volume = malloc(sizeof(void *));
|
||||
volset->volume[0] = vol;
|
||||
volset->volset_id = towcs(id);
|
||||
volset->volset_id = strdup(id);
|
||||
|
||||
vol->refcount++;
|
||||
return volset;
|
||||
@ -63,11 +63,11 @@ iso_volume_new_with_root(const char *volume_id,
|
||||
volume->root = root ? root : iso_tree_new_root(volume);
|
||||
|
||||
if (volume_id != NULL)
|
||||
volume->volume_id = towcs(volume_id);
|
||||
volume->volume_id = strdup(volume_id);
|
||||
if (publisher_id != NULL)
|
||||
volume->publisher_id = towcs(publisher_id);
|
||||
volume->publisher_id = strdup(publisher_id);
|
||||
if (data_preparer_id != NULL)
|
||||
volume->data_preparer_id = towcs(data_preparer_id);
|
||||
volume->data_preparer_id = strdup(data_preparer_id);
|
||||
return volume;
|
||||
}
|
||||
|
||||
|
@ -21,9 +21,9 @@ struct iso_volume
|
||||
struct iso_tree_node *root; /**< Root of the directory tree for the
|
||||
volume. */
|
||||
|
||||
wchar_t *volume_id; /**< Volume identifier. */
|
||||
wchar_t *publisher_id; /**< Volume publisher. */
|
||||
wchar_t *data_preparer_id; /**< Volume data preparer. */
|
||||
char *volume_id; /**< Volume identifier. */
|
||||
char *publisher_id; /**< Volume publisher. */
|
||||
char *data_preparer_id; /**< Volume data preparer. */
|
||||
};
|
||||
|
||||
/**
|
||||
@ -38,7 +38,7 @@ struct iso_volset
|
||||
int volset_size; /**< The number of volumes in this
|
||||
volume set. */
|
||||
|
||||
wchar_t *volset_id; /**< The id of this volume set, encoded
|
||||
char *volset_id; /**< The id of this volume set, encoded
|
||||
in the current locale. */
|
||||
};
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
126
test/master.c
126
test/master.c
@ -1,126 +0,0 @@
|
||||
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
|
||||
#include <libburn/libburn.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static struct burn_drive_info *drives;
|
||||
static unsigned int n_drives;
|
||||
|
||||
void burn_files(struct burn_drive *drive, struct burn_disc *disc)
|
||||
{
|
||||
struct burn_write_opts *o;
|
||||
enum burn_disc_status s;
|
||||
|
||||
if (!burn_drive_grab(drive, 1)) {
|
||||
printf("Unable to open the drive!\n");
|
||||
return;
|
||||
}
|
||||
while (burn_drive_get_status(drive, NULL))
|
||||
usleep(1000);
|
||||
|
||||
while ((s = burn_disc_get_status(drive)) == BURN_DISC_UNREADY)
|
||||
usleep(1000);
|
||||
|
||||
if (s != BURN_DISC_BLANK) {
|
||||
burn_drive_release(drive, 0);
|
||||
printf("Please insert blank media in the drive\n");
|
||||
return;
|
||||
}
|
||||
o = burn_write_opts_new(drive);
|
||||
burn_drive_set_speed(drive, 0, 2816);
|
||||
burn_write_opts_set_perform_opc(o, 0);
|
||||
burn_write_opts_set_write_type(o, BURN_WRITE_TAO, BURN_BLOCK_MODE1);
|
||||
burn_write_opts_set_simulate(o, 1);
|
||||
/* want failure on seggy while debugging :) */
|
||||
burn_write_opts_set_underrun_proof(o, 0);
|
||||
burn_structure_print_disc(disc);
|
||||
burn_disc_write(o, disc);
|
||||
burn_write_opts_free(o);
|
||||
|
||||
while (burn_drive_get_status(drive, NULL)) {
|
||||
sleep(1);
|
||||
}
|
||||
printf("\n");
|
||||
burn_drive_release(drive, 0);
|
||||
burn_disc_free(disc);
|
||||
}
|
||||
|
||||
void parse_args(int argc, char **argv, int *drive, struct burn_disc **disc)
|
||||
{
|
||||
int i, tmode = BURN_AUDIO;
|
||||
int help = 1;
|
||||
struct burn_session *session;
|
||||
struct burn_track *tr;
|
||||
struct burn_source *src;
|
||||
|
||||
*disc = burn_disc_create();
|
||||
session = burn_session_create();
|
||||
burn_disc_add_session(*disc, session, BURN_POS_END);
|
||||
for (i = 1; i < argc; ++i) {
|
||||
if (!strcmp(argv[i], "--drive")) {
|
||||
++i;
|
||||
if (i >= argc)
|
||||
printf("--drive requires an argument\n");
|
||||
else
|
||||
*drive = atoi(argv[i]);
|
||||
} else if (!strcmp(argv[i], "--audio")) {
|
||||
tmode = BURN_AUDIO;
|
||||
} else if (!strcmp(argv[i], "--data")) {
|
||||
tmode = BURN_MODE1;
|
||||
} else if (!strcmp(argv[i], "--verbose")) {
|
||||
++i;
|
||||
if (i >= argc)
|
||||
printf("--verbose requires an argument\n");
|
||||
else
|
||||
burn_set_verbosity(atoi(argv[i]));
|
||||
} else if (!strcmp(argv[i], "--help")) {
|
||||
help = 1; /* who cares */
|
||||
} else {
|
||||
help = 0;
|
||||
printf("%s is a track\n", argv[i]);
|
||||
|
||||
tr = burn_track_create();
|
||||
src = burn_file_source_new(argv[i], NULL);
|
||||
burn_track_set_source(tr, src);
|
||||
burn_source_free(src);
|
||||
burn_track_define_data(tr, 0, 0, 1, tmode);
|
||||
burn_session_add_track(session, tr, BURN_POS_END);
|
||||
}
|
||||
}
|
||||
if (help) {
|
||||
printf("Usage: %s [--drive <num>] [--verbose <level>] files\n",
|
||||
argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int drive = 0;
|
||||
struct burn_disc *disc;
|
||||
|
||||
parse_args(argc, argv, &drive, &disc);
|
||||
printf("Initializing library...");
|
||||
if (burn_initialize())
|
||||
printf("Success\n");
|
||||
else {
|
||||
printf("Failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Scanning for devices...");
|
||||
while (!burn_drive_scan(&drives, &n_drives)) ;
|
||||
printf("Done\n");
|
||||
|
||||
burn_files(drives[drive].drive, disc);
|
||||
burn_drive_info_free(drives);
|
||||
burn_finish();
|
||||
return 0;
|
||||
}
|
54
test/rip.c
54
test/rip.c
@ -1,54 +0,0 @@
|
||||
/* THIS IS NOT A PROPER EXAMPLE */
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <libburn/libburn.h>
|
||||
|
||||
static struct burn_drive_info *drives;
|
||||
static unsigned int n_drives;
|
||||
|
||||
#warning this example is totally fried
|
||||
int main()
|
||||
{
|
||||
#if 0
|
||||
struct burn_drive *drive;
|
||||
struct burn_read_opts o;
|
||||
|
||||
burn_initialize();
|
||||
o.datafd =
|
||||
open("/xp/burn/blah.data", O_CREAT | O_WRONLY,
|
||||
S_IRUSR | S_IWUSR);
|
||||
o.subfd =
|
||||
open("/xp/burn/blah.sub", O_CREAT | O_WRONLY,
|
||||
S_IRUSR | S_IWUSR);
|
||||
o.raw = 1;
|
||||
o.c2errors = 0;
|
||||
o.subcodes_audio = 1;
|
||||
o.subcodes_data = 1;
|
||||
o.hardware_error_recovery = 1;
|
||||
o.report_recovered_errors = 0;
|
||||
o.transfer_damaged_blocks = 1;
|
||||
o.hardware_error_retries = 1;
|
||||
|
||||
printf("Scanning for devices...");
|
||||
while (!burn_drive_scan(&drives, &n_drives)) ;
|
||||
printf("Done\n");
|
||||
drive = drives[0].drive;
|
||||
burn_drive_set_speed(drive, 0, 0);
|
||||
|
||||
if (!burn_drive_grab(drive, 1)) {
|
||||
printf("Unable to open the drive!\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
while (burn_drive_get_status(drive, NULL))
|
||||
usleep(1000);
|
||||
|
||||
burn_disc_read(drive, &o);
|
||||
#endif
|
||||
return EXIT_SUCCESS;
|
||||
}
|
BIN
test/tree.pyc
BIN
test/tree.pyc
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
Note: this is a libburn-0.2.2 release candidate
|
||||
|
Reference in New Issue
Block a user