winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
June 2012
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
3 participants
827 discussions
Start a n
N
ew thread
Alexandre Julliard : opengl32: Make the WGL driver context-specific.
by Alexandre Julliard
29 Jun '12
29 Jun '12
Module: wine Branch: master Commit: 83be88953bc5a4fa6d3cd53f81c09f493e2dd86a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=83be88953bc5a4fa6d3cd53f8…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Jun 29 15:53:37 2012 +0200 opengl32: Make the WGL driver context-specific. --- dlls/gdi32/driver.c | 2 +- dlls/opengl32/wgl.c | 83 +++++++++++++++++++++++++++----------------- dlls/winex11.drv/opengl.c | 5 +-- include/wine/gdi_driver.h | 4 +- 4 files changed, 55 insertions(+), 39 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=83be88953bc5a4fa6d3cd…
1
0
0
0
Alexandre Julliard : opengl32: Don' t allow making a thread current in multiple threads.
by Alexandre Julliard
29 Jun '12
29 Jun '12
Module: wine Branch: master Commit: 676194383c0e37644e98586ca0a1a201d3dd2e6a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=676194383c0e37644e98586ca…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Jun 29 15:15:57 2012 +0200 opengl32: Don't allow making a thread current in multiple threads. --- dlls/opengl32/tests/opengl.c | 27 ++++++++++++++++++--------- dlls/opengl32/wgl.c | 36 ++++++++++++++++++++++++++---------- 2 files changed, 44 insertions(+), 19 deletions(-) diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index 03e8ed2..77b4cf5 100644 --- a/dlls/opengl32/tests/opengl.c +++ b/dlls/opengl32/tests/opengl.c @@ -694,24 +694,30 @@ static void test_bitmap_rendering( BOOL use_dib ) struct wgl_thread_param { HANDLE test_finished; + HWND hwnd; HGLRC hglrc; - BOOL hglrc_deleted; - DWORD last_error; + BOOL make_current; + BOOL make_current_error; + BOOL deleted; + DWORD deleted_error; }; static DWORD WINAPI wgl_thread(void *param) { struct wgl_thread_param *p = param; + HDC hdc = GetDC( p->hwnd ); SetLastError(0xdeadbeef); - p->hglrc_deleted = wglDeleteContext(p->hglrc); - p->last_error = GetLastError(); + p->make_current = wglMakeCurrent(hdc, p->hglrc); + p->make_current_error = GetLastError(); + p->deleted = wglDeleteContext(p->hglrc); + p->deleted_error = GetLastError(); + ReleaseDC( p->hwnd, hdc ); SetEvent(p->test_finished); - return 0; } -static void test_deletecontext(HDC hdc) +static void test_deletecontext(HWND hwnd, HDC hdc) { struct wgl_thread_param thread_params; HGLRC hglrc = wglCreateContext(hdc); @@ -740,14 +746,17 @@ static void test_deletecontext(HDC hdc) * This differs from GLX which does allow it but it delays actual deletion until the context becomes not current. */ thread_params.hglrc = hglrc; + thread_params.hwnd = hwnd; thread_params.test_finished = CreateEvent(NULL, FALSE, FALSE, NULL); thread_handle = CreateThread(NULL, 0, wgl_thread, &thread_params, 0, &tid); ok(!!thread_handle, "Failed to create thread, last error %#x.\n", GetLastError()); if(thread_handle) { WaitForSingleObject(thread_handle, INFINITE); - ok(thread_params.hglrc_deleted == FALSE, "Attempt to delete WGL context from another thread passed but should fail!\n"); - ok(thread_params.last_error == ERROR_BUSY, "Expected last error to be ERROR_BUSY, got %u\n", thread_params.last_error); + ok(!thread_params.make_current, "Attempt to make WGL context from another thread passed\n"); + ok(thread_params.make_current_error == ERROR_BUSY, "Expected last error to be ERROR_BUSY, got %u\n", thread_params.make_current_error); + ok(!thread_params.deleted, "Attempt to delete WGL context from another thread passed\n"); + ok(thread_params.deleted_error == ERROR_BUSY, "Expected last error to be ERROR_BUSY, got %u\n", thread_params.deleted_error); } CloseHandle(thread_params.test_finished); @@ -1469,6 +1478,7 @@ START_TEST(opengl) * any WGL call :( On Wine this would work but not on real Windows because there can be different implementations (software, ICD, MCD). */ init_functions(); + test_deletecontext(hwnd, hdc); /* The lack of wglGetExtensionsStringARB in general means broken software rendering or the lack of decent OpenGL support, skip tests in such cases */ if (!pwglGetExtensionsStringARB) { @@ -1477,7 +1487,6 @@ START_TEST(opengl) } test_getprocaddress(hdc); - test_deletecontext(hdc); test_makecurrent(hdc); test_setpixelformat(hdc); test_destroy(hdc); diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 6906b56..d0d9d83 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -223,12 +223,20 @@ BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc) if (hglrc) { if (!(ptr = get_handle_ptr( hglrc ))) return FALSE; - ret = wgl_driver->p_wglMakeCurrent( hdc, ptr->context ); - if (ret) + if (!ptr->tid || ptr->tid == GetCurrentThreadId()) { - if (prev) prev->tid = 0; - ptr->tid = GetCurrentThreadId(); - NtCurrentTeb()->glCurrentRC = hglrc; + ret = wgl_driver->p_wglMakeCurrent( hdc, ptr->context ); + if (ret) + { + if (prev) prev->tid = 0; + ptr->tid = GetCurrentThreadId(); + NtCurrentTeb()->glCurrentRC = hglrc; + } + } + else + { + SetLastError( ERROR_BUSY ); + ret = FALSE; } release_handle_ptr( ptr ); } @@ -278,12 +286,20 @@ static BOOL WINAPI wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, HGLRC h if (hglrc) { if (!(ptr = get_handle_ptr( hglrc ))) return FALSE; - ret = wgl_driver->p_wglMakeContextCurrentARB( draw_hdc, read_hdc, ptr->context ); - if (ret) + if (!ptr->tid || ptr->tid == GetCurrentThreadId()) + { + ret = wgl_driver->p_wglMakeContextCurrentARB( draw_hdc, read_hdc, ptr->context ); + if (ret) + { + if (prev) prev->tid = 0; + ptr->tid = GetCurrentThreadId(); + NtCurrentTeb()->glCurrentRC = hglrc; + } + } + else { - if (prev) prev->tid = 0; - ptr->tid = GetCurrentThreadId(); - NtCurrentTeb()->glCurrentRC = hglrc; + SetLastError( ERROR_BUSY ); + ret = FALSE; } release_handle_ptr( ptr ); }
1
0
0
0
Alexandre Julliard : opengl32: Move checks of the context thread id to opengl32.
by Alexandre Julliard
29 Jun '12
29 Jun '12
Module: wine Branch: master Commit: d89f7f25631850be571ca1a93854d048e9e7c776 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d89f7f25631850be571ca1a93…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Jun 29 14:13:13 2012 +0200 opengl32: Move checks of the context thread id to opengl32. --- dlls/gdi32/driver.c | 3 +- dlls/opengl32/wgl.c | 71 ++++++++++++++++++++++++++++++++++---------- dlls/winex11.drv/opengl.c | 23 +-------------- include/wine/gdi_driver.h | 2 +- 4 files changed, 58 insertions(+), 41 deletions(-) diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index 2b62c46..1dfdbb1 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -682,9 +682,8 @@ static struct wgl_context *nulldrv_wglCreateContextAttribsARB( HDC hdc, struct w return 0; } -static BOOL nulldrv_wglDeleteContext( struct wgl_context *context ) +static void nulldrv_wglDeleteContext( struct wgl_context *context ) { - return FALSE; } static HDC nulldrv_wglGetCurrentDC(void) diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index abd38e1..6906b56 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -86,6 +86,7 @@ extern BOOL WINAPI GdiSwapBuffers( HDC hdc ); struct wgl_handle { UINT handle; + DWORD tid; struct wgl_context *context; }; @@ -110,6 +111,13 @@ static inline HGLRC next_handle( struct wgl_handle *ptr ) return ULongToHandle( ptr->handle ); } +/* the current handle is assumed valid and doesn't need locking */ +static inline struct wgl_handle *get_current_handle_ptr(void) +{ + if (!NtCurrentTeb()->glCurrentRC) return NULL; + return &wgl_handles[LOWORD(NtCurrentTeb()->glCurrentRC)]; +} + static struct wgl_handle *get_handle_ptr( HGLRC handle ) { unsigned int index = LOWORD( handle ); @@ -191,12 +199,15 @@ BOOL WINAPI wglDeleteContext(HGLRC hglrc) struct wgl_handle *ptr = get_handle_ptr( hglrc ); if (!ptr) return FALSE; - if (hglrc == NtCurrentTeb()->glCurrentRC) wglMakeCurrent( 0, 0 ); - if (!wgl_driver->p_wglDeleteContext( ptr->context )) + + if (ptr->tid && ptr->tid != GetCurrentThreadId()) { + SetLastError( ERROR_BUSY ); release_handle_ptr( ptr ); return FALSE; } + if (hglrc == NtCurrentTeb()->glCurrentRC) wglMakeCurrent( 0, 0 ); + wgl_driver->p_wglDeleteContext( ptr->context ); free_handle_ptr( ptr ); return TRUE; } @@ -206,18 +217,32 @@ BOOL WINAPI wglDeleteContext(HGLRC hglrc) */ BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc) { - struct wgl_handle *ptr = NULL; - BOOL ret; + BOOL ret = TRUE; + struct wgl_handle *ptr, *prev = get_current_handle_ptr(); - if (!hglrc && !hdc && !NtCurrentTeb()->glCurrentRC) + if (hglrc) + { + if (!(ptr = get_handle_ptr( hglrc ))) return FALSE; + ret = wgl_driver->p_wglMakeCurrent( hdc, ptr->context ); + if (ret) + { + if (prev) prev->tid = 0; + ptr->tid = GetCurrentThreadId(); + NtCurrentTeb()->glCurrentRC = hglrc; + } + release_handle_ptr( ptr ); + } + else if (prev) + { + if (!wgl_driver->p_wglMakeCurrent( 0, NULL )) return FALSE; + prev->tid = 0; + NtCurrentTeb()->glCurrentRC = 0; + } + else if (!hdc) { SetLastError( ERROR_INVALID_HANDLE ); - return FALSE; + ret = FALSE; } - if (hglrc && !(ptr = get_handle_ptr( hglrc ))) return FALSE; - ret = wgl_driver->p_wglMakeCurrent( hdc, ptr ? ptr->context : NULL ); - if (ret) NtCurrentTeb()->glCurrentRC = hglrc; - release_handle_ptr( ptr ); return ret; } @@ -247,13 +272,27 @@ static HGLRC WINAPI wglCreateContextAttribsARB( HDC hdc, HGLRC share, const int */ static BOOL WINAPI wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, HGLRC hglrc ) { - struct wgl_handle *ptr = NULL; - BOOL ret; + BOOL ret = TRUE; + struct wgl_handle *ptr, *prev = get_current_handle_ptr(); - if (hglrc && !(ptr = get_handle_ptr( hglrc ))) return FALSE; - ret = wgl_driver->p_wglMakeContextCurrentARB( draw_hdc, read_hdc, ptr ? ptr->context : NULL ); - if (ret) NtCurrentTeb()->glCurrentRC = hglrc; - release_handle_ptr( ptr ); + if (hglrc) + { + if (!(ptr = get_handle_ptr( hglrc ))) return FALSE; + ret = wgl_driver->p_wglMakeContextCurrentARB( draw_hdc, read_hdc, ptr->context ); + if (ret) + { + if (prev) prev->tid = 0; + ptr->tid = GetCurrentThreadId(); + NtCurrentTeb()->glCurrentRC = hglrc; + } + release_handle_ptr( ptr ); + } + else if (prev) + { + if (!wgl_driver->p_wglMakeCurrent( 0, NULL )) return FALSE; + prev->tid = 0; + NtCurrentTeb()->glCurrentRC = 0; + } return ret; } diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index e87fe5d..c278c46 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -115,7 +115,6 @@ struct wgl_context HDC hdc; BOOL has_been_current; BOOL sharing; - DWORD tid; BOOL gl3_context; XVisualInfo *vis; WineGLPixelFormat *fmt; @@ -1453,18 +1452,10 @@ static struct wgl_context *glxdrv_wglCreateContext( HDC hdc ) /*********************************************************************** * glxdrv_wglDeleteContext */ -static BOOL glxdrv_wglDeleteContext(struct wgl_context *ctx) +static void glxdrv_wglDeleteContext(struct wgl_context *ctx) { TRACE("(%p)\n", ctx); - /* WGL doesn't allow deletion of a context which is current in another thread */ - if (ctx->tid != 0 && ctx->tid != GetCurrentThreadId()) - { - TRACE("Cannot delete context=%p because it is current in another thread.\n", ctx); - SetLastError(ERROR_BUSY); - return FALSE; - } - wine_tsx11_lock(); list_remove( &ctx->entry ); if (ctx->ctx) pglXDestroyContext( gdi_display, ctx->ctx ); @@ -1474,7 +1465,6 @@ static BOOL glxdrv_wglDeleteContext(struct wgl_context *ctx) wine_tsx11_unlock(); HeapFree( GetProcessHeap(), 0, ctx ); - return TRUE; } /** @@ -1551,15 +1541,12 @@ static GLXPixmap get_context_pixmap( HDC hdc, struct wgl_context *ctx ) static BOOL glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx) { BOOL ret; - struct wgl_context *prev_ctx = NtCurrentTeb()->glContext; struct x11drv_escape_get_drawable escape; TRACE("(%p,%p)\n", hdc, ctx); if (!ctx) { - if (prev_ctx) prev_ctx->tid = 0; - wine_tsx11_lock(); ret = pglXMakeCurrent(gdi_display, None, NULL); wine_tsx11_unlock(); @@ -1603,11 +1590,9 @@ static BOOL glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx) if (ret) { - if (prev_ctx) prev_ctx->tid = 0; NtCurrentTeb()->glContext = ctx; ctx->has_been_current = TRUE; - ctx->tid = GetCurrentThreadId(); ctx->hdc = hdc; ctx->read_hdc = hdc; ctx->drawables[0] = escape.drawable; @@ -1629,7 +1614,6 @@ static BOOL glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx) */ static BOOL glxdrv_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct wgl_context *ctx ) { - struct wgl_context *prev_ctx = NtCurrentTeb()->glContext; struct x11drv_escape_get_drawable escape_draw, escape_read; BOOL ret; @@ -1637,8 +1621,6 @@ static BOOL glxdrv_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct if (!ctx) { - if (prev_ctx) prev_ctx->tid = 0; - wine_tsx11_lock(); ret = pglXMakeCurrent(gdi_display, None, NULL); wine_tsx11_unlock(); @@ -1673,10 +1655,7 @@ static BOOL glxdrv_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct ret = pglXMakeContextCurrent(gdi_display, escape_draw.drawable, escape_read.drawable, ctx->ctx); if (ret) { - if (prev_ctx) prev_ctx->tid = 0; - ctx->has_been_current = TRUE; - ctx->tid = GetCurrentThreadId(); ctx->hdc = draw_hdc; ctx->read_hdc = read_hdc; ctx->drawables[0] = escape_draw.drawable; diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 4626371..22214f2 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -234,7 +234,7 @@ struct wgl_funcs BOOL (*p_wglCopyContext)(struct wgl_context*,struct wgl_context*,UINT); struct wgl_context* (*p_wglCreateContext)(HDC); struct wgl_context* (*p_wglCreateContextAttribsARB)(HDC,struct wgl_context*,const int*); - BOOL (*p_wglDeleteContext)(struct wgl_context*); + void (*p_wglDeleteContext)(struct wgl_context*); HDC (*p_wglGetCurrentDC)(void); PROC (*p_wglGetProcAddress)(LPCSTR); BOOL (*p_wglMakeContextCurrentARB)(HDC,HDC,struct wgl_context*);
1
0
0
0
Alexandre Julliard : opengl32: Use proper handles for GL contexts and pass a context pointer to the WGL driver functions .
by Alexandre Julliard
29 Jun '12
29 Jun '12
Module: wine Branch: master Commit: 0045ec9dfb29a36e7b00357c90f3b57f642506e1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0045ec9dfb29a36e7b00357c9…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Jun 29 12:29:55 2012 +0200 opengl32: Use proper handles for GL contexts and pass a context pointer to the WGL driver functions. --- dlls/gdi32/driver.c | 15 ++-- dlls/opengl32/tests/opengl.c | 2 +- dlls/opengl32/wgl.c | 168 ++++++++++++++++++++++++++++++++++++------ dlls/winex11.drv/opengl.c | 107 ++++++++++----------------- include/wine/gdi_driver.h | 24 +++--- 5 files changed, 206 insertions(+), 110 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=0045ec9dfb29a36e7b003…
1
0
0
0
Dmitry Timoshkov : gdiplus: Add a bunch of tests for TIFF image properties.
by Alexandre Julliard
29 Jun '12
29 Jun '12
Module: wine Branch: master Commit: f88231b96ba2761a5e5354108919f71d3b130099 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f88231b96ba2761a5e5354108…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Thu Jun 28 13:28:34 2012 +0900 gdiplus: Add a bunch of tests for TIFF image properties. --- dlls/gdiplus/tests/image.c | 251 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 251 insertions(+), 0 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=f88231b96ba2761a5e535…
1
0
0
0
Dmitry Timoshkov : gdiplus: Add some tests for GdipGetPropertyItemSize and GdipGetPropertyItem.
by Alexandre Julliard
29 Jun '12
29 Jun '12
Module: wine Branch: master Commit: 0c681b1478838a627443656a6784cb67adf9d84b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0c681b1478838a627443656a6…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Thu Jun 28 13:27:39 2012 +0900 gdiplus: Add some tests for GdipGetPropertyItemSize and GdipGetPropertyItem. --- dlls/gdiplus/tests/image.c | 99 ++++++++++++++++++++++++++++++++++++++------ 1 files changed, 86 insertions(+), 13 deletions(-) diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index c373f13..274098f 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -21,6 +21,7 @@ #define COBJMACROS #include <math.h> +#include <assert.h> #include "initguid.h" #include "windows.h" @@ -2711,22 +2712,32 @@ static void test_image_properties(void) UINT image_size; ImageType image_type; UINT prop_count; + UINT prop_count2; /* if win7 behaves differently */ + /* 1st property attributes */ + UINT prop_size; + UINT prop_size2; /* if win7 behaves differently */ + UINT prop_id; + UINT prop_id2; /* if win7 behaves differently */ } td[] = { - { pngimage, sizeof(pngimage), ImageTypeBitmap, 4 }, - /* Win7 reports 4 properties, while everybody else just 1 - { gifimage, sizeof(gifimage), ImageTypeBitmap, 1 }, */ - { jpgimage, sizeof(jpgimage), ImageTypeBitmap, 2 }, - { tiffimage, sizeof(tiffimage), ImageTypeBitmap, 16 }, - { bmpimage, sizeof(bmpimage), ImageTypeBitmap, 0 }, - { wmfimage, sizeof(wmfimage), ImageTypeMetafile, 0 } + { pngimage, sizeof(pngimage), ImageTypeBitmap, 4, ~0, 1, 20, 0x5110, 0x132 }, + { gifimage, sizeof(gifimage), ImageTypeBitmap, 1, 4, 4, 0, 0x5100, 0 }, + { jpgimage, sizeof(jpgimage), ImageTypeBitmap, 2, ~0, 128, 0, 0x5090, 0x5091 }, + { tiffimage, sizeof(tiffimage), ImageTypeBitmap, 16, 0, 4, 0, 0xfe, 0 }, + { bmpimage, sizeof(bmpimage), ImageTypeBitmap, 0, 0, 0, 0, 0, 0 }, + { wmfimage, sizeof(wmfimage), ImageTypeMetafile, 0, 0, 0, 0, 0, 0 } }; GpStatus status; GpImage *image; - UINT prop_count, i; - PROPID prop_id[16]; + UINT prop_count, prop_size, i; + PROPID prop_id[16] = { 0 }; ImageType image_type; + union + { + PropertyItem data; + char buf[256]; + } item; for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) { @@ -2744,12 +2755,35 @@ static void test_image_properties(void) if (td[i].image_data == pngimage || td[i].image_data == gifimage || td[i].image_data == jpgimage) todo_wine - ok(td[i].prop_count == prop_count, " %u: expected property count %u, got %u\n", - i, td[i].prop_count, prop_count); + ok(td[i].prop_count == prop_count || td[i].prop_count2 == prop_count, + " %u: expected property count %u or %u, got %u\n", + i, td[i].prop_count, td[i].prop_count2, prop_count); + else + ok(td[i].prop_count == prop_count || td[i].prop_count2 == prop_count, + " %u: expected property count %u or %u, got %u\n", + i, td[i].prop_count, td[i].prop_count2, prop_count); + + status = GdipGetPropertyItemSize(NULL, 0, &prop_size); + expect(InvalidParameter, status); + status = GdipGetPropertyItemSize(image, 0, NULL); + expect(InvalidParameter, status); + status = GdipGetPropertyItemSize(image, 0, &prop_size); + if (image_type == ImageTypeMetafile) + expect(NotImplemented, status); else - ok(td[i].prop_count == prop_count, " %u: expected property count %u, got %u\n", - i, td[i].prop_count, prop_count); + expect(PropertyNotFound, status); + status = GdipGetPropertyItem(NULL, 0, 0, &item.data); + expect(InvalidParameter, status); + status = GdipGetPropertyItem(image, 0, 0, NULL); + expect(InvalidParameter, status); + status = GdipGetPropertyItem(image, 0, 0, &item.data); + if (image_type == ImageTypeMetafile) + expect(NotImplemented, status); + else + expect(PropertyNotFound, status); + + /* FIXME: remove once Wine is fixed */ if (td[i].prop_count != prop_count) { GdipDisposeImage(image); @@ -2781,7 +2815,46 @@ static void test_image_properties(void) if (image_type == ImageTypeMetafile) expect(NotImplemented, status); else + { expect(Ok, status); + if (prop_count != 0) + ok(td[i].prop_id == prop_id[0] || td[i].prop_id2 == prop_id[0], + " %u: expected property id %#x or %#x, got %#x\n", + i, td[i].prop_id, td[i].prop_id2, prop_id[0]); + } + + if (status == Ok) + { + status = GdipGetPropertyItemSize(image, prop_id[0], &prop_size); + if (prop_count == 0) + expect(PropertyNotFound, status); + else + { + expect(Ok, status); + + assert(sizeof(item) >= prop_size); + ok(prop_size > sizeof(PropertyItem), "%u: got too small prop_size %u\n", + i, prop_size); + ok(td[i].prop_size + sizeof(PropertyItem) == prop_size || + td[i].prop_size2 + sizeof(PropertyItem) == prop_size, + " %u: expected property size %u or %u, got %u\n", + i, td[i].prop_size, td[i].prop_size2, prop_size); + + status = GdipGetPropertyItem(image, prop_id[0], 0, &item.data); + ok(status == InvalidParameter || status == GenericError /* Win7 */, + "%u: expected InvalidParameter, got %d\n", i, status); + status = GdipGetPropertyItem(image, prop_id[0], prop_size - 1, &item.data); + ok(status == InvalidParameter || status == GenericError /* Win7 */, + "%u: expected InvalidParameter, got %d\n", i, status); + status = GdipGetPropertyItem(image, prop_id[0], prop_size + 1, &item.data); + ok(status == InvalidParameter || status == GenericError /* Win7 */, + "%u: expected InvalidParameter, got %d\n", i, status); + status = GdipGetPropertyItem(image, prop_id[0], prop_size, &item.data); + expect(Ok, status); + ok(prop_id[0] == item.data.id, + "%u: expected property id %#x, got %#x\n", i, prop_id[0], item.data.id); + } + } GdipDisposeImage(image); }
1
0
0
0
Dmitry Timoshkov : gdiplus: Implement GdipGetPropertyItem.
by Alexandre Julliard
29 Jun '12
29 Jun '12
Module: wine Branch: master Commit: 670445b22b9ce027bc35c40359499447ef4f8632 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=670445b22b9ce027bc35c4035…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Thu Jun 28 13:26:49 2012 +0900 gdiplus: Implement GdipGetPropertyItem. --- dlls/gdiplus/image.c | 144 +++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 131 insertions(+), 13 deletions(-) diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 63f3a65..d1affae 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -2475,19 +2475,6 @@ GpStatus WINGDIPAPI GdipGetPropertyIdList(GpImage *image, UINT num, PROPID *list return hr == S_OK ? Ok : hresult_to_status(hr); } -GpStatus WINGDIPAPI GdipGetPropertyItem(GpImage *image, PROPID id, UINT size, - PropertyItem* buffer) -{ - static int calls; - - TRACE("(%p, %u, %u, %p)\n", image, id, size, buffer); - - if(!(calls++)) - FIXME("not implemented\n"); - - return InvalidParameter; -} - static UINT propvariant_size(PROPVARIANT *value) { switch (value->vt & ~VT_VECTOR) @@ -2553,6 +2540,137 @@ GpStatus WINGDIPAPI GdipGetPropertyItemSize(GpImage *image, PROPID propid, UINT return Ok; } +#ifndef PropertyTagTypeSByte +#define PropertyTagTypeSByte 6 +#define PropertyTagTypeSShort 8 +#define PropertyTagTypeFloat 11 +#define PropertyTagTypeDouble 12 +#endif + +static UINT vt_to_itemtype(UINT vt) +{ + static const struct + { + UINT vt, type; + } vt2type[] = + { + { VT_I1, PropertyTagTypeSByte }, + { VT_UI1, PropertyTagTypeByte }, + { VT_I2, PropertyTagTypeSShort }, + { VT_UI2, PropertyTagTypeShort }, + { VT_I4, PropertyTagTypeSLONG }, + { VT_UI4, PropertyTagTypeLong }, + { VT_I8, PropertyTagTypeSRational }, + { VT_UI8, PropertyTagTypeRational }, + { VT_R4, PropertyTagTypeFloat }, + { VT_R8, PropertyTagTypeDouble }, + { VT_LPSTR, PropertyTagTypeASCII }, + { VT_BLOB, PropertyTagTypeUndefined } + }; + UINT i; + for (i = 0; i < sizeof(vt2type)/sizeof(vt2type[0]); i++) + { + if (vt2type[i].vt == vt) return vt2type[i].type; + } + FIXME("not supported variant type %u\n", vt); + return 0; +} + +static GpStatus propvariant_to_item(PROPVARIANT *value, PropertyItem *item, + UINT size, PROPID id) +{ + UINT item_size, item_type; + + item_size = propvariant_size(value); + if (size != item_size + sizeof(PropertyItem)) return InvalidParameter; + + item_type = vt_to_itemtype(value->vt & ~VT_VECTOR); + if (!item_type) return InvalidParameter; + + item->value = item + 1; + + switch (value->vt & ~VT_VECTOR) + { + case VT_I1: + case VT_UI1: + if (!(value->vt & VT_VECTOR)) + *(BYTE *)item->value = value->u.bVal; + else + memcpy(item->value, value->u.caub.pElems, item_size); + break; + case VT_I2: + case VT_UI2: + if (!(value->vt & VT_VECTOR)) + *(USHORT *)item->value = value->u.uiVal; + else + memcpy(item->value, value->u.caui.pElems, item_size); + break; + case VT_I4: + case VT_UI4: + case VT_R4: + if (!(value->vt & VT_VECTOR)) + *(ULONG *)item->value = value->u.ulVal; + else + memcpy(item->value, value->u.caul.pElems, item_size); + break; + case VT_I8: + case VT_UI8: + case VT_R8: + if (!(value->vt & VT_VECTOR)) + *(ULONGLONG *)item->value = value->u.uhVal.QuadPart; + else + memcpy(item->value, value->u.cauh.pElems, item_size); + break; + case VT_LPSTR: + memcpy(item->value, value->u.pszVal, item_size); + break; + case VT_BLOB: + memcpy(item->value, value->u.blob.pBlobData, item_size); + break; + default: + FIXME("not supported variant type %d\n", value->vt); + return InvalidParameter; + } + + item->length = item_size; + item->type = item_type; + item->id = id; + + return Ok; +} + +GpStatus WINGDIPAPI GdipGetPropertyItem(GpImage *image, PROPID propid, UINT size, + PropertyItem *buffer) +{ + GpStatus stat; + HRESULT hr; + IWICMetadataReader *reader; + PROPVARIANT id, value; + + TRACE("(%p,%#x,%u,%p)\n", image, propid, size, buffer); + + if (!image || !buffer) return InvalidParameter; + + if (image->type != ImageTypeBitmap) + { + FIXME("Not implemented for type %d\n", image->type); + return NotImplemented; + } + + reader = ((GpBitmap *)image)->metadata_reader; + if (!reader) return PropertyNotFound; + + id.vt = VT_UI2; + id.u.uiVal = propid; + hr = IWICMetadataReader_GetValue(reader, NULL, &id, &value); + if (FAILED(hr)) return PropertyNotFound; + + stat = propvariant_to_item(&value, buffer, size, propid); + PropVariantClear(&value); + + return stat; +} + GpStatus WINGDIPAPI GdipGetPropertySize(GpImage *image, UINT* size, UINT* num) { static int calls;
1
0
0
0
Dmitry Timoshkov : gdiplus: Implement GdipGetPropertyItemSize.
by Alexandre Julliard
29 Jun '12
29 Jun '12
Module: wine Branch: master Commit: 9d953c5f793174d28f20df6c5a378ea09f01aeaf URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9d953c5f793174d28f20df6c5…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Thu Jun 28 13:25:57 2012 +0900 gdiplus: Implement GdipGetPropertyItemSize. --- dlls/gdiplus/image.c | 67 +++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 58 insertions(+), 9 deletions(-) diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index e676a4e..63f3a65 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -2488,20 +2488,69 @@ GpStatus WINGDIPAPI GdipGetPropertyItem(GpImage *image, PROPID id, UINT size, return InvalidParameter; } -GpStatus WINGDIPAPI GdipGetPropertyItemSize(GpImage *image, PROPID pid, - UINT* size) +static UINT propvariant_size(PROPVARIANT *value) { - static int calls; + switch (value->vt & ~VT_VECTOR) + { + case VT_EMPTY: + return 0; + case VT_I1: + case VT_UI1: + if (!(value->vt & VT_VECTOR)) return 1; + return value->u.caub.cElems; + case VT_I2: + case VT_UI2: + if (!(value->vt & VT_VECTOR)) return 2; + return value->u.caui.cElems * 2; + case VT_I4: + case VT_UI4: + case VT_R4: + if (!(value->vt & VT_VECTOR)) return 4; + return value->u.caul.cElems * 4; + case VT_I8: + case VT_UI8: + case VT_R8: + if (!(value->vt & VT_VECTOR)) return 8; + return value->u.cauh.cElems * 8; + case VT_LPSTR: + return value->u.pszVal ? strlen(value->u.pszVal) + 1 : 0; + case VT_BLOB: + return value->u.blob.cbSize; + default: + FIXME("not supported variant type %d\n", value->vt); + return 0; + } +} - TRACE("%p %x %p\n", image, pid, size); +GpStatus WINGDIPAPI GdipGetPropertyItemSize(GpImage *image, PROPID propid, UINT *size) +{ + HRESULT hr; + IWICMetadataReader *reader; + PROPVARIANT id, value; - if(!size || !image) - return InvalidParameter; + TRACE("(%p,%#x,%p)\n", image, propid, size); - if(!(calls++)) - FIXME("not implemented\n"); + if (!size || !image) return InvalidParameter; - return NotImplemented; + if (image->type != ImageTypeBitmap) + { + FIXME("Not implemented for type %d\n", image->type); + return NotImplemented; + } + + reader = ((GpBitmap *)image)->metadata_reader; + if (!reader) return PropertyNotFound; + + id.vt = VT_UI2; + id.u.uiVal = propid; + hr = IWICMetadataReader_GetValue(reader, NULL, &id, &value); + if (FAILED(hr)) return PropertyNotFound; + + *size = propvariant_size(&value); + if (*size) *size += sizeof(PropertyItem); + PropVariantClear(&value); + + return Ok; } GpStatus WINGDIPAPI GdipGetPropertySize(GpImage *image, UINT* size, UINT* num)
1
0
0
0
Dmitry Timoshkov : windowscodecs: Implement MetadataHandler_GetValue.
by Alexandre Julliard
29 Jun '12
29 Jun '12
Module: wine Branch: master Commit: 8b30ef11cf9a5bd7ffc1b0c22b8681dfa68dfefa URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8b30ef11cf9a5bd7ffc1b0c22…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Thu Jun 28 13:25:05 2012 +0900 windowscodecs: Implement MetadataHandler_GetValue. --- dlls/windowscodecs/metadatahandler.c | 79 ++++++++++++++++++++++++++++++++- dlls/windowscodecs/tests/metadata.c | 41 +++++++++++++++++- 2 files changed, 116 insertions(+), 4 deletions(-) diff --git a/dlls/windowscodecs/metadatahandler.c b/dlls/windowscodecs/metadatahandler.c index a3eea1f..7072a95 100644 --- a/dlls/windowscodecs/metadatahandler.c +++ b/dlls/windowscodecs/metadatahandler.c @@ -213,11 +213,84 @@ static HRESULT WINAPI MetadataHandler_GetValueByIndex(IWICMetadataWriter *iface, return hr; } +static BOOL get_int_value(const PROPVARIANT *pv, LONGLONG *value) +{ + switch (pv->vt) + { + case VT_NULL: + case VT_EMPTY: + *value = 0; + break; + case VT_I1: + *value = pv->u.cVal; + break; + case VT_UI1: + *value = pv->u.bVal; + break; + case VT_I2: + *value = pv->u.iVal; + break; + case VT_UI2: + *value = pv->u.uiVal; + break; + case VT_I4: + *value = pv->u.lVal; + break; + case VT_UI4: + *value = pv->u.ulVal; + break; + case VT_I8: + case VT_UI8: + *value = pv->u.hVal.QuadPart; + break; + default: + FIXME("not supported variant type %d\n", pv->vt); + return FALSE; + } + return TRUE; +} + +/* FiXME: Use propsys.PropVariantCompareEx once it's implemented */ +static int propvar_cmp(const PROPVARIANT *v1, const PROPVARIANT *v2) +{ + LONGLONG value1, value2; + + if (!get_int_value(v1, &value1)) return -1; + if (!get_int_value(v2, &value2)) return -1; + + value1 -= value2; + if (value1) return value1 < 0 ? -1 : 1; + return 0; +} + static HRESULT WINAPI MetadataHandler_GetValue(IWICMetadataWriter *iface, - const PROPVARIANT *pvarSchema, const PROPVARIANT *pvarId, PROPVARIANT *pvarValue) + const PROPVARIANT *schema, const PROPVARIANT *id, PROPVARIANT *value) { - FIXME("(%p,%p,%p,%p): stub\n", iface, pvarSchema, pvarId, pvarValue); - return E_NOTIMPL; + UINT i; + HRESULT hr = WINCODEC_ERR_PROPERTYNOTFOUND; + MetadataHandler *This = impl_from_IWICMetadataWriter(iface); + + TRACE("(%p,%p,%p,%p)\n", iface, schema, id, value); + + if (!id) return E_INVALIDARG; + + EnterCriticalSection(&This->lock); + + for (i = 0; i < This->item_count; i++) + { + if (schema && This->items[i].schema.vt != VT_EMPTY) + { + if (propvar_cmp(schema, &This->items[i].schema) != 0) continue; + } + + if (propvar_cmp(id, &This->items[i].id) != 0) continue; + + hr = value ? PropVariantCopy(value, &This->items[i].value) : S_OK; + break; + } + + LeaveCriticalSection(&This->lock); + return hr; } static HRESULT WINAPI MetadataHandler_GetEnumerator(IWICMetadataWriter *iface, diff --git a/dlls/windowscodecs/tests/metadata.c b/dlls/windowscodecs/tests/metadata.c index 76fd241..d3b2869 100644 --- a/dlls/windowscodecs/tests/metadata.c +++ b/dlls/windowscodecs/tests/metadata.c @@ -726,7 +726,46 @@ static void test_metadata_IFD(void) PropVariantClear(&value); hr = IWICMetadataReader_GetValueByIndex(reader, count, &schema, NULL, NULL); - ok(hr == E_INVALIDARG, "GetValueByIndex should fail\n"); + ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr); + + PropVariantInit(&schema); + PropVariantInit(&id); + PropVariantInit(&value); + + hr = IWICMetadataReader_GetValue(reader, &schema, &id, &value); + ok(hr == WINCODEC_ERR_PROPERTYNOTFOUND, "expected WINCODEC_ERR_PROPERTYNOTFOUND, got %#x\n", hr); + + hr = IWICMetadataReader_GetValue(reader, NULL, &id, NULL); + ok(hr == WINCODEC_ERR_PROPERTYNOTFOUND, "expected WINCODEC_ERR_PROPERTYNOTFOUND, got %#x\n", hr); + + hr = IWICMetadataReader_GetValue(reader, &schema, NULL, NULL); + ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr); + + hr = IWICMetadataReader_GetValue(reader, &schema, &id, NULL); + ok(hr == WINCODEC_ERR_PROPERTYNOTFOUND, "expected WINCODEC_ERR_PROPERTYNOTFOUND, got %#x\n", hr); + + hr = IWICMetadataReader_GetValue(reader, &schema, NULL, &value); + ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr); + + id.vt = VT_UI2; + U(id).uiVal = 0xf00e; + hr = IWICMetadataReader_GetValue(reader, NULL, &id, NULL); + ok(hr == S_OK, "GetValue error %#x\n", hr); + + /* schema is ignored by Ifd metadata reader */ + schema.vt = VT_UI4; + U(schema).ulVal = 0xdeadbeef; + hr = IWICMetadataReader_GetValue(reader, &schema, &id, &value); + ok(hr == S_OK, "GetValue error %#x\n", hr); + ok(value.vt == VT_LPSTR, "unexpected vt: %i\n", id.vt); + ok(!strcmp(U(value).pszVal, "Hello World!"), "unexpected value: %s\n", U(value).pszVal); + PropVariantClear(&value); + + hr = IWICMetadataReader_GetValue(reader, NULL, &id, &value); + ok(hr == S_OK, "GetValue error %#x\n", hr); + ok(value.vt == VT_LPSTR, "unexpected vt: %i\n", id.vt); + ok(!strcmp(U(value).pszVal, "Hello World!"), "unexpected value: %s\n", U(value).pszVal); + PropVariantClear(&value); hr = IWICMetadataReader_QueryInterface(reader, &IID_IWICMetadataBlockReader, (void**)&blockreader); ok(hr == E_NOINTERFACE, "QueryInterface failed, hr=%x\n", hr);
1
0
0
0
Dmitry Timoshkov : include/basetsd.h: Fix int64 to int truncation warnings when compiling with a 64-bit PSDK compiler .
by Alexandre Julliard
29 Jun '12
29 Jun '12
Module: wine Branch: master Commit: 79969b6cc4bed59e7c24f03a001776b3816d9b5e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=79969b6cc4bed59e7c24f03a0…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Thu Jun 28 19:12:31 2012 +0900 include/basetsd.h: Fix int64 to int truncation warnings when compiling with a 64-bit PSDK compiler. --- include/basetsd.h | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/basetsd.h b/include/basetsd.h index 698dd5c..4a59897 100644 --- a/include/basetsd.h +++ b/include/basetsd.h @@ -153,12 +153,12 @@ typedef unsigned int UHALF_PTR, *PUHALF_PTR; static inline ULONG32 HandleToULong(const void *h) { - return (ULONG_PTR)h; + return (ULONG32)(ULONG_PTR)h; } static inline LONG32 HandleToLong(const void *h) { - return (LONG_PTR)h; + return (LONG32)(LONG_PTR)h; } static inline void *ULongToHandle(ULONG32 ul) @@ -173,32 +173,32 @@ static inline void *LongToHandle(LONG32 l) static inline ULONG32 PtrToUlong(const void *p) { - return (ULONG_PTR)p; + return (ULONG32)(ULONG_PTR)p; } static inline LONG32 PtrToLong(const void *p) { - return (LONG_PTR)p; + return (LONG32)(LONG_PTR)p; } static inline UINT32 PtrToUint(const void *p) { - return (UINT_PTR)p; + return (UINT32)(UINT_PTR)p; } static inline INT32 PtrToInt(const void *p) { - return (INT_PTR)p; + return (INT32)(INT_PTR)p; } static inline UINT16 PtrToUshort(const void *p) { - return (ULONG_PTR)p; + return (UINT16)(ULONG_PTR)p; } static inline INT16 PtrToShort(const void *p) { - return (LONG_PTR)p; + return (INT16)(LONG_PTR)p; } static inline void *IntToPtr(INT32 i)
1
0
0
0
← Newer
1
2
3
4
5
6
...
83
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
Results per page:
10
25
50
100
200