Change message functions signature.
This commit is contained in:
parent
d8cb56ecf3
commit
e18f5d8898
@ -185,12 +185,13 @@ int ecma119_writer_compute_data_blocks(IsoImageWriter *writer)
|
|||||||
target = writer->target;
|
target = writer->target;
|
||||||
|
|
||||||
/* compute position of directories */
|
/* compute position of directories */
|
||||||
iso_msg_debug(target->image, "Computing position of dir structure");
|
iso_msg_debug(target->image->messenger,
|
||||||
|
"Computing position of dir structure");
|
||||||
target->ndirs = 0;
|
target->ndirs = 0;
|
||||||
calc_dir_pos(target, target->root);
|
calc_dir_pos(target, target->root);
|
||||||
|
|
||||||
/* compute length of pathlist */
|
/* compute length of pathlist */
|
||||||
iso_msg_debug(target->image, "Computing length of pathlist");
|
iso_msg_debug(target->image->messenger, "Computing length of pathlist");
|
||||||
path_table_size = calc_path_table_size(target->root);
|
path_table_size = calc_path_table_size(target->root);
|
||||||
|
|
||||||
/* compute location for path tables */
|
/* compute location for path tables */
|
||||||
@ -295,7 +296,7 @@ int ecma119_writer_write_vol_desc(IsoImageWriter *writer)
|
|||||||
t = writer->target;
|
t = writer->target;
|
||||||
image = t->image;
|
image = t->image;
|
||||||
|
|
||||||
iso_msg_debug(image, "Write Primary Volume Descriptor");
|
iso_msg_debug(image->messenger, "Write Primary Volume Descriptor");
|
||||||
|
|
||||||
memset(&vol, 0, sizeof(struct ecma119_pri_vol_desc));
|
memset(&vol, 0, sizeof(struct ecma119_pri_vol_desc));
|
||||||
|
|
||||||
@ -546,7 +547,7 @@ int write_path_tables(Ecma119Image *t)
|
|||||||
size_t i, j, cur;
|
size_t i, j, cur;
|
||||||
Ecma119Node **pathlist;
|
Ecma119Node **pathlist;
|
||||||
|
|
||||||
iso_msg_debug(t->image, "Writing ISO Path tables");
|
iso_msg_debug(t->image->messenger, "Writing ISO Path tables");
|
||||||
|
|
||||||
/* allocate temporal pathlist */
|
/* allocate temporal pathlist */
|
||||||
pathlist = malloc(sizeof(void*) * t->ndirs);
|
pathlist = malloc(sizeof(void*) * t->ndirs);
|
||||||
@ -634,7 +635,8 @@ int ecma119_writer_create(Ecma119Image *target)
|
|||||||
/* add this writer to image */
|
/* add this writer to image */
|
||||||
target->writers[target->nwriters++] = writer;
|
target->writers[target->nwriters++] = writer;
|
||||||
|
|
||||||
iso_msg_debug(target->image, "Creating low level ECMA-119 tree...");
|
iso_msg_debug(target->image->messenger,
|
||||||
|
"Creating low level ECMA-119 tree...");
|
||||||
ret = ecma119_tree_create(target);
|
ret = ecma119_tree_create(target);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
@ -654,7 +656,7 @@ void *write_function(void *arg)
|
|||||||
IsoImageWriter *writer;
|
IsoImageWriter *writer;
|
||||||
|
|
||||||
Ecma119Image *target = (Ecma119Image*)arg;
|
Ecma119Image *target = (Ecma119Image*)arg;
|
||||||
iso_msg_debug(target->image, "Starting image writing...");
|
iso_msg_debug(target->image->messenger, "Starting image writing...");
|
||||||
|
|
||||||
target->bytes_written = (off_t) 0;
|
target->bytes_written = (off_t) 0;
|
||||||
target->percent_written = 0;
|
target->percent_written = 0;
|
||||||
@ -669,7 +671,7 @@ void *write_function(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* write volume descriptors, one per writer */
|
/* write volume descriptors, one per writer */
|
||||||
iso_msg_debug(target->image, "Write volume descriptors");
|
iso_msg_debug(target->image->messenger, "Write volume descriptors");
|
||||||
for (i = 0; i < target->nwriters; ++i) {
|
for (i = 0; i < target->nwriters; ++i) {
|
||||||
writer = target->writers[i];
|
writer = target->writers[i];
|
||||||
res = writer->write_vol_desc(writer);
|
res = writer->write_vol_desc(writer);
|
||||||
@ -706,7 +708,7 @@ void *write_function(void *arg)
|
|||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
|
|
||||||
write_error: ;
|
write_error: ;
|
||||||
iso_msg_fatal(target->image, LIBISO_WRITE_ERROR,
|
iso_msg_fatal(target->image->messenger, LIBISO_WRITE_ERROR,
|
||||||
"Image write error, code %d", res);
|
"Image write error, code %d", res);
|
||||||
iso_ring_buffer_writer_close(target->buffer);
|
iso_ring_buffer_writer_close(target->buffer);
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
@ -843,7 +845,7 @@ int ecma119_image_new(IsoImage *src, Ecma119WriteOpts *opts, Ecma119Image **img)
|
|||||||
ret = pthread_create(&(target->wthread), &(target->th_attr),
|
ret = pthread_create(&(target->wthread), &(target->th_attr),
|
||||||
write_function, (void *) target);
|
write_function, (void *) target);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
iso_msg_fatal(target->image, LIBISO_THREAD_ERROR,
|
iso_msg_fatal(target->image->messenger, LIBISO_THREAD_ERROR,
|
||||||
"Cannot create writer thread");
|
"Cannot create writer thread");
|
||||||
ret = ISO_THREAD_ERROR;
|
ret = ISO_THREAD_ERROR;
|
||||||
goto target_cleanup;
|
goto target_cleanup;
|
||||||
@ -874,7 +876,8 @@ static int bs_read(struct burn_source *bs, unsigned char *buf, int size)
|
|||||||
return size;
|
return size;
|
||||||
} else if (ret < 0) {
|
} else if (ret < 0) {
|
||||||
/* error */
|
/* error */
|
||||||
iso_msg_fatal(t->image, LIBISO_READ_ERROR, "Error reading pipe");
|
iso_msg_fatal(t->image->messenger, LIBISO_READ_ERROR,
|
||||||
|
"Error reading buffer");
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
/* EOF */
|
/* EOF */
|
||||||
@ -898,9 +901,10 @@ static void bs_free_data(struct burn_source *bs)
|
|||||||
/* wait until writer thread finishes */
|
/* wait until writer thread finishes */
|
||||||
pthread_join(target->wthread, NULL);
|
pthread_join(target->wthread, NULL);
|
||||||
|
|
||||||
iso_msg_debug(target->image, "Writer thread joined");
|
iso_msg_debug(target->image->messenger, "Writer thread joined");
|
||||||
iso_msg_debug(target->image, "Ring buffer was %d times full and %d times "
|
iso_msg_debug(target->image->messenger,
|
||||||
"empty", iso_ring_buffer_get_times_full(target->buffer),
|
"Ring buffer was %d times full and %d times empty",
|
||||||
|
iso_ring_buffer_get_times_full(target->buffer),
|
||||||
iso_ring_buffer_get_times_empty(target->buffer));
|
iso_ring_buffer_get_times_empty(target->buffer));
|
||||||
|
|
||||||
/* now we can safety free target */
|
/* now we can safety free target */
|
||||||
@ -975,8 +979,8 @@ int iso_write(Ecma119Image *target, void *buf, size_t count)
|
|||||||
|
|
||||||
/* only report in 5% chunks */
|
/* only report in 5% chunks */
|
||||||
if (percent >= target->percent_written + 5) {
|
if (percent >= target->percent_written + 5) {
|
||||||
iso_msg_debug(target->image, "Processed %u of %u KB (%d %%)",
|
iso_msg_debug(target->image->messenger,
|
||||||
kbw, kbt, percent);
|
"Processed %u of %u KB (%d %%)", kbw, kbt, percent);
|
||||||
target->percent_written = percent;
|
target->percent_written = percent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ int get_iso_name(Ecma119Image *img, IsoNode *iso, char **name)
|
|||||||
|
|
||||||
ret = str2ascii(img->input_charset, iso->name, &ascii_name);
|
ret = str2ascii(img->input_charset, iso->name, &ascii_name);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
iso_msg_debug(img->image, "Can't convert %s", iso->name);
|
iso_msg_debug(img->image->messenger, "Can't convert %s", iso->name);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ int create_file(Ecma119Image *img, IsoFile *iso, Ecma119Node **node)
|
|||||||
|
|
||||||
size = iso_stream_get_size(iso->stream);
|
size = iso_stream_get_size(iso->stream);
|
||||||
if (size > (off_t)0xffffffff) {
|
if (size > (off_t)0xffffffff) {
|
||||||
iso_msg_note(img->image, LIBISO_FILE_IGNORED,
|
iso_msg_note(img->image->messenger, LIBISO_FILE_IGNORED,
|
||||||
"File \"%s\" can't be added to image because is "
|
"File \"%s\" can't be added to image because is "
|
||||||
"greater than 4GB", iso->node.name);
|
"greater than 4GB", iso->node.name);
|
||||||
return 0;
|
return 0;
|
||||||
@ -241,7 +241,7 @@ int create_tree(Ecma119Image *image, IsoNode *iso, Ecma119Node **tree,
|
|||||||
max_path = pathlen + 1 + (iso_name ? strlen(iso_name) : 0);
|
max_path = pathlen + 1 + (iso_name ? strlen(iso_name) : 0);
|
||||||
if (!image->rockridge && !image->allow_deep_paths) {
|
if (!image->rockridge && !image->allow_deep_paths) {
|
||||||
if ((iso->type == LIBISO_DIR && depth > 8) || max_path > 255) {
|
if ((iso->type == LIBISO_DIR && depth > 8) || max_path > 255) {
|
||||||
iso_msg_note(image->image, LIBISO_FILE_IGNORED,
|
iso_msg_note(image->image->messenger, LIBISO_FILE_IGNORED,
|
||||||
"File \"%s\" can't be added, because depth > 8 "
|
"File \"%s\" can't be added, because depth > 8 "
|
||||||
"or path length over 255", iso->name);
|
"or path length over 255", iso->name);
|
||||||
free(iso_name);
|
free(iso_name);
|
||||||
@ -258,8 +258,9 @@ int create_tree(Ecma119Image *image, IsoNode *iso, Ecma119Node **tree,
|
|||||||
ret = create_symlink(image, (IsoSymlink*)iso, &node);
|
ret = create_symlink(image, (IsoSymlink*)iso, &node);
|
||||||
} else {
|
} else {
|
||||||
/* symlinks are only supported when RR is enabled */
|
/* symlinks are only supported when RR is enabled */
|
||||||
iso_msg_note(image->image, LIBISO_FILE_IGNORED, "File \"%s\" "
|
iso_msg_note(image->image->messenger, LIBISO_FILE_IGNORED,
|
||||||
"ignored. Symlinks need RockRidge extensions.", iso->name);
|
"File \"%s\" ignored. Symlinks need RockRidge extensions.",
|
||||||
|
iso->name);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -268,8 +269,9 @@ int create_tree(Ecma119Image *image, IsoNode *iso, Ecma119Node **tree,
|
|||||||
ret = create_special(image, (IsoSpecial*)iso, &node);
|
ret = create_special(image, (IsoSpecial*)iso, &node);
|
||||||
} else {
|
} else {
|
||||||
/* symlinks are only supported when RR is enabled */
|
/* symlinks are only supported when RR is enabled */
|
||||||
iso_msg_note(image->image, LIBISO_FILE_IGNORED, "File \"%s\" "
|
iso_msg_note(image->image->messenger, LIBISO_FILE_IGNORED,
|
||||||
"ignored. Special files need RockRidge extensions.", iso->name);
|
"File \"%s\" ignored. Special files need RockRidge extensions.",
|
||||||
|
iso->name);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -495,7 +497,8 @@ int mangle_single_dir(Ecma119Image *img, Ecma119Node *dir, int max_file_len,
|
|||||||
if (new == NULL) {
|
if (new == NULL) {
|
||||||
return ISO_MEM_ERROR;
|
return ISO_MEM_ERROR;
|
||||||
}
|
}
|
||||||
iso_msg_debug(img->image, "\"%s\" renamed to \"%s\"",
|
iso_msg_debug(img->image->messenger,
|
||||||
|
"\"%s\" renamed to \"%s\"",
|
||||||
children[k]->iso_name, new);
|
children[k]->iso_name, new);
|
||||||
free(children[k]->iso_name);
|
free(children[k]->iso_name);
|
||||||
children[k]->iso_name = new;
|
children[k]->iso_name = new;
|
||||||
@ -735,10 +738,10 @@ int ecma119_tree_create(Ecma119Image *img)
|
|||||||
}
|
}
|
||||||
img->root = root;
|
img->root = root;
|
||||||
|
|
||||||
iso_msg_debug(img->image, "Sorting the low level tree...");
|
iso_msg_debug(img->image->messenger, "Sorting the low level tree...");
|
||||||
sort_tree(root);
|
sort_tree(root);
|
||||||
|
|
||||||
iso_msg_debug(img->image, "Mangling names...");
|
iso_msg_debug(img->image->messenger, "Mangling names...");
|
||||||
ret = mangle_tree(img, 1);
|
ret = mangle_tree(img, 1);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "writer.h"
|
#include "writer.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
|
#include "image.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -218,7 +219,7 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
|
|||||||
t = writer->target;
|
t = writer->target;
|
||||||
filelist = writer->data;
|
filelist = writer->data;
|
||||||
|
|
||||||
iso_msg_debug(t->image, "Writing Files...");
|
iso_msg_debug(t->image->messenger, "Writing Files...");
|
||||||
|
|
||||||
nfiles = iso_rbtree_get_size(t->files);
|
nfiles = iso_rbtree_get_size(t->files);
|
||||||
for (i = 0; i < nfiles; ++i) {
|
for (i = 0; i < nfiles; ++i) {
|
||||||
@ -238,8 +239,8 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
|
|||||||
* 0's to image
|
* 0's to image
|
||||||
*/
|
*/
|
||||||
char *name = iso_stream_get_name(file->stream);
|
char *name = iso_stream_get_name(file->stream);
|
||||||
iso_msg_sorry(t->image, LIBISO_FILE_CANT_WRITE, "File \"%s\" can't"
|
iso_msg_sorry(t->image->messenger, LIBISO_FILE_CANT_WRITE,
|
||||||
" be opened. Filling with 0s.", name);
|
"File \"%s\" can't be opened. Filling with 0s.", name);
|
||||||
free(name);
|
free(name);
|
||||||
memset(buffer, 0, BLOCK_SIZE);
|
memset(buffer, 0, BLOCK_SIZE);
|
||||||
for (b = 0; b < nblocks; ++b) {
|
for (b = 0; b < nblocks; ++b) {
|
||||||
@ -268,17 +269,18 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
|
|||||||
char *name = iso_stream_get_name(file->stream);
|
char *name = iso_stream_get_name(file->stream);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
/* error */
|
/* error */
|
||||||
iso_msg_sorry(t->image, LIBISO_FILE_CANT_WRITE,
|
iso_msg_sorry(t->image->messenger, LIBISO_FILE_CANT_WRITE,
|
||||||
"Read error in file %s.", name);
|
"Read error in file %s.", name);
|
||||||
} else {
|
} else {
|
||||||
/* eof */
|
/* eof */
|
||||||
iso_msg_sorry(t->image, LIBISO_FILE_CANT_WRITE,
|
iso_msg_sorry(t->image->messenger, LIBISO_FILE_CANT_WRITE,
|
||||||
"Premature end of file %s.", name);
|
"Premature end of file %s.", name);
|
||||||
}
|
}
|
||||||
free(name);
|
free(name);
|
||||||
|
|
||||||
/* fill with 0s */
|
/* fill with 0s */
|
||||||
iso_msg_sorry(t->image, LIBISO_FILE_CANT_WRITE, "Filling with 0");
|
iso_msg_sorry(t->image->messenger, LIBISO_FILE_CANT_WRITE,
|
||||||
|
"Filling with 0");
|
||||||
memset(buffer, 0, BLOCK_SIZE);
|
memset(buffer, 0, BLOCK_SIZE);
|
||||||
while (b++ < nblocks) {
|
while (b++ < nblocks) {
|
||||||
res = iso_write(t, buffer, BLOCK_SIZE);
|
res = iso_write(t, buffer, BLOCK_SIZE);
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#define MAX_MSG_LEN 4096
|
#define MAX_MSG_LEN 4096
|
||||||
|
|
||||||
void iso_msg_debug(IsoImage *img, const char *fmt, ...)
|
void iso_msg_debug(IsoMessenger *msgr, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
char msg[MAX_MSG_LEN];
|
char msg[MAX_MSG_LEN];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@ -25,11 +25,11 @@ void iso_msg_debug(IsoImage *img, const char *fmt, ...)
|
|||||||
vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
|
vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
libiso_msgs_submit(img->messenger, -1, 0x00000002, LIBISO_MSGS_SEV_DEBUG,
|
libiso_msgs_submit(msgr, -1, 0x00000002, LIBISO_MSGS_SEV_DEBUG,
|
||||||
LIBISO_MSGS_PRIO_ZERO, msg, 0, 0);
|
LIBISO_MSGS_PRIO_ZERO, msg, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void iso_msg_note(IsoImage *img, int error_code, const char *fmt, ...)
|
void iso_msg_note(IsoMessenger *msgr, int error_code, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
char msg[MAX_MSG_LEN];
|
char msg[MAX_MSG_LEN];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@ -38,11 +38,11 @@ void iso_msg_note(IsoImage *img, int error_code, const char *fmt, ...)
|
|||||||
vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
|
vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
libiso_msgs_submit(img->messenger, -1, error_code, LIBISO_MSGS_SEV_NOTE,
|
libiso_msgs_submit(msgr, -1, error_code, LIBISO_MSGS_SEV_NOTE,
|
||||||
LIBISO_MSGS_PRIO_MEDIUM, msg, 0, 0);
|
LIBISO_MSGS_PRIO_MEDIUM, msg, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void iso_msg_hint(IsoImage *img, int error_code, const char *fmt, ...)
|
void iso_msg_hint(IsoMessenger *msgr, int error_code, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
char msg[MAX_MSG_LEN];
|
char msg[MAX_MSG_LEN];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@ -51,11 +51,11 @@ void iso_msg_hint(IsoImage *img, int error_code, const char *fmt, ...)
|
|||||||
vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
|
vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
libiso_msgs_submit(img->messenger, -1, error_code, LIBISO_MSGS_SEV_HINT,
|
libiso_msgs_submit(msgr, -1, error_code, LIBISO_MSGS_SEV_HINT,
|
||||||
LIBISO_MSGS_PRIO_MEDIUM, msg, 0, 0);
|
LIBISO_MSGS_PRIO_MEDIUM, msg, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void iso_msg_warn(IsoImage *img, int error_code, const char *fmt, ...)
|
void iso_msg_warn(IsoMessenger *msgr, int error_code, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
char msg[MAX_MSG_LEN];
|
char msg[MAX_MSG_LEN];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@ -64,11 +64,11 @@ void iso_msg_warn(IsoImage *img, int error_code, const char *fmt, ...)
|
|||||||
vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
|
vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
libiso_msgs_submit(img->messenger, -1, error_code, LIBISO_MSGS_SEV_WARNING,
|
libiso_msgs_submit(msgr, -1, error_code, LIBISO_MSGS_SEV_WARNING,
|
||||||
LIBISO_MSGS_PRIO_MEDIUM, msg, 0, 0);
|
LIBISO_MSGS_PRIO_MEDIUM, msg, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void iso_msg_sorry(IsoImage *img, int error_code, const char *fmt, ...)
|
void iso_msg_sorry(IsoMessenger *msgr, int error_code, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
char msg[MAX_MSG_LEN];
|
char msg[MAX_MSG_LEN];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@ -77,11 +77,11 @@ void iso_msg_sorry(IsoImage *img, int error_code, const char *fmt, ...)
|
|||||||
vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
|
vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
libiso_msgs_submit(img->messenger, -1, error_code, LIBISO_MSGS_SEV_SORRY,
|
libiso_msgs_submit(msgr, -1, error_code, LIBISO_MSGS_SEV_SORRY,
|
||||||
LIBISO_MSGS_PRIO_HIGH, msg, 0, 0);
|
LIBISO_MSGS_PRIO_HIGH, msg, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void iso_msg_fatal(IsoImage *img, int error_code, const char *fmt, ...)
|
void iso_msg_fatal(IsoMessenger *msgr, int error_code, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
char msg[MAX_MSG_LEN];
|
char msg[MAX_MSG_LEN];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@ -90,7 +90,7 @@ void iso_msg_fatal(IsoImage *img, int error_code, const char *fmt, ...)
|
|||||||
vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
|
vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
libiso_msgs_submit(img->messenger, -1, error_code, LIBISO_MSGS_SEV_FATAL,
|
libiso_msgs_submit(msgr, -1, error_code, LIBISO_MSGS_SEV_FATAL,
|
||||||
LIBISO_MSGS_PRIO_HIGH, msg, 0, 0);
|
LIBISO_MSGS_PRIO_HIGH, msg, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,16 +74,18 @@
|
|||||||
/** Unsupported file type for Joliet tree */
|
/** Unsupported file type for Joliet tree */
|
||||||
#define LIBISO_JOLIET_WRONG_FILE_TYPE 0x00030301
|
#define LIBISO_JOLIET_WRONG_FILE_TYPE 0x00030301
|
||||||
|
|
||||||
void iso_msg_debug(IsoImage *img, const char *fmt, ...);
|
typedef struct libiso_msgs IsoMessenger;
|
||||||
|
|
||||||
void iso_msg_note(IsoImage *img, int error_code, const char *fmt, ...);
|
void iso_msg_debug(IsoMessenger *msgr, const char *fmt, ...);
|
||||||
|
|
||||||
void iso_msg_hint(IsoImage *img, int error_code, const char *fmt, ...);
|
void iso_msg_note(IsoMessenger *msgr, int error_code, const char *fmt, ...);
|
||||||
|
|
||||||
void iso_msg_warn(IsoImage *img, int error_code, const char *fmt, ...);
|
void iso_msg_hint(IsoMessenger *msgr, int error_code, const char *fmt, ...);
|
||||||
|
|
||||||
void iso_msg_sorry(IsoImage *img, int error_code, const char *fmt, ...);
|
void iso_msg_warn(IsoMessenger *msgr, int error_code, const char *fmt, ...);
|
||||||
|
|
||||||
void iso_msg_fatal(IsoImage *img, int error_code, const char *fmt, ...);
|
void iso_msg_sorry(IsoMessenger *msgr, int error_code, const char *fmt, ...);
|
||||||
|
|
||||||
|
void iso_msg_fatal(IsoMessenger *msgr, int error_code, const char *fmt, ...);
|
||||||
|
|
||||||
#endif /*MESSAGES_H_*/
|
#endif /*MESSAGES_H_*/
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "writer.h"
|
#include "writer.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
|
#include "image.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -260,7 +261,7 @@ char *get_rr_name(Ecma119Image *t, Ecma119Node *n)
|
|||||||
|
|
||||||
ret = strconv(n->node->name, t->input_charset, t->output_charset, &name);
|
ret = strconv(n->node->name, t->input_charset, t->output_charset, &name);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
iso_msg_sorry(t->image, LIBISO_CHARSET_ERROR,
|
iso_msg_sorry(t->image->messenger, LIBISO_CHARSET_ERROR,
|
||||||
"Charset conversion error. Can't convert %s from %s to %s",
|
"Charset conversion error. Can't convert %s from %s to %s",
|
||||||
n->node->name, t->input_charset, t->output_charset);
|
n->node->name, t->input_charset, t->output_charset);
|
||||||
|
|
||||||
|
16
src/tree.c
16
src/tree.c
@ -460,7 +460,7 @@ int iso_add_dir_aux(IsoImage *image, IsoDir *parent, IsoFileSource *dir)
|
|||||||
|
|
||||||
result = iso_file_source_open(dir);
|
result = iso_file_source_open(dir);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
iso_msg_debug(image, "Can't open dir %s",
|
iso_msg_debug(image->messenger, "Can't open dir %s",
|
||||||
iso_file_source_get_path(dir));
|
iso_file_source_get_path(dir));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -475,15 +475,15 @@ int iso_add_dir_aux(IsoImage *image, IsoDir *parent, IsoFileSource *dir)
|
|||||||
name = iso_file_source_get_name(file);
|
name = iso_file_source_get_name(file);
|
||||||
|
|
||||||
if (check_excludes(image, iso_file_source_get_path(file))) {
|
if (check_excludes(image, iso_file_source_get_path(file))) {
|
||||||
iso_msg_debug(image, "Skipping excluded file %s",
|
iso_msg_debug(image->messenger, "Skipping excluded file %s",
|
||||||
iso_file_source_get_path(file));
|
iso_file_source_get_path(file));
|
||||||
action = 2;
|
action = 2;
|
||||||
} else if (check_hidden(image, name)) {
|
} else if (check_hidden(image, name)) {
|
||||||
iso_msg_debug(image, "Skipping hidden file %s",
|
iso_msg_debug(image->messenger, "Skipping hidden file %s",
|
||||||
iso_file_source_get_path(file));
|
iso_file_source_get_path(file));
|
||||||
action = 2;
|
action = 2;
|
||||||
} else {
|
} else {
|
||||||
iso_msg_debug(image, "Adding file %s",
|
iso_msg_debug(image->messenger, "Adding file %s",
|
||||||
iso_file_source_get_path(file));
|
iso_file_source_get_path(file));
|
||||||
action = 1;
|
action = 1;
|
||||||
}
|
}
|
||||||
@ -523,8 +523,9 @@ int iso_add_dir_aux(IsoImage *image, IsoDir *parent, IsoFileSource *dir)
|
|||||||
result = builder->create_node(builder, image, file, &new);
|
result = builder->create_node(builder, image, file, &new);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
|
|
||||||
iso_msg_note(image, LIBISO_FILE_IGNORED, "Error %d when adding "
|
iso_msg_note(image->messenger, LIBISO_FILE_IGNORED,
|
||||||
"file %s", result, iso_file_source_get_path(file));
|
"Error %d when adding file %s", result,
|
||||||
|
iso_file_source_get_path(file));
|
||||||
|
|
||||||
if (image->recOpts.report) {
|
if (image->recOpts.report) {
|
||||||
action = image->recOpts.report(file, result, flag);
|
action = image->recOpts.report(file, result, flag);
|
||||||
@ -584,7 +585,8 @@ int iso_add_dir_aux(IsoImage *image, IsoDir *parent, IsoFileSource *dir)
|
|||||||
|
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
/* error reading dir, should never occur */
|
/* error reading dir, should never occur */
|
||||||
iso_msg_sorry(image, LIBISO_CANT_READ_FILE, "Error reading dir");
|
iso_msg_sorry(image->messenger, LIBISO_CANT_READ_FILE,
|
||||||
|
"Error reading dir");
|
||||||
action = result;
|
action = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user