summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Kreitman <stuart.kreitman@sun.com>2004-03-30 16:35:06 +0000
committerStuart Kreitman <stuart.kreitman@sun.com>2004-03-30 16:35:06 +0000
commit478b62a4074e4c3c8ee2b1bfea16d125e1cbde6a (patch)
tree9ffd8024071f0beff1e80a2242ceaec5fb1aba5c
parentc8cf81cfe939413745d063c0b5f3b3a2d91f8d66 (diff)
First integration from modular tree Modified Files: Tag: DAMAGE-XFIXES
dixutils.c
-rw-r--r--dix/dixutils.c58
1 files changed, 43 insertions, 15 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,17 +175,27 @@ CopyISOLatin1Lowered(dest, source, length)
register int i;
for (i = 0; i < length; i++, source++, dest++)
+ *dest = ISOLatin1ToLower (*source);
+ *dest = '\0';
+}
+
+int
+CompareISOLatin1Lowered(unsigned char *s1, int s1len,
+ unsigned char *s2, int s2len)
+{
+ unsigned char c1, c2;
+
+ for (;;)
{
- 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;
+ /* 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;
}
- *dest = '\0';
+ return (int) c1 - (int) c2;
}
#ifdef XCSECURITY
@@ -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);
}
}