dix: unexport CompareISOLatin1Lowered() and make it static

This function isn't used by any drivers, so no need to export it.

Also has just one consumer, so move it there and make it static.
(and also move ISOLatin1ToLower() along with it)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1374>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-03-07 14:20:05 +01:00 committed by Marge Bot
parent 1999785fa9
commit ad7e7d9259
3 changed files with 44 additions and 48 deletions

View File

@ -96,8 +96,6 @@ Author: Adobe Systems Incorporated
#include "pixmapstr.h"
#include "gcstruct.h"
#include "scrnintstr.h"
#define XK_LATIN1
#include <X11/keysymdef.h>
#include "xace.h"
/*
@ -144,47 +142,6 @@ ClientTimeToServerTime(CARD32 c)
return ts;
}
/*
* ISO Latin-1 case conversion routine
*
* this routine always null-terminates the result, so
* beware of too-small buffers
*/
static unsigned char
ISOLatin1ToLower(unsigned char source)
{
unsigned char dest;
if ((source >= XK_A) && (source <= XK_Z))
dest = source + (XK_a - XK_A);
else if ((source >= XK_Agrave) && (source <= XK_Odiaeresis))
dest = source + (XK_agrave - XK_Agrave);
else if ((source >= XK_Ooblique) && (source <= XK_Thorn))
dest = source + (XK_oslash - XK_Ooblique);
else
dest = source;
return dest;
}
int
CompareISOLatin1Lowered(const unsigned char *s1, int s1len,
const unsigned char *s2, int s2len)
{
unsigned char c1, c2;
for (;;) {
/* note -- compare against zero so that -1 ignores len */
c1 = s1len-- ? *s1++ : '\0';
c2 = s2len-- ? *s2++ : '\0';
if (!c1 ||
(c1 != c2 &&
(c1 = ISOLatin1ToLower(c1)) != (c2 = ISOLatin1ToLower(c2))))
break;
}
return (int) c1 - (int) c2;
}
/*
* dixLookupWindow and dixLookupDrawable:
* Look up the window/drawable taking into account the client doing the

View File

@ -185,11 +185,6 @@ extern _X_HIDDEN Bool CreateConnectionBlock(void);
/* dixutils.c */
extern _X_EXPORT int CompareISOLatin1Lowered(const unsigned char * /*a */ ,
int alen,
const unsigned char * /*b */ ,
int blen);
extern _X_EXPORT int dixLookupWindow(WindowPtr *result,
XID id,
ClientPtr client, Mask access_mode);

View File

@ -24,6 +24,9 @@
#include <dix-config.h>
#endif
#define XK_LATIN1
#include <X11/keysymdef.h>
#include "misc.h"
#include "scrnintstr.h"
#include "os.h"
@ -42,6 +45,47 @@
static char **filterNames;
static int nfilterNames;
/*
* ISO Latin-1 case conversion routine
*
* this routine always null-terminates the result, so
* beware of too-small buffers
*/
static unsigned char
ISOLatin1ToLower(unsigned char source)
{
unsigned char dest;
if ((source >= XK_A) && (source <= XK_Z))
dest = source + (XK_a - XK_A);
else if ((source >= XK_Agrave) && (source <= XK_Odiaeresis))
dest = source + (XK_agrave - XK_Agrave);
else if ((source >= XK_Ooblique) && (source <= XK_Thorn))
dest = source + (XK_oslash - XK_Ooblique);
else
dest = source;
return dest;
}
static int
CompareISOLatin1Lowered(const unsigned char *s1, int s1len,
const unsigned char *s2, int s2len)
{
unsigned char c1, c2;
for (;;) {
/* note -- compare against zero so that -1 ignores len */
c1 = s1len-- ? *s1++ : '\0';
c2 = s2len-- ? *s2++ : '\0';
if (!c1 ||
(c1 != c2 &&
(c1 = ISOLatin1ToLower(c1)) != (c2 = ISOLatin1ToLower(c2))))
break;
}
return (int) c1 - (int) c2;
}
/*
* standard but not required filters don't have constant indices
*/