mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-02 06:05:45 +01:00
WINGs: Added 'const' attribute to functions in wballoon, wmenuitem, wmisc, wtextfield
This makes both the API and local function const-correct on their input parameters.
This commit is contained in:
committed by
Carlos R. Mafra
parent
a1119f8dd3
commit
6616323088
@@ -936,7 +936,7 @@ extern char *WMViewRealizedNotification;
|
||||
|
||||
/* ---[ WINGs/wballoon.c ]------------------------------------------------ */
|
||||
|
||||
void WMSetBalloonTextForView(char *text, WMView *view);
|
||||
void WMSetBalloonTextForView(const char *text, WMView *view);
|
||||
|
||||
void WMSetBalloonTextAlignment(WMScreen *scr, WMAlignment alignment);
|
||||
|
||||
@@ -1097,14 +1097,14 @@ void WMSetFrameTitle(WMFrame *fPtr, const char *title);
|
||||
|
||||
WMTextField* WMCreateTextField(WMWidget *parent);
|
||||
|
||||
void WMInsertTextFieldText(WMTextField *tPtr, char *text, int position);
|
||||
void WMInsertTextFieldText(WMTextField *tPtr, const char *text, int position);
|
||||
|
||||
void WMDeleteTextFieldRange(WMTextField *tPtr, WMRange range);
|
||||
|
||||
/* you can free the returned string */
|
||||
char* WMGetTextFieldText(WMTextField *tPtr);
|
||||
|
||||
void WMSetTextFieldText(WMTextField *tPtr, char *text);
|
||||
void WMSetTextFieldText(WMTextField *tPtr, const char *text);
|
||||
|
||||
void WMSetTextFieldAlignment(WMTextField *tPtr, WMAlignment alignment);
|
||||
|
||||
@@ -1325,7 +1325,7 @@ char* WMGetMenuItemShortcut(WMMenuItem *item);
|
||||
|
||||
unsigned WMGetMenuItemShortcutModifierMask(WMMenuItem *item);
|
||||
|
||||
void WMSetMenuItemShortcut(WMMenuItem *item, char *shortcut);
|
||||
void WMSetMenuItemShortcut(WMMenuItem *item, const char *shortcut);
|
||||
|
||||
void WMSetMenuItemShortcutModifierMask(WMMenuItem *item, unsigned mask);
|
||||
|
||||
@@ -1339,7 +1339,7 @@ WMAction* WMGetMenuItemAction(WMMenuItem *item);
|
||||
|
||||
void* WMGetMenuItemData(WMMenuItem *item);
|
||||
|
||||
void WMSetMenuItemTitle(WMMenuItem *item, char *title);
|
||||
void WMSetMenuItemTitle(WMMenuItem *item, const char *title);
|
||||
|
||||
char* WMGetMenuItemTitle(WMMenuItem *item);
|
||||
|
||||
|
||||
@@ -519,18 +519,18 @@ void W_DrawReliefWithGC(W_Screen *scr, Drawable d, int x, int y,
|
||||
void W_CallDestroyHandlers(W_View *view);
|
||||
|
||||
void W_PaintTextAndImage(W_View *view, int wrap, WMColor *textColor,
|
||||
W_Font *font, WMReliefType relief, char *text,
|
||||
W_Font *font, WMReliefType relief, const char *text,
|
||||
WMAlignment alignment, W_Pixmap *image,
|
||||
WMImagePosition position, WMColor *backColor, int ofs);
|
||||
|
||||
void W_PaintText(W_View *view, Drawable d, WMFont *font, int x, int y,
|
||||
int width, WMAlignment alignment, WMColor *color,
|
||||
int wrap, char *text, int length);
|
||||
int wrap, const char *text, int length);
|
||||
|
||||
int W_GetTextHeight(WMFont *font, char *text, int width, int wrap);
|
||||
int W_GetTextHeight(WMFont *font, const char *text, int width, int wrap);
|
||||
|
||||
|
||||
int W_TextWidth(WMFont *font, char *text, int length);
|
||||
int W_TextWidth(WMFont *font, const char *text, int length);
|
||||
|
||||
|
||||
void W_BroadcastMessage(W_View *targetParent, XEvent *event);
|
||||
|
||||
@@ -43,7 +43,7 @@ static void destroyBalloon(Balloon * bPtr);
|
||||
|
||||
static void handleEvents(XEvent * event, void *data);
|
||||
|
||||
static void showText(Balloon * bPtr, int x, int y, int w, int h, char *text);
|
||||
static void showText(Balloon * bPtr, int x, int y, int w, int h, const char *text);
|
||||
|
||||
struct W_Balloon *W_CreateBalloon(WMScreen * scr)
|
||||
{
|
||||
@@ -80,7 +80,7 @@ void WMSetBalloonTextAlignment(WMScreen * scr, WMAlignment alignment)
|
||||
|
||||
}
|
||||
|
||||
void WMSetBalloonTextForView(char *text, WMView * view)
|
||||
void WMSetBalloonTextForView(const char *text, WMView * view)
|
||||
{
|
||||
char *oldText = NULL;
|
||||
WMScreen *scr = view->screen;
|
||||
@@ -361,7 +361,7 @@ static Pixmap makePixmap(WMScreen * scr, int width, int height, int side, Pixmap
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
static void showText(Balloon * bPtr, int x, int y, int w, int h, char *text)
|
||||
static void showText(Balloon * bPtr, int x, int y, int w, int h, const char *text)
|
||||
{
|
||||
WMScreen *scr = bPtr->view->screen;
|
||||
Display *dpy = WMScreenDisplay(scr);
|
||||
@@ -377,7 +377,7 @@ static void showText(Balloon * bPtr, int x, int y, int w, int h, char *text)
|
||||
|
||||
{
|
||||
int w;
|
||||
char *ptr, *ptr2;
|
||||
const char *ptr, *ptr2;
|
||||
|
||||
ptr2 = ptr = text;
|
||||
width = 0;
|
||||
|
||||
@@ -88,7 +88,7 @@ unsigned WMGetMenuItemShortcutModifierMask(WMMenuItem * item)
|
||||
return item->shortcutModifierMask;
|
||||
}
|
||||
|
||||
void WMSetMenuItemShortcut(WMMenuItem * item, char *shortcut)
|
||||
void WMSetMenuItemShortcut(WMMenuItem * item, const char *shortcut)
|
||||
{
|
||||
if (item->shortcutKey)
|
||||
wfree(item->shortcutKey);
|
||||
@@ -127,7 +127,7 @@ void *WMGetMenuItemData(WMMenuItem * item)
|
||||
return item->data;
|
||||
}
|
||||
|
||||
void WMSetMenuItemTitle(WMMenuItem * item, char *title)
|
||||
void WMSetMenuItemTitle(WMMenuItem * item, const char *title)
|
||||
{
|
||||
if (item->title)
|
||||
wfree(item->title);
|
||||
|
||||
@@ -83,7 +83,7 @@ W_DrawReliefWithGC(W_Screen * scr, Drawable d, int x, int y, unsigned int width,
|
||||
}
|
||||
}
|
||||
|
||||
static int findNextWord(char *text, int limit)
|
||||
static int findNextWord(const char *text, int limit)
|
||||
{
|
||||
int pos, len;
|
||||
|
||||
@@ -95,7 +95,7 @@ static int findNextWord(char *text, int limit)
|
||||
return pos;
|
||||
}
|
||||
|
||||
static int fitText(char *text, WMFont * font, int width, int wrap)
|
||||
static int fitText(const char *text, WMFont * font, int width, int wrap)
|
||||
{
|
||||
int i, w, beforecrlf, word1, word2;
|
||||
|
||||
@@ -140,9 +140,9 @@ static int fitText(char *text, WMFont * font, int width, int wrap)
|
||||
return i;
|
||||
}
|
||||
|
||||
int W_GetTextHeight(WMFont * font, char *text, int width, int wrap)
|
||||
int W_GetTextHeight(WMFont * font, const char *text, int width, int wrap)
|
||||
{
|
||||
char *ptr = text;
|
||||
const char *ptr = text;
|
||||
int count;
|
||||
int length = strlen(text);
|
||||
int h;
|
||||
@@ -165,9 +165,10 @@ int W_GetTextHeight(WMFont * font, char *text, int width, int wrap)
|
||||
|
||||
void
|
||||
W_PaintText(W_View * view, Drawable d, WMFont * font, int x, int y,
|
||||
int width, WMAlignment alignment, WMColor * color, int wrap, char *text, int length)
|
||||
int width, WMAlignment alignment, WMColor * color, int wrap,
|
||||
const char *text, int length)
|
||||
{
|
||||
char *ptr = text;
|
||||
const char *ptr = text;
|
||||
int line_width;
|
||||
int line_x;
|
||||
int count;
|
||||
@@ -201,7 +202,7 @@ W_PaintText(W_View * view, Drawable d, WMFont * font, int x, int y,
|
||||
|
||||
void
|
||||
W_PaintTextAndImage(W_View * view, int wrap, WMColor * textColor, W_Font * font,
|
||||
WMReliefType relief, char *text,
|
||||
WMReliefType relief, const char *text,
|
||||
WMAlignment alignment, W_Pixmap * image,
|
||||
WMImagePosition position, WMColor * backColor, int ofs)
|
||||
{
|
||||
|
||||
@@ -122,18 +122,18 @@ static WMSelectionProcs selectionHandler = {
|
||||
#define TEXT_WIDTH2(tPtr, start, end) (WMWidthOfString((tPtr)->font, \
|
||||
&((tPtr)->text[(start)]), (end) - (start)))
|
||||
|
||||
static INLINE int oneUTF8CharBackward(char *str, int len)
|
||||
static INLINE int oneUTF8CharBackward(const char *str, int len)
|
||||
{
|
||||
unsigned char *ustr = (unsigned char *)str;
|
||||
const unsigned char *ustr = (const unsigned char *)str;
|
||||
int pos = 0;
|
||||
|
||||
while (len-- > 0 && ustr[--pos] >= 0x80 && ustr[pos] <= 0xbf) ;
|
||||
return pos;
|
||||
}
|
||||
|
||||
static INLINE int oneUTF8CharForward(char *str, int len)
|
||||
static INLINE int oneUTF8CharForward(const char *str, int len)
|
||||
{
|
||||
unsigned char *ustr = (unsigned char *)str;
|
||||
const unsigned char *ustr = (const unsigned char *)str;
|
||||
int pos = 0;
|
||||
|
||||
while (len-- > 0 && ustr[++pos] >= 0x80 && ustr[pos] <= 0xbf) ;
|
||||
@@ -141,9 +141,9 @@ static INLINE int oneUTF8CharForward(char *str, int len)
|
||||
}
|
||||
|
||||
// find the beginning of the UTF8 char pointed by str
|
||||
static INLINE int seekUTF8CharStart(char *str, int len)
|
||||
static INLINE int seekUTF8CharStart(const char *str, int len)
|
||||
{
|
||||
unsigned char *ustr = (unsigned char *)str;
|
||||
const unsigned char *ustr = (const unsigned char *)str;
|
||||
int pos = 0;
|
||||
|
||||
while (len-- > 0 && ustr[pos] >= 0x80 && ustr[pos] <= 0xbf)
|
||||
@@ -184,7 +184,7 @@ static void normalizeRange(TextField * tPtr, WMRange * range)
|
||||
range->count = tPtr->textLen - range->position;
|
||||
}
|
||||
|
||||
static void memmv(char *dest, char *src, int size)
|
||||
static void memmv(char *dest, const char *src, int size)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -376,7 +376,7 @@ WMTextFieldDelegate *WMGetTextFieldDelegate(WMTextField * tPtr)
|
||||
return tPtr->delegate;
|
||||
}
|
||||
|
||||
void WMInsertTextFieldText(WMTextField * tPtr, char *text, int position)
|
||||
void WMInsertTextFieldText(WMTextField * tPtr, const char *text, int position)
|
||||
{
|
||||
int len;
|
||||
|
||||
@@ -447,7 +447,7 @@ char *WMGetTextFieldText(WMTextField * tPtr)
|
||||
return wstrdup(tPtr->text);
|
||||
}
|
||||
|
||||
void WMSetTextFieldText(WMTextField * tPtr, char *text)
|
||||
void WMSetTextFieldText(WMTextField * tPtr, const char *text)
|
||||
{
|
||||
CHECK_CLASS(tPtr, WC_TextField);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user