diff --git a/WINGs/wfontpanel.c b/WINGs/wfontpanel.c index 0a99c3e0..c6df7b3f 100644 --- a/WINGs/wfontpanel.c +++ b/WINGs/wfontpanel.c @@ -428,7 +428,7 @@ static void addSizeToTypeface(Typeface * face, int size) if (size == 0) { int j; - for (j = 0; j < sizeof(scalableFontSizes) / sizeof(int); j++) { + for (j = 0; j < sizeof(scalableFontSizes) / sizeof(scalableFontSizes[0]); j++) { size = scalableFontSizes[j]; if (!WMCountInArray(face->sizes, (void *)(uintptr_t) size)) { diff --git a/WINGs/widgets.c b/WINGs/widgets.c index 39cc3eff..5aa3e807 100644 --- a/WINGs/widgets.c +++ b/WINGs/widgets.c @@ -552,7 +552,7 @@ WMScreen *WMCreateScreenWithRContext(Display * display, int screen, RContext * c "_NET_WM_ICON_NAME", "_NET_WM_ICON", }; - Atom atoms[sizeof(atomNames) / sizeof(char *)]; + Atom atoms[sizeof(atomNames) / sizeof(atomNames[0])]; int i; if (!initialized) { @@ -803,9 +803,9 @@ WMScreen *WMCreateScreenWithRContext(Display * display, int screen, RContext * c } #ifdef HAVE_XINTERNATOMS - XInternAtoms(display, atomNames, sizeof(atomNames) / sizeof(char *), False, atoms); + XInternAtoms(display, atomNames, sizeof(atomNames) / sizeof(atomNames[0]), False, atoms); #else - for (i = 0; i < sizeof(atomNames) / sizeof(char *); i++) { + for (i = 0; i < sizeof(atomNames) / sizeof(atomNames[0]); i++) { atoms[i] = XInternAtom(display, atomNames[i], False); } #endif diff --git a/WPrefs.app/Appearance.c b/WPrefs.app/Appearance.c index 3dfe891d..dc7c1db2 100644 --- a/WPrefs.app/Appearance.c +++ b/WPrefs.app/Appearance.c @@ -1102,7 +1102,7 @@ static void previewClick(XEvent * event, void *clientData) switch (panel->oldTabItem) { case 0: - for (i = 0; i < sizeof(previewPositions) / sizeof(WMRect); i++) { + for (i = 0; i < sizeof(previewPositions) / sizeof(previewPositions[0]); i++) { if (event->xbutton.x >= previewPositions[i].pos.x && event->xbutton.y >= previewPositions[i].pos.y && event->xbutton.x < previewPositions[i].pos.x diff --git a/WPrefs.app/MouseSettings.c b/WPrefs.app/MouseSettings.c index ca709e59..5291c0d5 100644 --- a/WPrefs.app/MouseSettings.c +++ b/WPrefs.app/MouseSettings.c @@ -608,13 +608,13 @@ static void createPanel(Panel * p) WMResizeWidget(panel->wheelP, 135, 20); WMMoveWidget(panel->wheelP, 95, 129); - for (i = 0; i < sizeof(buttonActions) / sizeof(char *); i++) { + for (i = 0; i < sizeof(buttonActions) / sizeof(buttonActions[0]); i++) { WMAddPopUpButtonItem(panel->button1P, buttonActions[i]); WMAddPopUpButtonItem(panel->button2P, buttonActions[i]); WMAddPopUpButtonItem(panel->button3P, buttonActions[i]); } - for (i = 0; i < sizeof(wheelActions) / sizeof(char *); i++) { + for (i = 0; i < sizeof(wheelActions) / sizeof(wheelActions[0]); i++) { WMAddPopUpButtonItem(panel->wheelP, wheelActions[i]); } diff --git a/WPrefs.app/Workspace.c b/WPrefs.app/Workspace.c index ce6ff543..d84a3931 100644 --- a/WPrefs.app/Workspace.c +++ b/WPrefs.app/Workspace.c @@ -81,7 +81,7 @@ static void showData(_Panel * panel) str = "center"; idx = 1; /* center */ - for (i = 0; i < sizeof(WSNamePositions) / sizeof(char *); i++) { + for (i = 0; i < sizeof(WSNamePositions) / sizeof(WSNamePositions[0]); i++) { if (strcasecmp(WSNamePositions[i], str) == 0) { idx = i; break; diff --git a/src/defaults.c b/src/defaults.c index a2d6e214..2a75b737 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -760,7 +760,7 @@ static void initDefaults() WMPLSetCaseSensitive(False); - for (i = 0; i < sizeof(optionList) / sizeof(WDefaultEntry); i++) { + for (i = 0; i < sizeof(optionList) / sizeof(optionList[0]); i++) { entry = &optionList[i]; entry->plkey = WMCreatePLString(entry->key); @@ -770,7 +770,7 @@ static void initDefaults() entry->plvalue = NULL; } - for (i = 0; i < sizeof(staticOptionList) / sizeof(WDefaultEntry); i++) { + for (i = 0; i < sizeof(staticOptionList) / sizeof(staticOptionList[0]); i++) { entry = &staticOptionList[i]; entry->plkey = WMCreatePLString(entry->key); @@ -925,7 +925,7 @@ void wReadStaticDefaults(WMPropList * dict) unsigned int i; void *tdata; - for (i = 0; i < sizeof(staticOptionList) / sizeof(WDefaultEntry); i++) { + for (i = 0; i < sizeof(staticOptionList) / sizeof(staticOptionList[0]); i++) { entry = &staticOptionList[i]; if (dict) @@ -1079,7 +1079,7 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict) needs_refresh = 0; - for (i = 0; i < sizeof(optionList) / sizeof(WDefaultEntry); i++) { + for (i = 0; i < sizeof(optionList) / sizeof(optionList[0]); i++) { entry = &optionList[i]; if (new_dict) diff --git a/src/startup.c b/src/startup.c index d309d98b..1532626b 100644 --- a/src/startup.c +++ b/src/startup.c @@ -482,7 +482,7 @@ void StartUp(Bool defaultScreenOnly) #ifdef HAVE_XRANDR int dummy; #endif - Atom atom[sizeof(atomNames) / sizeof(char *)]; + Atom atom[sizeof(atomNames) / sizeof(atomNames[0])]; /* * Ignore CapsLock in modifiers @@ -505,12 +505,12 @@ void StartUp(Bool defaultScreenOnly) /* _XA_VERSION = XInternAtom(dpy, "VERSION", False); */ #ifdef HAVE_XINTERNATOMS - XInternAtoms(dpy, atomNames, sizeof(atomNames) / sizeof(char *), False, atom); + XInternAtoms(dpy, atomNames, sizeof(atomNames) / sizeof(atomNames[0]), False, atom); #else { int i; - for (i = 0; i < sizeof(atomNames) / sizeof(char *); i++) + for (i = 0; i < sizeof(atomNames) / sizeof(atomNames[0]); i++) atom[i] = XInternAtom(dpy, atomNames[i], False); } #endif diff --git a/src/wmspec.c b/src/wmspec.c index 255982e7..149eab1d 100644 --- a/src/wmspec.c +++ b/src/wmspec.c @@ -202,7 +202,7 @@ static atomitem_t atomNames[] = { {"UTF8_STRING", &utf8_string}, }; -#define atomNr (sizeof(atomNames)/sizeof(atomitem_t)) +#define atomNr (sizeof(atomNames)/sizeof(atomNames[0])) #define _NET_WM_STATE_REMOVE 0 #define _NET_WM_STATE_ADD 1 diff --git a/src/xutil.c b/src/xutil.c index fc3ebd11..3d1e83ed 100644 --- a/src/xutil.c +++ b/src/xutil.c @@ -168,7 +168,7 @@ void FormatXError(Display * dpy, XErrorEvent * error, char *buffer, int size) if (i > size - 100) return; buffer += i; - if (error->request_code >= sizeof(requestCodes) / sizeof(char *)) { + if (error->request_code >= sizeof(requestCodes) / sizeof(requestCodes[0])) { sprintf(buffer, "\n Request code: %i\n", error->request_code); } else { sprintf(buffer, "\n Request code: %i %s\n", error->request_code, diff --git a/util/fontconv.c b/util/fontconv.c index 4c420cc0..19204db3 100644 --- a/util/fontconv.c +++ b/util/fontconv.c @@ -105,7 +105,7 @@ static char *mapWeightToName(str * weight) if (weight->len == 0) return ""; - for (i = 0; i < sizeof(normalNames) / sizeof(char *); i++) { + for (i = 0; i < sizeof(normalNames) / sizeof(normalNames[0]); i++) { if (strlen(normalNames[i]) == weight->len && strncmp(normalNames[i], weight->str, weight->len)) { return ""; }