From f157272bee862bfded39895d99cb61fe61282590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 11 Mar 2006 15:13:19 +0000 Subject: [PATCH] * You are supposed to free() the mode list returned by BScreen::GetModeList(), and not to delete it. * The header didn't include everything it needed. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16702 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/graphics/radeon/multimon.h | 7 ++- src/preferences/screen/multimon.cpp | 51 +++++++++++----------- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/headers/private/graphics/radeon/multimon.h b/headers/private/graphics/radeon/multimon.h index fbc57a39ef..f745d1a2d4 100644 --- a/headers/private/graphics/radeon/multimon.h +++ b/headers/private/graphics/radeon/multimon.h @@ -6,10 +6,13 @@ Multi-Monitor Settings interface */ - #ifndef _MULTIMON_H #define _MULTIMON_H + +#include + + class BScreen; status_t GetSwapDisplays( BScreen *screen, bool *swap ); @@ -24,4 +27,4 @@ status_t SetTVStandard( BScreen *screen, uint32 standard ); status_t TestMultiMonSupport( BScreen *screen ); -#endif +#endif // _MULTIMON_H diff --git a/src/preferences/screen/multimon.cpp b/src/preferences/screen/multimon.cpp index cf44ad8fe3..29bcc7db93 100644 --- a/src/preferences/screen/multimon.cpp +++ b/src/preferences/screen/multimon.cpp @@ -1,21 +1,21 @@ /* Copyright (c) 2002, Thomas Kurschel - Part of Radeon driver - Multi-Monitor Settings interface */ -#include #include "multimon.h" #include "accelerant_ext.h" -#include -#include +#include #include +#include +#include +#include + // prepare parameters so they recognized as tunneled settings static void PrepareTunnel( @@ -181,38 +181,39 @@ status_t SetTVStandard( BScreen *screen, uint32 standard ) // Verify existence of Multi-Monitor Settings Tunnel -status_t TestMultiMonSupport( BScreen *screen ) +status_t +TestMultiMonSupport(BScreen *screen) { - display_mode *mode_list; + display_mode *modeList = NULL; display_mode low, high; uint32 count; status_t result; // take any valid mode - result = screen->GetModeList( &mode_list, &count ); - if( result != B_OK ) + result = screen->GetModeList(&modeList, &count); + if (result != B_OK) return result; - - if( count < 1 ) + + if (count < 1) return B_ERROR; - + // set request bits - mode_list[0].timing.flags |= RADEON_MODE_MULTIMON_REQUEST; - mode_list[0].timing.flags &= ~RADEON_MODE_MULTIMON_REPLY; - low = high = mode_list[0]; - - result = screen->ProposeMode( &mode_list[0], &low, &high ); - if( result != B_OK ) - goto err; - + modeList[0].timing.flags |= RADEON_MODE_MULTIMON_REQUEST; + modeList[0].timing.flags &= ~RADEON_MODE_MULTIMON_REPLY; + low = high = modeList[0]; + + result = screen->ProposeMode(&modeList[0], &low, &high); + if (result != B_OK) + goto out; + // check reply bits - if( (mode_list[0].timing.flags & RADEON_MODE_MULTIMON_REQUEST) == 0 && - (mode_list[0].timing.flags & RADEON_MODE_MULTIMON_REPLY) != 0 ) + if ((modeList[0].timing.flags & RADEON_MODE_MULTIMON_REQUEST) == 0 + && (modeList[0].timing.flags & RADEON_MODE_MULTIMON_REPLY) != 0) result = B_OK; else result = B_ERROR; - -err: - delete mode_list; + +out: + free(modeList); return result; }