From 478b62a4074e4c3c8ee2b1bfea16d125e1cbde6a Mon Sep 17 00:00:00 2001 From: Stuart Kreitman Date: Tue, 30 Mar 2004 16:35:06 +0000 Subject: [PATCH] First integration from modular tree Modified Files: Tag: DAMAGE-XFIXES dixutils.c --- dix/dixutils.c | 60 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 16 deletions(-) diff --git a/dix/dixutils.c b/dix/dixutils.c index 40f80d348..7c2fe09e3 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -152,6 +152,21 @@ ClientTimeToServerTime(c) * 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; +} + void CopyISOLatin1Lowered(dest, source, length) register unsigned char *dest, *source; @@ -160,19 +175,29 @@ CopyISOLatin1Lowered(dest, source, length) register int i; for (i = 0; i < length; i++, source++, 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; - } + *dest = ISOLatin1ToLower (*source); *dest = '\0'; } +int +CompareISOLatin1Lowered(unsigned char *s1, int s1len, + 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; +} + #ifdef XCSECURITY /* SecurityLookupWindow and SecurityLookupDrawable: @@ -321,10 +346,11 @@ LookupClient(rid, client) int -AlterSaveSetForClient(client, pWin, mode) - ClientPtr client; - WindowPtr pWin; - unsigned mode; +AlterSaveSetForClient(ClientPtr client, + WindowPtr pWin, + unsigned mode, + Bool toRoot, + Bool remap) { int numnow; pointer *pTmp = NULL; @@ -348,7 +374,9 @@ AlterSaveSetForClient(client, pWin, mode) return(BadAlloc); client->saveSet = pTmp; client->numSaved = numnow; - client->saveSet[numnow - 1] = (pointer)pWin; + SaveSetAssignWindow(client->saveSet[numnow - 1], pWin); + SaveSetAssignToRoot(client->saveSet[numnow - 1], toRoot); + SaveSetAssignRemap(client->saveSet[numnow - 1], remap); return(Success); } else if ((mode == SetModeDelete) && (j < numnow)) @@ -388,7 +416,7 @@ DeleteWindowFromAnySaveSet(pWin) { client = clients[i]; if (client && client->numSaved) - (void)AlterSaveSetForClient(client, pWin, SetModeDelete); + (void)AlterSaveSetForClient(client, pWin, SetModeDelete, FALSE, TRUE); } }