diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2010-07-27 19:02:39 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2010-07-27 19:02:39 +0000 |
commit | 269d40cbcc43b41f621ca6d91c182952f60ec48e (patch) | |
tree | 872f2fddd3f2207e57a28595e73886713ce4a77a /xserver/dix/extension.c | |
parent | 917a2249b787451cad3f9697872aeccfd0da3324 (diff) |
Update to xserver 1.8. Tested by many. Ok oga@, todd@.
Diffstat (limited to 'xserver/dix/extension.c')
-rw-r--r-- | xserver/dix/extension.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/xserver/dix/extension.c b/xserver/dix/extension.c index 0375339e6..0740bfde2 100644 --- a/xserver/dix/extension.c +++ b/xserver/dix/extension.c @@ -50,8 +50,6 @@ SOFTWARE. #endif #include <X11/X.h> -#define NEED_EVENTS -#define NEED_REPLIES #include <X11/Xproto.h> #include "misc.h" #include "dixstruct.h" @@ -72,7 +70,7 @@ int lastEvent = EXTENSION_EVENT_BASE; static int lastError = FirstExtensionError; static unsigned int NumExtensions = 0; -_X_EXPORT ExtensionEntry * +ExtensionEntry * AddExtension(char *name, int NumEvents, int NumErrors, int (*MainProc)(ClientPtr c1), int (*SwappedMainProc)(ClientPtr c2), @@ -86,14 +84,17 @@ AddExtension(char *name, int NumEvents, int NumErrors, if (!MainProc || !SwappedMainProc || !MinorOpcodeProc) return((ExtensionEntry *) NULL); if ((lastEvent + NumEvents > LAST_EVENT) || - (unsigned)(lastError + NumErrors > LAST_ERROR)) + (unsigned)(lastError + NumErrors > LAST_ERROR)) { + LogMessage(X_ERROR, "Not enabling extension %s: maximum number of " + "events or errors exceeded.\n", name); return((ExtensionEntry *) NULL); + } - ext = (ExtensionEntry *) xalloc(sizeof(ExtensionEntry)); + ext = xalloc(sizeof(ExtensionEntry)); if (!ext) - return((ExtensionEntry *) NULL); + return(NULL); buflen = strlen(name) + 1; - ext->name = (char *)xalloc(buflen); + ext->name = xalloc(buflen); ext->num_aliases = 0; ext->aliases = (char **)NULL; ext->devPrivates = NULL; @@ -148,7 +149,7 @@ AddExtension(char *name, int NumEvents, int NumErrors, return(ext); } -_X_EXPORT Bool AddExtensionAlias(char *alias, ExtensionEntry *ext) +Bool AddExtensionAlias(char *alias, ExtensionEntry *ext) { char *name; char **aliases; @@ -162,7 +163,7 @@ _X_EXPORT Bool AddExtensionAlias(char *alias, ExtensionEntry *ext) return FALSE; ext->aliases = aliases; buflen = strlen(alias) + 1; - name = (char *)xalloc(buflen); + name = xalloc(buflen); if (!name) return FALSE; strlcpy(name, alias, buflen); @@ -196,7 +197,7 @@ FindExtension(char *extname, int len) * CheckExtension returns the extensions[] entry for the requested * extension name. Maybe this could just return a Bool instead? */ -_X_EXPORT ExtensionEntry * +ExtensionEntry * CheckExtension(const char *extname) { int n; @@ -222,13 +223,13 @@ GetExtensionEntry(int major) return extensions[major]; } -_X_EXPORT unsigned short +unsigned short StandardMinorOpcode(ClientPtr client) { return ((xReq *)client->requestBuffer)->data; } -_X_EXPORT unsigned short +unsigned short MinorOpcodeOfRequest(ClientPtr client) { unsigned char major; @@ -273,7 +274,8 @@ ProcQueryExtension(ClientPtr client) REQUEST(xQueryExtensionReq); REQUEST_FIXED_SIZE(xQueryExtensionReq, stuff->nbytes); - + + memset(&reply, 0, sizeof(xQueryExtensionReply)); reply.type = X_Reply; reply.length = 0; reply.major_opcode = 0; @@ -307,6 +309,7 @@ ProcListExtensions(ClientPtr client) REQUEST_SIZE_MATCH(xReq); + memset(&reply, 0, sizeof(xListExtensionsReply)); reply.type = X_Reply; reply.nExtensions = 0; reply.length = 0; @@ -328,8 +331,8 @@ ProcListExtensions(ClientPtr client) for (j = extensions[i]->num_aliases; --j >= 0;) total_length += strlen(extensions[i]->aliases[j]) + 1; } - reply.length = (total_length + 3) >> 2; - buffer = bufptr = (char *)xalloc(total_length); + reply.length = bytes_to_int32(total_length); + buffer = bufptr = xalloc(total_length); if (!buffer) return(BadAlloc); for (i=0; i<NumExtensions; i++) |