From c33a44612947eb91579b24f98848812018dd8c16 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 9 May 2015 11:38:18 -0700 Subject: Fix -Wsign-compare warnings actions.c:291:21: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] for ( i = 0 ; i < num_table; i++ ) ~ ^ ~~~~~~~~~ actions.c:299:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] for (i = 0; i < num_table; ) { ~ ^ ~~~~~~~~~ actions.c:302:8: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare] if (i == (num_table - 1)) ~ ^ ~~~~~~~~~~~~~ actions.c:304:13: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] else if (i < num_table) ~ ^ ~~~~~~~~~ geometry.c:150:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] for (i = 0; i < tree_info->num_nodes; i++) ~ ^ ~~~~~~~~~~~~~~~~~~~~ geometry.c:380:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] for (i = 0; i < tree_info->num_flash_widgets; i++) { ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ geometry.c:401:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] for (i = 0; i < tree_info->num_flash_widgets; i++) ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ geometry.c:423:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] for (i = 0; i < tree_info->num_flash_widgets; i++) ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ geometry.c:428:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] for (i = 0; i < tree_info->num_flash_widgets; i++) ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ handler.c:475:13: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] if (len > malloc_size) { ~~~ ^ ~~~~~~~~~~~ handler.c:476:58: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] malloc_string = XtRealloc(malloc_string, sizeof(char) * len); ~ ^~~ handler.c:477:16: warning: implicit conversion changes signedness: 'int' to 'Cardinal' (aka 'unsigned int') [-Wsign-conversion] malloc_size = len; ~ ^~~ utils.c:167:37: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] for (node = top_node, i = 1 ; i < number; i++) { ~ ^ ~~~~~~ utils.c:170:16: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] for (j = 0; j < node->num_children; j++) { ~ ^ ~~~~~~~~~~~~~~~~~~ utils.c:215:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] for (i = 0; i < node->num_children; i++) { ~ ^ ~~~~~~~~~~~~~~~~~~ utils.c:787:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] for (i = 0; i < top_node->num_children; i++) ~ ^ ~~~~~~~~~~~~~~~~~~~~~~ wtree.c:129:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] for (i = 0; i < top->num_children; i++) ~ ^ ~~~~~~~~~~~~~~~~~ wtree.c:194:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] for (i = 0; i < info->num_nodes; i++) { ~ ^ ~~~~~~~~~~~~~~~ wtree.c:216:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] for (i = 0; i < info->num_nodes; i++) ~ ^ ~~~~~~~~~~~~~~~ wtree.c:270:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] for (i = 0; i < top->num_children; i++) ~ ^ ~~~~~~~~~~~~~~~~~ wtree.c:339:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] for (i = 0; i < num_active_nodes; i++) ~ ^ ~~~~~~~~~~~~~~~~ wtree.c:386:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] for (i = 0; i < node->num_children; i++) ~ ^ ~~~~~~~~~~~~~~~~~~ wtree.c:446:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] for (i = 0; i < node->num_children; i++) ~ ^ ~~~~~~~~~~~~~~~~~~ wtree.c:478:16: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] for (i = 0; i < node->num_children; i++) { ~ ^ ~~~~~~~~~~~~~~~~~~ wtree.c:607:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] for (i = 0; i < tree_info->num_nodes; i++) ~ ^ ~~~~~~~~~~~~~~~~~~~~ wtree.c:686:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare] for (i = 0; i < node->num_children; i++) ~ ^ ~~~~~~~~~~~~~~~~~~ Signed-off-by: Alan Coopersmith --- actions.c | 2 +- editresP.h | 2 +- geometry.c | 8 ++++---- handler.c | 2 +- utils.c | 6 +++--- wtree.c | 26 +++++++++++++------------- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/actions.c b/actions.c index 800839d..d62c03f 100644 --- a/actions.c +++ b/actions.c @@ -279,7 +279,7 @@ CheckAndFindEntry(String action_name, String *params, Cardinal num_params, struct ActionValues *table, Cardinal num_table, int *type) { char buf[BUFSIZ]; - int i; + Cardinal i; if (num_params != 1) { snprintf(buf, sizeof(buf), res_labels[2], action_name); diff --git a/editresP.h b/editresP.h index 2149e99..fcdca7f 100644 --- a/editresP.h +++ b/editresP.h @@ -393,7 +393,7 @@ extern void LayoutTree ( Widget tree ); extern int main ( int argc, char **argv ); extern void ModifySVEntry ( Widget w, XEvent *event, String * params, Cardinal * num_params ); extern void PannerCallback ( Widget w, XtPointer closure, XtPointer report_ptr ); -extern void PerformTreeToFileDump ( WNode * node, int num_tabs, FILE * fp ); +extern void PerformTreeToFileDump ( WNode * node, Cardinal num_tabs, FILE * fp ); extern void PopdownResBox ( Widget w, XtPointer shell_ptr, XtPointer junk ); extern void PopupCentered ( XEvent * event, Widget w, XtGrabKind mode ); extern void PopupSetValues ( Widget parent, XEvent * event ); diff --git a/geometry.c b/geometry.c index 0bc9445..c9b01a5 100644 --- a/geometry.c +++ b/geometry.c @@ -127,7 +127,7 @@ DisplayChild(Event *event) void _FlashActiveWidgets(TreeInfo *tree_info) { - int i; + Cardinal i; ProtocolStream * stream = &(global_client.stream); if (tree_info == NULL) { @@ -374,7 +374,7 @@ static void FlashWidgetsOn(XtPointer info_ptr, XtIntervalId *id) { - int i; + Cardinal i; TreeInfo * tree_info = (TreeInfo *) info_ptr; for (i = 0; i < tree_info->num_flash_widgets; i++) { @@ -395,7 +395,7 @@ FlashWidgetsOn(XtPointer info_ptr, XtIntervalId *id) static void FlashWidgetsOff(XtPointer info_ptr, XtIntervalId *id) { - int i; + Cardinal i; TreeInfo * tree_info = (TreeInfo *) info_ptr; for (i = 0; i < tree_info->num_flash_widgets; i++) @@ -413,7 +413,7 @@ FlashWidgetsOff(XtPointer info_ptr, XtIntervalId *id) static void FlashWidgetsCleanup(XtPointer info_ptr, XtIntervalId *id) { - int i; + Cardinal i; TreeInfo * tree_info = (TreeInfo *) info_ptr; /* diff --git a/handler.c b/handler.c index f209971..b2bf83c 100644 --- a/handler.c +++ b/handler.c @@ -431,7 +431,7 @@ SetResourceString(Widget w, XtPointer node_ptr, XtPointer junk) char * temp, buf[BUFSIZ * 10]; /* here's hoping it's big enough. */ NameInfo * name_node = res_box->name_info; Arg args[1]; - int len; + Cardinal len; if ((w != NULL) && XtIsSubclass(w, toggleWidgetClass)) { /* diff --git a/utils.c b/utils.c index a0f74d0..9d93e3d 100644 --- a/utils.c +++ b/utils.c @@ -155,7 +155,7 @@ AddString(char ** str, char *add) WNode * FindNode(WNode *top_node, unsigned long *ids, Cardinal number) { - int i, j; + Cardinal i, j; WNode *node; if (top_node == NULL) @@ -206,7 +206,7 @@ FindWidgetFromWindow(TreeInfo *tree_info, Window win) static WNode * FindWidgetFromWindowGivenNode(WNode *node, Window win) { - int i; + Cardinal i; WNode * ret_node; if (node->window == win) @@ -780,7 +780,7 @@ void ExecuteOverAllNodes(WNode *top_node, void (*func)(WNode *, XtPointer), XtPointer data) { - int i; + Cardinal i; (*func)(top_node, data); diff --git a/wtree.c b/wtree.c index 9c3a884..4550082 100644 --- a/wtree.c +++ b/wtree.c @@ -100,7 +100,7 @@ BuildVisualTree(Widget tree_parent, Event *event) void AddTreeNode(Widget tree, WNode *top) { - int i; + Cardinal i; Arg args[1]; Cardinal num_args = 0; char msg[BUFSIZ]; @@ -186,7 +186,7 @@ RemoveNodeFromActiveList(WNode *node) { TreeInfo * info = node->tree_info; Boolean found_node = FALSE; - int i; + Cardinal i; if (!IsActiveNode(node)) /* This node is not active. */ return; @@ -211,7 +211,7 @@ static Boolean IsActiveNode(WNode *node) { TreeInfo * info = node->tree_info; - int i; + Cardinal i; for (i = 0; i < info->num_nodes; i++) if (info->active_nodes[i] == node) @@ -230,7 +230,7 @@ TreeInfo * CreateTree(Event *event) { SendWidgetTreeEvent * send_event = (SendWidgetTreeEvent *) event; - int i; + unsigned short i; TreeInfo * tree_info; @@ -243,7 +243,7 @@ CreateTree(Event *event) tree_info->flash_widgets = NULL; tree_info->num_flash_widgets = tree_info->alloc_flash_widgets = 0; - for ( i = 0; i < (int)send_event->num_entries; i++) + for ( i = 0; i < send_event->num_entries; i++) AddNode(&(tree_info->top_node), (send_event->info + i), tree_info); return(tree_info); @@ -258,7 +258,7 @@ CreateTree(Event *event) void PrintNodes(WNode *top) { - int i; + Cardinal i; if (top->parent == NULL) printf("Top of Tree, Name: %10s, ID: %10ld, Class: %10s\n", @@ -309,7 +309,7 @@ _TreeSelect(TreeInfo *tree_info, SelectTypes type) { WNode ** active_nodes; Cardinal num_active_nodes; - int i; + Cardinal i; if (tree_info == NULL) { SetMessage(global_screen_data.info_label, @@ -353,7 +353,7 @@ _TreeSelect(TreeInfo *tree_info, SelectTypes type) void _TreeSelectNode(WNode *node, SelectTypes type, Boolean recurse) { - int i; + Cardinal i; Arg args[1]; Boolean state; @@ -398,7 +398,7 @@ _TreeSelectNode(WNode *node, SelectTypes type, Boolean recurse) void _TreeRelabelNode(WNode *node, LabelTypes type, Boolean recurse) { - int i; + Cardinal i; Arg args[1]; char buf[30]; char *label; @@ -459,7 +459,7 @@ void _TreeActivateNode(WNode* node, SelectTypes type) { Arg args[1]; - int i; + Cardinal i; XtSetArg(args[0], XtNstate, TRUE); @@ -597,7 +597,7 @@ static WNode ** CopyActiveNodes(TreeInfo *tree_info) { WNode ** list; - int i; + Cardinal i; if ( (tree_info == NULL) || (tree_info->num_nodes == 0)) return(NULL); @@ -674,9 +674,9 @@ SetAndCenterTreeNode(WNode *node) */ void -PerformTreeToFileDump(WNode *node, int num_tabs, FILE *fp) +PerformTreeToFileDump(WNode *node, Cardinal num_tabs, FILE *fp) { - int i; + Cardinal i; for (i = 0; i < num_tabs; i++) fprintf(fp, "\t"); -- cgit v1.2.3