From b8415af0d8eaf323be49e698a088c320ed47920d Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Wed, 23 Jul 2014 17:26:49 +0200 Subject: [PATCH 1/5] Fix compiler warnings. This commit is based on pull request #1493 --- libfreerdp/common/settings.c | 271 ------------------ winpr/libwinpr/crt/string.c | 2 +- winpr/libwinpr/interlocked/interlocked.c | 2 +- winpr/libwinpr/synch/critical.c | 4 +- winpr/libwinpr/sysinfo/sysinfo.c | 1 - winpr/libwinpr/utils/collections/BufferPool.c | 4 +- winpr/libwinpr/utils/sam.c | 6 +- winpr/libwinpr/utils/trio/triodef.h | 6 +- 8 files changed, 12 insertions(+), 284 deletions(-) diff --git a/libfreerdp/common/settings.c b/libfreerdp/common/settings.c index 776a55757..05f672da5 100644 --- a/libfreerdp/common/settings.c +++ b/libfreerdp/common/settings.c @@ -657,507 +657,380 @@ BOOL freerdp_get_param_bool(rdpSettings* settings, int id) { case FreeRDP_ServerMode: return settings->ServerMode; - break; case FreeRDP_NetworkAutoDetect: return settings->NetworkAutoDetect; - break; case FreeRDP_SupportAsymetricKeys: return settings->SupportAsymetricKeys; - break; case FreeRDP_SupportErrorInfoPdu: return settings->SupportErrorInfoPdu; - break; case FreeRDP_SupportStatusInfoPdu: return settings->SupportStatusInfoPdu; - break; case FreeRDP_SupportMonitorLayoutPdu: return settings->SupportMonitorLayoutPdu; - break; case FreeRDP_SupportGraphicsPipeline: return settings->SupportGraphicsPipeline; - break; case FreeRDP_SupportDynamicTimeZone: return settings->SupportDynamicTimeZone; - break; case FreeRDP_DisableEncryption: return settings->DisableEncryption; - break; case FreeRDP_ConsoleSession: return settings->ConsoleSession; - break; case FreeRDP_SpanMonitors: return settings->SpanMonitors; - break; case FreeRDP_UseMultimon: return settings->UseMultimon; - break; case FreeRDP_ForceMultimon: return settings->ForceMultimon; - break; case FreeRDP_AutoLogonEnabled: return settings->AutoLogonEnabled; - break; case FreeRDP_CompressionEnabled: return settings->CompressionEnabled; - break; case FreeRDP_DisableCtrlAltDel: return settings->DisableCtrlAltDel; - break; case FreeRDP_EnableWindowsKey: return settings->EnableWindowsKey; - break; case FreeRDP_MaximizeShell: return settings->MaximizeShell; - break; case FreeRDP_LogonNotify: return settings->LogonNotify; - break; case FreeRDP_LogonErrors: return settings->LogonErrors; - break; case FreeRDP_MouseAttached: return settings->MouseAttached; - break; case FreeRDP_MouseHasWheel: return settings->MouseHasWheel; - break; case FreeRDP_RemoteConsoleAudio: return settings->RemoteConsoleAudio; - break; case FreeRDP_AudioPlayback: return settings->AudioPlayback; - break; case FreeRDP_AudioCapture: return settings->AudioCapture; - break; case FreeRDP_VideoDisable: return settings->VideoDisable; - break; case FreeRDP_PasswordIsSmartcardPin: return settings->PasswordIsSmartcardPin; - break; case FreeRDP_UsingSavedCredentials: return settings->UsingSavedCredentials; - break; case FreeRDP_ForceEncryptedCsPdu: return settings->ForceEncryptedCsPdu; - break; case FreeRDP_HiDefRemoteApp: return settings->HiDefRemoteApp; - break; case FreeRDP_IPv6Enabled: return settings->IPv6Enabled; - break; case FreeRDP_AutoReconnectionEnabled: return settings->AutoReconnectionEnabled; - break; case FreeRDP_DynamicDaylightTimeDisabled: return settings->DynamicDaylightTimeDisabled; - break; case FreeRDP_AllowFontSmoothing: return settings->AllowFontSmoothing; - break; case FreeRDP_DisableWallpaper: return settings->DisableWallpaper; - break; case FreeRDP_DisableFullWindowDrag: return settings->DisableFullWindowDrag; - break; case FreeRDP_DisableMenuAnims: return settings->DisableMenuAnims; - break; case FreeRDP_DisableThemes: return settings->DisableThemes; - break; case FreeRDP_DisableCursorShadow: return settings->DisableCursorShadow; - break; case FreeRDP_DisableCursorBlinking: return settings->DisableCursorBlinking; - break; case FreeRDP_AllowDesktopComposition: return settings->AllowDesktopComposition; - break; case FreeRDP_RemoteAssistanceMode: return settings->RemoteAssistanceMode; - break; case FreeRDP_TlsSecurity: return settings->TlsSecurity; - break; case FreeRDP_NlaSecurity: return settings->NlaSecurity; - break; case FreeRDP_RdpSecurity: return settings->RdpSecurity; - break; case FreeRDP_ExtSecurity: return settings->ExtSecurity; - break; case FreeRDP_Authentication: return settings->Authentication; - break; case FreeRDP_NegotiateSecurityLayer: return settings->NegotiateSecurityLayer; - break; case FreeRDP_RestrictedAdminModeRequired: return settings->RestrictedAdminModeRequired; - break; case FreeRDP_DisableCredentialsDelegation: return settings->DisableCredentialsDelegation; - break; case FreeRDP_AuthenticationLevel: return settings->AuthenticationLevel; - break; case FreeRDP_MstscCookieMode: return settings->MstscCookieMode; - break; case FreeRDP_SendPreconnectionPdu: return settings->SendPreconnectionPdu; - break; case FreeRDP_IgnoreCertificate: return settings->IgnoreCertificate; - break; case FreeRDP_ExternalCertificateManagement: return settings->ExternalCertificateManagement; - break; case FreeRDP_Workarea: return settings->Workarea; - break; case FreeRDP_Fullscreen: return settings->Fullscreen; - break; case FreeRDP_GrabKeyboard: return settings->GrabKeyboard; - break; case FreeRDP_Decorations: return settings->Decorations; - break; case FreeRDP_SmartSizing: return settings->SmartSizing; - break; case FreeRDP_MouseMotion: return settings->MouseMotion; - break; case FreeRDP_AsyncInput: return settings->AsyncInput; - break; case FreeRDP_AsyncUpdate: return settings->AsyncUpdate; - break; case FreeRDP_AsyncChannels: return settings->AsyncChannels; - break; case FreeRDP_AsyncTransport: return settings->AsyncTransport; - break; case FreeRDP_ToggleFullscreen: return settings->ToggleFullscreen; - break; case FreeRDP_SoftwareGdi: return settings->SoftwareGdi; - break; case FreeRDP_LocalConnection: return settings->LocalConnection; - break; case FreeRDP_AuthenticationOnly: return settings->AuthenticationOnly; - break; case FreeRDP_CredentialsFromStdin: return settings->CredentialsFromStdin; - break; case FreeRDP_DumpRemoteFx: return settings->DumpRemoteFx; - break; case FreeRDP_PlayRemoteFx: return settings->PlayRemoteFx; - break; case FreeRDP_GatewayUseSameCredentials: return settings->GatewayUseSameCredentials; - break; case FreeRDP_GatewayEnabled: return settings->GatewayEnabled; - break; case FreeRDP_GatewayBypassLocal: return settings->GatewayBypassLocal; - break; case FreeRDP_RemoteApplicationMode: return settings->RemoteApplicationMode; - break; case FreeRDP_DisableRemoteAppCapsCheck: return settings->DisableRemoteAppCapsCheck; - break; case FreeRDP_RemoteAppLanguageBarSupported: return settings->RemoteAppLanguageBarSupported; - break; case FreeRDP_RefreshRect: return settings->RefreshRect; - break; case FreeRDP_SuppressOutput: return settings->SuppressOutput; - break; case FreeRDP_FastPathOutput: return settings->FastPathOutput; - break; case FreeRDP_SaltedChecksum: return settings->SaltedChecksum; - break; case FreeRDP_LongCredentialsSupported: return settings->LongCredentialsSupported; - break; case FreeRDP_NoBitmapCompressionHeader: return settings->NoBitmapCompressionHeader; - break; case FreeRDP_BitmapCompressionDisabled: return settings->BitmapCompressionDisabled; - break; case FreeRDP_DesktopResize: return settings->DesktopResize; - break; case FreeRDP_DrawAllowDynamicColorFidelity: return settings->DrawAllowDynamicColorFidelity; - break; case FreeRDP_DrawAllowColorSubsampling: return settings->DrawAllowColorSubsampling; - break; case FreeRDP_DrawAllowSkipAlpha: return settings->DrawAllowSkipAlpha; - break; case FreeRDP_BitmapCacheV3Enabled: return settings->BitmapCacheV3Enabled; - break; case FreeRDP_AltSecFrameMarkerSupport: return settings->AltSecFrameMarkerSupport; - break; case FreeRDP_BitmapCacheEnabled: return settings->BitmapCacheEnabled; - break; case FreeRDP_AllowCacheWaitingList: return settings->AllowCacheWaitingList; - break; case FreeRDP_BitmapCachePersistEnabled: return settings->BitmapCachePersistEnabled; - break; case FreeRDP_ColorPointerFlag: return settings->ColorPointerFlag; - break; case FreeRDP_UnicodeInput: return settings->UnicodeInput; - break; case FreeRDP_FastPathInput: return settings->FastPathInput; - break; case FreeRDP_MultiTouchInput: return settings->MultiTouchInput; - break; case FreeRDP_MultiTouchGestures: return settings->MultiTouchGestures; - break; case FreeRDP_SoundBeepsEnabled: return settings->SoundBeepsEnabled; - break; case FreeRDP_SurfaceCommandsEnabled: return settings->SurfaceCommandsEnabled; - break; case FreeRDP_FrameMarkerCommandEnabled: return settings->FrameMarkerCommandEnabled; - break; case FreeRDP_RemoteFxOnly: return settings->RemoteFxOnly; - break; case FreeRDP_RemoteFxCodec: return settings->RemoteFxCodec; - break; case FreeRDP_RemoteFxImageCodec: return settings->RemoteFxImageCodec; - break; case FreeRDP_NSCodec: return settings->NSCodec; - break; case FreeRDP_FrameAcknowledge: return settings->FrameAcknowledge; - break; case FreeRDP_JpegCodec: return settings->JpegCodec; - break; case FreeRDP_GfxThinClient: return settings->GfxThinClient; - break; case FreeRDP_GfxSmallCache: return settings->GfxSmallCache; - break; case FreeRDP_GfxProgressive: return settings->GfxProgressive; - break; case FreeRDP_GfxProgressiveV2: return settings->GfxProgressiveV2; - break; case FreeRDP_GfxH264: return settings->GfxH264; - break; case FreeRDP_DrawNineGridEnabled: return settings->DrawNineGridEnabled; - break; case FreeRDP_DrawGdiPlusEnabled: return settings->DrawGdiPlusEnabled; - break; case FreeRDP_DrawGdiPlusCacheEnabled: return settings->DrawGdiPlusCacheEnabled; - break; case FreeRDP_DeviceRedirection: return settings->DeviceRedirection; - break; case FreeRDP_RedirectDrives: return settings->RedirectDrives; - break; case FreeRDP_RedirectHomeDrive: return settings->RedirectHomeDrive; - break; case FreeRDP_RedirectSmartCards: return settings->RedirectSmartCards; - break; case FreeRDP_RedirectPrinters: return settings->RedirectPrinters; - break; case FreeRDP_RedirectSerialPorts: return settings->RedirectSerialPorts; - break; case FreeRDP_RedirectParallelPorts: return settings->RedirectParallelPorts; - break; case FreeRDP_RedirectClipboard: return settings->RedirectClipboard; - break; default: fprintf(stderr, "freerdp_get_param_bool: unknown id: %d\n", id); return -1; - break; } - - return -1; } int freerdp_set_param_bool(rdpSettings* settings, int id, BOOL param) @@ -1663,7 +1536,6 @@ int freerdp_set_param_bool(rdpSettings* settings, int id, BOOL param) default: fprintf(stderr, "freerdp_set_param_bool: unknown id %d (param = %d)\n", id, param); return -1; - break; } /* Mark field as modified */ @@ -1678,19 +1550,14 @@ int freerdp_get_param_int(rdpSettings* settings, int id) { case FreeRDP_XPan: return settings->XPan; - break; case FreeRDP_YPan: return settings->YPan; - break; default: fprintf(stderr, "freerdp_get_param_int: unknown id: %d\n", id); return 0; - break; } - - return 0; } int freerdp_set_param_int(rdpSettings* settings, int id, int param) @@ -1708,7 +1575,6 @@ int freerdp_set_param_int(rdpSettings* settings, int id, int param) default: fprintf(stderr, "freerdp_set_param_int: unknown id %d (param = %d)\n", id, param); return -1; - break; } settings->SettingsModified[id] = 1; @@ -1722,307 +1588,230 @@ UINT32 freerdp_get_param_uint32(rdpSettings* settings, int id) { case FreeRDP_ShareId: return settings->ShareId; - break; case FreeRDP_PduSource: return settings->PduSource; - break; case FreeRDP_ServerPort: return settings->ServerPort; - break; case FreeRDP_RdpVersion: return settings->RdpVersion; - break; case FreeRDP_DesktopWidth: return settings->DesktopWidth; - break; case FreeRDP_DesktopHeight: return settings->DesktopHeight; - break; case FreeRDP_ColorDepth: return settings->ColorDepth; - break; case FreeRDP_ConnectionType: return settings->ConnectionType; - break; case FreeRDP_ClientBuild: return settings->ClientBuild; - break; case FreeRDP_EarlyCapabilityFlags: return settings->EarlyCapabilityFlags; - break; case FreeRDP_EncryptionMethods: return settings->EncryptionMethods; - break; case FreeRDP_ExtEncryptionMethods: return settings->ExtEncryptionMethods; - break; case FreeRDP_EncryptionLevel: return settings->EncryptionLevel; - break; case FreeRDP_ChannelCount: return settings->ChannelCount; - break; case FreeRDP_ChannelDefArraySize: return settings->ChannelDefArraySize; - break; case FreeRDP_ClusterInfoFlags: return settings->ClusterInfoFlags; - break; case FreeRDP_RedirectedSessionId: return settings->RedirectedSessionId; - break; case FreeRDP_MonitorDefArraySize: return settings->MonitorDefArraySize; - break; case FreeRDP_DesktopPosX: return settings->DesktopPosX; - break; case FreeRDP_DesktopPosY: return settings->DesktopPosY; - break; case FreeRDP_MultitransportFlags: return settings->MultitransportFlags; - break; case FreeRDP_CompressionLevel: return settings->CompressionLevel; - break; case FreeRDP_AutoReconnectMaxRetries: return settings->AutoReconnectMaxRetries; - break; case FreeRDP_PerformanceFlags: return settings->PerformanceFlags; - break; case FreeRDP_RequestedProtocols: return settings->RequestedProtocols; - break; case FreeRDP_SelectedProtocol: return settings->SelectedProtocol; - break; case FreeRDP_NegotiationFlags: return settings->NegotiationFlags; - break; case FreeRDP_CookieMaxLength: return settings->CookieMaxLength; - break; case FreeRDP_PreconnectionId: return settings->PreconnectionId; - break; case FreeRDP_RedirectionFlags: return settings->RedirectionFlags; - break; case FreeRDP_LoadBalanceInfoLength: return settings->LoadBalanceInfoLength; - break; case FreeRDP_RedirectionPasswordLength: return settings->RedirectionPasswordLength; - break; case FreeRDP_RedirectionTsvUrlLength: return settings->RedirectionTsvUrlLength; - break; case FreeRDP_TargetNetAddressCount: return settings->TargetNetAddressCount; - break; case FreeRDP_PercentScreen: return settings->PercentScreen; - break; case FreeRDP_GatewayUsageMethod: return settings->GatewayUsageMethod; - break; case FreeRDP_GatewayPort: return settings->GatewayPort; - break; case FreeRDP_GatewayCredentialsSource: return settings->GatewayCredentialsSource; - break; case FreeRDP_RemoteAppNumIconCaches: return settings->RemoteAppNumIconCaches; - break; case FreeRDP_RemoteAppNumIconCacheEntries: return settings->RemoteAppNumIconCacheEntries; - break; case FreeRDP_ReceivedCapabilitiesSize: return settings->ReceivedCapabilitiesSize; - break; case FreeRDP_OsMajorType: return settings->OsMajorType; - break; case FreeRDP_OsMinorType: return settings->OsMinorType; - break; case FreeRDP_BitmapCacheVersion: return settings->BitmapCacheVersion; - break; case FreeRDP_BitmapCacheV2NumCells: return settings->BitmapCacheV2NumCells; - break; case FreeRDP_PointerCacheSize: return settings->PointerCacheSize; - break; case FreeRDP_KeyboardLayout: return settings->KeyboardLayout; - break; case FreeRDP_KeyboardType: return settings->KeyboardType; - break; case FreeRDP_KeyboardSubType: return settings->KeyboardSubType; - break; case FreeRDP_KeyboardFunctionKey: return settings->KeyboardFunctionKey; - break; case FreeRDP_BrushSupportLevel: return settings->BrushSupportLevel; - break; case FreeRDP_GlyphSupportLevel: return settings->GlyphSupportLevel; - break; case FreeRDP_OffscreenSupportLevel: return settings->OffscreenSupportLevel; - break; case FreeRDP_OffscreenCacheSize: return settings->OffscreenCacheSize; - break; case FreeRDP_OffscreenCacheEntries: return settings->OffscreenCacheEntries; - break; case FreeRDP_VirtualChannelCompressionFlags: return settings->VirtualChannelCompressionFlags; - break; case FreeRDP_VirtualChannelChunkSize: return settings->VirtualChannelChunkSize; - break; case FreeRDP_MultifragMaxRequestSize: return settings->MultifragMaxRequestSize; - break; case FreeRDP_LargePointerFlag: return settings->LargePointerFlag; - break; case FreeRDP_CompDeskSupportLevel: return settings->CompDeskSupportLevel; - break; case FreeRDP_RemoteFxCodecId: return settings->RemoteFxCodecId; - break; case FreeRDP_RemoteFxCodecMode: return settings->RemoteFxCodecMode; - break; case FreeRDP_NSCodecId: return settings->NSCodecId; - break; case FreeRDP_JpegCodecId: return settings->JpegCodecId; - break; case FreeRDP_JpegQuality: return settings->JpegQuality; - break; case FreeRDP_BitmapCacheV3CodecId: return settings->BitmapCacheV3CodecId; - break; case FreeRDP_DrawNineGridCacheSize: return settings->DrawNineGridCacheSize; - break; case FreeRDP_DrawNineGridCacheEntries: return settings->DrawNineGridCacheEntries; - break; case FreeRDP_DeviceCount: return settings->DeviceCount; - break; case FreeRDP_DeviceArraySize: return settings->DeviceArraySize; - break; case FreeRDP_StaticChannelCount: return settings->StaticChannelCount; - break; case FreeRDP_StaticChannelArraySize: return settings->StaticChannelArraySize; - break; case FreeRDP_DynamicChannelCount: return settings->DynamicChannelCount; - break; case FreeRDP_DynamicChannelArraySize: return settings->DynamicChannelArraySize; - break; default: fprintf(stderr, "freerdp_get_param_uint32: unknown id: %d\n", id); return 0; - break; } - - return 0; } int freerdp_set_param_uint32(rdpSettings* settings, int id, UINT32 param) @@ -2328,7 +2117,6 @@ int freerdp_set_param_uint32(rdpSettings* settings, int id, UINT32 param) default: fprintf(stderr, "freerdp_set_param_uint32: unknown id %d (param = %u)\n", id, param); return -1; - break; } /* Mark field as modified */ @@ -2343,15 +2131,11 @@ UINT64 freerdp_get_param_uint64(rdpSettings* settings, int id) { case FreeRDP_ParentWindowId: return settings->ParentWindowId; - break; default: fprintf(stderr, "freerdp_get_param_uint64: unknown id: %d\n", id); return -1; - break; } - - return 0; } int freerdp_set_param_uint64(rdpSettings* settings, int id, UINT64 param) @@ -2365,7 +2149,6 @@ int freerdp_set_param_uint64(rdpSettings* settings, int id, UINT64 param) default: fprintf(stderr, "freerdp_set_param_uint64: unknown id %d (param = %u)\n", id, (UINT32) param); return -1; - break; } /* Mark field as modified */ @@ -2380,191 +2163,143 @@ char* freerdp_get_param_string(rdpSettings* settings, int id) { case FreeRDP_ServerHostname: return settings->ServerHostname; - break; case FreeRDP_Username: return settings->Username; - break; case FreeRDP_Password: return settings->Password; - break; case FreeRDP_Domain: return settings->Domain; - break; case FreeRDP_PasswordHash: return settings->PasswordHash; - break; case FreeRDP_ClientHostname: return settings->ClientHostname; - break; case FreeRDP_ClientProductId: return settings->ClientProductId; - break; case FreeRDP_AlternateShell: return settings->AlternateShell; - break; case FreeRDP_ShellWorkingDirectory: return settings->ShellWorkingDirectory; - break; case FreeRDP_ClientAddress: return settings->ClientAddress; - break; case FreeRDP_ClientDir: return settings->ClientDir; - break; case FreeRDP_DynamicDSTTimeZoneKeyName: return settings->DynamicDSTTimeZoneKeyName; - break; case FreeRDP_RemoteAssistanceSessionId: return settings->RemoteAssistanceSessionId; - break; case FreeRDP_RemoteAssistancePassStub: return settings->RemoteAssistancePassStub; - break; case FreeRDP_RemoteAssistancePassword: return settings->RemoteAssistancePassword; - break; case FreeRDP_RemoteAssistanceRCTicket: return settings->RemoteAssistanceRCTicket; - break; case FreeRDP_AuthenticationServiceClass: return settings->AuthenticationServiceClass; - break; case FreeRDP_PreconnectionBlob: return settings->PreconnectionBlob; - break; case FreeRDP_KerberosKdc: return settings->KerberosKdc; - break; case FreeRDP_KerberosRealm: return settings->KerberosRealm; - break; case FreeRDP_CertificateName: return settings->CertificateName; - break; case FreeRDP_CertificateFile: return settings->CertificateFile; - break; case FreeRDP_PrivateKeyFile: return settings->PrivateKeyFile; - break; case FreeRDP_RdpKeyFile: return settings->RdpKeyFile; - break; case FreeRDP_WindowTitle: return settings->WindowTitle; - break; case FreeRDP_ComputerName: return settings->ComputerName; - break; case FreeRDP_ConnectionFile: return settings->ConnectionFile; - break; case FreeRDP_AssistanceFile: return settings->AssistanceFile; - break; case FreeRDP_HomePath: return settings->HomePath; - break; case FreeRDP_ConfigPath: return settings->ConfigPath; - break; case FreeRDP_CurrentPath: return settings->CurrentPath; - break; case FreeRDP_DumpRemoteFxFile: return settings->DumpRemoteFxFile; - break; case FreeRDP_PlayRemoteFxFile: return settings->PlayRemoteFxFile; - break; case FreeRDP_GatewayHostname: return settings->GatewayHostname; - break; case FreeRDP_GatewayUsername: return settings->GatewayUsername; - break; case FreeRDP_GatewayPassword: return settings->GatewayPassword; - break; case FreeRDP_GatewayDomain: return settings->GatewayDomain; - break; case FreeRDP_RemoteApplicationName: return settings->RemoteApplicationName; - break; case FreeRDP_RemoteApplicationIcon: return settings->RemoteApplicationIcon; - break; case FreeRDP_RemoteApplicationProgram: return settings->RemoteApplicationProgram; - break; case FreeRDP_RemoteApplicationFile: return settings->RemoteApplicationFile; - break; case FreeRDP_RemoteApplicationGuid: return settings->RemoteApplicationGuid; - break; case FreeRDP_RemoteApplicationCmdLine: return settings->RemoteApplicationCmdLine; - break; case FreeRDP_ImeFileName: return settings->ImeFileName; - break; case FreeRDP_DrivesToRedirect: return settings->DrivesToRedirect; - break; default: fprintf(stderr, "freerdp_get_param_string: unknown id: %d\n", id); return NULL; - break; } - - return NULL; } int freerdp_set_param_string(rdpSettings* settings, int id, const char* param) @@ -2799,7 +2534,6 @@ int freerdp_set_param_string(rdpSettings* settings, int id, const char* param) default: fprintf(stderr, "freerdp_set_param_string: unknown id %d (param = %s)\n", id, param); return -1; - break; } /* Mark field as modified */ @@ -2814,15 +2548,11 @@ double freerdp_get_param_double(rdpSettings* settings, int id) { case FreeRDP_ScalingFactor: return settings->ScalingFactor; - break; default: fprintf(stderr, "freerdp_get_param_double: unknown id: %d\n", id); return 0; - break; } - - return 0; } int freerdp_set_param_double(rdpSettings* settings, int id, double param) @@ -2835,7 +2565,6 @@ int freerdp_set_param_double(rdpSettings* settings, int id, double param) default: return -1; - break; } /* Mark field as modified */ diff --git a/winpr/libwinpr/crt/string.c b/winpr/libwinpr/crt/string.c index 0ecdc6a42..37bd6ebec 100644 --- a/winpr/libwinpr/crt/string.c +++ b/winpr/libwinpr/crt/string.c @@ -54,7 +54,7 @@ WCHAR* _wcsdup(const WCHAR* strSource) if (strSource == NULL) return NULL; -#if sun +#if defined(sun) && sun strDestination = wsdup(strSource); #elif defined(__APPLE__) && defined(__MACH__) || defined(ANDROID) strDestination = malloc(wcslen((wchar_t*)strSource)); diff --git a/winpr/libwinpr/interlocked/interlocked.c b/winpr/libwinpr/interlocked/interlocked.c index 0b8c0d45a..6490bb6f1 100644 --- a/winpr/libwinpr/interlocked/interlocked.c +++ b/winpr/libwinpr/interlocked/interlocked.c @@ -282,7 +282,7 @@ LONGLONG InterlockedCompareExchange64(LONGLONG volatile *Destination, LONGLONG E return previousValue; } -#elif ANDROID || (defined(__GNUC__) && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)) +#elif (defined(ANDROID) && ANDROID) || (defined(__GNUC__) && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)) #include diff --git a/winpr/libwinpr/synch/critical.c b/winpr/libwinpr/synch/critical.c index f67c373a3..0ea0def34 100644 --- a/winpr/libwinpr/synch/critical.c +++ b/winpr/libwinpr/synch/critical.c @@ -101,7 +101,7 @@ DWORD SetCriticalSectionSpinCount(LPCRITICAL_SECTION lpCriticalSection, DWORD dw #endif } -VOID _WaitForCriticalSection(LPCRITICAL_SECTION lpCriticalSection) +static VOID _WaitForCriticalSection(LPCRITICAL_SECTION lpCriticalSection) { #if defined(__APPLE__) semaphore_wait(*((winpr_sem_t*) lpCriticalSection->LockSemaphore)); @@ -110,7 +110,7 @@ VOID _WaitForCriticalSection(LPCRITICAL_SECTION lpCriticalSection) #endif } -VOID _UnWaitCriticalSection(LPCRITICAL_SECTION lpCriticalSection) +static VOID _UnWaitCriticalSection(LPCRITICAL_SECTION lpCriticalSection) { #if defined __APPLE__ semaphore_signal(*((winpr_sem_t*) lpCriticalSection->LockSemaphore)); diff --git a/winpr/libwinpr/sysinfo/sysinfo.c b/winpr/libwinpr/sysinfo/sysinfo.c index 572916ca3..fcef5b4cb 100644 --- a/winpr/libwinpr/sysinfo/sysinfo.c +++ b/winpr/libwinpr/sysinfo/sysinfo.c @@ -222,7 +222,6 @@ BOOL GetComputerNameExA(COMPUTER_NAME_FORMAT NameType, LPSTR lpBuffer, LPDWORD l default: return FALSE; - break; } return TRUE; diff --git a/winpr/libwinpr/utils/collections/BufferPool.c b/winpr/libwinpr/utils/collections/BufferPool.c index 3a0fda5b4..2b05263c6 100644 --- a/winpr/libwinpr/utils/collections/BufferPool.c +++ b/winpr/libwinpr/utils/collections/BufferPool.c @@ -34,7 +34,7 @@ * Methods */ -BOOL BufferPool_ShiftAvailable(wBufferPool* pool, int index, int count) +static BOOL BufferPool_ShiftAvailable(wBufferPool* pool, int index, int count) { if (count > 0) { @@ -61,7 +61,7 @@ BOOL BufferPool_ShiftAvailable(wBufferPool* pool, int index, int count) return TRUE; } -BOOL BufferPool_ShiftUsed(wBufferPool* pool, int index, int count) +static BOOL BufferPool_ShiftUsed(wBufferPool* pool, int index, int count) { if (count > 0) { diff --git a/winpr/libwinpr/utils/sam.c b/winpr/libwinpr/utils/sam.c index 8c3b91764..cf28fa243 100644 --- a/winpr/libwinpr/utils/sam.c +++ b/winpr/libwinpr/utils/sam.c @@ -68,7 +68,7 @@ WINPR_SAM* SamOpen(BOOL read_only) return sam; } -BOOL SamLookupStart(WINPR_SAM* sam) +static BOOL SamLookupStart(WINPR_SAM* sam) { size_t read_size; long int file_size; @@ -105,7 +105,7 @@ BOOL SamLookupStart(WINPR_SAM* sam) return TRUE; } -void SamLookupFinish(WINPR_SAM* sam) +static void SamLookupFinish(WINPR_SAM* sam) { free(sam->buffer); @@ -113,7 +113,7 @@ void SamLookupFinish(WINPR_SAM* sam) sam->line = NULL; } -void HexStrToBin(char* str, BYTE* bin, int length) +static void HexStrToBin(char* str, BYTE* bin, int length) { int i; diff --git a/winpr/libwinpr/utils/trio/triodef.h b/winpr/libwinpr/utils/trio/triodef.h index 11c14b9c4..ce2667b0a 100644 --- a/winpr/libwinpr/utils/trio/triodef.h +++ b/winpr/libwinpr/utils/trio/triodef.h @@ -168,9 +168,9 @@ #if defined(__cplusplus) # define PREDEF_STANDARD_CXX -#endif -#if __cplusplus - 0 >= 199711L -# define PREDEF_STANDARD_CXX89 +# if __cplusplus - 0 >= 199711L +# define PREDEF_STANDARD_CXX89 +# endif #endif #if defined(TRIO_PLATFORM_UNIX) From 8c318da7b1932dc3069c85b247388caee667c51c Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Wed, 23 Jul 2014 19:08:06 +0200 Subject: [PATCH 2/5] fix compiler warnings --- channels/echo/server/echo_main.c | 3 ++- libfreerdp/codec/h264.c | 4 +++- libfreerdp/core/tcp.c | 2 +- libfreerdp/utils/test/TestRingBuffer.c | 8 ++++---- winpr/libwinpr/comm/test/TestCommConfig.c | 2 +- winpr/libwinpr/crt/alignment.c | 1 - 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/channels/echo/server/echo_main.c b/channels/echo/server/echo_main.c index 37d42cb61..979294d28 100644 --- a/channels/echo/server/echo_main.c +++ b/channels/echo/server/echo_main.c @@ -29,6 +29,7 @@ #include #include #include +#include #include @@ -166,7 +167,7 @@ static void* echo_server_thread_func(void* arg) break; } - IFCALL(echo->context.Response, &echo->context, (PCHAR) Stream_Buffer(s), BytesReturned); + IFCALL(echo->context.Response, &echo->context, (BYTE *) Stream_Buffer(s), BytesReturned); } Stream_Free(s, TRUE); diff --git a/libfreerdp/codec/h264.c b/libfreerdp/codec/h264.c index f690b3f23..2546d9289 100644 --- a/libfreerdp/codec/h264.c +++ b/libfreerdp/codec/h264.c @@ -31,6 +31,7 @@ #define USE_GRAY_SCALE 0 #define USE_UPCONVERT 0 +#ifdef WITH_OPENH264 static BYTE clip(int x) { if (x < 0) return 0; @@ -100,6 +101,7 @@ static UINT32 YUV_to_RGB(BYTE Y, BYTE U, BYTE V) return RGB32(R, G, B); } +#endif //WITH_OPENH264 #if USE_UPCONVERT static BYTE* convert_420_to_444(BYTE* chroma420, int chroma420Width, int chroma420Height, int chroma420Stride) @@ -335,8 +337,8 @@ H264_CONTEXT* h264_context_new(BOOL Compressor) return h264; -EXCEPTION: #ifdef WITH_OPENH264 +EXCEPTION: if (h264->pDecoder) { WelsDestroyDecoder(h264->pDecoder); diff --git a/libfreerdp/core/tcp.c b/libfreerdp/core/tcp.c index 21a875150..4ed62e1ba 100644 --- a/libfreerdp/core/tcp.c +++ b/libfreerdp/core/tcp.c @@ -562,7 +562,7 @@ BOOL tcp_connect(rdpTcp* tcp, const char* hostname, int port, int timeout) } } - BIO_set_close(tcp->socketBio, BIO_NOCLOSE); + (void)BIO_set_close(tcp->socketBio, BIO_NOCLOSE); BIO_free(tcp->socketBio); tcp->socketBio = BIO_new(BIO_s_simple_socket()); diff --git a/libfreerdp/utils/test/TestRingBuffer.c b/libfreerdp/utils/test/TestRingBuffer.c index 1f4e3f504..dd128f44e 100644 --- a/libfreerdp/utils/test/TestRingBuffer.c +++ b/libfreerdp/utils/test/TestRingBuffer.c @@ -111,7 +111,7 @@ int TestRingBuffer(int argc, char* argv[]) if (ringbuffer_used(&ringBuffer) != 15) { - fprintf(stderr, "invalid used size got %d when i would expect 15\n", ringbuffer_used(&ringBuffer)); + fprintf(stderr, "invalid used size got %ld when i would expect 15\n", ringbuffer_used(&ringBuffer)); return -1; } @@ -134,7 +134,7 @@ int TestRingBuffer(int argc, char* argv[]) if (ringbuffer_used(&ringBuffer) != 5) { - fprintf(stderr, "invalid used size after read got %d when i would expect 5\n", ringbuffer_used(&ringBuffer)); + fprintf(stderr, "invalid used size after read got %ld when i would expect 5\n", ringbuffer_used(&ringBuffer)); return -1; } @@ -189,7 +189,7 @@ int TestRingBuffer(int argc, char* argv[]) if (ringbuffer_capacity(&ringBuffer) != 10) { - fprintf(stderr, "not the expected capacity, have %d and expects 10\n", ringbuffer_capacity(&ringBuffer)); + fprintf(stderr, "not the expected capacity, have %ld and expects 10\n", ringbuffer_capacity(&ringBuffer)); return -1; } fprintf(stderr, "ok\n"); @@ -213,7 +213,7 @@ int TestRingBuffer(int argc, char* argv[]) fprintf(stderr, "%d: specific overlaps test...", ++testNo); if (!test_overlaps()) { - fprintf(stderr, "ko\n", i); + fprintf(stderr, "ko\n"); return -1; } fprintf(stderr, "ok\n"); diff --git a/winpr/libwinpr/comm/test/TestCommConfig.c b/winpr/libwinpr/comm/test/TestCommConfig.c index 093c44e24..b60abd885 100644 --- a/winpr/libwinpr/comm/test/TestCommConfig.c +++ b/winpr/libwinpr/comm/test/TestCommConfig.c @@ -100,7 +100,7 @@ int TestCommConfig(int argc, char* argv[]) ZeroMemory(&commProp, sizeof(COMMPROP)); if (!GetCommProperties(hComm, &commProp)) { - fprintf(stderr, "GetCommProperties failure: GetLastError(): 0x0.8x\n", GetLastError()); + fprintf(stderr, "GetCommProperties failure: GetLastError(): 0x%0.8x\n", GetLastError()); return EXIT_FAILURE; } diff --git a/winpr/libwinpr/crt/alignment.c b/winpr/libwinpr/crt/alignment.c index 47bb88e89..a4b870f94 100644 --- a/winpr/libwinpr/crt/alignment.c +++ b/winpr/libwinpr/crt/alignment.c @@ -139,7 +139,6 @@ void* _aligned_offset_realloc(void* memblock, size_t size, size_t alignment, siz void* _aligned_offset_recalloc(void* memblock, size_t num, size_t size, size_t alignment, size_t offset) { - size_t copySize; void* newMemblock; WINPR_ALIGNED_MEM* pMem; WINPR_ALIGNED_MEM* pNewMem; From 352dbd52e2d34ddae4052254189e76f022846a38 Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Wed, 23 Jul 2014 19:08:30 +0200 Subject: [PATCH 3/5] winpr/comm: don't build on apple Since code is only defined on linux building comm causes /usr/bin/ranlib to warn about empty objects and the test doesn't build at all on apple. --- winpr/libwinpr/comm/CMakeLists.txt | 32 ++++++++++++++++-------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/winpr/libwinpr/comm/CMakeLists.txt b/winpr/libwinpr/comm/CMakeLists.txt index 58ff2fe1d..0fe9f566f 100644 --- a/winpr/libwinpr/comm/CMakeLists.txt +++ b/winpr/libwinpr/comm/CMakeLists.txt @@ -18,21 +18,23 @@ set(MODULE_NAME "winpr-comm") set(MODULE_PREFIX "WINPR_COMM") -set(${MODULE_PREFIX}_SRCS - comm.c - comm.h - comm_io.c - comm_ioctl.c - comm_ioctl.h - comm_serial_sys.c - comm_serial_sys.h - comm_sercx_sys.c - comm_sercx_sys.h - comm_sercx2_sys.c - comm_sercx2_sys.h) +if(UNIX AND NOT WIN32 AND NOT APPLE) + set(${MODULE_PREFIX}_SRCS + comm.c + comm.h + comm_io.c + comm_ioctl.c + comm_ioctl.h + comm_serial_sys.c + comm_serial_sys.h + comm_sercx_sys.c + comm_sercx_sys.h + comm_sercx2_sys.c + comm_sercx2_sys.h) -winpr_module_add(${${MODULE_PREFIX}_SRCS}) + winpr_module_add(${${MODULE_PREFIX}_SRCS}) -if(BUILD_TESTING AND UNIX AND NOT WIN32) - add_subdirectory(test) + if(BUILD_TESTING) + add_subdirectory(test) + endif() endif() From a9eed46e38940ede5ad17b6e832557e60f6c6af2 Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Wed, 23 Jul 2014 20:22:30 +0200 Subject: [PATCH 4/5] Fix warnings found in Xcode --- channels/cliprdr/client/cliprdr_main.c | 2 ++ libfreerdp/core/nego.c | 2 ++ winpr/libwinpr/synch/timer.c | 8 ++++++-- winpr/libwinpr/utils/trio/trio.c | 4 ++-- winpr/libwinpr/utils/trio/trionan.c | 3 ++- winpr/libwinpr/utils/trio/triostr.c | 3 ++- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/channels/cliprdr/client/cliprdr_main.c b/channels/cliprdr/client/cliprdr_main.c index 7a7907021..7eeaad6a9 100644 --- a/channels/cliprdr/client/cliprdr_main.c +++ b/channels/cliprdr/client/cliprdr_main.c @@ -36,6 +36,7 @@ #include "cliprdr_main.h" #include "cliprdr_format.h" +#ifdef WITH_DEBUG_CLIPRDR static const char* const CB_MSG_TYPE_STRINGS[] = { "", @@ -51,6 +52,7 @@ static const char* const CB_MSG_TYPE_STRINGS[] = "CB_LOCK_CLIPDATA" "CB_UNLOCK_CLIPDATA" }; +#endif CliprdrClientContext* cliprdr_get_client_interface(cliprdrPlugin* cliprdr) { diff --git a/libfreerdp/core/nego.c b/libfreerdp/core/nego.c index 09d63065a..c10cd274f 100644 --- a/libfreerdp/core/nego.c +++ b/libfreerdp/core/nego.c @@ -32,6 +32,7 @@ #include "transport.h" +#ifdef WITH_DEBUG_NEGO static const char* const NEGO_STATE_STRINGS[] = { "NEGO_STATE_INITIAL", @@ -55,6 +56,7 @@ static const char PROTOCOL_SECURITY_STRINGS[9][4] = "UNK", "EXT" }; +#endif // WITH_DEBUG_NEGO BOOL nego_security_connect(rdpNego* nego); diff --git a/winpr/libwinpr/synch/timer.c b/winpr/libwinpr/synch/timer.c index 0f0c41572..f19f1366e 100644 --- a/winpr/libwinpr/synch/timer.c +++ b/winpr/libwinpr/synch/timer.c @@ -190,10 +190,14 @@ BOOL SetWaitableTimer(HANDLE hTimer, const LARGE_INTEGER* lpDueTime, LONG lPerio { ULONG Type; PVOID Object; - int status = 0; WINPR_TIMER* timer; - LONGLONG seconds = 0; +#ifdef WITH_POSIX_TIMER + LONGLONG seconds = 0; LONGLONG nanoseconds = 0; +#ifdef HAVE_TIMERFD_H + int status = 0; +#endif // HAVE_TIMERFD_H +#endif // WITH_POSIX_TIMER if (!winpr_Handle_GetInfo(hTimer, &Type, &Object)) return FALSE; diff --git a/winpr/libwinpr/utils/trio/trio.c b/winpr/libwinpr/utils/trio/trio.c index 08b02240a..19cfdadd0 100644 --- a/winpr/libwinpr/utils/trio/trio.c +++ b/winpr/libwinpr/utils/trio/trio.c @@ -901,8 +901,8 @@ typedef struct _trio_userdef_t { * Internal Variables * *************************************************************************/ - -static TRIO_CONST char rcsid[] = "@(#)$Id: trio.c,v 1.131 2010/09/12 11:08:08 breese Exp $"; +/* Unused but kept for reference */ +/* static TRIO_CONST char rcsid[] = "@(#)$Id: trio.c,v 1.131 2010/09/12 11:08:08 breese Exp $"; */ #if TRIO_FEATURE_FLOAT /* diff --git a/winpr/libwinpr/utils/trio/trionan.c b/winpr/libwinpr/utils/trio/trionan.c index 301632257..d58246881 100644 --- a/winpr/libwinpr/utils/trio/trionan.c +++ b/winpr/libwinpr/utils/trio/trionan.c @@ -227,7 +227,8 @@ */ #if !defined(TRIO_EMBED_NAN) -static TRIO_CONST char rcsid[] = "@(#)$Id: trionan.c,v 1.33 2005/05/29 11:57:25 breese Exp $"; +/* Unused but kept for reference */ +/* static TRIO_CONST char rcsid[] = "@(#)$Id: trionan.c,v 1.33 2005/05/29 11:57:25 breese Exp $"; */ #endif #if defined(TRIO_FUNC_INTERNAL_MAKE_DOUBLE) \ diff --git a/winpr/libwinpr/utils/trio/triostr.c b/winpr/libwinpr/utils/trio/triostr.c index c471b4a1d..4425bcd21 100644 --- a/winpr/libwinpr/utils/trio/triostr.c +++ b/winpr/libwinpr/utils/trio/triostr.c @@ -160,7 +160,8 @@ struct _trio_string_t */ #if !defined(TRIO_EMBED_STRING) -static TRIO_CONST char rcsid[] = "@(#)$Id: triostr.c,v 1.36 2010/01/26 13:02:02 breese Exp $"; +/* Unused but kept for reference */ +/* static TRIO_CONST char rcsid[] = "@(#)$Id: triostr.c,v 1.36 2010/01/26 13:02:02 breese Exp $"; */ #endif /************************************************************************* From a124f6a7c6aea9186fe36b3e7e9803ee5a811336 Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Wed, 23 Jul 2014 23:53:43 +0200 Subject: [PATCH 5/5] fix comment style // to /* */ --- libfreerdp/codec/h264.c | 2 +- libfreerdp/core/nego.c | 2 +- winpr/libwinpr/synch/timer.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libfreerdp/codec/h264.c b/libfreerdp/codec/h264.c index 2546d9289..3ec637ebe 100644 --- a/libfreerdp/codec/h264.c +++ b/libfreerdp/codec/h264.c @@ -101,7 +101,7 @@ static UINT32 YUV_to_RGB(BYTE Y, BYTE U, BYTE V) return RGB32(R, G, B); } -#endif //WITH_OPENH264 +#endif /* WITH_OPENH264 */ #if USE_UPCONVERT static BYTE* convert_420_to_444(BYTE* chroma420, int chroma420Width, int chroma420Height, int chroma420Stride) diff --git a/libfreerdp/core/nego.c b/libfreerdp/core/nego.c index c10cd274f..8d385bf6d 100644 --- a/libfreerdp/core/nego.c +++ b/libfreerdp/core/nego.c @@ -56,7 +56,7 @@ static const char PROTOCOL_SECURITY_STRINGS[9][4] = "UNK", "EXT" }; -#endif // WITH_DEBUG_NEGO +#endif /* WITH_DEBUG_NEGO */ BOOL nego_security_connect(rdpNego* nego); diff --git a/winpr/libwinpr/synch/timer.c b/winpr/libwinpr/synch/timer.c index f19f1366e..3b715a74a 100644 --- a/winpr/libwinpr/synch/timer.c +++ b/winpr/libwinpr/synch/timer.c @@ -196,8 +196,8 @@ BOOL SetWaitableTimer(HANDLE hTimer, const LARGE_INTEGER* lpDueTime, LONG lPerio LONGLONG nanoseconds = 0; #ifdef HAVE_TIMERFD_H int status = 0; -#endif // HAVE_TIMERFD_H -#endif // WITH_POSIX_TIMER +#endif /* HAVE_TIMERFD_H */ +#endif /* WITH_POSIX_TIMER */ if (!winpr_Handle_GetInfo(hTimer, &Type, &Object)) return FALSE;