wined3d: Avoid using the long type. (resend)

Michael Stefaniuc mstefani at redhat.de
Fri May 21 05:45:40 CDT 2010


---
Rebased on top off Henri's wined3d patch series.

 dlls/wined3d/arb_program_shader.c |    4 ++--
 dlls/wined3d/device.c             |    2 +-
 dlls/wined3d/directx.c            |    4 ++--
 dlls/wined3d/drawprim.c           |   18 +++++++++---------
 dlls/wined3d/state.c              |    2 +-
 dlls/wined3d/swapchain_gdi.c      |    2 +-
 dlls/wined3d/utils.c              |    8 ++++----
 dlls/wined3d/wined3d_private.h    |    4 ++--
 8 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index c0b3924..b6285b2 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -61,14 +61,14 @@ static char *get_line(char **ptr)
 
 static void shader_arb_dump_program_source(const char *source)
 {
-    unsigned long source_size;
+    ULONG source_size;
     char *ptr, *line, *tmp;
 
     source_size = strlen(source) + 1;
     tmp = HeapAlloc(GetProcessHeap(), 0, source_size);
     if (!tmp)
     {
-        ERR("Failed to allocate %lu bytes for shader source.\n", source_size);
+        ERR("Failed to allocate %u bytes for shader source.\n", source_size);
         return;
     }
     memcpy(tmp, source, source_size);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 7c06e6c..498efea 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3941,7 +3941,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_ProcessVertices(IWineD3DDevice *iface,
             {
                 struct wined3d_buffer *vb = (struct wined3d_buffer *)This->stateBlock->streamSource[e->stream_idx];
                 e->buffer_object = 0;
-                e->data = (BYTE *)((unsigned long)e->data + (unsigned long)buffer_get_sysmem(vb, gl_info));
+                e->data = (BYTE *)((ULONG_PTR)e->data + (ULONG_PTR)buffer_get_sysmem(vb, gl_info));
                 ENTER_GL();
                 GL_EXTCALL(glDeleteBuffersARB(1, &vb->buffer_object));
                 vb->buffer_object = 0;
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index a2a7f8e..07120ec 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -327,12 +327,12 @@ fail:
 }
 
 /* Adjust the amount of used texture memory */
-long WineD3DAdapterChangeGLRam(IWineD3DDeviceImpl *device, long glram)
+unsigned int WineD3DAdapterChangeGLRam(IWineD3DDeviceImpl *device, unsigned int glram)
 {
     struct wined3d_adapter *adapter = device->adapter;
 
     adapter->UsedTextureRam += glram;
-    TRACE("Adjusted gl ram by %ld to %d\n", glram, adapter->UsedTextureRam);
+    TRACE("Adjusted gl ram by %d to %d\n", glram, adapter->UsedTextureRam);
     return adapter->UsedTextureRam;
 }
 
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 882234d..d845160 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -71,7 +71,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
     UINT vx_index;
     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
     const UINT *streamOffset = This->stateBlock->streamOffset;
-    long                      SkipnStrides = startIdx + This->stateBlock->loadBaseVertexIndex;
+    LONG                      SkipnStrides = startIdx + This->stateBlock->loadBaseVertexIndex;
     BOOL                      pixelShader = use_ps(This->stateBlock);
     BOOL specular_fog = FALSE;
     const BYTE *texCoords[WINED3DDP_MAXTEXCOORD];
@@ -423,7 +423,7 @@ static void drawStridedSlowVs(IWineD3DDevice *iface, const struct wined3d_stream
 {
     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
     const struct wined3d_gl_info *gl_info = &This->adapter->gl_info;
-    long                      SkipnStrides = startIdx + This->stateBlock->loadBaseVertexIndex;
+    LONG                      SkipnStrides = startIdx + This->stateBlock->loadBaseVertexIndex;
     const WORD                *pIdxBufS     = NULL;
     const DWORD               *pIdxBufL     = NULL;
     UINT vx_index;
@@ -536,7 +536,7 @@ static inline void drawStridedInstanced(IWineD3DDevice *iface, const struct wine
             {
                 struct wined3d_buffer *vb =
                         (struct wined3d_buffer *)stateblock->streamSource[si->elements[instancedData[j]].stream_idx];
-                ptr += (long)buffer_get_sysmem(vb, &This->adapter->gl_info);
+                ptr += (ULONG_PTR)buffer_get_sysmem(vb, &This->adapter->gl_info);
             }
 
             send_attribute(This, si->elements[instancedData[j]].format_desc->format, instancedData[j], ptr);
@@ -564,7 +564,7 @@ static inline void remove_vbos(IWineD3DDeviceImpl *This, const struct wined3d_gl
         {
             struct wined3d_buffer *vb = (struct wined3d_buffer *)This->stateBlock->streamSource[e->stream_idx];
             e->buffer_object = 0;
-            e->data = (BYTE *)((unsigned long)e->data + (unsigned long)buffer_get_sysmem(vb, gl_info));
+            e->data = (BYTE *)((ULONG_PTR)e->data + (ULONG_PTR)buffer_get_sysmem(vb, gl_info));
         }
     }
 }
@@ -731,14 +731,14 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
     /* Diagnostics */
 #ifdef SHOW_FRAME_MAKEUP
     {
-        static long int primCounter = 0;
+        static LONG primCounter = 0;
         /* NOTE: set primCounter to the value reported by drawprim
            before you want to to write frame makeup to /tmp */
         if (primCounter >= 0) {
             WINED3DLOCKED_RECT r;
             char buffer[80];
             IWineD3DSurface_LockRect(This->render_targets[0], &r, NULL, WINED3DLOCK_READONLY);
-            sprintf(buffer, "/tmp/backbuffer_%ld.tga", primCounter);
+            sprintf(buffer, "/tmp/backbuffer_%d.tga", primCounter);
             TRACE("Saving screenshot %s\n", buffer);
             IWineD3DSurface_SaveSnapshot(This->render_targets[0], buffer);
             IWineD3DSurface_UnlockRect(This->render_targets[0]);
@@ -749,7 +749,7 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
             int textureNo;
             for (textureNo = 0; textureNo < MAX_COMBINED_SAMPLERS; ++textureNo) {
                 if (This->stateBlock->textures[textureNo] != NULL) {
-                    sprintf(buffer, "/tmp/texture_%p_%ld_%d.tga", This->stateBlock->textures[textureNo], primCounter, textureNo);
+                    sprintf(buffer, "/tmp/texture_%p_%d_%d.tga", This->stateBlock->textures[textureNo], primCounter, textureNo);
                     TRACE("Saving texture %s\n", buffer);
                     if (IWineD3DBaseTexture_GetType(This->stateBlock->textures[textureNo]) == WINED3DRTYPE_TEXTURE) {
                             IWineD3DTexture_GetSurfaceLevel(This->stateBlock->textures[textureNo], 0, &pSur);
@@ -763,7 +763,7 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
            }
 #endif
         }
-        TRACE("drawprim #%ld\n", primCounter);
+        TRACE("drawprim #%d\n", primCounter);
         ++primCounter;
     }
 #endif
@@ -832,7 +832,7 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This,
     {
         struct wined3d_buffer *vb;
         vb = (struct wined3d_buffer *)This->stateBlock->streamSource[e->stream_idx];
-        e->data = (BYTE *)((unsigned long)e->data + (unsigned long)buffer_get_sysmem(vb, context->gl_info));
+        e->data = (BYTE *)((ULONG_PTR)e->data + (ULONG_PTR)buffer_get_sysmem(vb, context->gl_info));
     }
     vtxStride = e->stride;
     data = e->data +
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 5ade1a4..7773c3e 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -4100,7 +4100,7 @@ static inline void loadNumberedArrays(IWineD3DStateBlockImpl *stateblock,
             if (stream_info->elements[i].buffer_object)
             {
                 vb = (struct wined3d_buffer *)stateblock->streamSource[stream_info->elements[i].stream_idx];
-                ptr += (long)buffer_get_sysmem(vb, gl_info);
+                ptr += (ULONG_PTR)buffer_get_sysmem(vb, gl_info);
             }
 
             if (context->numbered_array_mask & (1 << i)) unload_numbered_array(stateblock, context, i);
diff --git a/dlls/wined3d/swapchain_gdi.c b/dlls/wined3d/swapchain_gdi.c
index 5885518..b80352c 100644
--- a/dlls/wined3d/swapchain_gdi.c
+++ b/dlls/wined3d/swapchain_gdi.c
@@ -230,7 +230,7 @@ static HRESULT WINAPI IWineGDISwapChainImpl_Present(IWineD3DSwapChain *iface, CO
     /* FPS support */
     if (TRACE_ON(fps))
     {
-        static long prev_time, frames;
+        static LONG prev_time, frames;
 
         DWORD time = GetTickCount();
         frames++;
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 404768d..b63a5f8 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -337,7 +337,7 @@ static void convert_r8g8_snorm(const BYTE *src, BYTE *dst, UINT pitch, UINT widt
         Dest = dst + y * outpitch;
         for (x = 0; x < width; x++ )
         {
-            long color = (*Source++);
+            LONG color = (*Source++);
             /* B */ Dest[0] = 0xff;
             /* G */ Dest[1] = (color >> 8) + 128; /* V */
             /* R */ Dest[2] = (color) + 128;      /* U */
@@ -362,7 +362,7 @@ static void convert_r8g8_snorm_l8x8_unorm(const BYTE *src, BYTE *dst, UINT pitch
         Dest = dst + y * pitch;
         for (x = 0; x < width; x++ )
         {
-            long color = (*Source++);
+            LONG color = (*Source++);
             /* B */ Dest[0] = ((color >> 16) & 0xff);       /* L */
             /* G */ Dest[1] = ((color >> 8 ) & 0xff) + 128; /* V */
             /* R */ Dest[2] = (color         & 0xff) + 128; /* U */
@@ -386,7 +386,7 @@ static void convert_r8g8_snorm_l8x8_unorm_nv(const BYTE *src, BYTE *dst, UINT pi
         Dest = dst + y * pitch;
         for (x = 0; x < width; x++ )
         {
-            long color = (*Source++);
+            LONG color = (*Source++);
             /* L */ Dest[2] = ((color >> 16) & 0xff);   /* L */
             /* V */ Dest[1] = ((color >> 8 ) & 0xff);   /* V */
             /* U */ Dest[0] = (color         & 0xff);   /* U */
@@ -408,7 +408,7 @@ static void convert_r8g8b8a8_snorm(const BYTE *src, BYTE *dst, UINT pitch, UINT
         Dest = dst + y * pitch;
         for (x = 0; x < width; x++ )
         {
-            long color = (*Source++);
+            LONG color = (*Source++);
             /* B */ Dest[0] = ((color >> 16) & 0xff) + 128; /* W */
             /* G */ Dest[1] = ((color >> 8 ) & 0xff) + 128; /* V */
             /* R */ Dest[2] = (color         & 0xff) + 128; /* U */
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index bc35409..001312d 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1470,7 +1470,7 @@ struct wined3d_adapter
 
 BOOL initPixelFormats(struct wined3d_gl_info *gl_info, enum wined3d_pci_vendor vendor) DECLSPEC_HIDDEN;
 BOOL initPixelFormatsNoGL(struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
-extern long WineD3DAdapterChangeGLRam(IWineD3DDeviceImpl *D3DDevice, long glram) DECLSPEC_HIDDEN;
+extern unsigned int WineD3DAdapterChangeGLRam(IWineD3DDeviceImpl *D3DDevice, unsigned int glram) DECLSPEC_HIDDEN;
 extern void add_gl_compat_wrappers(struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
 
 /*****************************************************************************
@@ -2546,7 +2546,7 @@ struct IWineD3DSwapChainImpl
     BOOL                      render_to_fbo;
     const struct wined3d_format_desc *ds_format;
 
-    long prev_time, frames;   /* Performance tracking */
+    LONG prev_time, frames;   /* Performance tracking */
     unsigned int vSyncCounter;
 
     struct wined3d_context **context;
-- 
1.6.4.4


-- 
Michael Stefaniuc                           Tel.: +49-711-96437-199
Consulting Communications Engineer          Fax.: +49-711-96437-111
--------------------------------------------------------------------
Reg. Adresse: Red Hat GmbH, Otto-Hahn-Strasse 20, 85609 Dornach
Handelsregister: Amtsgericht Muenchen HRB 153243
Geschäftsführer: Brendan Lane, Charlie Peters, Michael Cunningham,
                 Charles Cachera



More information about the wine-patches mailing list