This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository enlightenment.
View the commit online.
commit 94f0d2ed2fc33de91d81503578e664584ef211cc
Author: Carsten Haitzler <[email protected]>
AuthorDate: Sun Jan 4 16:17:53 2026 +0000
clipboard - fix worst warnings
fixes the worst of warnings.. but i really need to redo stuff
1. config - so many boolean things are stored as ints.
2. use of sliders requires doubles which is a bot naff...
3. history storage is bleh. nieed to redo this.
and more
4. popup should use e.g. a genlist not buttons
5. probably move to elm for settings ui
---
src/modules/clipboard/e_mod_config.c | 38 ++++++++++++++++++------------------
src/modules/clipboard/e_mod_config.h | 9 +++++----
src/modules/clipboard/e_mod_main.c | 14 ++++++-------
src/modules/clipboard/e_mod_main.h | 7 -------
src/modules/clipboard/history.c | 31 ++++++++---------------------
5 files changed, 39 insertions(+), 60 deletions(-)
diff --git a/src/modules/clipboard/e_mod_config.c b/src/modules/clipboard/e_mod_config.c
index c0b76578a..1bc4993da 100644
--- a/src/modules/clipboard/e_mod_config.c
+++ b/src/modules/clipboard/e_mod_config.c
@@ -7,15 +7,15 @@ struct _E_Config_Dialog_Data
/* Store some initial states of clipboard configuration we will need */
- double init_label_length; /* Initial label length. */
+ unsigned int init_label_length; /* Initial label length. */
/* Actual options user can change */
int clip_copy; /* Clipboard to use */
int clip_select; /* Clipboard to use */
int persistence; /* History file persistance */
int hist_reverse; /* Order to display History */
- double hist_items; /* Number of history items to store */
+ double hist_items; /* Number of history items to store */
int confirm_clear; /* Display history confirmation dialog on deletion */
- double label_length; /* Number of characters of item to display */
+ double label_length; /* Number of characters of item to display */
int ignore_ws; /* Should we ignore White space in label */
int ignore_ws_copy; /* Should we not copy White space only */
int trim_ws; /* Should we trim White space from selection */
@@ -71,16 +71,16 @@ _basic_apply_data(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata
clip_cfg->clip_select = cfdata->clip_select;
clip_cfg->persistence = cfdata->persistence;
clip_cfg->hist_reverse = cfdata->hist_reverse;
-
+
/* Do we need to Truncate our history list? */
- if (clip_cfg->hist_items != cfdata->hist_items)
+ if (clip_cfg->hist_items != (unsigned int)cfdata->hist_items)
truncate_history(cfdata-> hist_items);
-
+
clip_cfg->hist_items = cfdata->hist_items;
clip_cfg->confirm_clear = cfdata->confirm_clear;
-
+
/* Has clipboard label name length changed ? */
- if (cfdata->label_length != cfdata->init_label_length) {
+ if ((unsigned int)cfdata->label_length != cfdata->init_label_length) {
clip_cfg->label_length_changed = EINA_TRUE;
cfdata->init_label_length = cfdata->label_length;
}
@@ -113,7 +113,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 0, 0.5);
-
+
/* History Config Section */
of = e_widget_framelist_add(evas, _("History"), 0);
ob = e_widget_check_add(evas, _(" Save History"), &(cfdata->persistence));
@@ -121,7 +121,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
ob = e_widget_check_add(evas, _(" Reverse Order"), &(cfdata->hist_reverse));
e_widget_framelist_object_append(of, ob);
-
+
ob = e_widget_check_add(evas, _(" Confirm before Clearing"), &(cfdata->confirm_clear));
e_widget_framelist_object_append(of, ob);
@@ -131,24 +131,24 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 0, 0.5);
-
+
/* Label Config Section */
of = e_widget_framelist_add(evas, _("Labels"), 0);
ob = e_widget_check_add(evas, _(" Ignore Whitespace"), &(cfdata->ignore_ws));
e_widget_framelist_object_append(of, ob);
-
+
ob = e_widget_label_add(evas, _(" Label Length"));
e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(evas, 1, 0, "%2.0f", LABEL_MIN, LABEL_MAX, 1.0, 0, &(cfdata->label_length), NULL, 40);
e_widget_framelist_object_append(of, ob);
-
+
e_widget_list_object_append(o, of, 1, 0, 0.5);
-
+
/* Content Config Section */
of = e_widget_framelist_add(evas, _("Content"), 0);
ob = e_widget_check_add(evas, _(" Ignore Whitespace"), &(cfdata->ignore_ws_copy));
e_widget_framelist_object_append(of, ob);
-
+
ob = e_widget_check_add(evas, _(" Trim Whitespace"), &(cfdata->trim_ws));
e_widget_framelist_object_append(of, ob);
@@ -156,7 +156,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 0, 0.5);
-
+
e_dialog_resizable_set(cfd->dia, EINA_TRUE);
return o;
}
@@ -190,9 +190,9 @@ _basic_check_changed(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfd
if (clip_cfg->clip_select != cfdata->clip_select) return 1;
if (clip_cfg->persistence != cfdata->persistence) return 1;
if (clip_cfg->hist_reverse != cfdata->hist_reverse) return 1;
- if (clip_cfg->hist_items != cfdata->hist_items) return 1;
- if (clip_cfg->confirm_clear != cfdata->confirm_clear) return 1;
- if (clip_cfg->label_length != cfdata->label_length) return 1;
+ if (clip_cfg->hist_items != (unsigned int)cfdata->hist_items) return 1;
+ if (clip_cfg->confirm_clear != cfdata->confirm_clear) return 1;
+ if (clip_cfg->label_length != (unsigned int)cfdata->label_length) return 1;
if (clip_cfg->ignore_ws != cfdata->ignore_ws) return 1;
if (clip_cfg->ignore_ws_copy != cfdata->ignore_ws_copy) return 1;
if (clip_cfg->trim_ws != cfdata->trim_ws) return 1;
diff --git a/src/modules/clipboard/e_mod_config.h b/src/modules/clipboard/e_mod_config.h
index e6eb6434f..8edaa1771 100644
--- a/src/modules/clipboard/e_mod_config.h
+++ b/src/modules/clipboard/e_mod_config.h
@@ -19,15 +19,16 @@ struct _Config
labels as configfuration changed. */
int version; /* Configuration version */
+ unsigned int hist_items; /* Number of history items to store */
+ unsigned int label_length; /* Number of characters of item to display */
+ // these are booleans really...
int clip_copy; /* Clipboard to use */
int clip_select; /* Clipboard to use */
int persistence; /* History file persistance */
int hist_reverse; /* Order to display History */
- double hist_items; /* Number of history items to store */
int confirm_clear; /* Display history confirmation dialog on deletion */
- double label_length; /* Number of characters of item to display */
- int ignore_ws; /* Should we ignore White space in label */
- int ignore_ws_copy; /* Should we not copy White space only */
+ int ignore_ws; /* Should we ignore White space in label */
+ int ignore_ws_copy; /* Should we not copy White space only */
int trim_ws; /* Should we trim White space from selection */
int trim_nl; /* Should we trim new lines from selection */
};
diff --git a/src/modules/clipboard/e_mod_main.c b/src/modules/clipboard/e_mod_main.c
index 685f4bdec..1a14c8198 100644
--- a/src/modules/clipboard/e_mod_main.c
+++ b/src/modules/clipboard/e_mod_main.c
@@ -88,12 +88,12 @@ _clip_config_new(E_Module *m)
clip_cfg->trim_ws = CF_DEFAULT_WS;
clip_cfg->trim_nl = CF_DEFAULT_NL;
}
+ E_CONFIG_LIMIT(clip_cfg->hist_items, HIST_MIN, HIST_MAX);
+ E_CONFIG_LIMIT(clip_cfg->label_length, LABEL_MIN, LABEL_MAX);
E_CONFIG_LIMIT(clip_cfg->clip_copy, 0, 1);
E_CONFIG_LIMIT(clip_cfg->clip_select, 0, 1);
E_CONFIG_LIMIT(clip_cfg->persistence, 0, 1);
E_CONFIG_LIMIT(clip_cfg->hist_reverse, 0, 1);
- E_CONFIG_LIMIT(clip_cfg->hist_items, HIST_MIN, HIST_MAX);
- E_CONFIG_LIMIT(clip_cfg->label_length, LABEL_MIN, LABEL_MAX);
E_CONFIG_LIMIT(clip_cfg->confirm_clear, 0, 1);
E_CONFIG_LIMIT(clip_cfg->ignore_ws, 0, 1);
E_CONFIG_LIMIT(clip_cfg->ignore_ws_copy, 0, 1);
@@ -635,14 +635,14 @@ e_modapi_init (E_Module *m)
#define T Config
#define D conf_edd
E_CONFIG_LIST(D, T, items, conf_item_edd);
- E_CONFIG_VAL(D, T, version, INT);
+ E_CONFIG_VAL(D, T, version, UINT);
+ E_CONFIG_VAL(D, T, label_length, UINT);
+ E_CONFIG_VAL(D, T, hist_items, INT);
E_CONFIG_VAL(D, T, clip_copy, INT);
E_CONFIG_VAL(D, T, clip_select, INT);
E_CONFIG_VAL(D, T, persistence, INT);
E_CONFIG_VAL(D, T, hist_reverse, INT);
- E_CONFIG_VAL(D, T, hist_items, DOUBLE);
E_CONFIG_VAL(D, T, confirm_clear, INT);
- E_CONFIG_VAL(D, T, label_length, DOUBLE);
E_CONFIG_VAL(D, T, ignore_ws, INT);
E_CONFIG_VAL(D, T, ignore_ws_copy, INT);
E_CONFIG_VAL(D, T, trim_ws, INT);
@@ -714,12 +714,12 @@ e_modapi_init (E_Module *m)
clip_inst);
E_LIST_HANDLER_APPEND(clip_inst->handle,
ECORE_EVENT_MOUSE_BUTTON_UP,
- (Ecore_Event_Handler_Cb)_clipboard_cb_event_selection,
+ _clipboard_cb_event_selection,
clip_inst);
/* Does not seem to fire */
E_LIST_HANDLER_APPEND(clip_inst->handle,
ELM_CNP_EVENT_SELECTION_CHANGED,
- (Ecore_Event_Handler_Cb)_clipboard_cb_event_selection,
+ _clipboard_cb_event_selection,
clip_inst);
/* Tell any gadget containers (shelves, etc) that we provide a module */
diff --git a/src/modules/clipboard/e_mod_main.h b/src/modules/clipboard/e_mod_main.h
index 3c7ea3896..03320e3ca 100644
--- a/src/modules/clipboard/e_mod_main.h
+++ b/src/modules/clipboard/e_mod_main.h
@@ -6,13 +6,6 @@
#include "history.h"
#include "utility.h"
-#ifdef ENABLE_NLS
-# include <libintl.h>
-# define _(x) gettext(x)
-#else
-# define _(x) (x)
-#endif
-
/* Key Board Bindings action names */
#define ACT_FLOAT _("Show History")
#define ACT_CONFIG _("Show Settings")
diff --git a/src/modules/clipboard/history.c b/src/modules/clipboard/history.c
index 603ad1500..7af720533 100644
--- a/src/modules/clipboard/history.c
+++ b/src/modules/clipboard/history.c
@@ -1,39 +1,24 @@
#include "history.h"
#define CLIPBOARD_MOD_NAME "clipboard"
-#define DATA_DIR CLIPBOARD_MOD_NAME
-#define HISTORY_NAME "history"
-#define HISTORY_VERSION 1 /* must be < 9 */
-
-#if 0
- #define PATH_MAX 4096
- /** PATH_MAX is defined in <linux/limits.h>
- * While this define is used through out enlightenment source code
- * its use is perhaps a bad idea.
- *
- * see http://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html
- * "Since a path can be longer than PATH_MAX, the define is useless,
- * writing code based off of it is wrong, and the functions that
- * require it are broken."
- *
- * Regardless in the e-dev tradition we are using it here.
- */
-#endif
+#define DATA_DIR CLIPBOARD_MOD_NAME
+#define HISTORY_NAME "history"
+#define HISTORY_VERSION 1 /* must be < 9 */
/* convenience macros to compress code */
#define CALLOC_DIGIT_STR(str, n) \
do { \
long _digits_ = 1; \
- long _tempn_ = n; \
+ long _tempn_ = n + 9; \
while (_tempn_ /= 10) _digits_++; \
- str = calloc(_digits_ + 1, sizeof(long)); \
+ str = calloc(_digits_ + 1, sizeof(char)); \
if (!str) { \
/* This is bad, leave it to calling function */ \
CRI("ERROR: Memory allocation Failed!!"); \
eet_close(history_file); \
return EET_ERROR_OUT_OF_MEMORY; \
} \
- snprintf(str, _digits_, "%d", 0); \
+ snprintf(str, _digits_ + 1, "%d", 0); \
} while(0)
#define PATH_MAX_ERR \
@@ -89,7 +74,7 @@ _set_data_path(char *path)
*/
temp_str = getenv("XDG_DATA_HOME");
if (temp_str && temp_str[0] == '/' ) {
- const int len = snprintf(NULL, 0, "%s", temp_str)
+ const int len = snprintf(NULL, 0, "%s", temp_str)
+ 1 + (temp_str[strlen(temp_str)] != '/');
if (len <= PATH_MAX) {
snprintf(path, strlen(temp_str)+1, "%s", temp_str);
@@ -304,7 +289,7 @@ save_history(Eina_List *items)
EINA_LIST_FOREACH(items, l, cd) {
snprintf(str, str_len, "%d", i);
eet_write(history_file, str, cd->content, strlen(cd->content) + 1, 0);
- i++;
+ i++;
}
/* and wrap it up */
eet_write(history_file, "MAX_ITEMS", str, strlen(str) + 1, 0);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.