1 Subject: remove more cast warnings
6 source/highlight.c | 2 +-
7 source/macro.c | 12 ++++++------
8 source/preferences.c | 21 +++++++++++----------
9 source/userCmds.c | 10 +++++-----
10 util/prefFile.c | 4 ++--
11 6 files changed, 26 insertions(+), 25 deletions(-)
13 diff --quilt old/source/preferences.c new/source/preferences.c
14 --- old/source/preferences.c
15 +++ new/source/preferences.c
16 @@ -2281,9 +2281,8 @@ void SetLanguageMode(WindowInfo *window,
26 /* Do mode-specific actions */
27 reapplyLanguageMode(window, mode, forceNewDefaults);
28 @@ -2292,9 +2291,9 @@ void SetLanguageMode(WindowInfo *window,
29 if (IsTopDocument(window)) {
30 XtVaGetValues(window->langModeCascade, XmNsubMenuId, &menu, NULL);
31 XtVaGetValues(menu, XmNchildren, &items, XmNnumChildren, &nItems, NULL);
32 - for (n=0; n<(int)nItems; n++) {
33 + for (n=0; n<nItems; n++) {
34 XtVaGetValues(items[n], XmNuserData, &userData, NULL);
35 - XmToggleButtonSetState(items[n], (int)userData == mode, False);
36 + XmToggleButtonSetState(items[n], userData == (XtPointer)(long)mode, False);
40 @@ -5146,7 +5145,7 @@ static void updateLanguageModeSubmenu(Wi
41 xmToggleButtonGadgetClass, menu,
42 XmNlabelString, s1=XmStringCreateSimple(LanguageModes[i]->name),
44 - XmNuserData, (void *)i,
45 + XmNuserData, (XtPointer)(long)i,
46 XmNset, window->languageMode==i, NULL);
48 XtAddCallback(btn, XmNvalueChangedCallback, setLangModeCB, window);
49 @@ -5158,23 +5157,25 @@ static void setLangModeCB(Widget w, XtPo
51 WindowInfo *window = WidgetToWindow(MENU_WIDGET(w));
57 if (!XmToggleButtonGetState(w))
60 /* get name of language mode stored in userData field of menu item */
61 - XtVaGetValues(w, XmNuserData, &mode, NULL);
62 + XtVaGetValues(w, XmNuserData, &userData, NULL);
63 + mode = (int)(long)userData;
65 /* If the mode didn't change, do nothing */
66 - if (window->languageMode == (int)mode)
67 + if (window->languageMode == mode)
70 /* redo syntax highlighting word delimiters, etc. */
72 reapplyLanguageMode(window, (int)mode, False);
74 - params[0] = (((int)mode) == PLAIN_LANGUAGE_MODE) ? "" : LanguageModes[(int)mode]->name;
75 + params[0] = (mode == PLAIN_LANGUAGE_MODE) ? "" : LanguageModes[mode]->name;
76 XtCallActionProc(window->textArea, "set_language_mode", NULL, params, 1);
79 diff --quilt old/source/userCmds.c new/source/userCmds.c
80 --- old/source/userCmds.c
81 +++ new/source/userCmds.c
82 @@ -1111,13 +1111,13 @@ static void dimSelDepItemsInMenu(Widget
83 XtVaGetValues(menuPane, XmNchildren, &items, XmNnumChildren, &nItems, NULL);
84 for (n=0; n<(int)nItems; n++) {
85 XtVaGetValues(items[n], XmNuserData, &userData, NULL);
86 - if (userData != (XtPointer)PERMANENT_MENU_ITEM) {
87 + if (userData != PERMANENT_MENU_ITEM) {
88 if (XtClass(items[n]) == xmCascadeButtonWidgetClass) {
89 XtVaGetValues(items[n], XmNsubMenuId, &subMenu, NULL);
90 dimSelDepItemsInMenu(subMenu, menuList, nMenuItems, sensitive);
92 - index = (int)userData - 10;
93 - if (index <0 || index >= nMenuItems)
94 + index = (int)(long)userData - 10;
95 + if (index < 0 || index >= nMenuItems)
97 if (menuList[index]->input == FROM_SELECTION)
98 XtSetSensitive(items[n], sensitive);
99 @@ -1928,7 +1928,7 @@ static Widget createUserMenuItem(Widget
101 XmNacceleratorText, st2,
102 XmNmnemonic, f->mnemonic,
103 - XmNuserData, (XtPointer)(index+10), NULL);
104 + XmNuserData, (XtPointer)(long)(index + 10), NULL);
105 XtAddCallback(btn, XmNactivateCallback, cbRtn, cbArg);
108 @@ -1979,7 +1979,7 @@ static void deleteMenuItems(Widget menuP
109 /* delete all of the widgets not marked as PERMANENT_MENU_ITEM */
110 for (n=0; n<(int)nItems; n++) {
111 XtVaGetValues(items[n], XmNuserData, &userData, NULL);
112 - if (userData != (XtPointer)PERMANENT_MENU_ITEM) {
113 + if (userData != PERMANENT_MENU_ITEM) {
114 if (XtClass(items[n]) == xmCascadeButtonWidgetClass) {
115 XtVaGetValues(items[n], XmNsubMenuId, &subMenuID, NULL);
117 diff --quilt old/source/file.c new/source/file.c
118 --- old/source/file.c
119 +++ new/source/file.c
120 @@ -1919,7 +1919,7 @@ static void setFormatCB(Widget w, XtPoin
121 if (XmToggleButtonGetState(w)) {
123 XtVaGetValues(w, XmNuserData, &userData, NULL);
124 - *(int*) clientData = (int) userData;
125 + *(int*) clientData = (int)(long) userData;
129 diff --quilt old/source/macro.c new/source/macro.c
130 --- old/source/macro.c
131 +++ new/source/macro.c
132 @@ -2847,7 +2847,7 @@ static int dialogMS(WindowInfo *window,
133 readStringArg(argList[i], &btnLabel, btnStorage, errMsg);
134 btn = XtVaCreateManagedWidget("mdBtn", xmPushButtonWidgetClass, dialog,
135 XmNlabelString, s1=XmStringCreateSimple(btnLabel),
136 - XmNuserData, (XtPointer)(i+1), NULL);
137 + XmNuserData, (XtPointer)(long)(i + 1), NULL);
138 XtAddCallback(btn, XmNactivateCallback, dialogBtnCB, window);
141 @@ -2888,7 +2888,7 @@ static void dialogBtnCB(Widget w, XtPoin
142 return; /* shouldn't happen */
143 if (XtClass(w) == xmPushButtonWidgetClass) {
144 XtVaGetValues(w, XmNuserData, &userData, NULL);
145 - retVal.val.n = (int)userData;
146 + retVal.val.n = (int)(long)userData;
149 retVal.tag = INT_TAG;
150 @@ -3024,7 +3024,7 @@ static int stringDialogMS(WindowInfo *wi
151 readStringArg(argList[i], &btnLabel, btnStorage, errMsg);
152 btn = XtVaCreateManagedWidget("mdBtn", xmPushButtonWidgetClass, dialog,
153 XmNlabelString, s1=XmStringCreateSimple(btnLabel),
154 - XmNuserData, (XtPointer)(i+1), NULL);
155 + XmNuserData, (XtPointer)(long)(i + 1), NULL);
156 XtAddCallback(btn, XmNactivateCallback, stringDialogBtnCB, window);
159 @@ -3078,7 +3078,7 @@ static void stringDialogBtnCB(Widget w,
161 if (XtClass(w) == xmPushButtonWidgetClass) {
162 XtVaGetValues(w, XmNuserData, &userData, NULL);
163 - btnNum = (int)userData;
164 + btnNum = (int)(long)userData;
168 @@ -3603,7 +3603,7 @@ static int listDialogMS(WindowInfo *wind
169 readStringArg(argList[i], &btnLabel, btnStorage, errMsg);
170 btn = XtVaCreateManagedWidget("mdBtn", xmPushButtonWidgetClass, dialog,
171 XmNlabelString, s1=XmStringCreateSimple(btnLabel),
172 - XmNuserData, (XtPointer)(i+1), NULL);
173 + XmNuserData, (XtPointer)(long)(i + 1), NULL);
174 XtAddCallback(btn, XmNactivateCallback, listDialogBtnCB, window);
177 @@ -3683,7 +3683,7 @@ static void listDialogBtnCB(Widget w, Xt
179 if (XtClass(w) == xmPushButtonWidgetClass) {
180 XtVaGetValues(w, XmNuserData, &userData, NULL);
181 - btnNum = (int)userData;
182 + btnNum = (int)(long)userData;
186 diff --quilt old/util/prefFile.c new/util/prefFile.c
187 --- old/util/prefFile.c
188 +++ new/util/prefFile.c
189 @@ -353,9 +353,9 @@ static int stringToPref(const char *stri
190 *(int *)rsrcDescrip->valueAddr = 0;
193 - if ((int)strlen(string) >= (int)rsrcDescrip->arg)
194 + if (strlen(string) >= (size_t)rsrcDescrip->arg)
196 - strncpy(rsrcDescrip->valueAddr, string, (int)rsrcDescrip->arg);
197 + strncpy(rsrcDescrip->valueAddr, string, (size_t)rsrcDescrip->arg);
199 case PREF_ALLOC_STRING:
200 *(char **)rsrcDescrip->valueAddr = XtMalloc(strlen(string) + 1);
201 diff --quilt old/source/highlight.c new/source/highlight.c
202 --- old/source/highlight.c
203 +++ new/source/highlight.c
204 @@ -512,7 +512,7 @@ void* GetHighlightInfo(WindowInfo *windo
208 - return (void*)pattern->userStyleIndex;
209 + return (void*)(long)pattern->userStyleIndex;