mirror of
https://github.com/X11Libre/xserver.git
synced 2026-11-01 03:03:58 +00:00
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:
parent
1999785fa9
commit
ad7e7d9259
3 changed files with 44 additions and 48 deletions
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue