mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-15 15:41:24 +01:00
get rid of const-related warnings
This commit is contained in:
parent
145e55c7f0
commit
c811943e12
4 changed files with 22 additions and 22 deletions
|
@ -49,7 +49,7 @@ measureAskText( const XP_UCHAR* question, int width, FormatInfo* fip )
|
||||||
if ( NULL != cr && (cr - cur) < width ) {
|
if ( NULL != cr && (cr - cur) < width ) {
|
||||||
len = cr - cur;
|
len = cr - cur;
|
||||||
} else if ( len > width ) {
|
} else if ( len > width ) {
|
||||||
char* s = cur + width;
|
const char* s = cur + width;
|
||||||
while ( *s != ' ' && s > cur ) {
|
while ( *s != ' ' && s > cur ) {
|
||||||
--s;
|
--s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ typedef struct FormatInfo {
|
||||||
XP_U16 nLines;
|
XP_U16 nLines;
|
||||||
XP_U16 maxLen;
|
XP_U16 maxLen;
|
||||||
struct {
|
struct {
|
||||||
XP_UCHAR* substr;
|
const XP_UCHAR* substr;
|
||||||
XP_U16 len;
|
XP_U16 len;
|
||||||
} line[MAX_LINES];
|
} line[MAX_LINES];
|
||||||
} FormatInfo;
|
} FormatInfo;
|
||||||
|
|
|
@ -118,7 +118,7 @@ static XP_Bool handleRootKeyHide( CursesAppGlobals* globals );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
MenuList g_sharedMenuList[] = {
|
const MenuList g_sharedMenuList[] = {
|
||||||
{ handleQuit, "Quit", "Q", 'Q' },
|
{ handleQuit, "Quit", "Q", 'Q' },
|
||||||
{ handleRight, "Tab right", "<tab>", '\t' },
|
{ handleRight, "Tab right", "<tab>", '\t' },
|
||||||
{ handleSpace, "Raise focus", "<spc>", ' ' },
|
{ handleSpace, "Raise focus", "<spc>", ' ' },
|
||||||
|
@ -143,7 +143,7 @@ MenuList g_sharedMenuList[] = {
|
||||||
{ NULL, NULL, NULL, '\0'}
|
{ NULL, NULL, NULL, '\0'}
|
||||||
};
|
};
|
||||||
|
|
||||||
MenuList g_boardMenuList[] = {
|
const MenuList g_boardMenuList[] = {
|
||||||
{ handleAltLeft, "Force left", "{", '{' },
|
{ handleAltLeft, "Force left", "{", '{' },
|
||||||
{ handleAltRight, "Force right", "}", '}' },
|
{ handleAltRight, "Force right", "}", '}' },
|
||||||
{ handleAltUp, "Force up", "_", '_' },
|
{ handleAltUp, "Force up", "_", '_' },
|
||||||
|
@ -151,13 +151,13 @@ MenuList g_boardMenuList[] = {
|
||||||
{ NULL, NULL, NULL, '\0'}
|
{ NULL, NULL, NULL, '\0'}
|
||||||
};
|
};
|
||||||
|
|
||||||
MenuList g_scoreMenuList[] = {
|
const MenuList g_scoreMenuList[] = {
|
||||||
#ifdef KEYBOARD_NAV
|
#ifdef KEYBOARD_NAV
|
||||||
#endif
|
#endif
|
||||||
{ NULL, NULL, NULL, '\0'}
|
{ NULL, NULL, NULL, '\0'}
|
||||||
};
|
};
|
||||||
|
|
||||||
MenuList g_trayMenuList[] = {
|
const MenuList g_trayMenuList[] = {
|
||||||
{ handleJuggle, "Juggle", "G", 'G' },
|
{ handleJuggle, "Juggle", "G", 'G' },
|
||||||
{ handleHide, "[un]hIde", "I", 'I' },
|
{ handleHide, "[un]hIde", "I", 'I' },
|
||||||
{ handleAltLeft, "Divider left", "{", '{' },
|
{ handleAltLeft, "Divider left", "{", '{' },
|
||||||
|
@ -167,12 +167,12 @@ MenuList g_trayMenuList[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CURSES_SMALL_SCREEN
|
#ifdef CURSES_SMALL_SCREEN
|
||||||
MenuList g_rootMenuListShow[] = {
|
const MenuList g_rootMenuListShow[] = {
|
||||||
{ handleRootKeyShow, "Press . for menu", "", '.' },
|
{ handleRootKeyShow, "Press . for menu", "", '.' },
|
||||||
{ NULL, NULL, NULL, '\0'}
|
{ NULL, NULL, NULL, '\0'}
|
||||||
};
|
};
|
||||||
|
|
||||||
MenuList g_rootMenuListHide[] = {
|
const MenuList g_rootMenuListHide[] = {
|
||||||
{ handleRootKeyHide, "Clear menu", ".", '.' },
|
{ handleRootKeyHide, "Clear menu", ".", '.' },
|
||||||
{ NULL, NULL, NULL, '\0'}
|
{ NULL, NULL, NULL, '\0'}
|
||||||
};
|
};
|
||||||
|
@ -188,11 +188,11 @@ static XP_Bool handleRight( CursesAppGlobals* globals );
|
||||||
static XP_Bool handleUp( CursesAppGlobals* globals );
|
static XP_Bool handleUp( CursesAppGlobals* globals );
|
||||||
static XP_Bool handleDown( CursesAppGlobals* globals );
|
static XP_Bool handleDown( CursesAppGlobals* globals );
|
||||||
static XP_Bool handleFocusKey( CursesAppGlobals* globals, XP_Key key );
|
static XP_Bool handleFocusKey( CursesAppGlobals* globals, XP_Key key );
|
||||||
static void countMenuLines( MenuList** menuLists, int maxX, int padding,
|
static void countMenuLines( const MenuList** menuLists, int maxX, int padding,
|
||||||
int* nLinesP, int* nColsP );
|
int* nLinesP, int* nColsP );
|
||||||
static void drawMenuFromList( WINDOW* win, MenuList** menuLists,
|
static void drawMenuFromList( WINDOW* win, const MenuList** menuLists,
|
||||||
int nLines, int padding );
|
int nLines, int padding );
|
||||||
static CursesMenuHandler getHandlerForKey( MenuList* list, char ch );
|
static CursesMenuHandler getHandlerForKey( const MenuList* list, char ch );
|
||||||
|
|
||||||
|
|
||||||
#ifdef MEM_DEBUG
|
#ifdef MEM_DEBUG
|
||||||
|
@ -697,7 +697,7 @@ fmtMenuItem( const MenuList* item, char* buf, int maxLen )
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
countMenuLines( MenuList** menuLists, int maxX, int padding,
|
countMenuLines( const MenuList** menuLists, int maxX, int padding,
|
||||||
int* nLinesP, int* nColsP )
|
int* nLinesP, int* nColsP )
|
||||||
{
|
{
|
||||||
int nCols = 0;
|
int nCols = 0;
|
||||||
|
@ -719,7 +719,7 @@ countMenuLines( MenuList** menuLists, int maxX, int padding,
|
||||||
nCols = 0;
|
nCols = 0;
|
||||||
|
|
||||||
for ( i = 0; !tooFewLines && (NULL != menuLists[i]); ++i ) {
|
for ( i = 0; !tooFewLines && (NULL != menuLists[i]); ++i ) {
|
||||||
MenuList* entry;
|
const MenuList* entry;
|
||||||
for ( entry = menuLists[i]; !tooFewLines && !!entry->handler;
|
for ( entry = menuLists[i]; !tooFewLines && !!entry->handler;
|
||||||
++entry ) {
|
++entry ) {
|
||||||
int width;
|
int width;
|
||||||
|
@ -758,7 +758,7 @@ countMenuLines( MenuList** menuLists, int maxX, int padding,
|
||||||
} /* countMenuLines */
|
} /* countMenuLines */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
drawMenuFromList( WINDOW* win, MenuList** menuLists,
|
drawMenuFromList( WINDOW* win, const MenuList** menuLists,
|
||||||
int nLines, int padding )
|
int nLines, int padding )
|
||||||
{
|
{
|
||||||
short line = 0, col, i;
|
short line = 0, col, i;
|
||||||
|
@ -774,7 +774,7 @@ drawMenuFromList( WINDOW* win, MenuList** menuLists,
|
||||||
col = 0;
|
col = 0;
|
||||||
|
|
||||||
for ( i = 0; NULL != menuLists[i]; ++i ) {
|
for ( i = 0; NULL != menuLists[i]; ++i ) {
|
||||||
MenuList* entry;
|
const MenuList* entry;
|
||||||
for ( entry = menuLists[i]; !!entry->handler; ++entry ) {
|
for ( entry = menuLists[i]; !!entry->handler; ++entry ) {
|
||||||
char buf[32];
|
char buf[32];
|
||||||
|
|
||||||
|
@ -1049,21 +1049,21 @@ remapKey( int* kp )
|
||||||
key = 'L';
|
key = 'L';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if ( key > 0xFF ) {
|
if ( key > 0x7F ) {
|
||||||
XP_LOGF( "%s(%d): no mapping", __func__, key );
|
XP_LOGF( "%s(%d): no mapping", __func__, key );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*kp = key;
|
*kp = key;
|
||||||
}
|
} /* remapKey */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
drawMenuLargeOrSmall( CursesAppGlobals* globals, const MenuList* menuList )
|
drawMenuLargeOrSmall( CursesAppGlobals* globals, const MenuList* menuList )
|
||||||
{
|
{
|
||||||
#ifdef CURSES_SMALL_SCREEN
|
#ifdef CURSES_SMALL_SCREEN
|
||||||
MenuList* lists[] = { g_rootMenuListShow, NULL };
|
const MenuList* lists[] = { g_rootMenuListShow, NULL };
|
||||||
#else
|
#else
|
||||||
MenuList* lists[] = { g_sharedMenuList, menuList, NULL };
|
const MenuList* lists[] = { g_sharedMenuList, menuList, NULL };
|
||||||
#endif
|
#endif
|
||||||
wclear( globals->menuWin );
|
wclear( globals->menuWin );
|
||||||
drawMenuFromList( globals->menuWin, lists, 0, 0 );
|
drawMenuFromList( globals->menuWin, lists, 0, 0 );
|
||||||
|
@ -1204,7 +1204,7 @@ sendOnClose( XWStreamCtxt* stream, void* closure )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static CursesMenuHandler
|
static CursesMenuHandler
|
||||||
getHandlerForKey( MenuList* list, char ch )
|
getHandlerForKey( const MenuList* list, char ch )
|
||||||
{
|
{
|
||||||
CursesMenuHandler handler = NULL;
|
CursesMenuHandler handler = NULL;
|
||||||
while ( list->handler != NULL ) {
|
while ( list->handler != NULL ) {
|
||||||
|
@ -1218,7 +1218,7 @@ getHandlerForKey( MenuList* list, char ch )
|
||||||
}
|
}
|
||||||
|
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
handleKeyEvent( CursesAppGlobals* globals, MenuList* list, char ch )
|
handleKeyEvent( CursesAppGlobals* globals, const MenuList* list, char ch )
|
||||||
{
|
{
|
||||||
CursesMenuHandler handler = getHandlerForKey( list, ch );
|
CursesMenuHandler handler = getHandlerForKey( list, ch );
|
||||||
XP_Bool result = XP_FALSE;
|
XP_Bool result = XP_FALSE;
|
||||||
|
|
|
@ -68,7 +68,7 @@ struct CursesAppGlobals {
|
||||||
|
|
||||||
XP_Bool timeToExit;
|
XP_Bool timeToExit;
|
||||||
XP_Bool doDraw;
|
XP_Bool doDraw;
|
||||||
struct MenuList* menuList;
|
const struct MenuList* menuList;
|
||||||
XP_U16 nLinesMenu;
|
XP_U16 nLinesMenu;
|
||||||
|
|
||||||
union {
|
union {
|
||||||
|
|
Loading…
Reference in a new issue