summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-12-31 00:26:36 +0000
committerGuy Harris <guy@alum.mit.edu>2004-12-31 00:26:36 +0000
commit6e622fd24edc8a6532d58dea8cdf8e6a5ec313f4 (patch)
tree738949b79c0a12c924ec7155b79a0aa9ebfc032f /file.c
parent6d24b27606da5b9a86bb13d3de3bd195d249a757 (diff)
downloadwireshark-6e622fd24edc8a6532d58dea8cdf8e6a5ec313f4.tar.gz
"gtk_entry_get_text()" returns a "const char *" - assign the result to
one. "get_basename()" doesn't modify its argument, and its callers don't modify the substring pointed to by the result, so make it take a "const char *" as an argument and return a "const char *". "find_last_pathname_separator()" doesn't modify its argument, so make it a "const char *" - but some of its callers pass a non-"const" "char *" and modify the result, so don't make its return value a "const char *". And, as none of its callers are outside "filesystem.c", make it static. In "about_folders_page_new()", have separate variables for pathnames returned as "const char *" (which are cached by the routine that returns them, so you can't modify them - and can't free them, so get rid of the commented-out "g_free()" calls for them) and pathnames returned as "char *" (which are allocated anew for each call, and can be modified, but have to be freed). Clean up white space. svn path=/trunk/; revision=12881
Diffstat (limited to 'file.c')
-rw-r--r--file.c54
1 files changed, 28 insertions, 26 deletions
diff --git a/file.c b/file.c
index 44a040aaa6..a57bd0d033 100644
--- a/file.c
+++ b/file.c
@@ -301,14 +301,14 @@ cf_close(capture_file *cf)
static void
set_display_filename(capture_file *cf)
{
- gchar *name_ptr;
- size_t msg_len;
+ const gchar *name_ptr;
+ size_t msg_len;
static const gchar done_fmt_nodrops[] = " File: %s %s %02u:%02u:%02u";
static const gchar done_fmt_drops[] = " File: %s %s %02u:%02u:%02u Drops: %u";
- gchar *done_msg;
- gchar *win_name_fmt = "%s - Ethereal";
- gchar *win_name;
- gchar *size_str;
+ gchar *done_msg;
+ gchar *win_name_fmt = "%s - Ethereal";
+ gchar *win_name;
+ gchar *size_str;
name_ptr = cf_get_display_name(cf);
@@ -345,28 +345,29 @@ set_display_filename(capture_file *cf)
read_status_t
cf_read(capture_file *cf)
{
- int err;
- gchar *err_info;
- gchar *name_ptr, *load_msg, *load_fmt = "%s";
- char *errmsg;
- char errmsg_errno[1024+1];
- gchar err_str[2048+1];
- long data_offset;
- progdlg_t *progbar = NULL;
- gboolean stop_flag;
+ int err;
+ gchar *err_info;
+ const gchar *name_ptr;
+ gchar *load_msg, *load_fmt = "%s";
+ char *errmsg;
+ char errmsg_errno[1024+1];
+ gchar err_str[2048+1];
+ long data_offset;
+ progdlg_t *progbar = NULL;
+ gboolean stop_flag;
/*
* XXX - should be "off_t", but Wiretap would need more work to handle
* the full size of "off_t" on platforms where it's more than a "long"
* as well.
*/
- long file_pos;
- float prog_val;
- int fd;
- struct stat cf_stat;
- GTimeVal start_time;
- gchar status_str[100];
- int progbar_nextstep;
- int progbar_quantum;
+ long file_pos;
+ float prog_val;
+ int fd;
+ struct stat cf_stat;
+ GTimeVal start_time;
+ gchar status_str[100];
+ int progbar_nextstep;
+ int progbar_quantum;
cum_bytes=0;
reset_tap_listeners();
@@ -682,10 +683,10 @@ cf_finish_tail(capture_file *cf, int *err)
}
#endif /* HAVE_LIBPCAP */
-gchar *
+const gchar *
cf_get_display_name(capture_file *cf)
{
- gchar *displayname;
+ const gchar *displayname;
/* Return a name to use in displays */
if (!cf->is_tempfile) {
@@ -3042,7 +3043,8 @@ gboolean
cf_save(char *fname, capture_file *cf, packet_range_t *range, guint save_format)
{
gchar *from_filename;
- gchar *name_ptr, *save_msg, *save_fmt = " Saving: %s...";
+ const gchar *name_ptr;
+ gchar *save_msg, *save_fmt = " Saving: %s...";
size_t msg_len;
int err;
gboolean do_copy;