1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

fix some warnings

This commit is contained in:
FunkyFr3sh 2023-10-22 11:46:13 +02:00
parent 9b259d4ec6
commit 589b422d93
8 changed files with 24 additions and 13 deletions

View File

@ -159,7 +159,13 @@ ULONG __stdcall IDirectDraw__AddRef(IDirectDrawImpl* This)
{
TRACE("-> %s(This=%p)\n", __FUNCTION__, This);
ULONG ret = ++This->ref;
#ifdef _DEBUG
ULONG glob_ref = dd_AddRef();
#else
dd_AddRef();
#endif
TRACE("<- %s(This ref=%u, global ref=%u)\n", __FUNCTION__, ret, glob_ref);
return ret;
}
@ -177,7 +183,11 @@ ULONG __stdcall IDirectDraw__Release(IDirectDrawImpl* This)
HeapFree(GetProcessHeap(), 0, This);
}
#ifdef _DEBUG
ULONG glob_ref = dd_Release();
#else
dd_Release();
#endif
TRACE("<- %s(This ref=%u, global ref=%u)\n", __FUNCTION__, ret, glob_ref);
return ret;

View File

@ -753,13 +753,13 @@ HRESULT dds_Flip(IDirectDrawSurfaceImpl* This, IDirectDrawSurfaceImpl* lpDDSurfa
IDirectDrawSurfaceImpl* backbuffer = lpDDSurfaceTargetOverride ? lpDDSurfaceTargetOverride : This->backbuffer;
void* buf = InterlockedExchangePointer(&This->surface, backbuffer->surface);
HBITMAP bitmap = (HBITMAP)InterlockedExchangePointer(&This->bitmap, backbuffer->bitmap);
HDC dc = (HDC)InterlockedExchangePointer(&This->hdc, backbuffer->hdc);
HBITMAP bitmap = (HBITMAP)InterlockedExchangePointer((void*)&This->bitmap, backbuffer->bitmap);
HDC dc = (HDC)InterlockedExchangePointer((void*)&This->hdc, backbuffer->hdc);
HANDLE map = (HANDLE)InterlockedExchangePointer(&This->mapping, backbuffer->mapping);
InterlockedExchangePointer(&backbuffer->surface, buf);
InterlockedExchangePointer(&backbuffer->bitmap, bitmap);
InterlockedExchangePointer(&backbuffer->hdc, dc);
InterlockedExchangePointer((void*)&backbuffer->bitmap, bitmap);
InterlockedExchangePointer((void*)&backbuffer->hdc, dc);
InterlockedExchangePointer(&backbuffer->mapping, map);
if (g_config.flipclear)

View File

@ -16,11 +16,12 @@ LPTOP_LEVEL_EXCEPTION_FILTER g_dbg_exception_filter;
static LONGLONG g_dbg_counter_start_time = 0;
static double g_dbg_counter_freq = 0.0;
static int g_dbg_crash_count = 0;
static FILE* g_dbg_log_file;
static BOOL g_dbg_log_rotate;
#if _DEBUG
#ifdef _DEBUG
static int g_dbg_crash_count = 0;
int dbg_exception_handler(EXCEPTION_POINTERS* exception)
{
g_dbg_crash_count++;

View File

@ -617,7 +617,7 @@ DWORD WINAPI d3d9_render_main(void)
if (g_config.fixchilds)
{
g_ddraw->child_window_exists = FALSE;
InterlockedExchangePointer(&g_ddraw->video_window_hwnd, NULL);
InterlockedExchangePointer((void*)&g_ddraw->video_window_hwnd, NULL);
EnumChildWindows(g_ddraw->hwnd, util_enum_child_proc, (LPARAM)g_ddraw->primary);
if (g_ddraw->render.width != g_ddraw->width || g_ddraw->render.height != g_ddraw->height)

View File

@ -84,7 +84,7 @@ DWORD WINAPI gdi_render_main(void)
if (g_config.fixchilds)
{
g_ddraw->child_window_exists = FALSE;
InterlockedExchangePointer(&g_ddraw->video_window_hwnd, NULL);
InterlockedExchangePointer((void*)&g_ddraw->video_window_hwnd, NULL);
EnumChildWindows(g_ddraw->hwnd, util_enum_child_proc, (LPARAM)g_ddraw->primary);
}

View File

@ -156,7 +156,7 @@ static void ogl_build_programs()
{
char shader_path[MAX_PATH] = { 0 };
strncpy(shader_path, g_config.shader, sizeof(shader_path) - 1);
strncpy(shader_path, g_config.shader, sizeof(shader_path));
if (GetFileAttributes(shader_path) == INVALID_FILE_ATTRIBUTES)
{
@ -770,7 +770,7 @@ static void ogl_render()
if (g_config.fixchilds)
{
g_ddraw->child_window_exists = FALSE;
InterlockedExchangePointer(&g_ddraw->video_window_hwnd, NULL);
InterlockedExchangePointer((void*)&g_ddraw->video_window_hwnd, NULL);
EnumChildWindows(g_ddraw->hwnd, util_enum_child_proc, (LPARAM)g_ddraw->primary);
if (g_ddraw->render.width != g_ddraw->width || g_ddraw->render.height != g_ddraw->height)

View File

@ -162,7 +162,7 @@ BOOL ss_take_screenshot(IDirectDrawSurfaceImpl* src)
}
else if (src->bpp == 16)
{
if (!ss_screenshot_bmp(filename, src))
if (!ss_screenshot_16bit(filename, src))
return ss_screenshot_bmp(filename, src);
return TRUE;
@ -187,7 +187,7 @@ static BOOL ss_screenshot_bmp(char* filename, IDirectDrawSurfaceImpl* src)
if (_strcmpi(ext, ".png") == 0)
{
strncpy(ext, ".bmp", 4);
strncpy(ext, ".bmp", 5);
}
// Create the .BMP file.

View File

@ -501,7 +501,7 @@ BOOL CALLBACK util_enum_child_proc(HWND hwnd, LPARAM lparam)
{
if (g_config.fixchilds != FIX_CHILDS_DETECT_HIDE)
{
InterlockedExchangePointer(&g_ddraw->video_window_hwnd, hwnd);
InterlockedExchangePointer((void*)&g_ddraw->video_window_hwnd, hwnd);
}
LONG style = real_GetWindowLongA(hwnd, GWL_EXSTYLE);