diff options
| author | Mihai Moldovan <ionic@ionic.de> | 2017-12-15 12:55:17 +0100 |
|---|---|---|
| committer | Mihai Moldovan <ionic@ionic.de> | 2017-12-15 12:55:17 +0100 |
| commit | 1dad092caf01d733990648e6df64cbf964df5143 (patch) | |
| tree | 39de0e643e76754a3e23ca9dd0350b8ba4f76250 /nx-X11/programs/Xserver/GL/glx | |
| parent | 6d70b9e3c47f27a166f4aacb522c5c1e49092dd9 (diff) | |
| parent | 2b9025f797ee322e21077e100c2ee27c2e7fa0e0 (diff) | |
| download | nx-libs-1dad092caf01d733990648e6df64cbf964df5143.tar.gz nx-libs-1dad092caf01d733990648e6df64cbf964df5143.tar.bz2 nx-libs-1dad092caf01d733990648e6df64cbf964df5143.zip | |
Merge branch '3.6.x'
Diffstat (limited to 'nx-X11/programs/Xserver/GL/glx')
53 files changed, 652 insertions, 2633 deletions
diff --git a/nx-X11/programs/Xserver/GL/glx/Imakefile b/nx-X11/programs/Xserver/GL/glx/Imakefile index 5283e2286..2ee2d17e6 100644 --- a/nx-X11/programs/Xserver/GL/glx/Imakefile +++ b/nx-X11/programs/Xserver/GL/glx/Imakefile @@ -1,13 +1,5 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/glx/Imakefile,v 1.11 2004/01/28 18:11:50 alanh Exp $ +NULL = -#if DoLoadableServer -# if !BuildModuleInSubdir -# define IHaveModules -# elif !defined(IHaveModules) -# define IHaveSubdirs -SUBDIRS = module -# endif -#endif /* Large PIC tables needed for SPARC builds */ #if defined(sparc) || defined(SparcArchitecture) @@ -22,28 +14,97 @@ LinkSourceFile(glcontextmodes.h, $(MESASRCDIR)/src/mesa/drivers/dri/common) LinkSourceFile(indirect_size.c, $(MESASRCDIR)/src/glx/x11) LinkSourceFile(indirect_size.h, $(MESASRCDIR)/src/glx/x11) - SRCS = global.c glxbuf.c glxcmds.c glxcmdsswap.c glxext.c \ - glxfb.c glximports.c glxmem.c glxpix.c glxscreens.c \ - glxutil.c render2.c render2swap.c renderpix.c \ - renderpixswap.c rensize.c rensizetab.c single2.c \ - single2swap.c singlepix.c singlepixswap.c \ - singlesize.c xfont.c g_disptab.c g_disptab_EXT.c \ - g_render.c g_renderswap.c g_single.c g_singleswap.c \ - glcontextmodes.c indirect_size.c $(MSRCS) +#if (!(defined(NXAgentServer) && NXAgentServer)) +NXAGENT_SKIP_SRCS = \ + glxext.c \ + $(NULL) +NXAGENT_SKIP_OBJS = \ + glxext.o \ + $(NULL) +#else + NX_DEFINES = -DNXAGENT_SERVER +#endif + + SRCS = global.c \ + glxbuf.c \ + glxcmds.c \ + glxcmdsswap.c \ + glxfb.c \ + glximports.c \ + glxmem.c \ + glxpix.c \ + glxscreens.c \ + glxutil.c \ + render2.c \ + render2swap.c \ + renderpix.c \ + renderpixswap.c \ + rensize.c \ + rensizetab.c \ + single2.c \ + single2swap.c \ + singlepix.c \ + singlepixswap.c \ + singlesize.c \ + xfont.c \ + g_disptab.c \ + g_disptab_EXT.c \ + g_render.c \ + g_renderswap.c \ + g_single.c \ + g_singleswap.c \ + glcontextmodes.c \ + indirect_size.c \ + $(MSRCS) \ + $(NXAGENT_SKIP_SRCS) \ + $(NULL) - OBJS = global.o glxbuf.o glxcmds.o glxcmdsswap.o glxext.o \ - glxfb.o glximports.o glxmem.o glxpix.o glxscreens.o \ - glxutil.o render2.o render2swap.o renderpix.o \ - renderpixswap.o rensize.o rensizetab.o single2.o \ - single2swap.o singlepix.o singlepixswap.o \ - singlesize.o xfont.o g_disptab.o g_disptab_EXT.o \ - g_render.o g_renderswap.o g_single.o g_singleswap.o \ - glcontextmodes.o indirect_size.o $(MOBJS) + OBJS = global.o \ + glxbuf.o \ + glxcmds.o \ + glxcmdsswap.o \ + glxfb.o \ + glximports.o \ + glxmem.o \ + glxpix.o \ + glxscreens.o \ + glxutil.o \ + render2.o \ + render2swap.o \ + renderpix.o \ + renderpixswap.o \ + rensize.o \ + rensizetab.o \ + single2.o \ + single2swap.o \ + singlepix.o \ + singlepixswap.o \ + singlesize.o \ + xfont.o \ + g_disptab.o \ + g_disptab_EXT.o \ + g_render.o \ + g_renderswap.o \ + g_single.o \ + g_singleswap.o \ + glcontextmodes.o \ + indirect_size.o \ + $(MOBJS) \ + $(NXAGENT_SKIP_OBJS) \ + $(NULL) - INCLUDES = -I$(SERVERSRC)/GL/glx -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/include -I$(INCLUDESRC) -I$(MESASRCDIR)/include \ - -I$(XINCLUDESRC) -I$(SERVERSRC)/mi \ - -I$(EXTINCSRC) -I$(FONTINCSRC) -I$(LIBSRC)/GL/include \ - -I$(XF86SRC) + INCLUDES = -I$(SERVERSRC)/GL/glx \ + -I$(SERVERSRC)/GL/include \ + -I$(SERVERSRC)/include \ + -I$(INCLUDESRC) \ + -I$(MESASRCDIR)/include \ + -I$(XINCLUDESRC) \ + -I$(SERVERSRC)/mi \ + -I$(EXTINCSRC) \ + -I$(LIBSRC)/GL/include \ + -I$(XF86SRC) \ + `pkg-config --cflags-only-I pixman-1` \ + $(NULL) #if defined(DarwinArchitecture) && ((OSMajorVersion == 6 && OSMinorVersion < 3) || OSMajorVersion < 6) NO_EXT_DEFS = -DMISSING_GL_EXTS @@ -55,13 +116,13 @@ LinkSourceFile(indirect_size.h, $(MESASRCDIR)/src/glx/x11) XCOMM If you add "-DDEBUG" in DEFINES, then make sure you also XCOMM add DEBUG to the define in ../mesa/src/X/xf86glx.c - DEFINES = $(GLX_DEFINES) $(NO_EXT_DEFS) $(APIENTRY_DEFS) + DEFINES = \ + $(GLX_DEFINES) \ + $(NO_EXT_DEFS) \ + $(APIENTRY_DEFS) \ + $(NX_DEFINES) \ + $(NULL) - -#ifdef IHaveModules -ModuleObjectRule() -LibraryModuleTarget(glx,$(OBJS)) -#else NormalLibraryObjectRule() NormalLibraryTarget(glx,$(OBJS)) #if defined(GlxUseWindows) && GlxUseWindows @@ -72,7 +133,6 @@ includes:: SpecialObjectRule(stdcall/%.o,%.c,-DUSE_OPENGL32 -o $@) NormalLibraryTarget(glx_stdcall,$(foreach obj,$(OBJS), stdcall/$(obj))) #endif -#endif SubdirLibraryRule($(OBJS)) LintLibraryTarget(glx,$(SRCS)) diff --git a/nx-X11/programs/Xserver/GL/glx/g_disptab.c b/nx-X11/programs/Xserver/GL/glx/g_disptab.c index 93a9d628d..533bc6c9d 100644 --- a/nx-X11/programs/Xserver/GL/glx/g_disptab.c +++ b/nx-X11/programs/Xserver/GL/glx/g_disptab.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab.c,v 1.5 2004/01/28 18:11:50 alanh Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ /* ** License Applicability. Except to the extent portions of this file are diff --git a/nx-X11/programs/Xserver/GL/glx/g_disptab.h b/nx-X11/programs/Xserver/GL/glx/g_disptab.h index 0580b5529..85906cb43 100644 --- a/nx-X11/programs/Xserver/GL/glx/g_disptab.h +++ b/nx-X11/programs/Xserver/GL/glx/g_disptab.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab.h,v 1.4 2003/09/28 20:15:42 alanh Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> diff --git a/nx-X11/programs/Xserver/GL/glx/g_disptab_EXT.c b/nx-X11/programs/Xserver/GL/glx/g_disptab_EXT.c index d837c64d9..754e9854d 100644 --- a/nx-X11/programs/Xserver/GL/glx/g_disptab_EXT.c +++ b/nx-X11/programs/Xserver/GL/glx/g_disptab_EXT.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.c,v 1.5 2004/01/28 18:11:50 alanh Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ /* ** License Applicability. Except to the extent portions of this file are diff --git a/nx-X11/programs/Xserver/GL/glx/g_disptab_EXT.h b/nx-X11/programs/Xserver/GL/glx/g_disptab_EXT.h index 3def7f1c5..3c1872f09 100644 --- a/nx-X11/programs/Xserver/GL/glx/g_disptab_EXT.h +++ b/nx-X11/programs/Xserver/GL/glx/g_disptab_EXT.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.h,v 1.5 2004/01/28 18:11:50 alanh Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> diff --git a/nx-X11/programs/Xserver/GL/glx/g_render.c b/nx-X11/programs/Xserver/GL/glx/g_render.c index 24c64897e..ae3416bed 100644 --- a/nx-X11/programs/Xserver/GL/glx/g_render.c +++ b/nx-X11/programs/Xserver/GL/glx/g_render.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_render.c,v 1.8 2004/02/03 21:34:36 alanh Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ /* ** License Applicability. Except to the extent portions of this file are @@ -29,7 +28,6 @@ ** version 1.2.1 Specification. */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/g_renderswap.c b/nx-X11/programs/Xserver/GL/glx/g_renderswap.c index f485a2690..38b1497f1 100644 --- a/nx-X11/programs/Xserver/GL/glx/g_renderswap.c +++ b/nx-X11/programs/Xserver/GL/glx/g_renderswap.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_renderswap.c,v 1.8 2004/01/28 18:11:50 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -28,7 +27,6 @@ ** version 1.2.1 Specification. */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/g_single.c b/nx-X11/programs/Xserver/GL/glx/g_single.c index a60bf44c1..486ae7a25 100644 --- a/nx-X11/programs/Xserver/GL/glx/g_single.c +++ b/nx-X11/programs/Xserver/GL/glx/g_single.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_single.c,v 1.5tsi Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -28,7 +27,6 @@ ** version 1.2.1 Specification. */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/g_singleswap.c b/nx-X11/programs/Xserver/GL/glx/g_singleswap.c index 026530374..7ec32dd96 100644 --- a/nx-X11/programs/Xserver/GL/glx/g_singleswap.c +++ b/nx-X11/programs/Xserver/GL/glx/g_singleswap.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_singleswap.c,v 1.4tsi Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -28,7 +27,6 @@ ** version 1.2.1 Specification. */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/global.c b/nx-X11/programs/Xserver/GL/glx/global.c index 18cd5edc2..2ce275ba3 100644 --- a/nx-X11/programs/Xserver/GL/glx/global.c +++ b/nx-X11/programs/Xserver/GL/glx/global.c @@ -1,4 +1,3 @@ -/* $XFree86$ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,7 +33,6 @@ ** */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/glx-def.cpp b/nx-X11/programs/Xserver/GL/glx/glx-def.cpp deleted file mode 100644 index a653f4cb7..000000000 --- a/nx-X11/programs/Xserver/GL/glx/glx-def.cpp +++ /dev/null @@ -1,662 +0,0 @@ -LIBRARY GLX -VERSION LIBRARY_VERSION -EXPORTS -__glXFBInitDrawable -__glXFreeBuffers -__glXPixInitDrawable -__glXResizeBuffers -__glXClientInfo -__glXCopyContext -__glXCreateContext -__glXCreateGLXPixmap -__glXDestroyContext -__glXDestroyGLXPixmap -__glXGetVisualConfigs -__glXIsDirect -__glXLookupContextByTag -__glXMakeCurrent -__glXQueryContextInfoEXT -__glXQueryExtensionsString -__glXQueryServerString -__glXQueryVersion -__glXRender -__glXRenderLarge -__glXSwapBuffers -__glXVendorPrivate -__glXVendorPrivateWithReply -__glXWaitGL -__glXWaitX -__glXSwapClientInfo -__glXSwapCopyContext -__glXSwapCreateContext -__glXSwapCreateGLXPixmap -__glXSwapDestroyContext -__glXSwapDestroyGLXPixmap -__glXSwapGetVisualConfigs -__glXSwapIsDirect -__glXSwapIsDirectReply -__glXSwapMakeCurrent -__glXSwapMakeCurrentReply -__glXSwapQueryContextInfoEXT -__glXSwapQueryContextInfoEXTReply -__glXSwapQueryExtensionsString -__glXSwapQueryServerString -__glXSwapQueryVersion -__glXSwapQueryVersionReply -__glXSwapRender -__glXSwapRenderLarge -__glXSwapSwapBuffers -__glXSwapUseXFont -__glXSwapVendorPrivate -__glXSwapVendorPrivateWithReply -__glXSwapWaitGL -__glXSwapWaitX -glxSwapQueryExtensionsStringReply -glxSwapQueryServerStringReply -GlxExtensionInit -GlxInitVisuals -GlxSetVisualConfigs -GlxWrapInitVisuals -__glXClearErrorOccured -__glXCoreType -__glXErrorCallBack -__glXErrorOccured -__glXFlushContextCache -__glXForceCurrent -__glXFreeContext -__glXNoSuchRenderOpcode -__glXNoSuchSingleOpcode -__glXResetLargeCommandStatus -__glXFBGetGC -__glXFBMemSwapBuffers -__glXInitFB -__glXImpCalloc -__glXImpFatal -__glXImpFclose -__glXImpFopen -__glXImpFprintf -__glXImpFree -__glXImpGetDrawablePrivate -__glXImpGetenv -__glXImpMalloc -__glXImpRealloc -__glXImpSprintf -__glXImpWarning -__glXInitMem -__glXInitPix -__glXScreenInit -__glXAssociateContext -__glXCacheDrawableSize -__glXCalloc -__glXCreateDrawablePrivate -__glXDeassociateContext -__glXDestroyDrawablePrivate -__glXFindDrawablePrivate -__glXFree -__glXGetDrawablePrivate -__glXGetDrawableSize -__glXMalloc -__glXNop -__glXRealloc -__glXRefDrawablePrivate -__glXResizeDrawable -__glXResizeDrawableBuffers -__glXUnrefDrawablePrivate -__glXDisp_CallLists -__glXDisp_DrawArrays -__glXDisp_Map1d -__glXDisp_Map1f -__glXDisp_Map2d -__glXDisp_Map2f -__glXDispSwap_CallLists -__glXDispSwap_DrawArrays -__glXDispSwap_Map1d -__glXDispSwap_Map1f -__glXDispSwap_Map2d -__glXDispSwap_Map2f -__glXDisp_Bitmap -__glXDisp_DrawPixels -__glXDisp_PolygonStipple -__glXDisp_TexImage1D -__glXDisp_TexImage2D -__glXDisp_TexSubImage1D -__glXDisp_TexSubImage2D -__glXDispSwap_Bitmap -__glXDispSwap_DrawPixels -__glXDispSwap_PolygonStipple -__glXDispSwap_TexImage1D -__glXDispSwap_TexImage2D -__glXDispSwap_TexSubImage1D -__glXDispSwap_TexSubImage2D -__glXBitmapReqSize -__glXCallListsReqSize -__glXDrawArraysSize -__glXDrawPixelsReqSize -__glXFogfvReqSize -__glXFogivReqSize -__glXLightModelfvReqSize -__glXLightModelivReqSize -__glXLightfvReqSize -__glXLightivReqSize -__glXMap1dReqSize -__glXMap1fReqSize -__glXMap2dReqSize -__glXMap2fReqSize -__glXMaterialfvReqSize -__glXMaterialivReqSize -__glXPixelMapfvReqSize -__glXPixelMapuivReqSize -__glXPixelMapusvReqSize -__glXPrioritizeTexturesReqSize -__glXTexEnvfvReqSize -__glXTexEnvivReqSize -__glXTexGendvReqSize -__glXTexGenfvReqSize -__glXTexGenivReqSize -__glXTexImage1DReqSize -__glXTexImage2DReqSize -__glXTexParameterfvReqSize -__glXTexParameterivReqSize -__glXTexSubImage1DReqSize -__glXTexSubImage2DReqSize -__glXTypeSize -__glXDisp_FeedbackBuffer -__glXDisp_Finish -__glXDisp_Flush -__glXDisp_GetClipPlane -__glXDisp_GetString -__glXDisp_RenderMode -__glXDisp_SelectBuffer -__glXcombine_strings -__glXDispSwap_FeedbackBuffer -__glXDispSwap_Finish -__glXDispSwap_Flush -__glXDispSwap_GetClipPlane -__glXDispSwap_GetString -__glXDispSwap_RenderMode -__glXDispSwap_SelectBuffer -__glXDisp_GetPolygonStipple -__glXDisp_GetTexImage -__glXDisp_ReadPixels -__glXDispSwap_GetPolygonStipple -__glXDispSwap_GetTexImage -__glXDispSwap_ReadPixels -__glGetBooleanv_size -__glGetDoublev_size -__glGetFloatv_size -__glGetIntegerv_size -__glGetLightfv_size -__glGetLightiv_size -__glGetMap_size -__glGetMapdv_size -__glGetMapfv_size -__glGetMapiv_size -__glGetMaterialfv_size -__glGetMaterialiv_size -__glGetPixelMap_size -__glGetPixelMapfv_size -__glGetPixelMapuiv_size -__glGetPixelMapusv_size -__glGetTexEnvfv_size -__glGetTexEnviv_size -__glGetTexGendv_size -__glGetTexGenfv_size -__glGetTexGeniv_size -__glGetTexImage_size -__glGetTexLevelParameterfv_size -__glGetTexLevelParameteriv_size -__glGetTexParameterfv_size -__glGetTexParameteriv_size -__glGet_size -__glReadPixels_size -__glXUseXFont -__glXDisp_Accum -__glXDisp_AlphaFunc -__glXDisp_Begin -__glXDisp_BindTexture -__glXDisp_BlendFunc -__glXDisp_CallList -__glXDisp_Clear -__glXDisp_ClearAccum -__glXDisp_ClearColor -__glXDisp_ClearDepth -__glXDisp_ClearIndex -__glXDisp_ClearStencil -__glXDisp_ClipPlane -__glXDisp_Color3bv -__glXDisp_Color3dv -__glXDisp_Color3fv -__glXDisp_Color3iv -__glXDisp_Color3sv -__glXDisp_Color3ubv -__glXDisp_Color3uiv -__glXDisp_Color3usv -__glXDisp_Color4bv -__glXDisp_Color4dv -__glXDisp_Color4fv -__glXDisp_Color4iv -__glXDisp_Color4sv -__glXDisp_Color4ubv -__glXDisp_Color4uiv -__glXDisp_Color4usv -__glXDisp_ColorMask -__glXDisp_ColorMaterial -__glXDisp_CopyPixels -__glXDisp_CopyTexImage1D -__glXDisp_CopyTexImage2D -__glXDisp_CopyTexSubImage1D -__glXDisp_CopyTexSubImage2D -__glXDisp_CullFace -__glXDisp_DepthFunc -__glXDisp_DepthMask -__glXDisp_DepthRange -__glXDisp_Disable -__glXDisp_DrawBuffer -__glXDisp_EdgeFlagv -__glXDisp_Enable -__glXDisp_End -__glXDisp_EvalCoord1dv -__glXDisp_EvalCoord1fv -__glXDisp_EvalCoord2dv -__glXDisp_EvalCoord2fv -__glXDisp_EvalMesh1 -__glXDisp_EvalMesh2 -__glXDisp_EvalPoint1 -__glXDisp_EvalPoint2 -__glXDisp_Fogf -__glXDisp_Fogfv -__glXDisp_Fogi -__glXDisp_Fogiv -__glXDisp_FrontFace -__glXDisp_Frustum -__glXDisp_Hint -__glXDisp_IndexMask -__glXDisp_Indexdv -__glXDisp_Indexfv -__glXDisp_Indexiv -__glXDisp_Indexsv -__glXDisp_Indexubv -__glXDisp_InitNames -__glXDisp_LightModelf -__glXDisp_LightModelfv -__glXDisp_LightModeli -__glXDisp_LightModeliv -__glXDisp_Lightf -__glXDisp_Lightfv -__glXDisp_Lighti -__glXDisp_Lightiv -__glXDisp_LineStipple -__glXDisp_LineWidth -__glXDisp_ListBase -__glXDisp_LoadIdentity -__glXDisp_LoadMatrixd -__glXDisp_LoadMatrixf -__glXDisp_LoadName -__glXDisp_LogicOp -__glXDisp_MapGrid1d -__glXDisp_MapGrid1f -__glXDisp_MapGrid2d -__glXDisp_MapGrid2f -__glXDisp_Materialf -__glXDisp_Materialfv -__glXDisp_Materiali -__glXDisp_Materialiv -__glXDisp_MatrixMode -__glXDisp_MultMatrixd -__glXDisp_MultMatrixf -__glXDisp_Normal3bv -__glXDisp_Normal3dv -__glXDisp_Normal3fv -__glXDisp_Normal3iv -__glXDisp_Normal3sv -__glXDisp_Ortho -__glXDisp_PassThrough -__glXDisp_PixelMapfv -__glXDisp_PixelMapuiv -__glXDisp_PixelMapusv -__glXDisp_PixelTransferf -__glXDisp_PixelTransferi -__glXDisp_PixelZoom -__glXDisp_PointSize -__glXDisp_PolygonMode -__glXDisp_PolygonOffset -__glXDisp_PopAttrib -__glXDisp_PopMatrix -__glXDisp_PopName -__glXDisp_PrioritizeTextures -__glXDisp_PushAttrib -__glXDisp_PushMatrix -__glXDisp_PushName -__glXDisp_RasterPos2dv -__glXDisp_RasterPos2fv -__glXDisp_RasterPos2iv -__glXDisp_RasterPos2sv -__glXDisp_RasterPos3dv -__glXDisp_RasterPos3fv -__glXDisp_RasterPos3iv -__glXDisp_RasterPos3sv -__glXDisp_RasterPos4dv -__glXDisp_RasterPos4fv -__glXDisp_RasterPos4iv -__glXDisp_RasterPos4sv -__glXDisp_ReadBuffer -__glXDisp_Rectdv -__glXDisp_Rectfv -__glXDisp_Rectiv -__glXDisp_Rectsv -__glXDisp_Rotated -__glXDisp_Rotatef -__glXDisp_Scaled -__glXDisp_Scalef -__glXDisp_Scissor -__glXDisp_ShadeModel -__glXDisp_StencilFunc -__glXDisp_StencilMask -__glXDisp_StencilOp -__glXDisp_TexCoord1dv -__glXDisp_TexCoord1fv -__glXDisp_TexCoord1iv -__glXDisp_TexCoord1sv -__glXDisp_TexCoord2dv -__glXDisp_TexCoord2fv -__glXDisp_TexCoord2iv -__glXDisp_TexCoord2sv -__glXDisp_TexCoord3dv -__glXDisp_TexCoord3fv -__glXDisp_TexCoord3iv -__glXDisp_TexCoord3sv -__glXDisp_TexCoord4dv -__glXDisp_TexCoord4fv -__glXDisp_TexCoord4iv -__glXDisp_TexCoord4sv -__glXDisp_TexEnvf -__glXDisp_TexEnvfv -__glXDisp_TexEnvi -__glXDisp_TexEnviv -__glXDisp_TexGend -__glXDisp_TexGendv -__glXDisp_TexGenf -__glXDisp_TexGenfv -__glXDisp_TexGeni -__glXDisp_TexGeniv -__glXDisp_TexParameterf -__glXDisp_TexParameterfv -__glXDisp_TexParameteri -__glXDisp_TexParameteriv -__glXDisp_Translated -__glXDisp_Translatef -__glXDisp_Vertex2dv -__glXDisp_Vertex2fv -__glXDisp_Vertex2iv -__glXDisp_Vertex2sv -__glXDisp_Vertex3dv -__glXDisp_Vertex3fv -__glXDisp_Vertex3iv -__glXDisp_Vertex3sv -__glXDisp_Vertex4dv -__glXDisp_Vertex4fv -__glXDisp_Vertex4iv -__glXDisp_Vertex4sv -__glXDisp_Viewport -__glXDispSwap_Accum -__glXDispSwap_AlphaFunc -__glXDispSwap_Begin -__glXDispSwap_BindTexture -__glXDispSwap_BlendFunc -__glXDispSwap_CallList -__glXDispSwap_Clear -__glXDispSwap_ClearAccum -__glXDispSwap_ClearColor -__glXDispSwap_ClearDepth -__glXDispSwap_ClearIndex -__glXDispSwap_ClearStencil -__glXDispSwap_ClipPlane -__glXDispSwap_Color3bv -__glXDispSwap_Color3dv -__glXDispSwap_Color3fv -__glXDispSwap_Color3iv -__glXDispSwap_Color3sv -__glXDispSwap_Color3ubv -__glXDispSwap_Color3uiv -__glXDispSwap_Color3usv -__glXDispSwap_Color4bv -__glXDispSwap_Color4dv -__glXDispSwap_Color4fv -__glXDispSwap_Color4iv -__glXDispSwap_Color4sv -__glXDispSwap_Color4ubv -__glXDispSwap_Color4uiv -__glXDispSwap_Color4usv -__glXDispSwap_ColorMask -__glXDispSwap_ColorMaterial -__glXDispSwap_CopyPixels -__glXDispSwap_CopyTexImage1D -__glXDispSwap_CopyTexImage2D -__glXDispSwap_CopyTexSubImage1D -__glXDispSwap_CopyTexSubImage2D -__glXDispSwap_CullFace -__glXDispSwap_DepthFunc -__glXDispSwap_DepthMask -__glXDispSwap_DepthRange -__glXDispSwap_Disable -__glXDispSwap_DrawBuffer -__glXDispSwap_EdgeFlagv -__glXDispSwap_Enable -__glXDispSwap_End -__glXDispSwap_EvalCoord1dv -__glXDispSwap_EvalCoord1fv -__glXDispSwap_EvalCoord2dv -__glXDispSwap_EvalCoord2fv -__glXDispSwap_EvalMesh1 -__glXDispSwap_EvalMesh2 -__glXDispSwap_EvalPoint1 -__glXDispSwap_EvalPoint2 -__glXDispSwap_Fogf -__glXDispSwap_Fogfv -__glXDispSwap_Fogi -__glXDispSwap_Fogiv -__glXDispSwap_FrontFace -__glXDispSwap_Frustum -__glXDispSwap_Hint -__glXDispSwap_IndexMask -__glXDispSwap_Indexdv -__glXDispSwap_Indexfv -__glXDispSwap_Indexiv -__glXDispSwap_Indexsv -__glXDispSwap_Indexubv -__glXDispSwap_InitNames -__glXDispSwap_LightModelf -__glXDispSwap_LightModelfv -__glXDispSwap_LightModeli -__glXDispSwap_LightModeliv -__glXDispSwap_Lightf -__glXDispSwap_Lightfv -__glXDispSwap_Lighti -__glXDispSwap_Lightiv -__glXDispSwap_LineStipple -__glXDispSwap_LineWidth -__glXDispSwap_ListBase -__glXDispSwap_LoadIdentity -__glXDispSwap_LoadMatrixd -__glXDispSwap_LoadMatrixf -__glXDispSwap_LoadName -__glXDispSwap_LogicOp -__glXDispSwap_MapGrid1d -__glXDispSwap_MapGrid1f -__glXDispSwap_MapGrid2d -__glXDispSwap_MapGrid2f -__glXDispSwap_Materialf -__glXDispSwap_Materialfv -__glXDispSwap_Materiali -__glXDispSwap_Materialiv -__glXDispSwap_MatrixMode -__glXDispSwap_MultMatrixd -__glXDispSwap_MultMatrixf -__glXDispSwap_Normal3bv -__glXDispSwap_Normal3dv -__glXDispSwap_Normal3fv -__glXDispSwap_Normal3iv -__glXDispSwap_Normal3sv -__glXDispSwap_Ortho -__glXDispSwap_PassThrough -__glXDispSwap_PixelMapfv -__glXDispSwap_PixelMapuiv -__glXDispSwap_PixelMapusv -__glXDispSwap_PixelTransferf -__glXDispSwap_PixelTransferi -__glXDispSwap_PixelZoom -__glXDispSwap_PointSize -__glXDispSwap_PolygonMode -__glXDispSwap_PolygonOffset -__glXDispSwap_PopAttrib -__glXDispSwap_PopMatrix -__glXDispSwap_PopName -__glXDispSwap_PrioritizeTextures -__glXDispSwap_PushAttrib -__glXDispSwap_PushMatrix -__glXDispSwap_PushName -__glXDispSwap_RasterPos2dv -__glXDispSwap_RasterPos2fv -__glXDispSwap_RasterPos2iv -__glXDispSwap_RasterPos2sv -__glXDispSwap_RasterPos3dv -__glXDispSwap_RasterPos3fv -__glXDispSwap_RasterPos3iv -__glXDispSwap_RasterPos3sv -__glXDispSwap_RasterPos4dv -__glXDispSwap_RasterPos4fv -__glXDispSwap_RasterPos4iv -__glXDispSwap_RasterPos4sv -__glXDispSwap_ReadBuffer -__glXDispSwap_Rectdv -__glXDispSwap_Rectfv -__glXDispSwap_Rectiv -__glXDispSwap_Rectsv -__glXDispSwap_Rotated -__glXDispSwap_Rotatef -__glXDispSwap_Scaled -__glXDispSwap_Scalef -__glXDispSwap_Scissor -__glXDispSwap_ShadeModel -__glXDispSwap_StencilFunc -__glXDispSwap_StencilMask -__glXDispSwap_StencilOp -__glXDispSwap_TexCoord1dv -__glXDispSwap_TexCoord1fv -__glXDispSwap_TexCoord1iv -__glXDispSwap_TexCoord1sv -__glXDispSwap_TexCoord2dv -__glXDispSwap_TexCoord2fv -__glXDispSwap_TexCoord2iv -__glXDispSwap_TexCoord2sv -__glXDispSwap_TexCoord3dv -__glXDispSwap_TexCoord3fv -__glXDispSwap_TexCoord3iv -__glXDispSwap_TexCoord3sv -__glXDispSwap_TexCoord4dv -__glXDispSwap_TexCoord4fv -__glXDispSwap_TexCoord4iv -__glXDispSwap_TexCoord4sv -__glXDispSwap_TexEnvf -__glXDispSwap_TexEnvfv -__glXDispSwap_TexEnvi -__glXDispSwap_TexEnviv -__glXDispSwap_TexGend -__glXDispSwap_TexGendv -__glXDispSwap_TexGenf -__glXDispSwap_TexGenfv -__glXDispSwap_TexGeni -__glXDispSwap_TexGeniv -__glXDispSwap_TexParameterf -__glXDispSwap_TexParameterfv -__glXDispSwap_TexParameteri -__glXDispSwap_TexParameteriv -__glXDispSwap_Translated -__glXDispSwap_Translatef -__glXDispSwap_Vertex2dv -__glXDispSwap_Vertex2fv -__glXDispSwap_Vertex2iv -__glXDispSwap_Vertex2sv -__glXDispSwap_Vertex3dv -__glXDispSwap_Vertex3fv -__glXDispSwap_Vertex3iv -__glXDispSwap_Vertex3sv -__glXDispSwap_Vertex4dv -__glXDispSwap_Vertex4fv -__glXDispSwap_Vertex4iv -__glXDispSwap_Vertex4sv -__glXDispSwap_Viewport -__glXDisp_AreTexturesResident -__glXDisp_DeleteLists -__glXDisp_DeleteTextures -__glXDisp_EndList -__glXDisp_GenLists -__glXDisp_GenTextures -__glXDisp_GetBooleanv -__glXDisp_GetDoublev -__glXDisp_GetError -__glXDisp_GetFloatv -__glXDisp_GetIntegerv -__glXDisp_GetLightfv -__glXDisp_GetLightiv -__glXDisp_GetMapdv -__glXDisp_GetMapfv -__glXDisp_GetMapiv -__glXDisp_GetMaterialfv -__glXDisp_GetMaterialiv -__glXDisp_GetPixelMapfv -__glXDisp_GetPixelMapuiv -__glXDisp_GetPixelMapusv -__glXDisp_GetTexEnvfv -__glXDisp_GetTexEnviv -__glXDisp_GetTexGendv -__glXDisp_GetTexGenfv -__glXDisp_GetTexGeniv -__glXDisp_GetTexLevelParameterfv -__glXDisp_GetTexLevelParameteriv -__glXDisp_GetTexParameterfv -__glXDisp_GetTexParameteriv -__glXDisp_IsEnabled -__glXDisp_IsList -__glXDisp_IsTexture -__glXDisp_NewList -__glXDisp_PixelStoref -__glXDisp_PixelStorei -__glXDispSwap_AreTexturesResident -__glXDispSwap_DeleteLists -__glXDispSwap_DeleteTextures -__glXDispSwap_EndList -__glXDispSwap_GenLists -__glXDispSwap_GenTextures -__glXDispSwap_GetBooleanv -__glXDispSwap_GetDoublev -__glXDispSwap_GetError -__glXDispSwap_GetFloatv -__glXDispSwap_GetIntegerv -__glXDispSwap_GetLightfv -__glXDispSwap_GetLightiv -__glXDispSwap_GetMapdv -__glXDispSwap_GetMapfv -__glXDispSwap_GetMapiv -__glXDispSwap_GetMaterialfv -__glXDispSwap_GetMaterialiv -__glXDispSwap_GetPixelMapfv -__glXDispSwap_GetPixelMapuiv -__glXDispSwap_GetPixelMapusv -__glXDispSwap_GetTexEnvfv -__glXDispSwap_GetTexEnviv -__glXDispSwap_GetTexGendv -__glXDispSwap_GetTexGenfv -__glXDispSwap_GetTexGeniv -__glXDispSwap_GetTexLevelParameterfv -__glXDispSwap_GetTexLevelParameteriv -__glXDispSwap_GetTexParameterfv -__glXDispSwap_GetTexParameteriv -__glXDispSwap_IsEnabled -__glXDispSwap_IsList -__glXDispSwap_IsTexture -__glXDispSwap_NewList -__glXDispSwap_PixelStoref -__glXDispSwap_PixelStorei - -/* $XFree86$ */ diff --git a/nx-X11/programs/Xserver/GL/glx/glxbuf.c b/nx-X11/programs/Xserver/GL/glx/glxbuf.c index 44be53614..047bc569e 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxbuf.c +++ b/nx-X11/programs/Xserver/GL/glx/glxbuf.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxbuf.c,v 1.6 2001/03/25 05:32:01 tsi Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free diff --git a/nx-X11/programs/Xserver/GL/glx/glxbuf.h b/nx-X11/programs/Xserver/GL/glx/glxbuf.h index 88b04e8bd..9354dc4f8 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxbuf.h +++ b/nx-X11/programs/Xserver/GL/glx/glxbuf.h @@ -1,4 +1,3 @@ -/* $XFree86$ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/glxcmds.c b/nx-X11/programs/Xserver/GL/glx/glxcmds.c index ca5eee82a..602b79099 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxcmds.c +++ b/nx-X11/programs/Xserver/GL/glx/glxcmds.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxcmds.c,v 1.12 2004/01/28 18:11:50 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,12 +33,14 @@ ** */ -#define NEED_REPLIES #define FONT_PCF #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif +#include <string.h> +#include <assert.h> + #include "glxserver.h" #include <GL/glxtokens.h> #include <unpack.h> @@ -50,7 +51,6 @@ #include "glximports.h" #include "glxutil.h" #include "glxext.h" -#include "GL/glx_ansic.h" #include "glcontextmodes.h" /************************************************************************/ @@ -193,11 +193,11 @@ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId, /* ** Allocate memory for the new context */ - glxc = (__GLXcontext *) __glXMalloc(sizeof(__GLXcontext)); + glxc = (__GLXcontext *) malloc(sizeof(__GLXcontext)); if (!glxc) { return BadAlloc; } - __glXMemset(glxc, 0, sizeof(__GLXcontext)); + memset(glxc, 0, sizeof(__GLXcontext)); /* ** Initially, setup the part of the context that could be used by @@ -216,7 +216,7 @@ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId, imports.other = (void *)glxc; glxc->gc = (*pGlxScreen->createContext)(&imports, glxc->modes, shareGC); if (!glxc->gc) { - __glXFree(glxc); + free(glxc); client->errorValue = gcId; return BadAlloc; } @@ -229,11 +229,11 @@ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId, /* ** Register this context as a resource. */ - if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) { + if (!AddResource(gcId, __glXContextRes, (void *)glxc)) { if (!isDirect) { (*glxc->gc->exports.destroyContext)((__GLcontext *)glxc->gc); } - __glXFree(glxc); + free(glxc); client->errorValue = gcId; return BadAlloc; } @@ -335,9 +335,9 @@ static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc) ** Didn't find a free slot, so we'll have to grow the table. */ if (!num) { - table = (__GLXcontext **) __glXMalloc(sizeof(__GLXcontext *)); + table = (__GLXcontext **) malloc(sizeof(__GLXcontext *)); } else { - table = (__GLXcontext **) __glXRealloc(table, + table = (__GLXcontext **) realloc(table, (num+1)*sizeof(__GLXcontext *)); } table[num] = glxc; @@ -685,7 +685,7 @@ int DoMakeCurrent( __GLXclientState *cl, ** refcount of the X pixmap and free only if it's zero. */ (*prevglxc->readPixmap->pScreen->DestroyPixmap)(pPixmap); - __glXFree(prevglxc->readPixmap); + free(prevglxc->readPixmap); } } @@ -701,7 +701,7 @@ int DoMakeCurrent( __GLXclientState *cl, ** refcount of the X pixmap and free only if it's zero. */ (*prevglxc->drawPixmap->pScreen->DestroyPixmap)(pPixmap); - __glXFree(prevglxc->drawPixmap); + free(prevglxc->drawPixmap); } prevglxc->drawPixmap = NULL; @@ -736,7 +736,7 @@ int DoMakeCurrent( __GLXclientState *cl, if (client->swapped) { __glXSwapMakeCurrentReply(client, &reply); } else { - WriteToClient(client, sz_xGLXMakeCurrentReply, (char *)&reply); + WriteToClient(client, sz_xGLXMakeCurrentReply, &reply); } return Success; } @@ -765,7 +765,7 @@ int __glXIsDirect(__GLXclientState *cl, GLbyte *pc) if (client->swapped) { __glXSwapIsDirectReply(client, &reply); } else { - WriteToClient(client, sz_xGLXIsDirectReply, (char *)&reply); + WriteToClient(client, sz_xGLXIsDirectReply, &reply); } return Success; @@ -783,6 +783,8 @@ int __glXQueryVersion(__GLXclientState *cl, GLbyte *pc) (void)major; (void)minor; + memset(&reply, 0, sizeof(xGLXQueryVersionReply)); + /* ** Server should take into consideration the version numbers sent by the ** client if it wants to work with older clients; however, in this @@ -797,7 +799,7 @@ int __glXQueryVersion(__GLXclientState *cl, GLbyte *pc) if (client->swapped) { __glXSwapQueryVersionReply(client, &reply); } else { - WriteToClient(client, sz_xGLXQueryVersionReply, (char *)&reply); + WriteToClient(client, sz_xGLXQueryVersionReply, &reply); } return Success; } @@ -948,7 +950,7 @@ int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen, __GLX_SWAP_INT(&reply.numProps); } - WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply); + WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply); for ( modes = pGlxScreen->modes ; modes != NULL ; modes = modes->next ) { if (modes->visualID == 0) { @@ -999,7 +1001,7 @@ int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen, __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG); } WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG, - (char *)buf); + buf); } return Success; } @@ -1056,7 +1058,7 @@ int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap) __GLX_SWAP_INT(&reply.numAttribs); } - WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *)&reply); + WriteToClient(client, sz_xGLXGetFBConfigsReply, &reply); for ( modes = pGlxScreen->modes ; modes != NULL ; modes = modes->next ) { if (modes->visualID == 0) { @@ -1108,7 +1110,7 @@ int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap) __GLX_SWAP_INT_ARRAY(buf, __GLX_FBCONFIG_ATTRIBS_LENGTH); } WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_FBCONFIG_ATTRIBS_LENGTH, - (char *)buf); + buf); } return Success; } @@ -1192,7 +1194,7 @@ int DoCreateGLXPixmap(__GLXclientState *cl, VisualID visual, return BadValue; } - pGlxPixmap = (__GLXpixmap *) __glXMalloc(sizeof(__GLXpixmap)); + pGlxPixmap = (__GLXpixmap *) malloc(sizeof(__GLXpixmap)); if (!pGlxPixmap) { return BadAlloc; } @@ -1382,7 +1384,7 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) reply.n = nProps; nReplyBytes = reply.length << 2; - sendBuf = (int *)__glXMalloc((size_t)nReplyBytes); + sendBuf = (int *)malloc((size_t)nReplyBytes); if (sendBuf == NULL) { return __glXBadContext; /* XXX: Is this correct? */ } @@ -1397,10 +1399,10 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) if (client->swapped) { __glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf); } else { - WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)&reply); - WriteToClient(client, nReplyBytes, (char *)sendBuf); + WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply); + WriteToClient(client, nReplyBytes, sendBuf); } - __glXFree((char *)sendBuf); + free((char *)sendBuf); return Success; } @@ -1443,7 +1445,7 @@ int __glXRender(__GLXclientState *cl, GLbyte *pc) left = (req->length << 2) - sz_xGLXRenderReq; while (left > 0) { __GLXrenderSizeData *entry; - int extra; + int extra = 0; void (* proc)(GLbyte *); /* @@ -1454,6 +1456,9 @@ int __glXRender(__GLXclientState *cl, GLbyte *pc) cmdlen = hdr->length; opcode = hdr->opcode; + if (left < cmdlen) + return BadLength; + /* ** Check for core opcodes and grab entry data. */ @@ -1480,22 +1485,19 @@ int __glXRender(__GLXclientState *cl, GLbyte *pc) client->errorValue = commandsDone; return __glXBadRenderRequest; } + + if (cmdlen < entry->bytes) { + return BadLength; + } + if (entry->varsize) { /* variable size command */ - extra = (*entry->varsize)(pc + __GLX_RENDER_HDR_SIZE, False); + extra = (*entry->varsize)(pc + __GLX_RENDER_HDR_SIZE, False, left - __GLX_RENDER_HDR_SIZE); if (extra < 0) { - extra = 0; - } - if (cmdlen != __GLX_PAD(entry->bytes + extra)) { - return BadLength; - } - } else { - /* constant size command */ - if (cmdlen != __GLX_PAD(entry->bytes)) { return BadLength; } } - if (left < cmdlen) { + if (cmdlen != safe_pad(safe_add(entry->bytes, extra))) { return BadLength; } @@ -1535,6 +1537,8 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) ** duplicated there. */ + REQUEST_AT_LEAST_SIZE(xGLXRenderLargeReq); + req = (xGLXRenderLargeReq *) pc; glxc = __glXForceCurrent(cl, req->contextTag, &error); if (!glxc) { @@ -1542,12 +1546,15 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) __glXResetLargeCommandStatus(cl); return error; } + if (safe_pad(req->dataBytes) < 0) + return BadLength; + dataBytes = req->dataBytes; /* ** Check the request length. */ - if ((req->length << 2) != __GLX_PAD(dataBytes) + sz_xGLXRenderLargeReq) { + if ((req->length << 2) != safe_pad(dataBytes) + sz_xGLXRenderLargeReq) { client->errorValue = req->length; /* Reset in case this isn't 1st request. */ __glXResetLargeCommandStatus(cl); @@ -1557,7 +1564,8 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) if (cl->largeCmdRequestsSoFar == 0) { __GLXrenderSizeData *entry; - int extra, cmdlen; + int extra = 0, cmdlen; + int left = (req->length << 2) - sz_xGLXRenderLargeReq; /* ** This is the first request of a multi request command. ** Make enough space in the buffer, then copy the entire request. @@ -1567,9 +1575,13 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) return __glXBadLargeRequest; } + if (dataBytes < __GLX_RENDER_LARGE_HDR_SIZE) + return BadLength; + hdr = (__GLXrenderLargeHeader *) pc; - cmdlen = hdr->length; opcode = hdr->opcode; + if ((cmdlen = safe_pad(hdr->length)) < 0) + return BadLength; /* ** Check for core opcodes and grab entry data. @@ -1599,36 +1611,34 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) ** be computed from its parameters), all the parameters needed ** will be in the 1st request, so it's okay to do this. */ - extra = (*entry->varsize)(pc + __GLX_RENDER_LARGE_HDR_SIZE, False); + extra = (*entry->varsize)(pc + __GLX_RENDER_LARGE_HDR_SIZE, False, + left - __GLX_RENDER_LARGE_HDR_SIZE); if (extra < 0) { - extra = 0; - } - /* large command's header is 4 bytes longer, so add 4 */ - if (cmdlen != __GLX_PAD(entry->bytes + 4 + extra)) { - return BadLength; - } - } else { - /* constant size command */ - if (cmdlen != __GLX_PAD(entry->bytes + 4)) { - return BadLength; + return BadLength; } } + + /* the +4 is safe because we know entry.bytes is small */ + if (cmdlen != safe_pad(safe_add(entry->bytes + 4, extra))) { + return BadLength; + } + /* ** Make enough space in the buffer, then copy the entire request. */ if (cl->largeCmdBufSize < cmdlen) { if (!cl->largeCmdBuf) { - cl->largeCmdBuf = (GLbyte *) __glXMalloc((size_t)cmdlen); + cl->largeCmdBuf = (GLbyte *) malloc((size_t)cmdlen); } else { - cl->largeCmdBuf = (GLbyte *) __glXRealloc(cl->largeCmdBuf, - (size_t)cmdlen); + cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, + (size_t)cmdlen); } if (!cl->largeCmdBuf) { return BadAlloc; } cl->largeCmdBufSize = cmdlen; } - __glXMemcpy(cl->largeCmdBuf, pc, dataBytes); + memcpy(cl->largeCmdBuf, pc, dataBytes); cl->largeCmdBytesSoFar = dataBytes; cl->largeCmdBytesTotal = cmdlen; @@ -1641,6 +1651,7 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) ** We are receiving subsequent (i.e. not the first) requests of a ** multi request command. */ + int bytesSoFar; /* including this packet */ /* ** Check the request number and the total request count. @@ -1659,12 +1670,18 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) /* ** Check that we didn't get too much data. */ - if ((cl->largeCmdBytesSoFar + dataBytes) > cl->largeCmdBytesTotal) { + if ((bytesSoFar = safe_add(cl->largeCmdBytesSoFar, dataBytes)) < 0) { + client->errorValue = dataBytes; + __glXResetLargeCommandStatus(cl); + return __glXBadLargeRequest; + } + + if (bytesSoFar > cl->largeCmdBytesTotal) { client->errorValue = dataBytes; __glXResetLargeCommandStatus(cl); return __glXBadLargeRequest; } - __glXMemcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes); + memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes); cl->largeCmdBytesSoFar += dataBytes; cl->largeCmdRequestsSoFar++; @@ -1673,17 +1690,16 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) ** This is the last request; it must have enough bytes to complete ** the command. */ - /* NOTE: the two pad macros have been added below; they are needed - ** because the client library pads the total byte count, but not - ** the per-request byte counts. The Protocol Encoding says the - ** total byte count should not be padded, so a proposal will be - ** made to the ARB to relax the padding constraint on the total - ** byte count, thus preserving backward compatibility. Meanwhile, - ** the padding done below fixes a bug that did not allow - ** large commands of odd sizes to be accepted by the server. + /* NOTE: the pad macro below is needed because the client library + ** pads the total byte count, but not the per-request byte counts. + ** The Protocol Encoding says the total byte count should not be + ** padded, so a proposal will be made to the ARB to relax the + ** padding constraint on the total byte count, thus preserving + ** backward compatibility. Meanwhile, the padding done below + ** fixes a bug that did not allow large commands of odd sizes to + ** be accepted by the server. */ - if (__GLX_PAD(cl->largeCmdBytesSoFar) != - __GLX_PAD(cl->largeCmdBytesTotal)) { + if (safe_pad(cl->largeCmdBytesSoFar) != cl->largeCmdBytesTotal) { client->errorValue = dataBytes; __glXResetLargeCommandStatus(cl); return __glXBadLargeRequest; @@ -1746,7 +1762,7 @@ static int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc) if (ret == Success) { if (barrier) /* add source for cleanup when drawable is gone */ - AddResource(drawable, __glXSwapBarrierRes, (pointer)screen); + AddResource(drawable, __glXSwapBarrierRes, (void *)(intptr_t)screen); else /* delete source */ FreeResourceByType(drawable, __glXSwapBarrierRes, FALSE); @@ -1784,7 +1800,7 @@ static int __glXQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc) } WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply, - (char *) &reply); + &reply); return Success; } @@ -1823,9 +1839,9 @@ static int __glxQueryHyperpipeNetworkSGIX(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_INT(&reply.npipes); } WriteToClient(client, sz_xGLXQueryHyperpipeNetworkSGIXReply, - (char *) &reply); + &reply); - WriteToClient(client, length << 2, (char *)rdata); + WriteToClient(client, length << 2, rdata); return Success; } @@ -1861,7 +1877,7 @@ static int __glxDestroyHyperpipeConfigSGIX (__GLXclientState *cl, GLbyte *pc) } WriteToClient(client, sz_xGLXDestroyHyperpipeConfigSGIXReply, - (char *) &reply); + &reply); return Success; } @@ -1902,9 +1918,9 @@ static int __glxQueryHyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc) } WriteToClient(client, sz_xGLXQueryHyperpipeConfigSGIXReply, - (char *) &reply); + &reply); - WriteToClient(client, length << 2, (char *)rdata); + WriteToClient(client, length << 2, rdata); return Success; } @@ -1947,7 +1963,7 @@ static int __glxHyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc) } WriteToClient(client, sz_xGLXHyperpipeConfigSGIXReply, - (char *) &reply); + &reply); return Success; } @@ -2060,26 +2076,27 @@ int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc) ptr = __glXActiveScreens[screen].GLXextensions; - n = __glXStrlen(ptr) + 1; + n = strlen(ptr) + 1; length = __GLX_PAD(n) >> 2; reply.type = X_Reply; reply.sequenceNumber = client->sequence; reply.length = length; reply.n = n; - if ((buf = (char *) __glXMalloc(length << 2)) == NULL) { + /* Allocate buffer to make sure it's a multiple of 4 bytes big.*/ + buf = (char *) malloc(length << 2); + if (buf == NULL) return BadAlloc; - } - __glXStrncpy(buf, ptr, n); + memcpy(buf, ptr, n); if (client->swapped) { glxSwapQueryExtensionsStringReply(client, &reply, buf); } else { - WriteToClient(client, sz_xGLXQueryExtensionsStringReply,(char *)&reply); - WriteToClient(client, (int)(length << 2), (char *)buf); + WriteToClient(client, sz_xGLXQueryExtensionsStringReply,&reply); + WriteToClient(client, (int)(length << 2), buf); } - __glXFree(buf); + free(buf); return Success; } @@ -2117,26 +2134,26 @@ int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc) return BadValue; } - n = __glXStrlen(ptr) + 1; + n = strlen(ptr) + 1; length = __GLX_PAD(n) >> 2; reply.type = X_Reply; reply.sequenceNumber = client->sequence; reply.length = length; reply.n = n; - if ((buf = (char *) Xalloc(length << 2)) == NULL) { + if ((buf = (char *) malloc(length << 2)) == NULL) { return BadAlloc; } - __glXStrncpy(buf, ptr, n); + memcpy(buf, ptr, n); if (client->swapped) { glxSwapQueryServerStringReply(client, &reply, buf); } else { - WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)&reply); + WriteToClient(client, sz_xGLXQueryServerStringReply, &reply); WriteToClient(client, (int)(length << 2), buf); } - __glXFree(buf); + free(buf); return Success; } @@ -2147,9 +2164,10 @@ int __glXClientInfo(__GLXclientState *cl, GLbyte *pc) cl->GLClientmajorVersion = req->major; cl->GLClientminorVersion = req->minor; - if (cl->GLClientextensions) __glXFree(cl->GLClientextensions); + if (cl->GLClientextensions) + free(cl->GLClientextensions); buf = (const char *)(req+1); - cl->GLClientextensions = __glXStrdup(buf); + cl->GLClientextensions = xstrdup(buf); return Success; } diff --git a/nx-X11/programs/Xserver/GL/glx/glxcmdsswap.c b/nx-X11/programs/Xserver/GL/glx/glxcmdsswap.c index 595e814e5..98acfe5af 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxcmdsswap.c +++ b/nx-X11/programs/Xserver/GL/glx/glxcmdsswap.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxcmdsswap.c,v 1.10 2004/01/28 18:11:50 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,7 +33,6 @@ ** */ -#define NEED_REPLIES #define FONT_PCF #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> @@ -49,7 +47,6 @@ #include <pixmapstr.h> #include <windowstr.h> #include "glxext.h" -#include "GL/glx_ansic.h" static int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc); static int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); @@ -397,7 +394,7 @@ void __glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReply *reply) __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->contextTag); - WriteToClient(client, sz_xGLXMakeCurrentReply, (char *)reply); + WriteToClient(client, sz_xGLXMakeCurrentReply, reply); } void __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply *reply) @@ -405,7 +402,7 @@ void __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply *reply) __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); - WriteToClient(client, sz_xGLXIsDirectReply, (char *)reply); + WriteToClient(client, sz_xGLXIsDirectReply, reply); } void __glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply *reply) @@ -415,7 +412,7 @@ void __glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply *reply) __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->majorVersion); __GLX_SWAP_INT(&reply->minorVersion); - WriteToClient(client, sz_xGLXQueryVersionReply, (char *)reply); + WriteToClient(client, sz_xGLXQueryVersionReply, reply); } void glxSwapQueryExtensionsStringReply(ClientPtr client, @@ -427,7 +424,7 @@ void glxSwapQueryExtensionsStringReply(ClientPtr client, __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->n); - WriteToClient(client, sz_xGLXQueryExtensionsStringReply, (char *)reply); + WriteToClient(client, sz_xGLXQueryExtensionsStringReply, reply); __GLX_SWAP_INT_ARRAY((int *)buf, length); WriteToClient(client, length << 2, buf); } @@ -440,7 +437,7 @@ void glxSwapQueryServerStringReply(ClientPtr client, __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->n); - WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)reply); + WriteToClient(client, sz_xGLXQueryServerStringReply, reply); /** no swap is needed for an array of chars **/ /* __GLX_SWAP_INT_ARRAY((int *)buf, length); */ WriteToClient(client, length << 2, buf); @@ -454,9 +451,9 @@ void __glXSwapQueryContextInfoEXTReply(ClientPtr client, xGLXQueryContextInfoEXT __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->n); - WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)reply); + WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, reply); __GLX_SWAP_INT_ARRAY((int *)buf, length); - WriteToClient(client, length << 2, (char *)buf); + WriteToClient(client, length << 2, buf); } @@ -498,7 +495,7 @@ int __glXSwapRender(__GLXclientState *cl, GLbyte *pc) left = (req->length << 2) - sz_xGLXRenderReq; while (left > 0) { __GLXrenderSizeData *entry; - int extra; + int extra = 0; void (* proc)(GLbyte *); /* @@ -511,6 +508,9 @@ int __glXSwapRender(__GLXclientState *cl, GLbyte *pc) cmdlen = hdr->length; opcode = hdr->opcode; + if (left < cmdlen) + return BadLength; + if ( (opcode >= __GLX_MIN_RENDER_OPCODE) && (opcode <= __GLX_MAX_RENDER_OPCODE) ) { entry = &__glXRenderSizeTable[opcode]; @@ -531,22 +531,20 @@ int __glXSwapRender(__GLXclientState *cl, GLbyte *pc) client->errorValue = commandsDone; return __glXBadRenderRequest; } + + if (cmdlen < entry->bytes) { + return BadLength; + } + if (entry->varsize) { /* variable size command */ - extra = (*entry->varsize)(pc + __GLX_RENDER_HDR_SIZE, True); + extra = (*entry->varsize)(pc + __GLX_RENDER_HDR_SIZE, True, + left - __GLX_RENDER_HDR_SIZE); if (extra < 0) { - extra = 0; - } - if (cmdlen != __GLX_PAD(entry->bytes + extra)) { - return BadLength; - } - } else { - /* constant size command */ - if (cmdlen != __GLX_PAD(entry->bytes)) { return BadLength; } } - if (left < cmdlen) { + if (cmdlen != safe_pad(safe_add(entry->bytes, extra))) { return BadLength; } @@ -587,6 +585,8 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) ** duplicated there. */ + REQUEST_AT_LEAST_SIZE(xGLXRenderLargeReq); + req = (xGLXRenderLargeReq *) pc; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); @@ -599,12 +599,15 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) __glXResetLargeCommandStatus(cl); return error; } + if (safe_pad(req->dataBytes) < 0) + return BadLength; + dataBytes = req->dataBytes; /* ** Check the request length. */ - if ((req->length << 2) != __GLX_PAD(dataBytes) + sz_xGLXRenderLargeReq) { + if ((req->length << 2) != safe_pad(dataBytes) + sz_xGLXRenderLargeReq) { client->errorValue = req->length; /* Reset in case this isn't 1st request. */ __glXResetLargeCommandStatus(cl); @@ -614,7 +617,8 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) if (cl->largeCmdRequestsSoFar == 0) { __GLXrenderSizeData *entry; - int extra; + int extra = 0; + int left = (req->length << 2) - sz_xGLXRenderLargeReq; size_t cmdlen; /* ** This is the first request of a multi request command. @@ -624,12 +628,17 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) client->errorValue = req->requestNumber; return __glXBadLargeRequest; } + if (dataBytes < __GLX_RENDER_LARGE_HDR_SIZE) + return BadLength; + hdr = (__GLXrenderLargeHeader *) pc; __GLX_SWAP_INT(&hdr->length); __GLX_SWAP_INT(&hdr->opcode); - cmdlen = hdr->length; opcode = hdr->opcode; + if ((cmdlen = safe_pad(hdr->length)) < 0) + return BadLength; + if ( (opcode >= __GLX_MIN_RENDER_OPCODE) && (opcode <= __GLX_MAX_RENDER_OPCODE) ) { entry = &__glXRenderSizeTable[opcode]; @@ -657,35 +666,32 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) ** be computed from its parameters), all the parameters needed ** will be in the 1st request, so it's okay to do this. */ - extra = (*entry->varsize)(pc + __GLX_RENDER_LARGE_HDR_SIZE, True); + extra = (*entry->varsize)(pc + __GLX_RENDER_LARGE_HDR_SIZE, True, + left - __GLX_RENDER_LARGE_HDR_SIZE); if (extra < 0) { - extra = 0; - } - /* large command's header is 4 bytes longer, so add 4 */ - if (cmdlen != __GLX_PAD(entry->bytes + 4 + extra)) { - return BadLength; - } - } else { - /* constant size command */ - if (cmdlen != __GLX_PAD(entry->bytes + 4)) { return BadLength; } } + /* the +4 is safe because we know entry->bytes is small */ + if (cmdlen != safe_pad(safe_add(entry->bytes + 4, extra))) { + return BadLength; + } + /* ** Make enough space in the buffer, then copy the entire request. */ if (cl->largeCmdBufSize < cmdlen) { if (!cl->largeCmdBuf) { - cl->largeCmdBuf = (GLbyte *) __glXMalloc(cmdlen); + cl->largeCmdBuf = (GLbyte *) malloc(cmdlen); } else { - cl->largeCmdBuf = (GLbyte *) __glXRealloc(cl->largeCmdBuf, cmdlen); + cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, cmdlen); } if (!cl->largeCmdBuf) { return BadAlloc; } cl->largeCmdBufSize = cmdlen; } - __glXMemcpy(cl->largeCmdBuf, pc, dataBytes); + memcpy(cl->largeCmdBuf, pc, dataBytes); cl->largeCmdBytesSoFar = dataBytes; cl->largeCmdBytesTotal = cmdlen; @@ -698,6 +704,7 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) ** We are receiving subsequent (i.e. not the first) requests of a ** multi request command. */ + int bytesSoFar; /* including this packet */ /* ** Check the request number and the total request count. @@ -716,12 +723,18 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) /* ** Check that we didn't get too much data. */ - if ((cl->largeCmdBytesSoFar + dataBytes) > cl->largeCmdBytesTotal) { + if ((bytesSoFar = safe_add(cl->largeCmdBytesSoFar, dataBytes)) < 0) { + client->errorValue = dataBytes; + __glXResetLargeCommandStatus(cl); + return __glXBadLargeRequest; + } + + if (bytesSoFar > cl->largeCmdBytesTotal) { client->errorValue = dataBytes; __glXResetLargeCommandStatus(cl); return __glXBadLargeRequest; } - __glXMemcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes); + memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes); cl->largeCmdBytesSoFar += dataBytes; cl->largeCmdRequestsSoFar++; @@ -730,17 +743,17 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) ** This is the last request; it must have enough bytes to complete ** the command. */ - /* NOTE: the two pad macros have been added below; they are needed - ** because the client library pads the total byte count, but not - ** the per-request byte counts. The Protocol Encoding says the - ** total byte count should not be padded, so a proposal will be - ** made to the ARB to relax the padding constraint on the total - ** byte count, thus preserving backward compatibility. Meanwhile, - ** the padding done below fixes a bug that did not allow - ** large commands of odd sizes to be accepted by the server. + /* NOTE: the pad macro below is needed because the client library + ** pads the total byte count, but not the per-request byte counts. + ** The Protocol Encoding says the total byte count should not be + ** padded, so a proposal will be made to the ARB to relax the + ** padding constraint on the total byte count, thus preserving + ** backward compatibility. Meanwhile, the padding done below + ** fixes a bug that did not allow large commands of odd sizes to + ** be accepted by the server. */ - if (__GLX_PAD(cl->largeCmdBytesSoFar) != - __GLX_PAD(cl->largeCmdBytesTotal)) { + + if (safe_pad(cl->largeCmdBytesSoFar) != cl->largeCmdBytesTotal) { client->errorValue = dataBytes; __glXResetLargeCommandStatus(cl); return __glXBadLargeRequest; @@ -797,10 +810,12 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXVendorPrivateReq *req; GLint vendorcode; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateReq); req = (xGLXVendorPrivateReq *) pc; __GLX_SWAP_SHORT(&req->length); @@ -835,10 +850,12 @@ int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc) int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXVendorPrivateWithReplyReq *req; GLint vendorcode; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateWithReplyReq); req = (xGLXVendorPrivateWithReplyReq *) pc; __GLX_SWAP_SHORT(&req->length); diff --git a/nx-X11/programs/Xserver/GL/glx/glxcontext.h b/nx-X11/programs/Xserver/GL/glx/glxcontext.h index 18d8b44c2..25f8daf44 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxcontext.h +++ b/nx-X11/programs/Xserver/GL/glx/glxcontext.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxcontext.h,v 1.4 2002/02/22 21:45:07 dawes Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/glxdrawable.h b/nx-X11/programs/Xserver/GL/glx/glxdrawable.h index 38a05bfeb..a7c975a44 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxdrawable.h +++ b/nx-X11/programs/Xserver/GL/glx/glxdrawable.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxdrawable.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/glxerror.h b/nx-X11/programs/Xserver/GL/glx/glxerror.h index 2c6d6d863..44973fccb 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxerror.h +++ b/nx-X11/programs/Xserver/GL/glx/glxerror.h @@ -1,4 +1,3 @@ -/* $XFree86$ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/glxext.c b/nx-X11/programs/Xserver/GL/glx/glxext.c index fa1382983..e92e605fa 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxext.c +++ b/nx-X11/programs/Xserver/GL/glx/glxext.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxext.c,v 1.9 2003/09/28 20:15:43 alanh Exp $ +/* ** The contents of this file are subject to the GLX Public License Version 1.0 ** (the "License"). You may not use this file except in compliance with the ** License. You may obtain a copy of the License at Silicon Graphics, Inc., @@ -18,7 +18,6 @@ ** */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -43,7 +42,6 @@ static __GLXextensionInfo *__glXExt /* = &__glDDXExtensionInfo */; /* ** Forward declarations. */ -static int __glXSwapDispatch(ClientPtr); static int __glXDispatch(ClientPtr); /* @@ -63,17 +61,18 @@ static void ResetClientState(int clientIndex) { __GLXclientState *cl = __glXClients[clientIndex]; - if (cl->returnBuf) __glXFree(cl->returnBuf); - if (cl->largeCmdBuf) __glXFree(cl->largeCmdBuf); - if (cl->currentContexts) __glXFree(cl->currentContexts); - __glXMemset(cl, 0, sizeof(__GLXclientState)); + if (cl->returnBuf) free(cl->returnBuf); + if (cl->largeCmdBuf) free(cl->largeCmdBuf); + if (cl->currentContexts) free(cl->currentContexts); + memset(cl, 0, sizeof(__GLXclientState)); /* ** By default, assume that the client supports ** GLX major version 1 minor version 0 protocol. */ cl->GLClientmajorVersion = 1; cl->GLClientminorVersion = 0; - if (cl->GLClientextensions) __glXFree(cl->GLClientextensions); + if (cl->GLClientextensions) + free(cl->GLClientextensions); } @@ -152,7 +151,7 @@ static int PixmapGone(__GLXpixmap *pGlxPixmap, XID id) ** only if it's zero. */ (*pGlxPixmap->pScreen->DestroyPixmap)(pPixmap); - __glXFree(pGlxPixmap); + free(pGlxPixmap); } return True; @@ -170,9 +169,9 @@ GLboolean __glXFreeContext(__GLXcontext *cx) return GL_FALSE; } } - if (cx->feedbackBuf) __glXFree(cx->feedbackBuf); - if (cx->selectBuf) __glXFree(cx->selectBuf); - __glXFree(cx); + if (cx->feedbackBuf) free(cx->feedbackBuf); + if (cx->selectBuf) free(cx->selectBuf); + free(cx); if (cx == __glXLastContext) { __glXFlushContextCache(); } @@ -246,7 +245,7 @@ void GlxExtensionInit(void) */ extEntry = AddExtension(GLX_EXTENSION_NAME, __GLX_NUMBER_EVENTS, __GLX_NUMBER_ERRORS, __glXDispatch, - __glXSwapDispatch, ResetExtension, + __glXDispatch, ResetExtension, StandardMinorOpcode); if (!extEntry) { FatalError("__glXExtensionInit: AddExtensions failed\n"); @@ -390,6 +389,8 @@ __GLXcontext *__glXForceCurrent(__GLXclientState *cl, GLXContextTag tag, /************************************************************************/ +#ifndef NXAGENT_SERVER + /* ** Top level dispatcher; all commands are executed from here down. */ @@ -403,12 +404,12 @@ static int __glXDispatch(ClientPtr client) opcode = stuff->glxCode; cl = __glXClients[client->index]; if (!cl) { - cl = (__GLXclientState *) __glXMalloc(sizeof(__GLXclientState)); + cl = (__GLXclientState *) malloc(sizeof(__GLXclientState)); __glXClients[client->index] = cl; if (!cl) { return BadAlloc; } - __glXMemset(cl, 0, sizeof(__GLXclientState)); + memset(cl, 0, sizeof(__GLXclientState)); } if (!cl->inUse) { @@ -417,7 +418,7 @@ static int __glXDispatch(ClientPtr client) ** with the client so we will be notified when the client dies. */ XID xid = FakeClientID(client->index); - if (!AddResource( xid, __glXClientRes, (pointer)(long)client->index)) { + if (!AddResource( xid, __glXClientRes, (void *)(long)client->index)) { return BadAlloc; } ResetClientState(client->index); @@ -443,55 +444,15 @@ static int __glXDispatch(ClientPtr client) /* ** Use the opcode to index into the procedure table. */ - proc = __glXSingleTable[opcode]; + if (client->swapped) + proc = __glXSwapSingleTable[opcode]; + else + proc = __glXSingleTable[opcode]; return (*proc)(cl, (GLbyte *) stuff); } -static int __glXSwapDispatch(ClientPtr client) -{ - REQUEST(xGLXSingleReq); - CARD8 opcode; - int (*proc)(__GLXclientState *cl, GLbyte *pc); - __GLXclientState *cl; +#endif /* NXAGENT_SERVER */ - opcode = stuff->glxCode; - cl = __glXClients[client->index]; - if (!cl) { - cl = (__GLXclientState *) __glXMalloc(sizeof(__GLXclientState)); - __glXClients[client->index] = cl; - if (!cl) { - return BadAlloc; - } - __glXMemset(cl, 0, sizeof(__GLXclientState)); - } - - if (!cl->inUse) { - /* - ** This is first request from this client. Associate a resource - ** with the client so we will be notified when the client dies. - */ - XID xid = FakeClientID(client->index); - if (!AddResource( xid, __glXClientRes, (pointer)(long)client->index)) { - return BadAlloc; - } - ResetClientState(client->index); - cl->inUse = GL_TRUE; - cl->client = client; - } - - /* - ** Check for valid opcode. - */ - if (opcode >= __GLX_SINGLE_TABLE_SIZE) { - return BadRequest; - } - - /* - ** Use the opcode to index into the procedure table. - */ - proc = __glXSwapSingleTable[opcode]; - return (*proc)(cl, (GLbyte *) stuff); -} int __glXNoSuchSingleOpcode(__GLXclientState *cl, GLbyte *pc) { diff --git a/nx-X11/programs/Xserver/GL/glx/glxext.h b/nx-X11/programs/Xserver/GL/glx/glxext.h index 5d569899f..edb65a5f3 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxext.h +++ b/nx-X11/programs/Xserver/GL/glx/glxext.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxext.h,v 1.7 2003/11/17 22:20:26 dawes Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/glxfb.c b/nx-X11/programs/Xserver/GL/glx/glxfb.c index 0d433d25d..13f02d448 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxfb.c +++ b/nx-X11/programs/Xserver/GL/glx/glxfb.c @@ -1,4 +1,3 @@ -/* $XFree86$ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -130,7 +129,7 @@ Free(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv) FreeScratchGC(bufferInfo->pGC); } - __glXFree(bufferInfo); + free(bufferInfo); buf->other = NULL; } @@ -173,7 +172,7 @@ __glXInitFB(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, GLint bits) buf->free = Free; /* allocate local information */ - bufferInfo = (__GLFBbufferInfo *) __glXMalloc(sizeof(__GLFBbufferInfo)); + bufferInfo = (__GLFBbufferInfo *) malloc(sizeof(__GLFBbufferInfo)); buf->other = (void *) bufferInfo; pGC = CreateScratchGC(glxPriv->pDraw->pScreen, diff --git a/nx-X11/programs/Xserver/GL/glx/glxfb.h b/nx-X11/programs/Xserver/GL/glx/glxfb.h index 325146d43..f414728f3 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxfb.h +++ b/nx-X11/programs/Xserver/GL/glx/glxfb.h @@ -1,4 +1,3 @@ -/* $XFree86$ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/glximports.c b/nx-X11/programs/Xserver/GL/glx/glximports.c index fae2346b9..fb4d508a9 100644 --- a/nx-X11/programs/Xserver/GL/glx/glximports.c +++ b/nx-X11/programs/Xserver/GL/glx/glximports.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glximports.c,v 1.5 2001/03/21 16:29:36 dawes Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -38,10 +37,13 @@ #include <dix-config.h> #endif +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + #include "glxserver.h" #include "glxcontext.h" #include "glximports.h" -#include "GL/glx_ansic.h" void *__glXImpMalloc(__GLcontext *gc, size_t size) { @@ -50,7 +52,7 @@ void *__glXImpMalloc(__GLcontext *gc, size_t size) if (size == 0) { return NULL; } - addr = xalloc(size); + addr = malloc(size); if (addr == NULL) { /* XXX: handle out of memory error */ return NULL; @@ -67,13 +69,13 @@ void *__glXImpCalloc(__GLcontext *gc, size_t numElements, size_t elementSize) return NULL; } size = numElements * elementSize; - addr = xalloc(size); + addr = malloc(size); if (addr == NULL) { /* XXX: handle out of memory error */ return NULL; } /* zero out memory */ - __glXMemset(addr, 0, size); + memset(addr, 0, size); return addr; } @@ -81,7 +83,7 @@ void *__glXImpCalloc(__GLcontext *gc, size_t numElements, size_t elementSize) void __glXImpFree(__GLcontext *gc, void *addr) { if (addr) { - xfree(addr); + free(addr); } } @@ -91,15 +93,15 @@ void *__glXImpRealloc(__GLcontext *gc, void *addr, size_t newSize) if (addr) { if (newSize == 0) { - xfree(addr); + free(addr); return NULL; } - newAddr = xrealloc(addr, newSize); + newAddr = realloc(addr, newSize); } else { if (newSize == 0) { return NULL; } - newAddr = xalloc(newSize); + newAddr = malloc(newSize); } if (newAddr == NULL) { return NULL; /* XXX: out of memory error */ @@ -110,23 +112,23 @@ void *__glXImpRealloc(__GLcontext *gc, void *addr, size_t newSize) void __glXImpWarning(__GLcontext *gc, char *msg) { - ErrorF((char *)msg); + ErrorF("%s",(char *)msg); } void __glXImpFatal(__GLcontext *gc, char *msg) { - ErrorF((char *)msg); - __glXAbort(); + ErrorF("%s",(char *)msg); + abort(); } char *__glXImpGetenv(__GLcontext *gc, const char *var) { - return __glXGetenv(var); + return getenv(var); } int __glXImpAtoi(__GLcontext *gc, const char *str) { - return __glXAtoi(str); + return atoi(str); } int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...) @@ -136,7 +138,7 @@ int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...) /* have to deal with var args */ va_start(ap, fmt); - ret = __glXVsprintf(str, fmt, ap); + ret = vsprintf(str, fmt, ap); va_end(ap); return ret; @@ -144,12 +146,12 @@ int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...) void *__glXImpFopen(__GLcontext *gc, const char *path, const char *mode) { - return (void *) __glXFopen(path, mode); + return (void *) fopen(path, mode); } int __glXImpFclose(__GLcontext *gc, void *stream) { - return __glXFclose((FILE *)stream); + return fclose((FILE *)stream); } int __glXImpFprintf(__GLcontext *gc, void *stream, const char *fmt, ...) @@ -159,7 +161,7 @@ int __glXImpFprintf(__GLcontext *gc, void *stream, const char *fmt, ...) /* have to deal with var args */ va_start(ap, fmt); - ret = __glXVfprintf((FILE *)stream, fmt, ap); + ret = vfprintf((FILE *)stream, fmt, ap); va_end(ap); return ret; diff --git a/nx-X11/programs/Xserver/GL/glx/glximports.h b/nx-X11/programs/Xserver/GL/glx/glximports.h index ef485822e..f57004b34 100644 --- a/nx-X11/programs/Xserver/GL/glx/glximports.h +++ b/nx-X11/programs/Xserver/GL/glx/glximports.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glximports.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/glxmem.c b/nx-X11/programs/Xserver/GL/glx/glxmem.c index 21a7c7962..e1487da94 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxmem.c +++ b/nx-X11/programs/Xserver/GL/glx/glxmem.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxmem.c,v 1.6 2001/10/31 22:50:27 tsi Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free diff --git a/nx-X11/programs/Xserver/GL/glx/glxmem.h b/nx-X11/programs/Xserver/GL/glx/glxmem.h index 06720dfdf..b4116dfa9 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxmem.h +++ b/nx-X11/programs/Xserver/GL/glx/glxmem.h @@ -1,4 +1,3 @@ -/* $XFree86$ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/glxpix.c b/nx-X11/programs/Xserver/GL/glx/glxpix.c index 98c033c98..81e29a9c5 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxpix.c +++ b/nx-X11/programs/Xserver/GL/glx/glxpix.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxpix.c,v 1.3 2000/09/26 15:57:02 tsi Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -96,7 +95,7 @@ Free(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv) FreeScratchGC(bufferInfo->pGC); } - __glXFree(bufferInfo); + free(bufferInfo); buf->other = NULL; } @@ -124,7 +123,7 @@ __glXInitPix(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, buf->free = Free; /* allocate local information */ - bufferInfo = (__GLPixBufferInfo *) __glXMalloc(sizeof(__GLPixBufferInfo)); + bufferInfo = (__GLPixBufferInfo *) malloc(sizeof(__GLPixBufferInfo)); buf->other = (void *) bufferInfo; bufferInfo->pGC = CreateScratchGC(pGlxPixmap->pDraw->pScreen, diff --git a/nx-X11/programs/Xserver/GL/glx/glxpix.h b/nx-X11/programs/Xserver/GL/glx/glxpix.h index 4b16352b4..285cf490c 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxpix.h +++ b/nx-X11/programs/Xserver/GL/glx/glxpix.h @@ -1,4 +1,3 @@ -/* $XFree86$ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/glxscreens.c b/nx-X11/programs/Xserver/GL/glx/glxscreens.c index 58b38b1a2..1bff4bc3a 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxscreens.c +++ b/nx-X11/programs/Xserver/GL/glx/glxscreens.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.c,v 1.14 2004/02/09 23:46:31 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -38,12 +37,8 @@ #include <dix-config.h> #endif -#ifdef IN_MODULE -#include <xf86_ansic.h> -#else #include <string.h> #include <signal.h> -#endif #include <windowstr.h> @@ -293,7 +288,7 @@ static void wrapPositionWindow(int screen) void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs) { if (__glXNumHyperpipeFuncs < screen + 1) { - __glXHyperpipeFuncs = __glXRealloc(__glXHyperpipeFuncs, + __glXHyperpipeFuncs = realloc(__glXHyperpipeFuncs, (screen+1) * sizeof(__GLXHyperpipeExtensionFuncs)); __glXNumHyperpipeFuncs = screen + 1; } @@ -311,7 +306,7 @@ void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs) void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs) { if (__glXNumSwapBarrierFuncs < screen + 1) { - __glXSwapBarrierFuncs = __glXRealloc(__glXSwapBarrierFuncs, + __glXSwapBarrierFuncs = realloc(__glXSwapBarrierFuncs, (screen+1) * sizeof(__GLXSwapBarrierExtensionFuncs)); __glXNumSwapBarrierFuncs = screen + 1; } @@ -332,7 +327,7 @@ void __glXScreenInit(GLint numscreens) ** This alloc has to work or else the server might as well core dump. */ __glXActiveScreens = - (__GLXscreenInfo *) __glXMalloc(sizeof(__GLXscreenInfo) * numscreens); + (__GLXscreenInfo *) malloc(sizeof(__GLXscreenInfo) * numscreens); for (i=0; i < numscreens; i++) { /* @@ -343,10 +338,10 @@ void __glXScreenInit(GLint numscreens) __glXActiveScreens[i] = *__glXScreens[j]; __glXActiveScreens[i].numUsableVisuals = __glXActiveScreens[i].numVisuals; - __glXActiveScreens[i].GLextensions = __glXStrdup(GLServerExtensions); - __glXActiveScreens[i].GLXvendor = __glXStrdup(GLXServerVendorName); - __glXActiveScreens[i].GLXversion = __glXStrdup(GLXServerVersion); - __glXActiveScreens[i].GLXextensions = __glXStrdup(GLXServerExtensions); + __glXActiveScreens[i].GLextensions = strdup(GLServerExtensions); + __glXActiveScreens[i].GLXvendor = strdup(GLXServerVendorName); + __glXActiveScreens[i].GLXversion = strdup(GLXServerVersion); + __glXActiveScreens[i].GLXextensions = strdup(GLXServerExtensions); __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone); wrapPositionWindow(i); @@ -361,14 +356,14 @@ void __glXScreenReset(void) int i; for (i = 0; i < __glXNumActiveScreens; i++) { - __glXFree(__glXActiveScreens[i].GLXvendor); - __glXFree(__glXActiveScreens[i].GLXversion); - __glXFree(__glXActiveScreens[i].GLXextensions); - __glXFree(__glXActiveScreens[i].GLextensions); + free(__glXActiveScreens[i].GLXvendor); + free(__glXActiveScreens[i].GLXversion); + free(__glXActiveScreens[i].GLXextensions); + free(__glXActiveScreens[i].GLextensions); } - xfree(__glXActiveScreens); - xfree(__glXHyperpipeFuncs); - xfree(__glXSwapBarrierFuncs); + free(__glXActiveScreens); + free(__glXHyperpipeFuncs); + free(__glXSwapBarrierFuncs); __glXNumHyperpipeFuncs = 0; __glXNumSwapBarrierFuncs = 0; __glXHyperpipeFuncs = NULL; diff --git a/nx-X11/programs/Xserver/GL/glx/glxscreens.h b/nx-X11/programs/Xserver/GL/glx/glxscreens.h index 2d68c8b60..dae21e9c9 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxscreens.h +++ b/nx-X11/programs/Xserver/GL/glx/glxscreens.h @@ -5,7 +5,6 @@ #ifndef _GLX_screens_h_ #define _GLX_screens_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.h,v 1.4 2001/03/21 16:29:37 dawes Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free diff --git a/nx-X11/programs/Xserver/GL/glx/glxserver.h b/nx-X11/programs/Xserver/GL/glx/glxserver.h index e8449b2bb..2debc8435 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxserver.h +++ b/nx-X11/programs/Xserver/GL/glx/glxserver.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxserver.h,v 1.5 2003/09/28 20:15:43 alanh Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -41,9 +40,9 @@ ** */ -#include <X11/X.h> -#include <X11/Xproto.h> -#include <X11/Xmd.h> +#include <nx-X11/X.h> +#include <nx-X11/Xproto.h> +#include <nx-X11/Xmd.h> #include <misc.h> #include <dixstruct.h> #include <pixmapstr.h> @@ -51,9 +50,9 @@ #include <extnsionst.h> #include <resource.h> #include <scrnintstr.h> -#include "GL/glx_ansic.h" - +#include "protocol-versions.h" +#include <limits.h> /* ** The X header misc.h defines these math functions. */ @@ -74,8 +73,8 @@ typedef struct __GLXdrawablePrivateRec __GLXdrawablePrivate; #include "glxerror.h" -#define GLX_SERVER_MAJOR_VERSION 1 -#define GLX_SERVER_MINOR_VERSION 2 +#define GLX_SERVER_MAJOR_VERSION SERVER_GLX_MAJOR_VERSION +#define GLX_SERVER_MINOR_VERSION SERVER_GLX_MINOR_VERSION #ifndef True #define True 1 @@ -178,7 +177,7 @@ extern __GLXprocPtr __glXProcTable[]; */ typedef struct { int bytes; - int (*varsize)(GLbyte *pc, Bool swap); + int (*varsize)(GLbyte *pc, Bool swap, int left); } __GLXrenderSizeData; extern __GLXrenderSizeData __glXRenderSizeTable[]; extern __GLXrenderSizeData __glXRenderSizeTable_EXT[]; @@ -223,6 +222,46 @@ extern void glxSwapQueryServerStringReply(ClientPtr client, /* * Routines for computing the size of variably-sized rendering commands. */ +static __inline__ int +safe_add(int a, int b) +{ + if (a < 0 || b < 0) + return -1; + + if (INT_MAX - a < b) + return -1; + + return a + b; +} + +static __inline__ int +safe_mul(int a, int b) +{ + if (a < 0 || b < 0) + return -1; + + if (a == 0 || b == 0) + return 0; + + if (a > INT_MAX / b) + return -1; + + return a * b; +} + +static __inline__ int +safe_pad(int a) +{ + int ret; + + if (a < 0) + return -1; + + if ((ret = safe_add(a, 3)) < 0) + return -1; + + return ret & (GLuint)~3; +} extern int __glXTypeSize(GLenum enm); extern int __glXImageSize(GLenum format, GLenum type, @@ -230,48 +269,48 @@ extern int __glXImageSize(GLenum format, GLenum type, GLint imageHeight, GLint rowLength, GLint skipImages, GLint skipRows, GLint alignment); -extern int __glXCallListsReqSize(GLbyte *pc, Bool swap); -extern int __glXBitmapReqSize(GLbyte *pc, Bool swap); -extern int __glXFogfvReqSize(GLbyte *pc, Bool swap); -extern int __glXFogivReqSize(GLbyte *pc, Bool swap); -extern int __glXLightfvReqSize(GLbyte *pc, Bool swap); -extern int __glXLightivReqSize(GLbyte *pc, Bool swap); -extern int __glXLightModelfvReqSize(GLbyte *pc, Bool swap); -extern int __glXLightModelivReqSize(GLbyte *pc, Bool swap); -extern int __glXMaterialfvReqSize(GLbyte *pc, Bool swap); -extern int __glXMaterialivReqSize(GLbyte *pc, Bool swap); -extern int __glXTexParameterfvReqSize(GLbyte *pc, Bool swap); -extern int __glXTexParameterivReqSize(GLbyte *pc, Bool swap); -extern int __glXTexImage1DReqSize(GLbyte *pc, Bool swap); -extern int __glXTexImage2DReqSize(GLbyte *pc, Bool swap); -extern int __glXTexEnvfvReqSize(GLbyte *pc, Bool swap); -extern int __glXTexEnvivReqSize(GLbyte *pc, Bool swap); -extern int __glXTexGendvReqSize(GLbyte *pc, Bool swap); -extern int __glXTexGenfvReqSize(GLbyte *pc, Bool swap); -extern int __glXTexGenivReqSize(GLbyte *pc, Bool swap); -extern int __glXMap1dReqSize(GLbyte *pc, Bool swap); -extern int __glXMap1fReqSize(GLbyte *pc, Bool swap); -extern int __glXMap2dReqSize(GLbyte *pc, Bool swap); -extern int __glXMap2fReqSize(GLbyte *pc, Bool swap); -extern int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap); -extern int __glXPixelMapuivReqSize(GLbyte *pc, Bool swap); -extern int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap); -extern int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap); -extern int __glXDrawArraysSize(GLbyte *pc, Bool swap); -extern int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap); -extern int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap); -extern int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap); -extern int __glXTexImage3DReqSize(GLbyte *pc, Bool swap ); -extern int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap); -extern int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap); -extern int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap); -extern int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap); -extern int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap); -extern int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap); -extern int __glXColorTableReqSize(GLbyte *pc, Bool swap); -extern int __glXColorSubTableReqSize(GLbyte *pc, Bool swap); -extern int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap); -extern int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap); +extern int __glXCallListsReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXBitmapReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXFogfvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXFogivReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXLightfvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXLightivReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXLightModelfvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXLightModelivReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXMaterialfvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXMaterialivReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexParameterfvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexParameterivReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexImage1DReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexImage2DReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexEnvfvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexEnvivReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexGendvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexGenfvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexGenivReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXMap1dReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXMap1fReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXMap2dReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXMap2fReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXPixelMapuivReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXDrawArraysSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexImage3DReqSize(GLbyte *pc, Bool swap, int reqlen ); +extern int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXColorTableReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXColorSubTableReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap, int reqlen); /* * Routines for computing the size of returned data. @@ -281,7 +320,7 @@ extern int __glXConvolutionParameterfvSize(GLenum pname); extern int __glXColorTableParameterfvSize(GLenum pname); extern int __glXColorTableParameterivSize(GLenum pname); -extern int __glXPointParameterfvARBReqSize(GLbyte *pc, Bool swap); -extern int __glXPointParameterivReqSize(GLbyte *pc, Bool swap); +extern int __glXPointParameterfvARBReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXPointParameterivReqSize(GLbyte *pc, Bool swap, int reqlen); #endif /* !__GLX_server_h__ */ diff --git a/nx-X11/programs/Xserver/GL/glx/glxutil.c b/nx-X11/programs/Xserver/GL/glx/glxutil.c index 03bc19f63..b4cd10a84 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxutil.c +++ b/nx-X11/programs/Xserver/GL/glx/glxutil.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxutil.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,12 +33,13 @@ ** */ -#define NEED_REPLIES #define FONT_PCF #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif +#include <string.h> + #include "glxserver.h" #include <GL/glxtokens.h> #include <unpack.h> @@ -47,7 +47,6 @@ #include <windowstr.h> #include "glxutil.h" #include "glxbuf.h" -#include "GL/glx_ansic.h" #include "GL/internal/glcore.h" #include "GL/glxint.h" #include "glcontextmodes.h" @@ -58,81 +57,8 @@ void __glXNop(void) {} /************************************************************************/ -/* Memory Allocation for GLX */ - -void * -__glXMalloc(size_t size) -{ - void *addr; - - if (size == 0) { - return NULL; - } - addr = (void *) xalloc(size); - if (addr == NULL) { - /* XXX: handle out of memory error */ - return NULL; - } - return addr; -} - -void * -__glXCalloc(size_t numElements, size_t elementSize) -{ - void *addr; - size_t size; - - if ((numElements == 0) || (elementSize == 0)) { - return NULL; - } - size = numElements * elementSize; - addr = (void *) xalloc(size); - if (addr == NULL) { - /* XXX: handle out of memory error */ - return NULL; - } - __glXMemset(addr, 0, size); - return addr; -} - -void * -__glXRealloc(void *addr, size_t newSize) -{ - void *newAddr; - - if (addr) { - if (newSize == 0) { - xfree(addr); - return NULL; - } else { - newAddr = xrealloc(addr, newSize); - } - } else { - if (newSize == 0) { - return NULL; - } else { - newAddr = xalloc(newSize); - } - } - if (newAddr == NULL) { - return NULL; /* XXX: out of memory */ - } - - return newAddr; -} - -void -__glXFree(void *addr) -{ - if (addr) { - xfree(addr); - } -} - -/************************************************************************/ /* Context stuff */ - /* ** associate a context with a drawable */ @@ -299,8 +225,8 @@ __glXCreateDrawablePrivate(DrawablePtr pDraw, XID drawId, __GLdrawablePrivate *glPriv; __GLXscreenInfo *pGlxScreen; - glxPriv = (__GLXdrawablePrivate *) __glXMalloc(sizeof(*glxPriv)); - __glXMemset(glxPriv, 0, sizeof(__GLXdrawablePrivate)); + glxPriv = (__GLXdrawablePrivate *) malloc(sizeof(*glxPriv)); + memset(glxPriv, 0, sizeof(__GLXdrawablePrivate)); glxPriv->type = pDraw->type; glxPriv->pDraw = pDraw; @@ -312,18 +238,18 @@ __glXCreateDrawablePrivate(DrawablePtr pDraw, XID drawId, /* since we are creating the drawablePrivate, drawId should be new */ if (!AddResource(drawId, __glXDrawableRes, glxPriv)) { /* oops! */ - __glXFree(glxPriv); + free(glxPriv); return NULL; } /* fill up glPriv */ glPriv = &glxPriv->glPriv; - glPriv->modes = (__GLcontextModes *) __glXMalloc(sizeof(__GLcontextModes)); + glPriv->modes = (__GLcontextModes *) malloc(sizeof(__GLcontextModes)); *glPriv->modes = *modes; - glPriv->malloc = __glXMalloc; - glPriv->calloc = __glXCalloc; - glPriv->realloc = __glXRealloc; - glPriv->free = __glXFree; + glPriv->malloc = malloc; + glPriv->calloc = calloc; + glPriv->realloc = realloc; + glPriv->free = free; glPriv->addSwapRect = NULL; glPriv->setClipRect = (void (*)(__GLdrawablePrivate *, GLint, GLint, GLsizei, GLsizei)) __glXNop; glPriv->lockDP = LockDP; @@ -334,7 +260,7 @@ __glXCreateDrawablePrivate(DrawablePtr pDraw, XID drawId, /* allocate a one-rect ownership region */ glPriv->ownershipRegion.rects = - (__GLregionRect *)__glXCalloc(1, sizeof(__GLregionRect)); + (__GLregionRect *)calloc(1, sizeof(__GLregionRect)); glPriv->ownershipRegion.numRects = 1; glxPriv->freeBuffers = __glXFreeBuffers; @@ -377,9 +303,9 @@ __glXDestroyDrawablePrivate(__GLXdrawablePrivate *glxPriv) } /* Free the drawable Private */ - __glXFree(glxPriv->glPriv.modes); - __glXFree(glxPriv->glPriv.ownershipRegion.rects); - __glXFree(glxPriv); + free(glxPriv->glPriv.modes); + free(glxPriv->glPriv.ownershipRegion.rects); + free(glxPriv); return GL_TRUE; } diff --git a/nx-X11/programs/Xserver/GL/glx/glxutil.h b/nx-X11/programs/Xserver/GL/glx/glxutil.h index 2c3090a46..a0a2e57b7 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxutil.h +++ b/nx-X11/programs/Xserver/GL/glx/glxutil.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxutil.h,v 1.3 2001/03/21 16:29:37 dawes Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -43,12 +42,6 @@ extern void __glXNop(void); -/* memory management */ -extern void *__glXMalloc(size_t size); -extern void *__glXCalloc(size_t numElements, size_t elementSize); -extern void *__glXRealloc(void *addr, size_t newSize); -extern void __glXFree(void *ptr); - /* relate contexts with drawables */ extern void __glXAssociateContext(__GLXcontext *glxc); extern void __glXDeassociateContext(__GLXcontext *glxc); diff --git a/nx-X11/programs/Xserver/GL/glx/impsize.h b/nx-X11/programs/Xserver/GL/glx/impsize.h index 0eaebb6d5..53777c6e3 100644 --- a/nx-X11/programs/Xserver/GL/glx/impsize.h +++ b/nx-X11/programs/Xserver/GL/glx/impsize.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/impsize.h,v 1.4 2003/09/28 20:15:43 alanh Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/module/Imakefile b/nx-X11/programs/Xserver/GL/glx/module/Imakefile deleted file mode 100644 index d063bc28d..000000000 --- a/nx-X11/programs/Xserver/GL/glx/module/Imakefile +++ /dev/null @@ -1,4 +0,0 @@ -#define IHaveModules -#define LinkDirectory .. - -#include "../Imakefile" diff --git a/nx-X11/programs/Xserver/GL/glx/render2.c b/nx-X11/programs/Xserver/GL/glx/render2.c index f4491b276..1336e2591 100644 --- a/nx-X11/programs/Xserver/GL/glx/render2.c +++ b/nx-X11/programs/Xserver/GL/glx/render2.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/render2.c,v 1.8 2004/02/03 23:04:08 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,7 +33,6 @@ ** */ -/* #define NEED_REPLIES */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/render2.c.NX.original b/nx-X11/programs/Xserver/GL/glx/render2.c.NX.original deleted file mode 100644 index f4491b276..000000000 --- a/nx-X11/programs/Xserver/GL/glx/render2.c.NX.original +++ /dev/null @@ -1,271 +0,0 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/render2.c,v 1.8 2004/02/03 23:04:08 alanh Exp $ */ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -*/ - -/* #define NEED_REPLIES */ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <glxserver.h> -#include "unpack.h" -#include "g_disptab.h" -#include "g_disptab_EXT.h" -#include "indirect_size.h" - -void __glXDisp_Map1f(GLbyte *pc) -{ - GLint order, k; - GLfloat u1, u2, *points; - GLenum target; - - target = *(GLenum *)(pc + 0); - order = *(GLint *)(pc + 12); - u1 = *(GLfloat *)(pc + 4); - u2 = *(GLfloat *)(pc + 8); - points = (GLfloat *)(pc + 16); - k = __glMap1f_size(target); - - glMap1f(target, u1, u2, k, order, points); -} - -void __glXDisp_Map2f(GLbyte *pc) -{ - GLint uorder, vorder, ustride, vstride, k; - GLfloat u1, u2, v1, v2, *points; - GLenum target; - - target = *(GLenum *)(pc + 0); - uorder = *(GLint *)(pc + 12); - vorder = *(GLint *)(pc + 24); - u1 = *(GLfloat *)(pc + 4); - u2 = *(GLfloat *)(pc + 8); - v1 = *(GLfloat *)(pc + 16); - v2 = *(GLfloat *)(pc + 20); - points = (GLfloat *)(pc + 28); - - k = __glMap2f_size(target); - ustride = vorder * k; - vstride = k; - - glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); -} - -void __glXDisp_Map1d(GLbyte *pc) -{ - GLint order, k; -#ifdef __GLX_ALIGN64 - GLint compsize; -#endif - GLenum target; - GLdouble u1, u2, *points; - - target = *(GLenum*) (pc + 16); - order = *(GLint*) (pc + 20); - k = __glMap1d_size(target); - -#ifdef __GLX_ALIGN64 - if (order < 0 || k < 0) { - compsize = 0; - } else { - compsize = order * k; - } -#endif - - __GLX_GET_DOUBLE(u1,pc); - __GLX_GET_DOUBLE(u2,pc+8); - pc += 24; - -#ifdef __GLX_ALIGN64 - if (((unsigned long)pc) & 7) { - /* - ** Copy the doubles up 4 bytes, trashing the command but aligning - ** the data in the process - */ - __GLX_MEM_COPY(pc-4, pc, compsize*8); - points = (GLdouble*) (pc - 4); - } else { - points = (GLdouble*) pc; - } -#else - points = (GLdouble*) pc; -#endif - glMap1d(target, u1, u2, k, order, points); -} - -void __glXDisp_Map2d(GLbyte *pc) -{ - GLdouble u1, u2, v1, v2, *points; - GLint uorder, vorder, ustride, vstride, k; -#ifdef __GLX_ALIGN64 - GLint compsize; -#endif - GLenum target; - - target = *(GLenum *)(pc + 32); - uorder = *(GLint *)(pc + 36); - vorder = *(GLint *)(pc + 40); - k = __glMap2d_size(target); - -#ifdef __GLX_ALIGN64 - if (vorder < 0 || uorder < 0 || k < 0) { - compsize = 0; - } else { - compsize = uorder * vorder * k; - } -#endif - - __GLX_GET_DOUBLE(u1,pc); - __GLX_GET_DOUBLE(u2,pc+8); - __GLX_GET_DOUBLE(v1,pc+16); - __GLX_GET_DOUBLE(v2,pc+24); - pc += 44; - - ustride = vorder * k; - vstride = k; - -#ifdef __GLX_ALIGN64 - if (((unsigned long)pc) & 7) { - /* - ** Copy the doubles up 4 bytes, trashing the command but aligning - ** the data in the process - */ - __GLX_MEM_COPY(pc-4, pc, compsize*8); - points = (GLdouble*) (pc - 4); - } else { - points = (GLdouble*) pc; - } -#else - points = (GLdouble*) pc; -#endif - glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); -} - -void __glXDisp_CallLists(GLbyte *pc) -{ - GLenum type; - GLsizei n; - - type = *(GLenum *)(pc + 4); - n = *(GLsizei *)(pc + 0); - glCallLists(n, type, pc + 8); -} - -void __glXDisp_DrawArrays(GLbyte *pc) -{ - __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *)pc; - __GLXdispatchDrawArraysComponentHeader *compHeader; - GLint numVertexes = hdr->numVertexes; - GLint numComponents = hdr->numComponents; - GLenum primType = hdr->primType; - GLint stride = 0; - int i; - - pc += sizeof(__GLXdispatchDrawArraysHeader); - compHeader = (__GLXdispatchDrawArraysComponentHeader *)pc; - - /* compute stride (same for all component arrays) */ - for (i = 0; i < numComponents; i++) { - GLenum datatype = compHeader[i].datatype; - GLint numVals = compHeader[i].numVals; - - stride += __GLX_PAD(numVals * __glXTypeSize(datatype)); - } - - pc += numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader); - - /* set up component arrays */ - for (i = 0; i < numComponents; i++) { - GLenum datatype = compHeader[i].datatype; - GLint numVals = compHeader[i].numVals; - GLenum component = compHeader[i].component; - - switch (component) { - case GL_VERTEX_ARRAY: - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(numVals, datatype, stride, pc); - break; - case GL_NORMAL_ARRAY: - glEnableClientState(GL_NORMAL_ARRAY); - glNormalPointer(datatype, stride, pc); - break; - case GL_COLOR_ARRAY: - glEnableClientState(GL_COLOR_ARRAY); - glColorPointer(numVals, datatype, stride, pc); - break; - case GL_INDEX_ARRAY: - glEnableClientState(GL_INDEX_ARRAY); - glIndexPointer(datatype, stride, pc); - break; - case GL_TEXTURE_COORD_ARRAY: - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(numVals, datatype, stride, pc); - break; - case GL_EDGE_FLAG_ARRAY: - glEnableClientState(GL_EDGE_FLAG_ARRAY); - glEdgeFlagPointer(stride, (const GLboolean *)pc); - break; - case GL_SECONDARY_COLOR_ARRAY: - glEnableClientState(GL_SECONDARY_COLOR_ARRAY); - glSecondaryColorPointer(numVals, datatype, stride, pc); - break; - case GL_FOG_COORD_ARRAY: - glEnableClientState(GL_FOG_COORD_ARRAY); - glFogCoordPointer(datatype, stride, pc); - break; - default: - break; - } - - pc += __GLX_PAD(numVals * __glXTypeSize(datatype)); - } - - glDrawArrays(primType, 0, numVertexes); - - /* turn off anything we might have turned on */ - glDisableClientState(GL_VERTEX_ARRAY); - glDisableClientState(GL_NORMAL_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - glDisableClientState(GL_INDEX_ARRAY); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_EDGE_FLAG_ARRAY); - glDisableClientState(GL_SECONDARY_COLOR_ARRAY); - glDisableClientState(GL_FOG_COORD_ARRAY); -} - -void __glXDisp_DrawArraysEXT(GLbyte *pc) -{ - __glXDisp_DrawArrays(pc); -} diff --git a/nx-X11/programs/Xserver/GL/glx/render2.c.X.original b/nx-X11/programs/Xserver/GL/glx/render2.c.X.original deleted file mode 100644 index 39d0c132a..000000000 --- a/nx-X11/programs/Xserver/GL/glx/render2.c.X.original +++ /dev/null @@ -1,271 +0,0 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/render2.c,v 1.8 2004/02/03 23:04:08 alanh Exp $ */ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -*/ - -/* #define NEED_REPLIES */ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <glxserver.h> -#include "unpack.h" -#include "g_disptab.h" -#include "g_disptab_EXT.h" - - -void __glXDisp_Map1f(GLbyte *pc) -{ - GLint order, k; - GLfloat u1, u2, *points; - GLenum target; - - target = *(GLenum *)(pc + 0); - order = *(GLint *)(pc + 12); - u1 = *(GLfloat *)(pc + 4); - u2 = *(GLfloat *)(pc + 8); - points = (GLfloat *)(pc + 16); - k = __glMap1f_size(target); - - glMap1f(target, u1, u2, k, order, points); -} - -void __glXDisp_Map2f(GLbyte *pc) -{ - GLint uorder, vorder, ustride, vstride, k; - GLfloat u1, u2, v1, v2, *points; - GLenum target; - - target = *(GLenum *)(pc + 0); - uorder = *(GLint *)(pc + 12); - vorder = *(GLint *)(pc + 24); - u1 = *(GLfloat *)(pc + 4); - u2 = *(GLfloat *)(pc + 8); - v1 = *(GLfloat *)(pc + 16); - v2 = *(GLfloat *)(pc + 20); - points = (GLfloat *)(pc + 28); - - k = __glMap2f_size(target); - ustride = vorder * k; - vstride = k; - - glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); -} - -void __glXDisp_Map1d(GLbyte *pc) -{ - GLint order, k; -#ifdef __GLX_ALIGN64 - GLint compsize; -#endif - GLenum target; - GLdouble u1, u2, *points; - - target = *(GLenum*) (pc + 16); - order = *(GLint*) (pc + 20); - k = __glMap1d_size(target); - -#ifdef __GLX_ALIGN64 - if (order < 0 || k < 0) { - compsize = 0; - } else { - compsize = order * k; - } -#endif - - __GLX_GET_DOUBLE(u1,pc); - __GLX_GET_DOUBLE(u2,pc+8); - pc += 24; - -#ifdef __GLX_ALIGN64 - if (((unsigned long)pc) & 7) { - /* - ** Copy the doubles up 4 bytes, trashing the command but aligning - ** the data in the process - */ - __GLX_MEM_COPY(pc-4, pc, compsize*8); - points = (GLdouble*) (pc - 4); - } else { - points = (GLdouble*) pc; - } -#else - points = (GLdouble*) pc; -#endif - glMap1d(target, u1, u2, k, order, points); -} - -void __glXDisp_Map2d(GLbyte *pc) -{ - GLdouble u1, u2, v1, v2, *points; - GLint uorder, vorder, ustride, vstride, k; -#ifdef __GLX_ALIGN64 - GLint compsize; -#endif - GLenum target; - - target = *(GLenum *)(pc + 32); - uorder = *(GLint *)(pc + 36); - vorder = *(GLint *)(pc + 40); - k = __glMap2d_size(target); - -#ifdef __GLX_ALIGN64 - if (vorder < 0 || uorder < 0 || k < 0) { - compsize = 0; - } else { - compsize = uorder * vorder * k; - } -#endif - - __GLX_GET_DOUBLE(u1,pc); - __GLX_GET_DOUBLE(u2,pc+8); - __GLX_GET_DOUBLE(v1,pc+16); - __GLX_GET_DOUBLE(v2,pc+24); - pc += 44; - - ustride = vorder * k; - vstride = k; - -#ifdef __GLX_ALIGN64 - if (((unsigned long)pc) & 7) { - /* - ** Copy the doubles up 4 bytes, trashing the command but aligning - ** the data in the process - */ - __GLX_MEM_COPY(pc-4, pc, compsize*8); - points = (GLdouble*) (pc - 4); - } else { - points = (GLdouble*) pc; - } -#else - points = (GLdouble*) pc; -#endif - glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); -} - -void __glXDisp_CallLists(GLbyte *pc) -{ - GLenum type; - GLsizei n; - - type = *(GLenum *)(pc + 4); - n = *(GLsizei *)(pc + 0); - glCallLists(n, type, pc + 8); -} - -void __glXDisp_DrawArrays(GLbyte *pc) -{ - __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *)pc; - __GLXdispatchDrawArraysComponentHeader *compHeader; - GLint numVertexes = hdr->numVertexes; - GLint numComponents = hdr->numComponents; - GLenum primType = hdr->primType; - GLint stride = 0; - int i; - - pc += sizeof(__GLXdispatchDrawArraysHeader); - compHeader = (__GLXdispatchDrawArraysComponentHeader *)pc; - - /* compute stride (same for all component arrays) */ - for (i = 0; i < numComponents; i++) { - GLenum datatype = compHeader[i].datatype; - GLint numVals = compHeader[i].numVals; - - stride += __GLX_PAD(numVals * __glXTypeSize(datatype)); - } - - pc += numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader); - - /* set up component arrays */ - for (i = 0; i < numComponents; i++) { - GLenum datatype = compHeader[i].datatype; - GLint numVals = compHeader[i].numVals; - GLenum component = compHeader[i].component; - - switch (component) { - case GL_VERTEX_ARRAY: - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(numVals, datatype, stride, pc); - break; - case GL_NORMAL_ARRAY: - glEnableClientState(GL_NORMAL_ARRAY); - glNormalPointer(datatype, stride, pc); - break; - case GL_COLOR_ARRAY: - glEnableClientState(GL_COLOR_ARRAY); - glColorPointer(numVals, datatype, stride, pc); - break; - case GL_INDEX_ARRAY: - glEnableClientState(GL_INDEX_ARRAY); - glIndexPointer(datatype, stride, pc); - break; - case GL_TEXTURE_COORD_ARRAY: - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(numVals, datatype, stride, pc); - break; - case GL_EDGE_FLAG_ARRAY: - glEnableClientState(GL_EDGE_FLAG_ARRAY); - glEdgeFlagPointer(stride, (const GLboolean *)pc); - break; - case GL_SECONDARY_COLOR_ARRAY: - glEnableClientState(GL_SECONDARY_COLOR_ARRAY); - glSecondaryColorPointer(numVals, datatype, stride, pc); - break; - case GL_FOG_COORD_ARRAY: - glEnableClientState(GL_FOG_COORD_ARRAY); - glFogCoordPointer(datatype, stride, pc); - break; - default: - break; - } - - pc += __GLX_PAD(numVals * __glXTypeSize(datatype)); - } - - glDrawArrays(primType, 0, numVertexes); - - /* turn off anything we might have turned on */ - glDisableClientState(GL_VERTEX_ARRAY); - glDisableClientState(GL_NORMAL_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - glDisableClientState(GL_INDEX_ARRAY); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_EDGE_FLAG_ARRAY); - glDisableClientState(GL_SECONDARY_COLOR_ARRAY); - glDisableClientState(GL_FOG_COORD_ARRAY); -} - -void __glXDisp_DrawArraysEXT(GLbyte *pc) -{ - __glXDisp_DrawArrays(pc); -} diff --git a/nx-X11/programs/Xserver/GL/glx/render2swap.c b/nx-X11/programs/Xserver/GL/glx/render2swap.c index 0225970cb..ea35d514d 100644 --- a/nx-X11/programs/Xserver/GL/glx/render2swap.c +++ b/nx-X11/programs/Xserver/GL/glx/render2swap.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/render2swap.c,v 1.6 2002/01/14 22:47:08 tsi Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,7 +33,6 @@ ** */ -/* #define NEED_REPLIES */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/render2swap.c.NX.original b/nx-X11/programs/Xserver/GL/glx/render2swap.c.NX.original deleted file mode 100644 index 0225970cb..000000000 --- a/nx-X11/programs/Xserver/GL/glx/render2swap.c.NX.original +++ /dev/null @@ -1,393 +0,0 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/render2swap.c,v 1.6 2002/01/14 22:47:08 tsi Exp $ */ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -*/ - -/* #define NEED_REPLIES */ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "glxserver.h" -#include "unpack.h" -#include "g_disptab.h" -#include "g_disptab_EXT.h" -#include "indirect_size.h" - -void __glXDispSwap_Map1f(GLbyte *pc) -{ - GLint order, k; - GLfloat u1, u2, *points; - GLenum target; - GLint compsize; - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_FLOAT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - - target = *(GLenum *)(pc + 0); - order = *(GLint *)(pc + 12); - u1 = *(GLfloat *)(pc + 4); - u2 = *(GLfloat *)(pc + 8); - points = (GLfloat *)(pc + 16); - k = __glMap1f_size(target); - - if (order <= 0 || k < 0) { - /* Erroneous command. */ - compsize = 0; - } else { - compsize = order * k; - } - __GLX_SWAP_FLOAT_ARRAY(points, compsize); - - glMap1f(target, u1, u2, k, order, points); -} - -void __glXDispSwap_Map2f(GLbyte *pc) -{ - GLint uorder, vorder, ustride, vstride, k; - GLfloat u1, u2, v1, v2, *points; - GLenum target; - GLint compsize; - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_INT(pc + 24); - __GLX_SWAP_FLOAT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - __GLX_SWAP_FLOAT(pc + 16); - __GLX_SWAP_FLOAT(pc + 20); - - target = *(GLenum *)(pc + 0); - uorder = *(GLint *)(pc + 12); - vorder = *(GLint *)(pc + 24); - u1 = *(GLfloat *)(pc + 4); - u2 = *(GLfloat *)(pc + 8); - v1 = *(GLfloat *)(pc + 16); - v2 = *(GLfloat *)(pc + 20); - points = (GLfloat *)(pc + 28); - - k = __glMap2f_size(target); - ustride = vorder * k; - vstride = k; - - if (vorder <= 0 || uorder <= 0 || k < 0) { - /* Erroneous command. */ - compsize = 0; - } else { - compsize = uorder * vorder * k; - } - __GLX_SWAP_FLOAT_ARRAY(points, compsize); - - glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); -} - -void __glXDispSwap_Map1d(GLbyte *pc) -{ - GLint order, k, compsize; - GLenum target; - GLdouble u1, u2, *points; - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_DOUBLE(pc + 0); - __GLX_SWAP_DOUBLE(pc + 8); - __GLX_SWAP_INT(pc + 16); - __GLX_SWAP_INT(pc + 20); - - target = *(GLenum*) (pc + 16); - order = *(GLint*) (pc + 20); - k = __glMap1d_size(target); - if (order <= 0 || k < 0) { - /* Erroneous command. */ - compsize = 0; - } else { - compsize = order * k; - } - __GLX_GET_DOUBLE(u1,pc); - __GLX_GET_DOUBLE(u2,pc+8); - __GLX_SWAP_DOUBLE_ARRAY(pc+24, compsize); - pc += 24; - -#ifdef __GLX_ALIGN64 - if (((unsigned long)pc) & 7) { - /* - ** Copy the doubles up 4 bytes, trashing the command but aligning - ** the data in the process - */ - __GLX_MEM_COPY(pc-4, pc, compsize*8); - points = (GLdouble*) (pc - 4); - } else { - points = (GLdouble*) pc; - } -#else - points = (GLdouble*) pc; -#endif - glMap1d(target, u1, u2, k, order, points); -} - -void __glXDispSwap_Map2d(GLbyte *pc) -{ - GLdouble u1, u2, v1, v2, *points; - GLint uorder, vorder, ustride, vstride, k, compsize; - GLenum target; - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_DOUBLE(pc + 0); - __GLX_SWAP_DOUBLE(pc + 8); - __GLX_SWAP_DOUBLE(pc + 16); - __GLX_SWAP_DOUBLE(pc + 24); - __GLX_SWAP_INT(pc + 32); - __GLX_SWAP_INT(pc + 36); - __GLX_SWAP_INT(pc + 40); - - target = *(GLenum *)(pc + 32); - uorder = *(GLint *)(pc + 36); - vorder = *(GLint *)(pc + 40); - k = __glMap2d_size(target); - if (vorder <= 0 || uorder <= 0 || k < 0) { - /* Erroneous command. */ - compsize = 0; - } else { - compsize = uorder * vorder * k; - } - __GLX_GET_DOUBLE(u1,pc); - __GLX_GET_DOUBLE(u2,pc+8); - __GLX_GET_DOUBLE(v1,pc+16); - __GLX_GET_DOUBLE(v2,pc+24); - __GLX_SWAP_DOUBLE_ARRAY(pc+44, compsize); - pc += 44; - ustride = vorder * k; - vstride = k; - -#ifdef __GLX_ALIGN64 - if (((unsigned long)pc) & 7) { - /* - ** Copy the doubles up 4 bytes, trashing the command but aligning - ** the data in the process - */ - __GLX_MEM_COPY(pc-4, pc, compsize*8); - points = (GLdouble*) (pc - 4); - } else { - points = (GLdouble*) pc; - } -#else - points = (GLdouble*) pc; -#endif - glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); -} - -void __glXDispSwap_CallLists(GLbyte *pc) -{ - GLenum type; - GLsizei n; - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 0); - type = *(GLenum *)(pc + 4); - n = *(GLsizei *)(pc + 0); - - switch (type) { - case GL_BYTE: - case GL_UNSIGNED_BYTE: - case GL_2_BYTES: - case GL_3_BYTES: - case GL_4_BYTES: - break; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - __GLX_SWAP_SHORT_ARRAY(pc+8, n); - break; - case GL_INT: - case GL_UNSIGNED_INT: - __GLX_SWAP_INT_ARRAY(pc+8, n); - break; - case GL_FLOAT: - __GLX_SWAP_FLOAT_ARRAY(pc+8, n); - break; - } - - glCallLists(n, type, pc+8); -} - -static void swapArray(GLint numVals, GLenum datatype, - GLint stride, GLint numVertexes, GLbyte *pc) -{ - int i,j; - __GLX_DECLARE_SWAP_VARIABLES; - - switch (datatype) { - case GL_BYTE: - case GL_UNSIGNED_BYTE: - /* don't need to swap */ - return; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - for (i=0; i<numVertexes; i++) { - GLshort *pVal = (GLshort *) pc; - for (j=0; j<numVals; j++) { - __GLX_SWAP_SHORT(&pVal[j]); - } - pc += stride; - } - break; - case GL_INT: - case GL_UNSIGNED_INT: - for (i=0; i<numVertexes; i++) { - GLint *pVal = (GLint *) pc; - for (j=0; j<numVals; j++) { - __GLX_SWAP_INT(&pVal[j]); - } - pc += stride; - } - break; - case GL_FLOAT: - for (i=0; i<numVertexes; i++) { - GLfloat *pVal = (GLfloat *) pc; - for (j=0; j<numVals; j++) { - __GLX_SWAP_FLOAT(&pVal[j]); - } - pc += stride; - } - break; - case GL_DOUBLE: - for (i=0; i<numVertexes; i++) { - GLdouble *pVal = (GLdouble *) pc; - for (j=0; j<numVals; j++) { - __GLX_SWAP_DOUBLE(&pVal[j]); - } - pc += stride; - } - break; - default: - return; - } -} - -void __glXDispSwap_DrawArrays(GLbyte *pc) -{ - __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *)pc; - __GLXdispatchDrawArraysComponentHeader *compHeader; - GLint numVertexes = hdr->numVertexes; - GLint numComponents = hdr->numComponents; - GLenum primType = hdr->primType; - GLint stride = 0; - int i; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(&numVertexes); - __GLX_SWAP_INT(&numComponents); - __GLX_SWAP_INT(&primType); - - pc += sizeof(__GLXdispatchDrawArraysHeader); - compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc; - - /* compute stride (same for all component arrays) */ - for (i=0; i<numComponents; i++) { - GLenum datatype = compHeader[i].datatype; - GLint numVals = compHeader[i].numVals; - GLenum component = compHeader[i].component; - - __GLX_SWAP_INT(&datatype); - __GLX_SWAP_INT(&numVals); - __GLX_SWAP_INT(&component); - - stride += __GLX_PAD(numVals * __glXTypeSize(datatype)); - } - - pc += numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader); - - /* set up component arrays */ - for (i=0; i<numComponents; i++) { - GLenum datatype = compHeader[i].datatype; - GLint numVals = compHeader[i].numVals; - GLenum component = compHeader[i].component; - - swapArray(numVals, datatype, stride, numVertexes, pc); - - switch (component) { - case GL_VERTEX_ARRAY: - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(numVals, datatype, stride, pc); - break; - case GL_NORMAL_ARRAY: - glEnableClientState(GL_NORMAL_ARRAY); - glNormalPointer(datatype, stride, pc); - break; - case GL_COLOR_ARRAY: - glEnableClientState(GL_COLOR_ARRAY); - glColorPointer(numVals, datatype, stride, pc); - break; - case GL_INDEX_ARRAY: - glEnableClientState(GL_INDEX_ARRAY); - glIndexPointer(datatype, stride, pc); - break; - case GL_TEXTURE_COORD_ARRAY: - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(numVals, datatype, stride, pc); - break; - case GL_EDGE_FLAG_ARRAY: - glEnableClientState(GL_EDGE_FLAG_ARRAY); - glEdgeFlagPointer(stride, (const GLboolean *)pc); - break; - default: - break; - } - - pc += __GLX_PAD(numVals * __glXTypeSize(datatype)); - } - - glDrawArrays(primType, 0, numVertexes); - - /* turn off anything we might have turned on */ - glDisableClientState(GL_VERTEX_ARRAY); - glDisableClientState(GL_NORMAL_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - glDisableClientState(GL_INDEX_ARRAY); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_EDGE_FLAG_ARRAY); -} - -void __glXDispSwap_DrawArraysEXT(GLbyte *pc) -{ - __glXDispSwap_DrawArrays(pc); -} diff --git a/nx-X11/programs/Xserver/GL/glx/render2swap.c.X.original b/nx-X11/programs/Xserver/GL/glx/render2swap.c.X.original deleted file mode 100644 index 65ac5e18a..000000000 --- a/nx-X11/programs/Xserver/GL/glx/render2swap.c.X.original +++ /dev/null @@ -1,393 +0,0 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/render2swap.c,v 1.6 2002/01/14 22:47:08 tsi Exp $ */ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -*/ - -/* #define NEED_REPLIES */ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "glxserver.h" -#include "unpack.h" -#include "g_disptab.h" -#include "g_disptab_EXT.h" - - -void __glXDispSwap_Map1f(GLbyte *pc) -{ - GLint order, k; - GLfloat u1, u2, *points; - GLenum target; - GLint compsize; - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_FLOAT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - - target = *(GLenum *)(pc + 0); - order = *(GLint *)(pc + 12); - u1 = *(GLfloat *)(pc + 4); - u2 = *(GLfloat *)(pc + 8); - points = (GLfloat *)(pc + 16); - k = __glMap1f_size(target); - - if (order <= 0 || k < 0) { - /* Erroneous command. */ - compsize = 0; - } else { - compsize = order * k; - } - __GLX_SWAP_FLOAT_ARRAY(points, compsize); - - glMap1f(target, u1, u2, k, order, points); -} - -void __glXDispSwap_Map2f(GLbyte *pc) -{ - GLint uorder, vorder, ustride, vstride, k; - GLfloat u1, u2, v1, v2, *points; - GLenum target; - GLint compsize; - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_INT(pc + 24); - __GLX_SWAP_FLOAT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - __GLX_SWAP_FLOAT(pc + 16); - __GLX_SWAP_FLOAT(pc + 20); - - target = *(GLenum *)(pc + 0); - uorder = *(GLint *)(pc + 12); - vorder = *(GLint *)(pc + 24); - u1 = *(GLfloat *)(pc + 4); - u2 = *(GLfloat *)(pc + 8); - v1 = *(GLfloat *)(pc + 16); - v2 = *(GLfloat *)(pc + 20); - points = (GLfloat *)(pc + 28); - - k = __glMap2f_size(target); - ustride = vorder * k; - vstride = k; - - if (vorder <= 0 || uorder <= 0 || k < 0) { - /* Erroneous command. */ - compsize = 0; - } else { - compsize = uorder * vorder * k; - } - __GLX_SWAP_FLOAT_ARRAY(points, compsize); - - glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); -} - -void __glXDispSwap_Map1d(GLbyte *pc) -{ - GLint order, k, compsize; - GLenum target; - GLdouble u1, u2, *points; - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_DOUBLE(pc + 0); - __GLX_SWAP_DOUBLE(pc + 8); - __GLX_SWAP_INT(pc + 16); - __GLX_SWAP_INT(pc + 20); - - target = *(GLenum*) (pc + 16); - order = *(GLint*) (pc + 20); - k = __glMap1d_size(target); - if (order <= 0 || k < 0) { - /* Erroneous command. */ - compsize = 0; - } else { - compsize = order * k; - } - __GLX_GET_DOUBLE(u1,pc); - __GLX_GET_DOUBLE(u2,pc+8); - __GLX_SWAP_DOUBLE_ARRAY(pc+24, compsize); - pc += 24; - -#ifdef __GLX_ALIGN64 - if (((unsigned long)pc) & 7) { - /* - ** Copy the doubles up 4 bytes, trashing the command but aligning - ** the data in the process - */ - __GLX_MEM_COPY(pc-4, pc, compsize*8); - points = (GLdouble*) (pc - 4); - } else { - points = (GLdouble*) pc; - } -#else - points = (GLdouble*) pc; -#endif - glMap1d(target, u1, u2, k, order, points); -} - -void __glXDispSwap_Map2d(GLbyte *pc) -{ - GLdouble u1, u2, v1, v2, *points; - GLint uorder, vorder, ustride, vstride, k, compsize; - GLenum target; - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_DOUBLE(pc + 0); - __GLX_SWAP_DOUBLE(pc + 8); - __GLX_SWAP_DOUBLE(pc + 16); - __GLX_SWAP_DOUBLE(pc + 24); - __GLX_SWAP_INT(pc + 32); - __GLX_SWAP_INT(pc + 36); - __GLX_SWAP_INT(pc + 40); - - target = *(GLenum *)(pc + 32); - uorder = *(GLint *)(pc + 36); - vorder = *(GLint *)(pc + 40); - k = __glMap2d_size(target); - if (vorder <= 0 || uorder <= 0 || k < 0) { - /* Erroneous command. */ - compsize = 0; - } else { - compsize = uorder * vorder * k; - } - __GLX_GET_DOUBLE(u1,pc); - __GLX_GET_DOUBLE(u2,pc+8); - __GLX_GET_DOUBLE(v1,pc+16); - __GLX_GET_DOUBLE(v2,pc+24); - __GLX_SWAP_DOUBLE_ARRAY(pc+44, compsize); - pc += 44; - ustride = vorder * k; - vstride = k; - -#ifdef __GLX_ALIGN64 - if (((unsigned long)pc) & 7) { - /* - ** Copy the doubles up 4 bytes, trashing the command but aligning - ** the data in the process - */ - __GLX_MEM_COPY(pc-4, pc, compsize*8); - points = (GLdouble*) (pc - 4); - } else { - points = (GLdouble*) pc; - } -#else - points = (GLdouble*) pc; -#endif - glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); -} - -void __glXDispSwap_CallLists(GLbyte *pc) -{ - GLenum type; - GLsizei n; - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 0); - type = *(GLenum *)(pc + 4); - n = *(GLsizei *)(pc + 0); - - switch (type) { - case GL_BYTE: - case GL_UNSIGNED_BYTE: - case GL_2_BYTES: - case GL_3_BYTES: - case GL_4_BYTES: - break; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - __GLX_SWAP_SHORT_ARRAY(pc+8, n); - break; - case GL_INT: - case GL_UNSIGNED_INT: - __GLX_SWAP_INT_ARRAY(pc+8, n); - break; - case GL_FLOAT: - __GLX_SWAP_FLOAT_ARRAY(pc+8, n); - break; - } - - glCallLists(n, type, pc+8); -} - -static void swapArray(GLint numVals, GLenum datatype, - GLint stride, GLint numVertexes, GLbyte *pc) -{ - int i,j; - __GLX_DECLARE_SWAP_VARIABLES; - - switch (datatype) { - case GL_BYTE: - case GL_UNSIGNED_BYTE: - /* don't need to swap */ - return; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - for (i=0; i<numVertexes; i++) { - GLshort *pVal = (GLshort *) pc; - for (j=0; j<numVals; j++) { - __GLX_SWAP_SHORT(&pVal[j]); - } - pc += stride; - } - break; - case GL_INT: - case GL_UNSIGNED_INT: - for (i=0; i<numVertexes; i++) { - GLint *pVal = (GLint *) pc; - for (j=0; j<numVals; j++) { - __GLX_SWAP_INT(&pVal[j]); - } - pc += stride; - } - break; - case GL_FLOAT: - for (i=0; i<numVertexes; i++) { - GLfloat *pVal = (GLfloat *) pc; - for (j=0; j<numVals; j++) { - __GLX_SWAP_FLOAT(&pVal[j]); - } - pc += stride; - } - break; - case GL_DOUBLE: - for (i=0; i<numVertexes; i++) { - GLdouble *pVal = (GLdouble *) pc; - for (j=0; j<numVals; j++) { - __GLX_SWAP_DOUBLE(&pVal[j]); - } - pc += stride; - } - break; - default: - return; - } -} - -void __glXDispSwap_DrawArrays(GLbyte *pc) -{ - __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *)pc; - __GLXdispatchDrawArraysComponentHeader *compHeader; - GLint numVertexes = hdr->numVertexes; - GLint numComponents = hdr->numComponents; - GLenum primType = hdr->primType; - GLint stride = 0; - int i; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(&numVertexes); - __GLX_SWAP_INT(&numComponents); - __GLX_SWAP_INT(&primType); - - pc += sizeof(__GLXdispatchDrawArraysHeader); - compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc; - - /* compute stride (same for all component arrays) */ - for (i=0; i<numComponents; i++) { - GLenum datatype = compHeader[i].datatype; - GLint numVals = compHeader[i].numVals; - GLenum component = compHeader[i].component; - - __GLX_SWAP_INT(&datatype); - __GLX_SWAP_INT(&numVals); - __GLX_SWAP_INT(&component); - - stride += __GLX_PAD(numVals * __glXTypeSize(datatype)); - } - - pc += numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader); - - /* set up component arrays */ - for (i=0; i<numComponents; i++) { - GLenum datatype = compHeader[i].datatype; - GLint numVals = compHeader[i].numVals; - GLenum component = compHeader[i].component; - - swapArray(numVals, datatype, stride, numVertexes, pc); - - switch (component) { - case GL_VERTEX_ARRAY: - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(numVals, datatype, stride, pc); - break; - case GL_NORMAL_ARRAY: - glEnableClientState(GL_NORMAL_ARRAY); - glNormalPointer(datatype, stride, pc); - break; - case GL_COLOR_ARRAY: - glEnableClientState(GL_COLOR_ARRAY); - glColorPointer(numVals, datatype, stride, pc); - break; - case GL_INDEX_ARRAY: - glEnableClientState(GL_INDEX_ARRAY); - glIndexPointer(datatype, stride, pc); - break; - case GL_TEXTURE_COORD_ARRAY: - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(numVals, datatype, stride, pc); - break; - case GL_EDGE_FLAG_ARRAY: - glEnableClientState(GL_EDGE_FLAG_ARRAY); - glEdgeFlagPointer(stride, (const GLboolean *)pc); - break; - default: - break; - } - - pc += __GLX_PAD(numVals * __glXTypeSize(datatype)); - } - - glDrawArrays(primType, 0, numVertexes); - - /* turn off anything we might have turned on */ - glDisableClientState(GL_VERTEX_ARRAY); - glDisableClientState(GL_NORMAL_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - glDisableClientState(GL_INDEX_ARRAY); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_EDGE_FLAG_ARRAY); -} - -void __glXDispSwap_DrawArraysEXT(GLbyte *pc) -{ - __glXDispSwap_DrawArrays(pc); -} diff --git a/nx-X11/programs/Xserver/GL/glx/renderpix.c b/nx-X11/programs/Xserver/GL/glx/renderpix.c index fe508e299..d1997b5ad 100644 --- a/nx-X11/programs/Xserver/GL/glx/renderpix.c +++ b/nx-X11/programs/Xserver/GL/glx/renderpix.c @@ -1,4 +1,3 @@ -/* $XFree86$ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,7 +33,6 @@ ** */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/renderpixswap.c b/nx-X11/programs/Xserver/GL/glx/renderpixswap.c index 9c3100fb3..a527a859a 100644 --- a/nx-X11/programs/Xserver/GL/glx/renderpixswap.c +++ b/nx-X11/programs/Xserver/GL/glx/renderpixswap.c @@ -1,4 +1,3 @@ -/* $XFree86$ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,7 +33,6 @@ ** */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/rensize.c b/nx-X11/programs/Xserver/GL/glx/rensize.c index 7ab02d257..d3a819cd5 100644 --- a/nx-X11/programs/Xserver/GL/glx/rensize.c +++ b/nx-X11/programs/Xserver/GL/glx/rensize.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/rensize.c,v 1.6 2003/09/28 20:15:43 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -48,7 +47,7 @@ (((a & 0xff000000U)>>24) | ((a & 0xff0000U)>>8) | \ ((a & 0xff00U)<<8) | ((a & 0xffU)<<24)) -int __glXCallListsReqSize(GLbyte *pc, Bool swap ) +int __glXCallListsReqSize(GLbyte *pc, Bool swap, int reqlen) { GLsizei n = *(GLsizei *)(pc + 0); GLenum type = *(GLenum *)(pc + 4); @@ -60,7 +59,7 @@ int __glXCallListsReqSize(GLbyte *pc, Bool swap ) return n * __glCallLists_size( type ); } -int __glXFogivReqSize(GLbyte *pc, Bool swap ) +int __glXFogivReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 0); if (swap) { @@ -69,12 +68,12 @@ int __glXFogivReqSize(GLbyte *pc, Bool swap ) return 4 * __glFogiv_size( pname ); /* defined in samplegl lib */ } -int __glXFogfvReqSize(GLbyte *pc, Bool swap ) +int __glXFogfvReqSize(GLbyte *pc, Bool swap, int reqlen) { - return __glXFogivReqSize( pc, swap ); + return __glXFogivReqSize( pc, swap, reqlen); } -int __glXLightfvReqSize(GLbyte *pc, Bool swap ) +int __glXLightfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { @@ -83,12 +82,12 @@ int __glXLightfvReqSize(GLbyte *pc, Bool swap ) return 4 * __glLightfv_size( pname ); /* defined in samplegl lib */ } -int __glXLightivReqSize(GLbyte *pc, Bool swap ) +int __glXLightivReqSize(GLbyte *pc, Bool swap, int reqlen) { - return __glXLightfvReqSize( pc, swap ); + return __glXLightfvReqSize( pc, swap, reqlen); } -int __glXLightModelfvReqSize(GLbyte *pc, Bool swap ) +int __glXLightModelfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 0); if (swap) { @@ -97,12 +96,12 @@ int __glXLightModelfvReqSize(GLbyte *pc, Bool swap ) return 4 * __glLightModelfv_size( pname ); /* defined in samplegl lib */ } -int __glXLightModelivReqSize(GLbyte *pc, Bool swap ) +int __glXLightModelivReqSize(GLbyte *pc, Bool swap, int reqlen) { - return __glXLightModelfvReqSize( pc, swap ); + return __glXLightModelfvReqSize( pc, swap, reqlen); } -int __glXMaterialfvReqSize(GLbyte *pc, Bool swap ) +int __glXMaterialfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { @@ -111,12 +110,12 @@ int __glXMaterialfvReqSize(GLbyte *pc, Bool swap ) return 4 * __glMaterialfv_size( pname ); /* defined in samplegl lib */ } -int __glXMaterialivReqSize(GLbyte *pc, Bool swap ) +int __glXMaterialivReqSize(GLbyte *pc, Bool swap, int reqlen) { - return __glXMaterialfvReqSize( pc, swap ); + return __glXMaterialfvReqSize( pc, swap, reqlen); } -int __glXTexGendvReqSize(GLbyte *pc, Bool swap ) +int __glXTexGendvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { @@ -125,7 +124,7 @@ int __glXTexGendvReqSize(GLbyte *pc, Bool swap ) return 8 * __glTexGendv_size( pname ); /* defined in samplegl lib */ } -int __glXTexGenfvReqSize(GLbyte *pc, Bool swap ) +int __glXTexGenfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { @@ -134,12 +133,12 @@ int __glXTexGenfvReqSize(GLbyte *pc, Bool swap ) return 4 * __glTexGenfv_size( pname ); /* defined in samplegl lib */ } -int __glXTexGenivReqSize(GLbyte *pc, Bool swap ) +int __glXTexGenivReqSize(GLbyte *pc, Bool swap, int reqlen) { - return __glXTexGenfvReqSize( pc, swap ); + return __glXTexGenfvReqSize( pc, swap, reqlen); } -int __glXTexParameterfvReqSize(GLbyte *pc, Bool swap ) +int __glXTexParameterfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { @@ -148,12 +147,12 @@ int __glXTexParameterfvReqSize(GLbyte *pc, Bool swap ) return 4 * __glTexParameterfv_size( pname ); /* defined in samplegl lib */ } -int __glXTexParameterivReqSize(GLbyte *pc, Bool swap ) +int __glXTexParameterivReqSize(GLbyte *pc, Bool swap, int reqlen) { - return __glXTexParameterfvReqSize( pc, swap ); + return __glXTexParameterfvReqSize( pc, swap, reqlen); } -int __glXTexEnvfvReqSize(GLbyte *pc, Bool swap ) +int __glXTexEnvfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { @@ -162,21 +161,15 @@ int __glXTexEnvfvReqSize(GLbyte *pc, Bool swap ) return 4 * __glTexEnvfv_size( pname ); /* defined in samplegl lib */ } -int __glXTexEnvivReqSize(GLbyte *pc, Bool swap ) +int __glXTexEnvivReqSize(GLbyte *pc, Bool swap, int reqlen ) { - return __glXTexEnvfvReqSize( pc, swap ); + return __glXTexEnvfvReqSize( pc, swap, reqlen); } -static int Map1Size( GLint k, GLint order) -{ - if (order <= 0 || k < 0) return -1; - return k * order; -} - -int __glXMap1dReqSize(GLbyte *pc, Bool swap ) +int __glXMap1dReqSize(GLbyte *pc, Bool swap, int reqlen ) { GLenum target; - GLint order, k; + GLint order; target = *(GLenum*) (pc + 16); order = *(GLint*) (pc + 20); @@ -184,14 +177,15 @@ int __glXMap1dReqSize(GLbyte *pc, Bool swap ) target = SWAPL( target ); order = SWAPL( order ); } - k = __glMap1d_size( target ); - return 8 * Map1Size( k, order ); + if (order < 1) + return -1; + return safe_mul(8, safe_mul(__glMap1d_size(target), order)); } -int __glXMap1fReqSize(GLbyte *pc, Bool swap ) +int __glXMap1fReqSize(GLbyte *pc, Bool swap, int reqlen ) { GLenum target; - GLint order, k; + GLint order; target = *(GLenum *)(pc + 0); order = *(GLint *)(pc + 12); @@ -199,20 +193,21 @@ int __glXMap1fReqSize(GLbyte *pc, Bool swap ) target = SWAPL( target ); order = SWAPL( order ); } - k = __glMap1f_size(target); - return 4 * Map1Size(k, order); + if (order < 1) + return -1; + return safe_mul(4, safe_mul(__glMap1f_size(target), order)); } static int Map2Size(int k, int majorOrder, int minorOrder) { - if (majorOrder <= 0 || minorOrder <= 0 || k < 0) return -1; - return k * majorOrder * minorOrder; + if (majorOrder < 1 || minorOrder < 1) return -1; + return safe_mul(k, safe_mul(majorOrder, minorOrder)); } -int __glXMap2dReqSize(GLbyte *pc, Bool swap ) +int __glXMap2dReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum target; - GLint uorder, vorder, k; + GLint uorder, vorder; target = *(GLenum *)(pc + 32); uorder = *(GLint *)(pc + 36); @@ -222,14 +217,13 @@ int __glXMap2dReqSize(GLbyte *pc, Bool swap ) uorder = SWAPL( uorder ); vorder = SWAPL( vorder ); } - k = __glMap2d_size( target ); - return 8 * Map2Size( k, uorder, vorder ); + return safe_mul(8, Map2Size(__glMap2d_size(target), uorder, vorder)); } -int __glXMap2fReqSize(GLbyte *pc, Bool swap ) +int __glXMap2fReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum target; - GLint uorder, vorder, k; + GLint uorder, vorder; target = *(GLenum *)(pc + 0); uorder = *(GLint *)(pc + 12); @@ -239,11 +233,10 @@ int __glXMap2fReqSize(GLbyte *pc, Bool swap ) uorder = SWAPL( uorder ); vorder = SWAPL( vorder ); } - k = __glMap2f_size( target ); - return 4 * Map2Size( k, uorder, vorder ); + return safe_mul(4, Map2Size(__glMap2f_size(target), uorder, vorder)); } -int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap ) +int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLint mapsize; mapsize = *(GLint *)(pc + 4); @@ -253,12 +246,12 @@ int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap ) return 4 * mapsize; } -int __glXPixelMapuivReqSize(GLbyte *pc, Bool swap ) +int __glXPixelMapuivReqSize(GLbyte *pc, Bool swap, int reqlen) { - return __glXPixelMapfvReqSize( pc, swap ); + return __glXPixelMapfvReqSize( pc, swap, reqlen); } -int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap ) +int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLint mapsize; mapsize = *(GLint *)(pc + 4); @@ -315,13 +308,16 @@ int __glXImageSize( GLenum format, GLenum type, GLenum target, GLint bytesPerElement, elementsPerGroup, groupsPerRow; GLint groupSize, rowSize, padding, imageSize; + if (w == 0 || h == 0 || d == 0) + return 0; + if (w < 0 || h < 0 || d < 0 || (type == GL_BITMAP && (format != GL_COLOR_INDEX && format != GL_STENCIL_INDEX))) { return -1; } - if (w==0 || h==0 || d == 0) return 0; + /* proxy targets have no data */ switch( target ) { case GL_PROXY_TEXTURE_1D: case GL_PROXY_TEXTURE_2D: @@ -338,6 +334,12 @@ int __glXImageSize( GLenum format, GLenum type, GLenum target, return 0; } + /* real data has to have real sizes */ + if (imageHeight < 0 || rowLength < 0 || skipImages < 0 || skipRows < 0) + return -1; + if (alignment != 1 && alignment != 2 && alignment != 4 && alignment != 8) + return -1; + if (type == GL_BITMAP) { if (rowLength > 0) { groupsPerRow = rowLength; @@ -345,11 +347,13 @@ int __glXImageSize( GLenum format, GLenum type, GLenum target, groupsPerRow = w; } rowSize = (groupsPerRow + 7) >> 3; + if (rowSize < 0) + return -1; padding = (rowSize % alignment); if (padding) { rowSize += alignment - padding; } - return ((h + skipRows) * rowSize); + return safe_mul(safe_add(h, skipRows), rowSize); } else { switch(format) { case GL_COLOR_INDEX: @@ -430,28 +434,30 @@ int __glXImageSize( GLenum format, GLenum type, GLenum target, default: return -1; } + /* known safe by the switches above, not checked */ groupSize = bytesPerElement * elementsPerGroup; if (rowLength > 0) { groupsPerRow = rowLength; } else { groupsPerRow = w; } - rowSize = groupsPerRow * groupSize; + if ((rowSize = safe_mul(groupsPerRow, groupSize)) < 0) + return -1; padding = (rowSize % alignment); if (padding) { rowSize += alignment - padding; } - if (imageHeight > 0) { - imageSize = (imageHeight + skipRows) * rowSize; - } else { - imageSize = (h + skipRows) * rowSize; - } - return ((d + skipImages) * imageSize); + if (imageHeight > 0) + h = imageHeight; + h = safe_add(h, skipRows); + + imageSize = safe_mul(h, rowSize); + return safe_mul(safe_add(d, skipImages), imageSize); } } -int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap ) +int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc; GLenum format = hdr->format; @@ -475,7 +481,7 @@ int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap ) 0, rowLength, 0, skipRows, alignment ); } -int __glXBitmapReqSize(GLbyte *pc, Bool swap ) +int __glXBitmapReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchBitmapHeader *hdr = (__GLXdispatchBitmapHeader *) pc; GLint w = hdr->width; @@ -495,7 +501,7 @@ int __glXBitmapReqSize(GLbyte *pc, Bool swap ) 0, rowLength, 0, skipRows, alignment ); } -int __glXTexImage1DReqSize(GLbyte *pc, Bool swap ) +int __glXTexImage1DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc; GLenum target = hdr->target; @@ -524,7 +530,7 @@ int __glXTexImage1DReqSize(GLbyte *pc, Bool swap ) 0, rowLength, 0, skipRows, alignment ); } -int __glXTexImage2DReqSize(GLbyte *pc, Bool swap ) +int __glXTexImage2DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc; GLenum target = hdr->target; @@ -571,13 +577,14 @@ int __glXTypeSize(GLenum enm) } } -int __glXDrawArraysSize( GLbyte *pc, Bool swap ) +int __glXDrawArraysSize( GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *) pc; __GLXdispatchDrawArraysComponentHeader *compHeader; GLint numVertexes = hdr->numVertexes; GLint numComponents = hdr->numComponents; GLint arrayElementSize = 0; + GLint x, size; int i; if (swap) { @@ -586,6 +593,13 @@ int __glXDrawArraysSize( GLbyte *pc, Bool swap ) } pc += sizeof(__GLXdispatchDrawArraysHeader); + reqlen -= sizeof(__GLXdispatchDrawArraysHeader); + + size = safe_mul(sizeof(__GLXdispatchDrawArraysComponentHeader), + numComponents); + if (size < 0 || reqlen < 0 || reqlen < size) + return -1; + compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc; for (i=0; i<numComponents; i++) { @@ -629,23 +643,24 @@ int __glXDrawArraysSize( GLbyte *pc, Bool swap ) return -1; } - arrayElementSize += __GLX_PAD(numVals * __glXTypeSize(datatype)); + x = safe_pad(safe_mul(numVals, __glXTypeSize(datatype))); + if ((arrayElementSize = safe_add(arrayElementSize, x)) < 0) + return -1; pc += sizeof(__GLXdispatchDrawArraysComponentHeader); } - return ((numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader)) + - (numVertexes * arrayElementSize)); + return safe_add(size, safe_mul(numVertexes, arrayElementSize)); } -int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap ) +int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap, int reqlen) { GLint n = *(GLsizei *)(pc + 0); if (swap) n = SWAPL(n); return(8*n); /* 4*n for textures, 4*n for priorities */ } -int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap ) +int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc; GLenum format = hdr->format; @@ -667,7 +682,7 @@ int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap ) 0, rowLength, 0, skipRows, alignment ); } -int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap ) +int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc; GLenum format = hdr->format; @@ -691,7 +706,7 @@ int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap ) 0, rowLength, 0, skipRows, alignment ); } -int __glXTexImage3DReqSize(GLbyte *pc, Bool swap ) +int __glXTexImage3DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc; GLenum target = hdr->target; @@ -728,7 +743,7 @@ int __glXTexImage3DReqSize(GLbyte *pc, Bool swap ) } } -int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap ) +int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchTexSubImage3DHeader *hdr = (__GLXdispatchTexSubImage3DHeader *) pc; @@ -765,7 +780,7 @@ int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap ) } } -int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap ) +int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchConvolutionFilterHeader *hdr = (__GLXdispatchConvolutionFilterHeader *) pc; @@ -788,7 +803,7 @@ int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap ) 0, rowLength, 0, 0, alignment ); } -int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap ) +int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchConvolutionFilterHeader *hdr = (__GLXdispatchConvolutionFilterHeader *) pc; @@ -834,7 +849,7 @@ int __glXConvolutionParameterfvSize(GLenum pname) return __glXConvolutionParameterivSize(pname); } -int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap ) +int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { @@ -843,12 +858,12 @@ int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap ) return 4 * __glXConvolutionParameterivSize( pname ); } -int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap ) +int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap, int reqlen) { - return __glXConvolutionParameterivReqSize( pc, swap ); + return __glXConvolutionParameterivReqSize( pc, swap, reqlen); } -int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap ) +int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchConvolutionFilterHeader *hdr = (__GLXdispatchConvolutionFilterHeader *) pc; @@ -873,10 +888,9 @@ int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap ) /* XXX Should rowLength be used for either or both image? */ image1size = __glXImageSize( format, type, 0, w, 1, 1, 0, rowLength, 0, 0, alignment ); - image1size = __GLX_PAD(image1size); image2size = __glXImageSize( format, type, 0, h, 1, 1, 0, rowLength, 0, 0, alignment ); - return image1size + image2size; + return safe_add(safe_pad(image1size), image2size); } @@ -898,7 +912,7 @@ int __glXColorTableParameterivSize(GLenum pname) return __glXColorTableParameterfvSize(pname); } -int __glXColorTableReqSize(GLbyte *pc, Bool swap ) +int __glXColorTableReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchColorTableHeader *hdr = (__GLXdispatchColorTableHeader *) pc; @@ -933,7 +947,7 @@ int __glXColorTableReqSize(GLbyte *pc, Bool swap ) 0, rowLength, 0, 0, alignment ); } -int __glXColorSubTableReqSize(GLbyte *pc, Bool swap ) +int __glXColorSubTableReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchColorSubTableHeader *hdr = (__GLXdispatchColorSubTableHeader *) pc; @@ -956,7 +970,7 @@ int __glXColorSubTableReqSize(GLbyte *pc, Bool swap ) 0, rowLength, 0, 0, alignment ); } -int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap ) +int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { @@ -965,13 +979,13 @@ int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap ) return 4 * __glXColorTableParameterfvSize(pname); } -int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap ) +int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap, int reqlen) { /* no difference between fv and iv versions */ - return __glXColorTableParameterfvReqSize(pc, swap); + return __glXColorTableParameterfvReqSize(pc, swap, reqlen); } -int __glXPointParameterfvARBReqSize(GLbyte *pc, Bool swap ) +int __glXPointParameterfvARBReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 0); if (swap) { @@ -980,8 +994,8 @@ int __glXPointParameterfvARBReqSize(GLbyte *pc, Bool swap ) return 4 * __glPointParameterfvEXT_size( pname ); } -int __glXPointParameterivReqSize(GLbyte *pc, Bool swap ) +int __glXPointParameterivReqSize(GLbyte *pc, Bool swap, int reqlen) { /* no difference between fv and iv versions */ - return __glXPointParameterfvARBReqSize(pc, swap); + return __glXPointParameterfvARBReqSize(pc, swap, reqlen); } diff --git a/nx-X11/programs/Xserver/GL/glx/rensizetab.c b/nx-X11/programs/Xserver/GL/glx/rensizetab.c index 41656890c..9d5abe844 100644 --- a/nx-X11/programs/Xserver/GL/glx/rensizetab.c +++ b/nx-X11/programs/Xserver/GL/glx/rensizetab.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/rensizetab.c,v 1.5 2004/01/28 18:11:53 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free diff --git a/nx-X11/programs/Xserver/GL/glx/single2.c b/nx-X11/programs/Xserver/GL/glx/single2.c index 9fee5ff49..47ba628af 100644 --- a/nx-X11/programs/Xserver/GL/glx/single2.c +++ b/nx-X11/programs/Xserver/GL/glx/single2.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/single2.c,v 1.8 2004/02/10 22:54:15 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,25 +33,30 @@ ** */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif +#include <string.h> +#include <stdio.h> +#include <stdlib.h> + #include "glxserver.h" #include "glxutil.h" #include "glxext.h" #include "unpack.h" #include "g_disptab.h" -#include "GL/glx_ansic.h" int __glXDisp_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; GLsizei size; GLenum type; __GLXcontext *cx; int error; + REQUEST_FIXED_SIZE(xGLXSingleReq, 8); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -62,7 +66,7 @@ int __glXDisp_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc) size = *(GLsizei *)(pc+0); type = *(GLenum *)(pc+4); if (cx->feedbackBufSize < size) { - cx->feedbackBuf = (GLfloat *) __glXRealloc(cx->feedbackBuf, + cx->feedbackBuf = (GLfloat *) realloc(cx->feedbackBuf, (size_t)size * __GLX_SIZE_FLOAT32); if (!cx->feedbackBuf) { @@ -78,10 +82,12 @@ int __glXDisp_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc) int __glXDisp_SelectBuffer(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; __GLXcontext *cx; GLsizei size; int error; + REQUEST_FIXED_SIZE(xGLXSingleReq, 4); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -90,7 +96,7 @@ int __glXDisp_SelectBuffer(__GLXclientState *cl, GLbyte *pc) pc += __GLX_SINGLE_HDR_SIZE; size = *(GLsizei *)(pc+0); if (cx->selectBufSize < size) { - cx->selectBuf = (GLuint *) __glXRealloc(cx->selectBuf, + cx->selectBuf = (GLuint *) realloc(cx->selectBuf, (size_t) size * __GLX_SIZE_CARD32); if (!cx->selectBuf) { @@ -106,7 +112,7 @@ int __glXDisp_SelectBuffer(__GLXclientState *cl, GLbyte *pc) int __glXDisp_RenderMode(__GLXclientState *cl, GLbyte *pc) { - ClientPtr client; + ClientPtr client = cl->client; xGLXRenderModeReply reply; __GLXcontext *cx; GLint nitems=0, retBytes=0, retval, newModeCheck; @@ -114,6 +120,8 @@ int __glXDisp_RenderMode(__GLXclientState *cl, GLbyte *pc) GLenum newMode; int error; + REQUEST_FIXED_SIZE(xGLXSingleReq, 4); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -188,25 +196,26 @@ int __glXDisp_RenderMode(__GLXclientState *cl, GLbyte *pc) ** selection array, as per the API for glRenderMode itself. */ noChangeAllowed:; - client = cl->client; reply.length = nitems; reply.type = X_Reply; reply.sequenceNumber = client->sequence; reply.retval = retval; reply.size = nitems; reply.newMode = newMode; - WriteToClient(client, sz_xGLXRenderModeReply, (char *)&reply); + WriteToClient(client, sz_xGLXRenderModeReply, &reply); if (retBytes) { - WriteToClient(client, retBytes, (char *)retBuffer); + WriteToClient(client, retBytes, retBuffer); } return Success; } int __glXDisp_Flush(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; __GLXcontext *cx; int error; + REQUEST_SIZE_MATCH(xGLXSingleReq); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -219,10 +228,11 @@ int __glXDisp_Flush(__GLXclientState *cl, GLbyte *pc) int __glXDisp_Finish(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; __GLXcontext *cx; - ClientPtr client; int error; + REQUEST_SIZE_MATCH(xGLXSingleReq); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -233,7 +243,6 @@ int __glXDisp_Finish(__GLXclientState *cl, GLbyte *pc) __GLX_NOTE_FLUSHED_CMDS(cx); /* Send empty reply packet to indicate finish is finished */ - client = cl->client; __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); return Success; @@ -258,24 +267,30 @@ char *__glXcombine_strings(const char *cext_string, const char *sext_string) ** pull tokens out of shortest string ** include space in combo_string for final separator and null terminator */ - if ( (clen = __glXStrlen(cext_string)) > (slen = __glXStrlen(sext_string)) ) { - combo_string = (char *) __glXMalloc(slen + 2); - s1 = (char *) __glXMalloc(slen + 2); __glXStrcpy(s1, sext_string); + clen = strlen(cext_string); + slen = strlen(sext_string); + if (clen > slen) { + combo_string = (char *) malloc(slen + 2); + s1 = (char *) malloc(slen + 2); + strcpy(s1, sext_string); s2 = cext_string; } else { - combo_string = (char *) __glXMalloc(clen + 2); - s1 = (char *) __glXMalloc(clen + 2); __glXStrcpy(s1, cext_string); + combo_string = (char *) malloc(clen + 2); + s1 = (char *) malloc(clen + 2); + strcpy(s1, cext_string); s2 = sext_string; } if (!combo_string || !s1) { - if (combo_string) __glXFree(combo_string); - if (s1) __glXFree(s1); + if (combo_string) + free(combo_string); + if (s1) + free(s1); return NULL; } combo_string[0] = '\0'; /* Get first extension token */ - token = __glXStrtok( s1, SEPARATOR); + token = strtok( s1, SEPARATOR); while ( token != NULL ) { /* @@ -283,26 +298,26 @@ char *__glXcombine_strings(const char *cext_string, const char *sext_string) ** beware of extension names which are prefixes of other extension names */ const char *p = s2; - end = p + __glXStrlen(p); + end = p + strlen(p); while (p < end) { - size_t n = __glXStrcspn(p, SEPARATOR); - if ((__glXStrlen(token) == n) && (__glXStrncmp(token, p, n) == 0)) { - combo_string = __glXStrcat( combo_string, token); - combo_string = __glXStrcat( combo_string, SEPARATOR); + size_t n = strcspn(p, SEPARATOR); + if ((strlen(token) == n) && (strncmp(token, p, n) == 0)) { + combo_string = strcat(combo_string, token); + combo_string = strcat(combo_string, SEPARATOR); } p += (n + 1); } /* Get next extension token */ - token = __glXStrtok( NULL, SEPARATOR); + token = strtok( NULL, SEPARATOR); } - __glXFree(s1); + free(s1); return combo_string; } int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap) { - ClientPtr client; + ClientPtr client = cl->client; __GLXcontext *cx; GLenum name; const char *string; @@ -311,6 +326,8 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap) char *buf = NULL, *buf1 = NULL; GLint length = 0; + REQUEST_FIXED_SIZE(xGLXSingleReq, 4); + /* If the client has the opposite byte order, swap the contextTag and * the name. */ @@ -327,7 +344,6 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap) pc += __GLX_SINGLE_HDR_SIZE; name = *(GLenum *)(pc + 0); string = (const char *)glGetString(name); - client = cl->client; /* ** Restrict extensions to those that are supported by both the @@ -340,26 +356,24 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap) buf = __glXcombine_strings(buf1, cx->pGlxScreen->GLextensions); if (buf1 != NULL) { - __glXFree(buf1); + free(buf1); } string = buf; } else if ( name == GL_VERSION ) { if ( atof( string ) > atof( GLServerVersion ) ) { - buf = __glXMalloc( __glXStrlen( string ) - + __glXStrlen( GLServerVersion ) - + 4 ); + buf = malloc( strlen( string ) + strlen( GLServerVersion ) + 4 ); if ( buf == NULL ) { string = GLServerVersion; } else { - __glXSprintf( buf, "%s (%s)", GLServerVersion, string ); + sprintf( buf, "%s (%s)", GLServerVersion, string ); string = buf; } } } if (string) { - length = __glXStrlen((const char *) string) + 1; + length = strlen((const char *) string) + 1; } __GLX_BEGIN_REPLY(length); @@ -371,9 +385,9 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap) } __GLX_SEND_HEADER(); - WriteToClient(client, length, (char *) string); + WriteToClient(client, length, string); if (buf != NULL) { - __glXFree(buf); + free(buf); } return Success; } diff --git a/nx-X11/programs/Xserver/GL/glx/single2swap.c b/nx-X11/programs/Xserver/GL/glx/single2swap.c index dab98ade9..6fdc7e7f2 100644 --- a/nx-X11/programs/Xserver/GL/glx/single2swap.c +++ b/nx-X11/programs/Xserver/GL/glx/single2swap.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/single2swap.c,v 1.7 2002/01/14 22:47:08 tsi Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,7 +33,6 @@ ** */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -44,16 +42,17 @@ #include "glxext.h" #include "unpack.h" #include "g_disptab.h" -#include "GL/glx_ansic.h" int __glXDispSwap_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; GLsizei size; GLenum type; __GLX_DECLARE_SWAP_VARIABLES; __GLXcontext *cx; int error; + REQUEST_FIXED_SIZE(xGLXSingleReq, 8); __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -66,7 +65,7 @@ int __glXDispSwap_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc) size = *(GLsizei *)(pc+0); type = *(GLenum *)(pc+4); if (cx->feedbackBufSize < size) { - cx->feedbackBuf = (GLfloat *) __glXRealloc(cx->feedbackBuf, + cx->feedbackBuf = (GLfloat *) realloc(cx->feedbackBuf, (size_t) size * __GLX_SIZE_FLOAT32); if (!cx->feedbackBuf) { @@ -82,11 +81,13 @@ int __glXDispSwap_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_SelectBuffer(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; __GLXcontext *cx; GLsizei size; __GLX_DECLARE_SWAP_VARIABLES; int error; + REQUEST_FIXED_SIZE(xGLXSingleReq, 4); __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -97,7 +98,7 @@ int __glXDispSwap_SelectBuffer(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_INT(pc+0); size = *(GLsizei *)(pc+0); if (cx->selectBufSize < size) { - cx->selectBuf = (GLuint *) __glXRealloc(cx->selectBuf, + cx->selectBuf = (GLuint *) realloc(cx->selectBuf, (size_t) size * __GLX_SIZE_CARD32); if (!cx->selectBuf) { @@ -113,7 +114,7 @@ int __glXDispSwap_SelectBuffer(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_RenderMode(__GLXclientState *cl, GLbyte *pc) { - ClientPtr client; + ClientPtr client = cl->client; __GLXcontext *cx; xGLXRenderModeReply reply; GLint nitems=0, retBytes=0, retval, newModeCheck; @@ -123,6 +124,8 @@ int __glXDispSwap_RenderMode(__GLXclientState *cl, GLbyte *pc) __GLX_DECLARE_SWAP_ARRAY_VARIABLES; int error; + REQUEST_FIXED_SIZE(xGLXSingleReq, 4); + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -201,7 +204,6 @@ int __glXDispSwap_RenderMode(__GLXclientState *cl, GLbyte *pc) ** selection array, as per the API for glRenderMode itself. */ noChangeAllowed:; - client = cl->client; reply.length = nitems; reply.type = X_Reply; reply.sequenceNumber = client->sequence; @@ -213,19 +215,21 @@ int __glXDispSwap_RenderMode(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_INT(&reply.retval); __GLX_SWAP_INT(&reply.size); __GLX_SWAP_INT(&reply.newMode); - WriteToClient(client, sz_xGLXRenderModeReply, (char *)&reply); + WriteToClient(client, sz_xGLXRenderModeReply, &reply); if (retBytes) { - WriteToClient(client, retBytes, (char *)retBuffer); + WriteToClient(client, retBytes, retBuffer); } return Success; } int __glXDispSwap_Flush(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; __GLXcontext *cx; int error; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXSingleReq); __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -239,11 +243,12 @@ int __glXDispSwap_Flush(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_Finish(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; __GLXcontext *cx; - ClientPtr client; int error; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXSingleReq); __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -255,7 +260,6 @@ int __glXDispSwap_Finish(__GLXclientState *cl, GLbyte *pc) __GLX_NOTE_FLUSHED_CMDS(cx); /* Send empty reply packet to indicate finish is finished */ - client = cl->client; __GLX_BEGIN_REPLY(0); __GLX_PUT_RETVAL(0); __GLX_SWAP_REPLY_HEADER(); diff --git a/nx-X11/programs/Xserver/GL/glx/singlepix.c b/nx-X11/programs/Xserver/GL/glx/singlepix.c index 845c46a64..9e3e36333 100644 --- a/nx-X11/programs/Xserver/GL/glx/singlepix.c +++ b/nx-X11/programs/Xserver/GL/glx/singlepix.c @@ -1,4 +1,3 @@ -/* $XFree86$ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,7 +33,6 @@ ** */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -57,6 +55,8 @@ int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc) int error; char *answer, answerBuffer[200]; + REQUEST_FIXED_SIZE(xGLXSingleReq, 28); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -70,7 +70,7 @@ int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc) swapBytes = *(GLboolean *)(pc + 24); lsbFirst = *(GLboolean *)(pc + 25); compsize = __glReadPixels_size(format,type,width,height); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); @@ -108,6 +108,7 @@ int __glXDisp_GetTexImage(__GLXclientState *cl, GLbyte *pc) char *answer, answerBuffer[200]; GLint width=0, height=0, depth=1; + REQUEST_FIXED_SIZE(xGLXSingleReq, 20); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -130,7 +131,7 @@ int __glXDisp_GetTexImage(__GLXclientState *cl, GLbyte *pc) * are illegal, but then width, height, and depth would still be zero anyway. */ compsize = __glGetTexImage_size(target,level,format,type,width,height,depth); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); @@ -204,6 +205,7 @@ int __glXDisp_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc) char *answer, answerBuffer[200]; GLint width=0, height=0; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -227,13 +229,11 @@ int __glXDisp_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc) compsize = __glGetTexImage_size(target,1,format,type,width,1,1); compsize2 = __glGetTexImage_size(target,1,format,type,height,1,1); - if (compsize < 0) compsize = 0; - if (compsize2 < 0) compsize2 = 0; - compsize = __GLX_PAD(compsize); - compsize2 = __GLX_PAD(compsize2); + if ((compsize = safe_pad(compsize)) < 0) return BadLength; + if ((compsize2 = safe_pad(compsize2)) < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); - __GLX_GET_ANSWER_BUFFER(answer,cl,compsize + compsize2,1); + __GLX_GET_ANSWER_BUFFER(answer,cl,safe_add(compsize, compsize2),1); __glXClearErrorOccured(); glGetSeparableFilter( *(GLenum *)(pc + 0), @@ -269,6 +269,7 @@ int __glXDisp_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc) char *answer, answerBuffer[200]; GLint width=0, height=0; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -291,7 +292,7 @@ int __glXDisp_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc) * are illegal, but then width and height would still be zero anyway. */ compsize = __glGetTexImage_size(target,1,format,type,width,height,1); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); @@ -328,6 +329,8 @@ int __glXDisp_GetHistogram(__GLXclientState *cl, GLbyte *pc) char *answer, answerBuffer[200]; GLint width=0; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -346,7 +349,7 @@ int __glXDisp_GetHistogram(__GLXclientState *cl, GLbyte *pc) * are illegal, but then width would still be zero anyway. */ compsize = __glGetTexImage_size(target,1,format,type,width,1,1); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); @@ -376,6 +379,8 @@ int __glXDisp_GetMinmax(__GLXclientState *cl, GLbyte *pc) int error; char *answer, answerBuffer[200]; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -389,7 +394,7 @@ int __glXDisp_GetMinmax(__GLXclientState *cl, GLbyte *pc) reset = *(GLboolean *)(pc + 13); compsize = __glGetTexImage_size(target,1,format,type,2,1,1); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); @@ -419,6 +424,8 @@ int __glXDisp_GetColorTable(__GLXclientState *cl, GLbyte *pc) char *answer, answerBuffer[200]; GLint width=0; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -436,7 +443,7 @@ int __glXDisp_GetColorTable(__GLXclientState *cl, GLbyte *pc) * are illegal, but then width would still be zero anyway. */ compsize = __glGetTexImage_size(target,1,format,type,width,1,1); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); diff --git a/nx-X11/programs/Xserver/GL/glx/singlepixswap.c b/nx-X11/programs/Xserver/GL/glx/singlepixswap.c index ff68ecedf..f029fd602 100644 --- a/nx-X11/programs/Xserver/GL/glx/singlepixswap.c +++ b/nx-X11/programs/Xserver/GL/glx/singlepixswap.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/singlepixswap.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,7 +33,6 @@ ** */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -58,6 +56,8 @@ int __glXDispSwap_ReadPixels(__GLXclientState *cl, GLbyte *pc) int error; char *answer, answerBuffer[200]; + REQUEST_FIXED_SIZE(xGLXSingleReq, 28); + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -79,7 +79,7 @@ int __glXDispSwap_ReadPixels(__GLXclientState *cl, GLbyte *pc) swapBytes = *(GLboolean *)(pc + 24); lsbFirst = *(GLboolean *)(pc + 25); compsize = __glReadPixels_size(format,type,width,height); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); @@ -120,6 +120,7 @@ int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc) char *answer, answerBuffer[200]; GLint width=0, height=0, depth=1; + REQUEST_FIXED_SIZE(xGLXSingleReq, 24); __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -148,7 +149,7 @@ int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc) * are illegal, but then width, height, and depth would still be zero anyway. */ compsize = __glGetTexImage_size(target,level,format,type,width,height,depth); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); @@ -190,6 +191,7 @@ int __glXDispSwap_GetPolygonStipple(__GLXclientState *cl, GLbyte *pc) char *answer; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_FIXED_SIZE(xGLXSingleReq, 4); __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -230,6 +232,7 @@ int __glXDispSwap_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc) char *answer, answerBuffer[200]; GLint width=0, height=0; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -257,13 +260,11 @@ int __glXDispSwap_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc) compsize = __glGetTexImage_size(target,1,format,type,width,1,1); compsize2 = __glGetTexImage_size(target,1,format,type,height,1,1); - if (compsize < 0) compsize = 0; - if (compsize2 < 0) compsize2 = 0; - compsize = __GLX_PAD(compsize); - compsize2 = __GLX_PAD(compsize2); + if ((compsize = safe_pad(compsize)) < 0) return BadLength; + if ((compsize2 = safe_pad(compsize2)) < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); - __GLX_GET_ANSWER_BUFFER(answer,cl,compsize + compsize2,1); + __GLX_GET_ANSWER_BUFFER(answer,cl,safe_add(compsize, compsize2),1); __glXClearErrorOccured(); glGetSeparableFilter( *(GLenum *)(pc + 0), @@ -302,6 +303,7 @@ int __glXDispSwap_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc) char *answer, answerBuffer[200]; GLint width=0, height=0; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -328,7 +330,7 @@ int __glXDispSwap_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc) * are illegal, but then width and height would still be zero anyway. */ compsize = __glGetTexImage_size(target,1,format,type,width,height,1); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); @@ -368,6 +370,7 @@ int __glXDispSwap_GetHistogram(__GLXclientState *cl, GLbyte *pc) char *answer, answerBuffer[200]; GLint width=0; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -390,7 +393,7 @@ int __glXDispSwap_GetHistogram(__GLXclientState *cl, GLbyte *pc) * are illegal, but then width would still be zero anyway. */ compsize = __glGetTexImage_size(target,1,format,type,width,1,1); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); @@ -422,6 +425,7 @@ int __glXDispSwap_GetMinmax(__GLXclientState *cl, GLbyte *pc) __GLX_DECLARE_SWAP_VARIABLES; char *answer, answerBuffer[200]; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -439,7 +443,7 @@ int __glXDispSwap_GetMinmax(__GLXclientState *cl, GLbyte *pc) reset = *(GLboolean *)(pc + 13); compsize = __glGetTexImage_size(target,1,format,type,2,1,1); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); @@ -470,6 +474,7 @@ int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc) char *answer, answerBuffer[200]; GLint width=0; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -491,7 +496,7 @@ int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc) * are illegal, but then width would still be zero anyway. */ compsize = __glGetTexImage_size(target,1,format,type,width,1,1); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); diff --git a/nx-X11/programs/Xserver/GL/glx/singlesize.c b/nx-X11/programs/Xserver/GL/glx/singlesize.c index 7ed5fe3ef..6d77f8be9 100644 --- a/nx-X11/programs/Xserver/GL/glx/singlesize.c +++ b/nx-X11/programs/Xserver/GL/glx/singlesize.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/singlesize.c,v 1.7tsi Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free diff --git a/nx-X11/programs/Xserver/GL/glx/singlesize.h b/nx-X11/programs/Xserver/GL/glx/singlesize.h index 4804a9982..7cd52eae8 100644 --- a/nx-X11/programs/Xserver/GL/glx/singlesize.h +++ b/nx-X11/programs/Xserver/GL/glx/singlesize.h @@ -1,4 +1,3 @@ -/* $XFree86$ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/unpack.h b/nx-X11/programs/Xserver/GL/glx/unpack.h index 723fb85f3..9554ba4b9 100644 --- a/nx-X11/programs/Xserver/GL/glx/unpack.h +++ b/nx-X11/programs/Xserver/GL/glx/unpack.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/unpack.h,v 1.4 2002/01/14 22:47:08 tsi Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -53,7 +52,7 @@ ** Fetch a double from potentially unaligned memory. */ #ifdef __GLX_ALIGN64 -#define __GLX_MEM_COPY(dst,src,n) if (src && dst) memcpy(dst,src,n) +#define __GLX_MEM_COPY(dst,src,n) memmove(dst,src,n) #define __GLX_GET_DOUBLE(dst,src) __GLX_MEM_COPY(&dst,src,8) #else #define __GLX_GET_DOUBLE(dst,src) (dst) = *((GLdouble*)(src)) @@ -69,7 +68,7 @@ extern xGLXSingleReply __glXReply; __glXReply.sequenceNumber = client->sequence; #define __GLX_SEND_HEADER() \ - WriteToClient( client, sz_xGLXSingleReply, (char *)&__glXReply); + WriteToClient( client, sz_xGLXSingleReply, &__glXReply); #define __GLX_PUT_RETVAL(a) \ __glXReply.retval = (a); @@ -89,10 +88,11 @@ extern xGLXSingleReply __glXReply; ** pointer. */ #define __GLX_GET_ANSWER_BUFFER(res,cl,size,align) \ - if ((size) > sizeof(answerBuffer)) { \ + if (size < 0) return BadLength; \ + else if ((size) > sizeof(answerBuffer)) { \ int bump; \ if ((cl)->returnBufSize < (size)+(align)) { \ - (cl)->returnBuf = (GLbyte*)Xrealloc((cl)->returnBuf, \ + (cl)->returnBuf = (GLbyte*)realloc((cl)->returnBuf, \ (size)+(align)); \ if (!(cl)->returnBuf) { \ return BadAlloc; \ @@ -122,19 +122,19 @@ extern xGLXSingleReply __glXReply; *(GLdouble *)&__glXReply.pad3 = *(GLdouble *)answer #define __GLX_SEND_BYTE_ARRAY(len) \ - WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), (char *)answer) + WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), answer) #define __GLX_SEND_SHORT_ARRAY(len) \ - WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT16), (char *)answer) + WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT16), answer) #define __GLX_SEND_INT_ARRAY(len) \ - WriteToClient(client, (len)*__GLX_SIZE_INT32, (char *)answer) + WriteToClient(client, (len)*__GLX_SIZE_INT32, answer) #define __GLX_SEND_FLOAT_ARRAY(len) \ - WriteToClient(client, (len)*__GLX_SIZE_FLOAT32, (char *)answer) + WriteToClient(client, (len)*__GLX_SIZE_FLOAT32, answer) #define __GLX_SEND_DOUBLE_ARRAY(len) \ - WriteToClient(client, (len)*__GLX_SIZE_FLOAT64, (char *)answer) + WriteToClient(client, (len)*__GLX_SIZE_FLOAT64, answer) #define __GLX_SEND_VOID_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len) diff --git a/nx-X11/programs/Xserver/GL/glx/xfont.c b/nx-X11/programs/Xserver/GL/glx/xfont.c index c4995e272..780183609 100644 --- a/nx-X11/programs/Xserver/GL/glx/xfont.c +++ b/nx-X11/programs/Xserver/GL/glx/xfont.c @@ -1,4 +1,3 @@ -/* $XFree86$ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,7 +33,6 @@ ** */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -78,7 +76,7 @@ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci) p = buf; allocbuf = 0; } else { - p = (unsigned char *) __glXMalloc(allocBytes); + p = (unsigned char *) malloc(allocBytes); if (!p) return BadAlloc; allocbuf = p; @@ -100,7 +98,7 @@ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci) pci->metrics.characterWidth, 0, allocbuf ? allocbuf : buf); if (allocbuf) { - __glXFree(allocbuf); + free(allocbuf); } return Success; #undef __GL_CHAR_BUF_SIZE |
