-/* vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: */
-
/*
* Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
* Copyright (C) 1999-2008 Michael Rasmussen and the Claws Mail Team
gdate = g_date_new();
parts = g_strsplit(date, "-", 3);
- if (! is_iso_string(parts))
- return NULL;
if (!parts)
return NULL;
+ if (! is_iso_string(parts))
+ return NULL;
for (i = 0; i < 3; i++) {
int t = atoi(parts[i]);
switch (i) {
#endif
filename = g_strrstr_len(path, strlen(path), "/");
if (! filename)
- g_warning("%s\n", path);
+ g_warning("no filename in path '%s'", path);
g_return_if_fail(filename != NULL);
filename++;
if ((res = archive_read_open_filename(
#endif
in, archive_name, READ_BLOCK_SIZE)) != ARCHIVE_OK) {
- buf = g_strdup_printf(
- "%s: %s\n", archive_name, archive_error_string(in));
- g_warning("%s\n", buf);
- g_free(buf);
+ g_warning("%s: %s", archive_name, archive_error_string(in));
result = archive_error_string(in);
}
else {
out, flags)) == ARCHIVE_OK) {
res = archive_read_next_header(in, &entry);
while (res == ARCHIVE_OK) {
- fprintf(stdout, "%s\n", archive_entry_pathname(entry));
res = archive_write_header(out, entry);
if (res != ARCHIVE_OK) {
- buf = g_strdup_printf("%s\n",
- archive_error_string(out));
- g_warning("%s\n", buf);
- g_free(buf);
+ g_warning("%s", archive_error_string(out));
/* skip this file an continue */
res = ARCHIVE_OK;
}
else {
res = archive_copy_data(in, out);
if (res != ARCHIVE_OK) {
- buf = g_strdup_printf("%s\n",
- archive_error_string(in));
- g_warning("%s\n", buf);
- g_free(buf);
+ g_warning("%s", archive_error_string(in));
/* skip this file an continue */
res = ARCHIVE_OK;
}
if (res == ARCHIVE_EOF)
res = ARCHIVE_OK;
if (res != ARCHIVE_OK) {
- buf = g_strdup_printf("%s\n", archive_error_string(in));
- if (*buf == '\n') {
- g_free(buf);
- buf = g_strdup_printf("%s: Unknown error\n", archive_name);
- }
- g_warning("%s\n", buf);
- g_free(buf);
- result = archive_error_string(in);
+ gchar *e = archive_error_string(in);
+ g_warning("%s: %s", archive_name, e? e: "unknown error");
+ result = e;
}
}
else
filename = get_full_path(file);
/* libarchive will crash if instructed to add archive to it self */
if (g_utf8_collate(archive_name, filename) == 0) {
- buf = NULL;
- buf = g_strdup_printf(
- "%s: Not dumping to %s", archive_name, filename);
- g_warning("%s\n", buf);
+ g_warning("%s: not dumping to '%s'", archive_name, filename);
#ifndef _TEST
- debug_print("%s\n", buf);
+ debug_print("%s: not dumping to '%s'\n", archive_name, filename);
#endif
- g_free(buf);
}
else {
#ifndef _TEST
g_free(msg);
#endif
entry = archive_entry_new();
- lstat(filename, &st);
if ((fd = open(filename, O_RDONLY)) == -1) {
perror("open file");
}
else {
+ lstat(filename, &st);
archive_entry_copy_stat(entry, &st);
archive_entry_set_pathname(entry, filename);
if (S_ISLNK(st.st_mode)) {