diff options
author | Laurent Napias <[email protected]> | 2019-06-29 10:46:39 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-07-01 18:38:12 +0200 |
commit | 3c4165189dce94303efa1744ecfd6c728d2db5ec (patch) | |
tree | fd104044ae3a367b25558053c4610490bb013680 | |
parent | e48cd4649f7a448ed585634e206347cab5b86051 (diff) | |
download | engrampa-3c4165189dce94303efa1744ecfd6c728d2db5ec.tar.bz2 engrampa-3c4165189dce94303efa1744ecfd6c728d2db5ec.tar.xz |
Remove trailing whitespaces
-rw-r--r-- | caja/caja-engrampa.h | 4 | ||||
-rw-r--r-- | caja/engrampa-module.c | 8 | ||||
-rw-r--r-- | copy-n-paste/eggdesktopfile.c | 6 | ||||
-rw-r--r-- | copy-n-paste/eggsmclient-xsmp.c | 8 | ||||
-rw-r--r-- | copy-n-paste/eggsmclient.c | 2 | ||||
-rw-r--r-- | src/dlg-add-files.c | 4 | ||||
-rw-r--r-- | src/dlg-ask-password.c | 8 | ||||
-rw-r--r-- | src/dlg-extract.c | 2 | ||||
-rw-r--r-- | src/eggfileformatchooser.c | 30 | ||||
-rw-r--r-- | src/fr-command-7z.c | 2 | ||||
-rw-r--r-- | src/fr-command-lrzip.c | 2 | ||||
-rw-r--r-- | src/fr-command-rar.c | 4 | ||||
-rw-r--r-- | src/fr-command-tar.h | 2 | ||||
-rw-r--r-- | src/fr-error.c | 6 | ||||
-rw-r--r-- | src/fr-process.c | 4 | ||||
-rw-r--r-- | src/fr-stock.c | 6 | ||||
-rw-r--r-- | src/fr-window.c | 10 | ||||
-rw-r--r-- | src/glib-utils.c | 54 | ||||
-rw-r--r-- | src/gtk-utils.h | 2 | ||||
-rw-r--r-- | src/java-utils.c | 94 | ||||
-rw-r--r-- | src/java-utils.h | 2 | ||||
-rw-r--r-- | src/open-file.c | 10 |
22 files changed, 135 insertions, 135 deletions
diff --git a/caja/caja-engrampa.h b/caja/caja-engrampa.h index b01fc6c..f94e455 100644 --- a/caja/caja-engrampa.h +++ b/caja/caja-engrampa.h @@ -1,6 +1,6 @@ /* * Engrampa - * + * * Copyright (C) 2004 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or @@ -18,7 +18,7 @@ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Author: Paolo Bacchilega <[email protected]> - * + * */ #ifndef CAJA_RNGRAMPA_H diff --git a/caja/engrampa-module.c b/caja/engrampa-module.c index 73be1a8..cda7e43 100644 --- a/caja/engrampa-module.c +++ b/caja/engrampa-module.c @@ -1,6 +1,6 @@ /* * Engrampa - * + * * Copyright (C) 2004 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or @@ -18,7 +18,7 @@ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Author: Paolo Bacchilega <[email protected]> - * + * */ #include <config.h> @@ -44,12 +44,12 @@ caja_module_shutdown (void) } -void +void caja_module_list_types (const GType **types, int *num_types) { static GType type_list[1]; - + type_list[0] = CAJA_TYPE_FR; *types = type_list; *num_types = 1; diff --git a/copy-n-paste/eggdesktopfile.c b/copy-n-paste/eggdesktopfile.c index 2c28d8b..c25b19c 100644 --- a/copy-n-paste/eggdesktopfile.c +++ b/copy-n-paste/eggdesktopfile.c @@ -1365,7 +1365,7 @@ egg_desktop_file_launch (EggDesktopFile *desktop_file, EGG_DESKTOP_FILE_ERROR_NOT_LAUNCHABLE, _("Can't pass documents to this desktop element")); return FALSE; - } + } if (!parse_link (desktop_file, &app_desktop_file, &documents, error)) return FALSE; @@ -1451,10 +1451,10 @@ egg_set_desktop_file (const char *desktop_file_path) /** * egg_get_desktop_file: - * + * * Gets the application's #EggDesktopFile, as set by * egg_set_desktop_file(). - * + * * Return value: the #EggDesktopFile, or %NULL if it hasn't been set. **/ EggDesktopFile * diff --git a/copy-n-paste/eggsmclient-xsmp.c b/copy-n-paste/eggsmclient-xsmp.c index e19a829..50b7432 100644 --- a/copy-n-paste/eggsmclient-xsmp.c +++ b/copy-n-paste/eggsmclient-xsmp.c @@ -228,7 +228,7 @@ sm_client_xsmp_set_initial_properties (gpointer user_data) if (xsmp->restart_style == SmRestartIfRunning) { - if (egg_desktop_file_get_boolean (desktop_file, + if (egg_desktop_file_get_boolean (desktop_file, "X-MATE-AutoRestart", NULL)) xsmp->restart_style = SmRestartImmediately; } @@ -1127,7 +1127,7 @@ delete_properties (EggSMClientXSMP *xsmp, ...) * until you're done with the SmProp. */ static SmProp * -array_prop (const char *name, ...) +array_prop (const char *name, ...) { SmProp *prop; SmPropValue pv; @@ -1344,13 +1344,13 @@ ice_error_handler (IceConn ice_conn, IcePointer values) { /* Do nothing */ -} +} static void ice_io_error_handler (IceConn ice_conn) { /* Do nothing */ -} +} static void smc_error_handler (SmcConn smc_conn, diff --git a/copy-n-paste/eggsmclient.c b/copy-n-paste/eggsmclient.c index 0f8d458..5a0fdd6 100644 --- a/copy-n-paste/eggsmclient.c +++ b/copy-n-paste/eggsmclient.c @@ -112,7 +112,7 @@ egg_sm_client_class_init (EggSMClientClass *klass) * handling this signal; if the user has requested that the session * be saved when logging out, then ::save_state will be emitted * separately. - * + * * If the application agrees to quit, it should then wait for either * the ::quit_cancelled or ::quit signals to be emitted. **/ diff --git a/src/dlg-add-files.c b/src/dlg-add-files.c index 73f5b2c..49b0382 100644 --- a/src/dlg-add-files.c +++ b/src/dlg-add-files.c @@ -69,13 +69,13 @@ file_sel_response_cb (GtkWidget *widget, g_settings_set_string (data->settings, PREF_ADD_CURRENT_FOLDER, current_folder); fr_window_set_add_default_dir (window, current_folder); } - + if (uri != NULL) { g_settings_set_string (data->settings, PREF_ADD_FILENAME, uri); g_free (uri); } - + if ((response == GTK_RESPONSE_CANCEL) || (response == GTK_RESPONSE_DELETE_EVENT)) { gtk_widget_destroy (data->dialog); diff --git a/src/dlg-ask-password.c b/src/dlg-ask-password.c index 45bcc20..6196deb 100644 --- a/src/dlg-ask-password.c +++ b/src/dlg-ask-password.c @@ -124,7 +124,7 @@ dlg_ask_password__common (FrWindow *window, text = g_strdup_printf (_("Enter the password for the archive '%s'."), name); gtk_label_set_label (GTK_LABEL (label), text); g_free (text); - + if (fr_window_get_password (window) != NULL) _gtk_entry_set_locale_text (GTK_ENTRY (data->pw_password_entry), fr_window_get_password (window)); @@ -149,10 +149,10 @@ dlg_ask_password__common (FrWindow *window, GTK_WINDOW (window)); gtk_window_set_modal (GTK_WINDOW (data->dialog), TRUE); } - else + else gtk_window_set_title (GTK_WINDOW (data->dialog), name); g_free (name); - + gtk_widget_show (data->dialog); } @@ -164,7 +164,7 @@ dlg_ask_password (FrWindow *window) } -void +void dlg_ask_password_for_paste_operation (FrWindow *window) { dlg_ask_password__common (window, FR_PASSWORD_TYPE_PASTE_FROM); diff --git a/src/dlg-extract.c b/src/dlg-extract.c index 0f18a02..ca40182 100644 --- a/src/dlg-extract.c +++ b/src/dlg-extract.c @@ -164,7 +164,7 @@ extract_cb (GtkWidget *w, /* check extraction directory permissions. */ if (uri_is_dir (extract_to_dir) - && ! check_permissions (extract_to_dir, R_OK | W_OK)) + && ! check_permissions (extract_to_dir, R_OK | W_OK)) { GtkWidget *d; char *utf8_path; diff --git a/src/eggfileformatchooser.c b/src/eggfileformatchooser.c index f297917..cd9d4a0 100644 --- a/src/eggfileformatchooser.c +++ b/src/eggfileformatchooser.c @@ -27,7 +27,7 @@ typedef struct _EggFileFormatFilterInfo EggFileFormatFilterInfo; typedef struct _EggFileFormatSearch EggFileFormatSearch; -enum +enum { MODEL_COLUMN_ID, MODEL_COLUMN_NAME, @@ -38,7 +38,7 @@ enum MODEL_COLUMN_DESTROY }; -enum +enum { SIGNAL_SELECTION_CHANGED, SIGNAL_LAST @@ -229,7 +229,7 @@ selection_changed_cb (GtkTreeSelection *selection, GtkTreeIter parent; GtkTreeIter iter; - if (gtk_tree_selection_get_selected (selection, &model, &iter)) + if (gtk_tree_selection_get_selected (selection, &model, &iter)) { gtk_tree_model_get (model, &iter, MODEL_COLUMN_NAME, &name, -1); @@ -254,7 +254,7 @@ selection_changed_cb (GtkTreeSelection *selection, } } -/* XXX This hack is needed, as gtk_expander_set_label seems +/* XXX This hack is needed, as gtk_expander_set_label seems * not to work from egg_file_format_chooser_init */ static gboolean select_default_file_format (gpointer data) @@ -554,7 +554,7 @@ filter_changed_cb (GObject *object, current_filter = gtk_file_chooser_get_filter (GTK_FILE_CHOOSER (object)); model = GTK_TREE_MODEL (self->priv->model); - if (gtk_tree_selection_get_selected (self->priv->selection, &model, &iter)) + if (gtk_tree_selection_get_selected (self->priv->selection, &model, &iter)) { while (gtk_tree_model_iter_parent (model, &parent, &iter)) iter = parent; @@ -692,7 +692,7 @@ chooser_response_cb (GtkDialog *dialog, g_free (filename); } - g_free (basename); + g_free (basename); } } @@ -725,7 +725,7 @@ egg_file_format_chooser_realize (GtkWidget *widget) g_object_ref (self->priv->chooser); - g_signal_connect (self->priv->chooser, "notify::filter", + g_signal_connect (self->priv->chooser, "notify::filter", G_CALLBACK (filter_changed_cb), self); gtk_file_chooser_add_filter (self->priv->chooser, self->priv->all_files); @@ -832,7 +832,7 @@ egg_file_format_chooser_add_format_impl (EggFileFormatChooser *self, else filter = egg_file_format_filter_new (name, TRUE); - gtk_tree_store_append (self->priv->model, &iter, + gtk_tree_store_append (self->priv->model, &iter, parent > 0 ? &search.iter : NULL); gtk_tree_store_set (self->priv->model, &iter, @@ -932,7 +932,7 @@ get_icon_name (const gchar *mime_type) return name; } -void +void egg_file_format_chooser_add_pixbuf_formats (EggFileFormatChooser *self, guint parent G_GNUC_UNUSED, guint **formats) @@ -971,7 +971,7 @@ egg_file_format_chooser_add_pixbuf_formats (EggFileFormatChooser *self, description = gdk_pixbuf_format_get_description (format); name = gdk_pixbuf_format_get_name (format); - id = egg_file_format_chooser_add_format_impl (self, parent, description, + id = egg_file_format_chooser_add_format_impl (self, parent, description, icon, extensions); g_free (description); @@ -1030,7 +1030,7 @@ egg_file_format_chooser_remove_format (EggFileFormatChooser *self, gtk_tree_store_remove (self->priv->model, &search.iter); } -void +void egg_file_format_chooser_set_format (EggFileFormatChooser *self, guint format) { @@ -1095,7 +1095,7 @@ egg_file_format_chooser_get_format (EggFileFormatChooser *self, return format; } -void +void egg_file_format_chooser_set_format_data (EggFileFormatChooser *self, guint format, gpointer data, @@ -1175,14 +1175,14 @@ egg_file_format_chooser_append_extension (EggFileFormatChooser *self, g_return_val_if_fail (search.success, NULL); - gtk_tree_model_get (model, &search.iter, + gtk_tree_model_get (model, &search.iter, MODEL_COLUMN_EXTENSIONS, &extensions, -1); - if (NULL == extensions && + if (NULL == extensions && gtk_tree_model_iter_nth_child (model, &child, &search.iter, 0)) { - gtk_tree_model_get (model, &child, + gtk_tree_model_get (model, &child, MODEL_COLUMN_EXTENSIONS, &extensions, -1); } diff --git a/src/fr-command-7z.c b/src/fr-command-7z.c index 2cb2034..4889c4f 100644 --- a/src/fr-command-7z.c +++ b/src/fr-command-7z.c @@ -129,7 +129,7 @@ list__process_line (char *line, comm->multi_volume = (strcmp (fields[1], "+") == 0); g_strfreev (fields); } - else if (strncmp (line, "Unexpected end of archive", 25) == 0) { + else if (strncmp (line, "Unexpected end of archive", 25) == 0) { unexpected_end_of_archive = TRUE; } return; diff --git a/src/fr-command-lrzip.c b/src/fr-command-lrzip.c index 9e88b75..7c02128 100644 --- a/src/fr-command-lrzip.c +++ b/src/fr-command-lrzip.c @@ -51,7 +51,7 @@ list__process_line (char *line, fdata->size = g_ascii_strtoull (get_last_field (line, 4), NULL, 10); struct stat st; - + if (stat (comm->filename, &st) == 0) fdata->modified = st.st_mtim.tv_sec; else diff --git a/src/fr-command-rar.c b/src/fr-command-rar.c index 3b0d79b..5fe4c7b 100644 --- a/src/fr-command-rar.c +++ b/src/fr-command-rar.c @@ -89,7 +89,7 @@ Details: RAR 4 Attributes Size Packed Ratio Date Time Checksum Name ----------- --------- -------- ----- -------- ----- -------- ---- -rw-rw-r-- 3165 1310 41% 07-03-17 21:34 888D50B3 loremipsum.txt - -rw-rw-r-- 0 8 0% 07-03-17 21:36 00000000 file2.empty + -rw-rw-r-- 0 8 0% 07-03-17 21:36 00000000 file2.empty ----------- --------- -------- ----- -------- ----- -------- ---- 3165 1318 41% 2 @@ -702,7 +702,7 @@ fr_command_rar_handle_error (FrCommand *comm, error->type = FR_PROC_ERROR_ASK_PASSWORD; break; } - + if (strncmp (line, "Unexpected end of archive", 25) == 0) { /* FIXME: handle this type of errors at a higher level when the freeze is over. */ } diff --git a/src/fr-command-tar.h b/src/fr-command-tar.h index 17aa097..5ee5e64 100644 --- a/src/fr-command-tar.h +++ b/src/fr-command-tar.h @@ -47,7 +47,7 @@ struct _FrCommandTar char *uncomp_filename; gboolean name_modified; char *compress_command; - + char *msg; }; diff --git a/src/fr-error.c b/src/fr-error.c index 35515df..efeb5d7 100644 --- a/src/fr-error.c +++ b/src/fr-error.c @@ -24,13 +24,13 @@ #include "fr-error.h" -GQuark +GQuark fr_error_quark (void) { static GQuark quark; - + if (!quark) quark = g_quark_from_static_string ("engrampa-error"); - + return quark; } diff --git a/src/fr-process.c b/src/fr-process.c index 6040439..7ee2d70 100644 --- a/src/fr-process.c +++ b/src/fr-process.c @@ -1057,10 +1057,10 @@ fr_close_suspend_process(FrProcess *process) if (process->priv->suspend) { if (process->priv->command_pid > 0) - { + { ret = killpg (process->priv->command_pid,SIGTERM); ret = killpg (process->priv->command_pid,SIGCONT); - } + } if(ret == 0) process->priv->suspend = FALSE; } diff --git a/src/fr-stock.c b/src/fr-stock.c index 7b5614f..a8a505f 100644 --- a/src/fr-stock.c +++ b/src/fr-stock.c @@ -41,17 +41,17 @@ static const struct { static const GtkStockItem stock_items [] = { { FR_STOCK_CREATE_ARCHIVE, N_("C_reate"), 0, 0, GETTEXT_PACKAGE }, { FR_STOCK_ADD_FILES, N_("_Add"), 0, 0, GETTEXT_PACKAGE }, - { FR_STOCK_ADD_FOLDER, N_("_Add"), 0, 0, GETTEXT_PACKAGE }, + { FR_STOCK_ADD_FOLDER, N_("_Add"), 0, 0, GETTEXT_PACKAGE }, { FR_STOCK_EXTRACT, N_("_Extract"), 0, 0, GETTEXT_PACKAGE } }; void fr_stock_init (void) -{ +{ GtkIconFactory *factory; GtkIconSource *source; int i; - + if (stock_initialized) return; stock_initialized = TRUE; diff --git a/src/fr-window.c b/src/fr-window.c index a6360a7..c582649 100644 --- a/src/fr-window.c +++ b/src/fr-window.c @@ -2318,8 +2318,8 @@ static void change_button_label (FrWindow *window, gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_icon_name ("media-playback-pause", GTK_ICON_SIZE_BUTTON)); - } -} + } +} static void fr_state_switch (FrWindow *window) { int ret; @@ -2329,9 +2329,9 @@ static void fr_state_switch (FrWindow *window) if (ret == 0) { change_button_label (window, window->priv->pd_state_button); - } + } } -} +} static void progress_dialog_response (GtkDialog *dialog, @@ -2370,7 +2370,7 @@ progress_dialog_response (GtkDialog *dialog, break; case GTK_RESPONSE_ACCEPT: fr_state_switch (window); - break; + break; default: break; } diff --git a/src/glib-utils.c b/src/glib-utils.c index ba3f850..1b0f1f9 100644 --- a/src/glib-utils.c +++ b/src/glib-utils.c @@ -326,20 +326,20 @@ match_regexps (GRegex **regexps, { gboolean matched; int i; - + if ((regexps == NULL) || (regexps[0] == NULL)) return TRUE; if (string == NULL) return FALSE; - + matched = FALSE; for (i = 0; regexps[i] != NULL; i++) if (g_regex_match (regexps[i], string, match_options, NULL)) { matched = TRUE; break; } - + return matched; } @@ -348,10 +348,10 @@ void free_regexps (GRegex **regexps) { int i; - - if (regexps == NULL) + + if (regexps == NULL) return; - + for (i = 0; regexps[i] != NULL; i++) g_regex_unref (regexps[i]); g_free (regexps); @@ -370,11 +370,11 @@ search_util_get_patterns (const char *pattern_string) patterns = g_utf8_strsplit (pattern_string, ";", MAX_PATTERNS); for (i = 0; patterns[i] != NULL; i++) { char *p1, *p2; - + p1 = g_utf8_strstrip (patterns[i]); p2 = str_substitute (p1, ".", "\\."); patterns[i] = str_substitute (p2, "*", ".*"); - + g_free (p2); g_free (p1); } @@ -390,19 +390,19 @@ search_util_get_regexps (const char *pattern_string, char **patterns; GRegex **regexps; int i; - + patterns = search_util_get_patterns (pattern_string); if (patterns == NULL) return NULL; - + regexps = g_new0 (GRegex*, n_fields (patterns) + 1); - for (i = 0; patterns[i] != NULL; i++) - regexps[i] = g_regex_new (patterns[i], - G_REGEX_OPTIMIZE | compile_options, - G_REGEX_MATCH_NOTEMPTY, + for (i = 0; patterns[i] != NULL; i++) + regexps[i] = g_regex_new (patterns[i], + G_REGEX_OPTIMIZE | compile_options, + G_REGEX_MATCH_NOTEMPTY, NULL); g_strfreev (patterns); - + return regexps; } @@ -557,7 +557,7 @@ get_time_string (time_t time) tm = localtime (&time); /* This is the time format used in the "Date Modified" column and - * in the Properties dialog. See the man page of strftime for an + * in the Properties dialog. See the man page of strftime for an * explanation of the values. */ locale_format = g_locale_from_utf8 (_("%d %B %Y, %H:%M"), -1, NULL, NULL, NULL); strftime (s_time, sizeof (s_time) - 1, locale_format, tm); @@ -572,14 +572,14 @@ GPtrArray * g_ptr_array_copy (GPtrArray *array) { GPtrArray *new_array; - + if (array == NULL) return NULL; - + new_array = g_ptr_array_sized_new (array->len); - memcpy (new_array->pdata, array->pdata, array->len * sizeof (gpointer)); + memcpy (new_array->pdata, array->pdata, array->len * sizeof (gpointer)); new_array->len = array->len; - + return new_array; } @@ -599,7 +599,7 @@ g_ptr_array_reverse (GPtrArray *array) { int i, j; gpointer tmp; - + for (i = 0; i < array->len / 2; i++) { j = array->len - i - 1; tmp = g_ptr_array_index (array, i); @@ -615,20 +615,20 @@ g_ptr_array_binary_search (GPtrArray *array, GCompareFunc func) { int l, r, p, cmp = -1; - + l = 0; r = array->len; while (l < r) { p = l + ((r - l) / 2); cmp = func(value, &g_ptr_array_index (array, p)); if (cmp == 0) - return p; + return p; else if (cmp < 0) r = p; - else + else l = p + 1; } - + return -1; } @@ -662,11 +662,11 @@ char* g_uri_display_basename (const char *uri) { char *e_name, *name; - + e_name = g_filename_display_basename (uri); name = g_uri_unescape_string (e_name, ""); g_free (e_name); - + return name; } diff --git a/src/gtk-utils.h b/src/gtk-utils.h index 7e76ff6..2612702 100644 --- a/src/gtk-utils.h +++ b/src/gtk-utils.h @@ -79,7 +79,7 @@ GdkPixbuf * get_mime_type_pixbuf (const char *mime_type, int get_folder_pixbuf_size_for_list (GtkWidget *widget); void show_help_dialog (GtkWindow *parent, const char *section); -GtkBuilder * +GtkBuilder * _gtk_builder_new_from_file (const char *filename); GtkBuilder * _gtk_builder_new_from_resource (const char *resource_path); diff --git a/src/java-utils.c b/src/java-utils.c index 1e757c8..ecb2bd6 100644 --- a/src/java-utils.c +++ b/src/java-utils.c @@ -19,7 +19,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - + #include <fcntl.h> #include <unistd.h> #include <errno.h> @@ -28,9 +28,9 @@ #include "java-utils.h" -/* +/* * The following code conforms to the JVM specification.(Java 2 Platform) - * For further changes to the classfile structure, please update the + * For further changes to the classfile structure, please update the * following macros. */ @@ -64,7 +64,7 @@ /* represents the utf8 strings in class file */ -struct utf_string +struct utf_string { guint16 index; guint16 length; @@ -80,7 +80,7 @@ struct class_info typedef struct { int fd; - + guint32 magic_no; /* 0xCAFEBABE (JVM Specification) :) */ guint16 major; /* versions */ @@ -92,7 +92,7 @@ typedef struct { guint16 access_flags; guint16 this_class; /* the index of the class the file is named after. */ - + #if 0 /* not needed */ guint16 super_class; guint16 interfaces_count; @@ -111,10 +111,10 @@ static JavaClassFile* java_class_file_new (void) { JavaClassFile *cfile; - + cfile = g_new0 (JavaClassFile, 1); cfile->fd = -1; - + return cfile; } @@ -133,7 +133,7 @@ java_class_file_free (JavaClassFile *cfile) struct utf_string *string = scan->data; g_free (string->str); } - + if (cfile->const_pool_utf != NULL) { g_slist_foreach (cfile->const_pool_utf, (GFunc)g_free, NULL); g_slist_free (cfile->const_pool_utf); @@ -146,18 +146,18 @@ java_class_file_free (JavaClassFile *cfile) } -/* The following function loads the utf8 strings and class structures from the +/* The following function loads the utf8 strings and class structures from the * class file. */ static void load_constant_pool_utfs (JavaClassFile *cfile) { guint8 tag; guint16 i = 0; /* should be comparable with const_pool_count */ - + while ((i < cfile->const_pool_count - 1) && (read (cfile->fd, &tag, 1) != -1)) { struct utf_string *txt = NULL; struct class_info *class = NULL; - + switch (tag) { case CONST_CLASS: class = g_new0 (struct class_info, 1); @@ -169,43 +169,43 @@ load_constant_pool_utfs (JavaClassFile *cfile) class->name_index = GUINT16_FROM_BE (class->name_index); cfile->const_pool_class = g_slist_append (cfile->const_pool_class, class); break; - + case CONST_FIELDREF: lseek (cfile->fd, CONST_FIELDREF_INFO, SEEK_CUR); break; - + case CONST_METHODREF: lseek (cfile->fd, CONST_METHODREF_INFO, SEEK_CUR); break; - + case CONST_INTERFACEMETHODREF: lseek (cfile->fd, CONST_INTERFACEMETHODREF_INFO, SEEK_CUR); break; - + case CONST_STRING: lseek (cfile->fd, CONST_STRING_INFO, SEEK_CUR); break; - + case CONST_INTEGER: lseek (cfile->fd, CONST_INTEGER_INFO, SEEK_CUR); break; - + case CONST_FLOAT: lseek (cfile->fd, CONST_FLOAT_INFO, SEEK_CUR); break; - + case CONST_LONG: lseek (cfile->fd, CONST_LONG_INFO, SEEK_CUR); break; - + case CONST_DOUBLE: lseek (cfile->fd, CONST_DOUBLE_INFO, SEEK_CUR); break; - + case CONST_NAMEANDTYPE: lseek (cfile->fd, CONST_NAMEANDTYPE_INFO, SEEK_CUR); break; - + case CONST_UTF8: txt = g_new0 (struct utf_string, 1); txt->index = i + 1; @@ -221,14 +221,14 @@ load_constant_pool_utfs (JavaClassFile *cfile) } cfile->const_pool_utf = g_slist_append (cfile->const_pool_utf, txt); break; - + default: return; /* error - unknown tag in class file */ break; } i++; } - + #ifdef DEBUG g_print( "Number of Entries: %d\n", i ); #endif @@ -236,7 +236,7 @@ load_constant_pool_utfs (JavaClassFile *cfile) static char* -close_and_exit (JavaClassFile *cfile) +close_and_exit (JavaClassFile *cfile) { java_class_file_free (cfile); return NULL; @@ -253,7 +253,7 @@ get_package_name_from_class_file (char *fname) guint32 magic; guint16 major, minor, count; int i = 0; - + if (! g_file_test (fname, G_FILE_TEST_EXISTS)) return NULL; @@ -288,7 +288,7 @@ get_package_name_from_class_file (char *fname) cfile->this_class = GUINT16_FROM_BE(cfile->this_class); /* now search for the class structure with index = cfile->this_class */ - + for (i = 0; (i < g_slist_length (cfile->const_pool_class)) && (utf_index == 0); i++ ) { struct class_info *class = g_slist_nth_data (cfile->const_pool_class, i); if (class->index == cfile->this_class) @@ -296,7 +296,7 @@ get_package_name_from_class_file (char *fname) } /* now search for the utf8 string with index = utf_index */ - + for (i = 0; i < g_slist_length (cfile->const_pool_utf); i++) { struct utf_string *data = g_slist_nth_data (cfile->const_pool_utf, i); if (data->index == utf_index) { @@ -314,12 +314,12 @@ get_package_name_from_class_file (char *fname) } java_class_file_free (cfile); - + return package; } -/* This function consumes a comment from the java file +/* This function consumes a comment from the java file * multiline = TRUE implies that comment is multiline */ static void consume_comment (int fdesc, @@ -328,7 +328,7 @@ consume_comment (int fdesc, gboolean escaped = FALSE; gboolean star = FALSE; char ch; - + while (read (fdesc, &ch, 1) == 1) { switch (ch) { case '/': @@ -337,21 +337,21 @@ consume_comment (int fdesc, else if (star) return; break; - + case '\n': if (! multiline) return; break; - + case '*': escaped = FALSE; star = TRUE; break; - + case '\\': escaped = ! escaped; break; - + default: escaped = FALSE; star = FALSE; @@ -370,7 +370,7 @@ get_package_name_from_java_file (char *fname) gboolean prev_char_is_bslash = FALSE; gboolean valid_char_found = FALSE; char ch; - + if (! g_file_test (fname, G_FILE_TEST_EXISTS)) return NULL; @@ -378,56 +378,56 @@ get_package_name_from_java_file (char *fname) cfile->fd = open (fname, O_RDONLY); if (cfile->fd == -1) return close_and_exit (cfile); - + while (! valid_char_found && (read (cfile->fd, &ch, 1) == 1)) { switch (ch) { case '/': - if (prev_char_is_bslash == TRUE) { + if (prev_char_is_bslash == TRUE) { consume_comment (cfile->fd, FALSE); prev_char_is_bslash = FALSE; } else prev_char_is_bslash = TRUE; break; - + case '*': if (prev_char_is_bslash == TRUE) consume_comment (cfile->fd, TRUE); prev_char_is_bslash = FALSE; break; - + case ' ': case '\t': case '\r': case '\n': prev_char_is_bslash = FALSE; break; - + default: prev_char_is_bslash = FALSE; valid_char_found = TRUE; break; } } - + if (ch == 'p') { char first_valid_word[8] = ""; - + first_valid_word[0] = 'p'; - if (read (cfile->fd, &first_valid_word[1], 6) != 6) + if (read (cfile->fd, &first_valid_word[1], 6) != 6) return close_and_exit (cfile); - + first_valid_word[7] = 0; if (g_ascii_strcasecmp (first_valid_word, "package") == 0) { char buffer[500]; int index = 0; - + while (read (cfile->fd, &ch, 1) == 1) { if (ch == ';') break; if (ch == '.') buffer[index++] = '/'; - else + else buffer[index++] = ch; } buffer[index] = 0; diff --git a/src/java-utils.h b/src/java-utils.h index edfd31e..3ed7f53 100644 --- a/src/java-utils.h +++ b/src/java-utils.h @@ -19,7 +19,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - + #ifndef JAVA_UTILS_H #define JAVA_UTILS_H diff --git a/src/open-file.c b/src/open-file.c index 35280ac..ceda1d3 100644 --- a/src/open-file.c +++ b/src/open-file.c @@ -31,17 +31,17 @@ open_file_new (const char *path, const char *temp_dir) { OpenFile *ofile; - + ofile = g_new0 (OpenFile, 1); ofile->path = g_strdup (path); ofile->extracted_uri = g_filename_to_uri (extracted_path, NULL, NULL); if (! uri_exists (ofile->extracted_uri)) { open_file_free (ofile); return NULL; - } + } ofile->temp_dir = g_strdup (temp_dir); ofile->last_modified = get_file_mtime (ofile->extracted_uri); - + return ofile; } @@ -79,9 +79,9 @@ GType open_file_get_type (void) { static GType type = 0; - + if (type == 0) type = g_boxed_type_register_static ("FROpenFile", (GBoxedCopyFunc) open_file_copy, (GBoxedFreeFunc) open_file_free); - + return type; } |