No need to report "some files could not be saved".
We've already reported the files that couldn't be saved; no need to tell the user something they already know by that point. Change-Id: I8251a46134342df6b40a6324aa76a5237fde7c93 Reviewed-on: https://code.wireshark.org/review/31298 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
This commit is contained in:
parent
caa2c0a95e
commit
8059bad284
@ -105,7 +105,6 @@ eo_draw(void *tapdata)
|
||||
export_object_list_gui_t *object_list = (export_object_list_gui_t*)tap_object->gui_data;
|
||||
GSList *slist = object_list->entries;
|
||||
export_object_entry_t *entry;
|
||||
gboolean all_saved = TRUE;
|
||||
gchar* save_in_path = (gchar*)g_hash_table_lookup(eo_opts, proto_get_protocol_filter_name(get_eo_proto_id(object_list->eo)));
|
||||
GString *safe_filename = NULL;
|
||||
gchar *save_as_fullpath = NULL;
|
||||
@ -140,16 +139,11 @@ eo_draw(void *tapdata)
|
||||
g_string_free(safe_filename, TRUE);
|
||||
} while (g_file_test(save_as_fullpath, G_FILE_TEST_EXISTS) && ++count < 1000);
|
||||
count = 0;
|
||||
if (!eo_save_entry(save_as_fullpath, entry))
|
||||
all_saved = FALSE;
|
||||
eo_save_entry(save_as_fullpath, entry);
|
||||
g_free(save_as_fullpath);
|
||||
save_as_fullpath = NULL;
|
||||
slist = slist->next;
|
||||
}
|
||||
|
||||
if (!all_saved)
|
||||
fprintf(stderr, "Export objects (%s): Some files could not be saved.\n",
|
||||
proto_get_protocol_filter_name(get_eo_proto_id(object_list->eo)));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include "export_object_ui.h"
|
||||
|
||||
gboolean
|
||||
void
|
||||
eo_save_entry(const gchar *save_as_filename, export_object_entry_t *entry)
|
||||
{
|
||||
int to_fd;
|
||||
@ -41,7 +41,7 @@ eo_save_entry(const gchar *save_as_filename, export_object_entry_t *entry)
|
||||
O_BINARY, 0644);
|
||||
if(to_fd == -1) { /* An error occurred */
|
||||
report_open_failure(save_as_filename, errno, TRUE);
|
||||
return FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -72,17 +72,13 @@ eo_save_entry(const gchar *save_as_filename, export_object_entry_t *entry)
|
||||
err = WTAP_ERR_SHORT_WRITE;
|
||||
report_write_failure(save_as_filename, err);
|
||||
ws_close(to_fd);
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
bytes_left -= bytes_written;
|
||||
ptr += bytes_written;
|
||||
}
|
||||
if (ws_close(to_fd) < 0) {
|
||||
if (ws_close(to_fd) < 0)
|
||||
report_write_failure(save_as_filename, errno);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -20,7 +20,7 @@ extern "C" {
|
||||
|
||||
/* Common between protocols */
|
||||
|
||||
gboolean eo_save_entry(const gchar *save_as_filename, export_object_entry_t *entry);
|
||||
void eo_save_entry(const gchar *save_as_filename, export_object_entry_t *entry);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -194,15 +194,7 @@ void ExportObjectDialog::saveAllEntries()
|
||||
if (save_in_path.length() < 1)
|
||||
return;
|
||||
|
||||
if (!model_.saveAllEntries(save_in_path))
|
||||
{
|
||||
QMessageBox::warning(
|
||||
this,
|
||||
tr("Object Export"),
|
||||
tr("Some files could not be saved."),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
}
|
||||
model_.saveAllEntries(save_in_path);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -152,12 +152,11 @@ bool ExportObjectModel::saveEntry(QModelIndex &index, QString filename)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ExportObjectModel::saveAllEntries(QString path)
|
||||
void ExportObjectModel::saveAllEntries(QString path)
|
||||
{
|
||||
if (path.isEmpty())
|
||||
return false;
|
||||
return;
|
||||
|
||||
bool all_saved = true;
|
||||
export_object_entry_t *entry;
|
||||
|
||||
for (QList<QVariant>::iterator it = objects_.begin(); it != objects_.end(); ++it)
|
||||
@ -190,13 +189,10 @@ bool ExportObjectModel::saveAllEntries(QString path)
|
||||
safe_filename->str, NULL);
|
||||
g_string_free(safe_filename, TRUE);
|
||||
} while (g_file_test(save_as_fullpath, G_FILE_TEST_EXISTS) && ++count < 1000);
|
||||
if (!eo_save_entry(save_as_fullpath, entry))
|
||||
all_saved = false;
|
||||
eo_save_entry(save_as_fullpath, entry);
|
||||
g_free(save_as_fullpath);
|
||||
save_as_fullpath = NULL;
|
||||
}
|
||||
|
||||
return all_saved;
|
||||
}
|
||||
|
||||
void ExportObjectModel::resetObjects()
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
void resetObjects();
|
||||
|
||||
bool saveEntry(QModelIndex &index, QString filename);
|
||||
bool saveAllEntries(QString path);
|
||||
void saveAllEntries(QString path);
|
||||
|
||||
const char* getTapListenerName();
|
||||
void* getTapData();
|
||||
|
Loading…
x
Reference in New Issue
Block a user