From 72108875aa1d610eec37cbd388abe712cb779717 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Thu, 9 May 2013 17:34:05 +0200 Subject: [PATCH] WINGs: Added 'const' attribute to functions in wpanel, wpopupbutton, wtabview This makes both the API and local function const-correct on their input parameters. --- WINGs/WINGs/WINGs.h | 36 ++++++++++++++++++------------------ WINGs/wpanel.c | 16 ++++++++-------- WINGs/wpopupbutton.c | 6 +++--- WINGs/wtabview.c | 6 +++--- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/WINGs/WINGs/WINGs.h b/WINGs/WINGs/WINGs.h index ff600811..72e6ac80 100644 --- a/WINGs/WINGs/WINGs.h +++ b/WINGs/WINGs/WINGs.h @@ -1380,10 +1380,10 @@ void WMSetPopUpButtonAction(WMPopUpButton *sPtr, WMAction *action, void WMSetPopUpButtonPullsDown(WMPopUpButton *bPtr, Bool flag); -WMMenuItem* WMAddPopUpButtonItem(WMPopUpButton *bPtr, char *title); +WMMenuItem* WMAddPopUpButtonItem(WMPopUpButton *bPtr, const char *title); WMMenuItem* WMInsertPopUpButtonItem(WMPopUpButton *bPtr, int index, - char *title); + const char *title); void WMRemovePopUpButtonItem(WMPopUpButton *bPtr, int index); @@ -1395,7 +1395,7 @@ void WMSetPopUpButtonSelectedItem(WMPopUpButton *bPtr, int index); int WMGetPopUpButtonSelectedItem(WMPopUpButton *bPtr); -void WMSetPopUpButtonText(WMPopUpButton *bPtr, char *text); +void WMSetPopUpButtonText(WMPopUpButton *bPtr, const char *text); /* don't free the returned data */ char* WMGetPopUpButtonItem(WMPopUpButton *bPtr, int index); @@ -1702,7 +1702,7 @@ void WMInsertItemInTabView(WMTabView *tPtr, int index, WMTabViewItem *item); void WMRemoveTabViewItem(WMTabView *tPtr, WMTabViewItem *item); WMTabViewItem* WMAddTabViewItemWithView(WMTabView *tPtr, WMView *view, - int identifier, char *label); + int identifier, const char *label); WMTabViewItem* WMTabViewItemAtPoint(WMTabView *tPtr, int x, int y); @@ -1729,7 +1729,7 @@ void WMSetTabViewItemEnabled(WMTabViewItem *tPtr, Bool flag); int WMGetTabViewItemIdentifier(WMTabViewItem *item); -void WMSetTabViewItemLabel(WMTabViewItem *item, char *label); +void WMSetTabViewItemLabel(WMTabViewItem *item, const char *label); char* WMGetTabViewItemLabel(WMTabViewItem *item); @@ -1758,26 +1758,26 @@ void WMSetBoxHorizontal(WMBox *box, Bool flag); /* ---[ WINGs/wpanel.c ]-------------------------------------------------- */ -int WMRunAlertPanel(WMScreen *app, WMWindow *owner, char *title, char *msg, - char *defaultButton, char *alternateButton, - char *otherButton); +int WMRunAlertPanel(WMScreen *app, WMWindow *owner, const char *title, const char *msg, + const char *defaultButton, const char *alternateButton, + const char *otherButton); /* you can free the returned string */ -char* WMRunInputPanel(WMScreen *app, WMWindow *owner, char *title, char *msg, - char *defaultText, char *okButton, char *cancelButton); +char* WMRunInputPanel(WMScreen *app, WMWindow *owner, const char *title, const char *msg, + const char *defaultText, const char *okButton, const char *cancelButton); -WMAlertPanel* WMCreateAlertPanel(WMScreen *app, WMWindow *owner, char *title, - char *msg, char *defaultButton, - char *alternateButton, char *otherButton); +WMAlertPanel* WMCreateAlertPanel(WMScreen *app, WMWindow *owner, const char *title, + const char *msg, const char *defaultButton, + const char *alternateButton, const char *otherButton); -WMInputPanel* WMCreateInputPanel(WMScreen *app, WMWindow *owner, char *title, - char *msg, char *defaultText, char *okButton, - char *cancelButton); +WMInputPanel* WMCreateInputPanel(WMScreen *app, WMWindow *owner, const char *title, + const char *msg, const char *defaultText, const char *okButton, + const char *cancelButton); WMGenericPanel* WMCreateGenericPanel(WMScreen *scrPtr, WMWindow *owner, - char *title, char *defaultButton, - char *alternateButton); + const char *title, const char *defaultButton, + const char *alternateButton); void WMDestroyAlertPanel(WMAlertPanel *panel); diff --git a/WINGs/wpanel.c b/WINGs/wpanel.c index 7e3f9f59..1c1d04f5 100644 --- a/WINGs/wpanel.c +++ b/WINGs/wpanel.c @@ -39,7 +39,7 @@ static void handleKeyPress(XEvent * event, void *clientData) int WMRunAlertPanel(WMScreen * scrPtr, WMWindow * owner, - char *title, char *msg, char *defaultButton, char *alternateButton, char *otherButton) + const char *title, const char *msg, const char *defaultButton, const char *alternateButton, const char *otherButton) { WMAlertPanel *panel; int tmp; @@ -85,8 +85,8 @@ void WMDestroyAlertPanel(WMAlertPanel * panel) } WMAlertPanel *WMCreateAlertPanel(WMScreen * scrPtr, WMWindow * owner, - char *title, char *msg, char *defaultButton, - char *alternateButton, char *otherButton) + const char *title, const char *msg, const char *defaultButton, + const char *alternateButton, const char *otherButton) { WMAlertPanel *panel; int dw = 0, aw = 0, ow = 0, w; @@ -262,8 +262,8 @@ static void handleKeyPress2(XEvent * event, void *clientData) } } -char *WMRunInputPanel(WMScreen * scrPtr, WMWindow * owner, char *title, - char *msg, char *defaultText, char *okButton, char *cancelButton) +char *WMRunInputPanel(WMScreen * scrPtr, WMWindow * owner, const char *title, + const char *msg, const char *defaultText, const char *okButton, const char *cancelButton) { WMInputPanel *panel; char *tmp; @@ -334,8 +334,8 @@ static void endedEditingObserver(void *observerData, WMNotification * notificati } } -WMInputPanel *WMCreateInputPanel(WMScreen * scrPtr, WMWindow * owner, char *title, char *msg, - char *defaultText, char *okButton, char *cancelButton) +WMInputPanel *WMCreateInputPanel(WMScreen * scrPtr, WMWindow * owner, const char *title, const char *msg, + const char *defaultText, const char *okButton, const char *cancelButton) { WMInputPanel *panel; int x, dw = 0, aw = 0, w; @@ -454,7 +454,7 @@ void WMDestroyGenericPanel(WMGenericPanel * panel) } WMGenericPanel *WMCreateGenericPanel(WMScreen * scrPtr, WMWindow * owner, - char *title, char *defaultButton, char *alternateButton) + const char *title, const char *defaultButton, const char *alternateButton) { WMGenericPanel *panel; int dw = 0, aw = 0, w; diff --git a/WINGs/wpopupbutton.c b/WINGs/wpopupbutton.c index 9982cc77..d41c7657 100644 --- a/WINGs/wpopupbutton.c +++ b/WINGs/wpopupbutton.c @@ -101,7 +101,7 @@ void WMSetPopUpButtonAction(WMPopUpButton * bPtr, WMAction * action, void *clien bPtr->clientData = clientData; } -WMMenuItem *WMAddPopUpButtonItem(WMPopUpButton * bPtr, char *title) +WMMenuItem *WMAddPopUpButtonItem(WMPopUpButton * bPtr, const char *title) { WMMenuItem *item; @@ -118,7 +118,7 @@ WMMenuItem *WMAddPopUpButtonItem(WMPopUpButton * bPtr, char *title) return item; } -WMMenuItem *WMInsertPopUpButtonItem(WMPopUpButton * bPtr, int index, char *title) +WMMenuItem *WMInsertPopUpButtonItem(WMPopUpButton * bPtr, int index, const char *title) { WMMenuItem *item; @@ -198,7 +198,7 @@ int WMGetPopUpButtonSelectedItem(WMPopUpButton * bPtr) return bPtr->selectedItemIndex; } -void WMSetPopUpButtonText(WMPopUpButton * bPtr, char *text) +void WMSetPopUpButtonText(WMPopUpButton * bPtr, const char *text) { if (bPtr->caption) wfree(bPtr->caption); diff --git a/WINGs/wtabview.c b/WINGs/wtabview.c index b4ec670c..86f71928 100644 --- a/WINGs/wtabview.c +++ b/WINGs/wtabview.c @@ -224,7 +224,7 @@ void WMSetTabViewDelegate(WMTabView * tPtr, WMTabViewDelegate * delegate) tPtr->delegate = delegate; } -WMTabViewItem *WMAddTabViewItemWithView(WMTabView * tPtr, WMView * view, int identifier, char *label) +WMTabViewItem *WMAddTabViewItemWithView(WMTabView * tPtr, WMView * view, int identifier, const char *label) { WMTabViewItem *item; @@ -823,7 +823,7 @@ WMTabViewItem *WMCreateTabViewItemWithIdentifier(int identifier) return item; } -WMTabViewItem *WMCreateTabViewItem(int identifier, char *label) +WMTabViewItem *WMCreateTabViewItem(int identifier, const char *label) { WMTabViewItem *item; @@ -858,7 +858,7 @@ void WMSetTabViewFont(WMTabView * tPtr, WMFont * font) recalcTabWidth(tPtr); } -void WMSetTabViewItemLabel(WMTabViewItem * item, char *label) +void WMSetTabViewItemLabel(WMTabViewItem * item, const char *label) { if (item->label) wfree(item->label);