diff options
Diffstat (limited to 'src/fr-command-zip.c')
-rw-r--r-- | src/fr-command-zip.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/src/fr-command-zip.c b/src/fr-command-zip.c index 9469e91..acdc5ad 100644 --- a/src/fr-command-zip.c +++ b/src/fr-command-zip.c @@ -44,7 +44,6 @@ static void fr_command_zip_finalize (GObject *object); static FrCommandClass *parent_class = NULL; - /* -- list -- */ static time_t @@ -60,6 +59,10 @@ mktime_from_string (char *datetime_s) char *min; char *sec; + /* expected YYYYMMDD.HHMMSS */ + if (strlen (datetime_s) < 15) + return mktime (&tm); + tm.tm_isdst = -1; /* date */ @@ -91,7 +94,6 @@ mktime_from_string (char *datetime_s) return mktime (&tm); } - static void list__process_line (char *line, gpointer data) @@ -126,9 +128,14 @@ list__process_line (char *line, /**/ + fields = split_line (line, 7); + if (g_strv_length (fields) < 7) { + g_strfreev (fields); + return; + } + fdata = file_data_new (); - fields = split_line (line, 7); fdata->size = g_ascii_strtoull (fields[3], NULL, 10); fdata->modified = mktime_from_string (fields[6]); fdata->encrypted = (*fields[4] == 'B') || (*fields[4] == 'T'); @@ -137,6 +144,8 @@ list__process_line (char *line, /* Full path */ name_field = get_last_field (line, 8); + if (name_field == NULL) + name_field = ""; if (*name_field == '/') { fdata->full_path = g_strdup (name_field); @@ -161,7 +170,6 @@ list__process_line (char *line, fr_command_add_file (comm, fdata); } - static void add_password_arg (FrCommand *comm, const char *password) @@ -172,7 +180,6 @@ add_password_arg (FrCommand *comm, } } - static void list__begin (gpointer data) { @@ -181,7 +188,6 @@ list__begin (gpointer data) comm->is_empty = FALSE; } - static void fr_command_zip_list (FrCommand *comm) { @@ -196,7 +202,6 @@ fr_command_zip_list (FrCommand *comm) fr_process_start (comm->process); } - static void process_line__common (char *line, gpointer data) @@ -214,7 +219,6 @@ process_line__common (char *line, fr_command_message (comm, line); } - static void fr_command_zip_add (FrCommand *comm, const char *from_file, @@ -262,7 +266,6 @@ fr_command_zip_add (FrCommand *comm, fr_process_end_command (comm->process); } - static void fr_command_zip_delete (FrCommand *comm, const char *from_file, @@ -291,7 +294,6 @@ fr_command_zip_delete (FrCommand *comm, fr_process_end_command (comm->process); } - static void fr_command_zip_extract (FrCommand *comm, const char *from_file, @@ -337,7 +339,6 @@ fr_command_zip_extract (FrCommand *comm, fr_process_end_command (comm->process); } - static void fr_command_zip_test (FrCommand *comm) { @@ -349,7 +350,6 @@ fr_command_zip_test (FrCommand *comm) fr_process_end_command (comm->process); } - static void fr_command_zip_handle_error (FrCommand *comm, FrProcError *error) @@ -380,7 +380,6 @@ fr_command_zip_handle_error (FrCommand *comm, } } - const char *zip_mime_type[] = { "application/epub+zip", "application/vnd.oasis.opendocument.presentation", @@ -396,7 +395,6 @@ const char *zip_mime_type[] = { "application/zip", /* zip always at the end and the number of */ NULL }; /* place in fr_command_zip_get_mime_types */ - static const char ** fr_command_zip_get_mime_types (FrCommand *comm) { @@ -414,13 +412,12 @@ fr_command_zip_get_mime_types (FrCommand *comm) return zip_mime_type; } - -static FrCommandCap +static FrCommandCaps fr_command_zip_get_capabilities (FrCommand *comm, const char *mime_type, gboolean check_command) { - FrCommandCap capabilities; + FrCommandCaps capabilities; capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES | FR_COMMAND_CAN_ENCRYPT; if (is_program_available ("zip", check_command)) { @@ -435,7 +432,6 @@ fr_command_zip_get_capabilities (FrCommand *comm, return capabilities; } - static const char * fr_command_zip_get_packages (FrCommand *comm, const char *mime_type) @@ -443,7 +439,6 @@ fr_command_zip_get_packages (FrCommand *comm, return PACKAGES ("zip,unzip"); } - static void fr_command_zip_class_init (FrCommandZipClass *class) { @@ -466,7 +461,6 @@ fr_command_zip_class_init (FrCommandZipClass *class) afc->get_packages = fr_command_zip_get_packages; } - static void fr_command_zip_init (FrCommand *comm) { @@ -482,7 +476,6 @@ fr_command_zip_init (FrCommand *comm) FR_COMMAND_ZIP (comm)->is_empty = FALSE; } - static void fr_command_zip_finalize (GObject *object) { @@ -494,7 +487,6 @@ fr_command_zip_finalize (GObject *object) G_OBJECT_CLASS (parent_class)->finalize (object); } - GType fr_command_zip_get_type () { |