diff --git a/client/Mac/MRDPView.m b/client/Mac/MRDPView.m index cba02f0ab..bbb761083 100644 --- a/client/Mac/MRDPView.m +++ b/client/Mac/MRDPView.m @@ -65,6 +65,8 @@ static BOOL mac_desktop_resize(rdpContext *context); static void input_activity_cb(freerdp *instance); static DWORD WINAPI mac_client_thread(void *param); +static void windows_to_apple_cords(MRDPView *view, NSRect *r); +static CGContextRef mac_create_bitmap_context(rdpContext *context); @implementation MRDPView diff --git a/client/common/file.c b/client/common/file.c index fe97d0cf1..2a67e6b7f 100644 --- a/client/common/file.c +++ b/client/common/file.c @@ -1117,7 +1117,6 @@ BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file, const rdpSett UINT32 LoadBalanceInfoLength = 0; const char* GatewayHostname = NULL; char* redirectCameras = NULL; - char* redirectUsb = NULL; if (!file || !settings) return FALSE; @@ -1307,7 +1306,8 @@ BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file, const rdpSett file->RedirectCameras = redirectCameras; } #ifdef CHANNEL_URBDRC_CLIENT - redirectUsb = freerdp_client_channel_args_to_string(settings, URBDRC_CHANNEL_NAME, "device:"); + char* redirectUsb = + freerdp_client_channel_args_to_string(settings, URBDRC_CHANNEL_NAME, "device:"); if (redirectUsb) file->UsbDevicesToRedirect = redirectUsb; diff --git a/libfreerdp/locale/locale.c b/libfreerdp/locale/locale.c index 9d42b0c4c..7ddc90ac5 100644 --- a/libfreerdp/locale/locale.c +++ b/libfreerdp/locale/locale.c @@ -648,7 +648,6 @@ static BOOL freerdp_get_system_language_and_country_codes(char* language, size_t #if defined(__APPLE__) { - CFIndex strSize; CFStringRef langRef, countryRef; CFLocaleRef localeRef = CFLocaleCopyCurrent(); if (!localeRef) diff --git a/libfreerdp/primitives/neon/prim_YUV_neon.c b/libfreerdp/primitives/neon/prim_YUV_neon.c index c45148503..3af62082c 100644 --- a/libfreerdp/primitives/neon/prim_YUV_neon.c +++ b/libfreerdp/primitives/neon/prim_YUV_neon.c @@ -251,7 +251,7 @@ static INLINE pstatus_t neon_YUV420ToX(const BYTE* WINPR_RESTRICT pSrc[3], const return PRIMITIVES_SUCCESS; } -static pstatus_t neon_YUV420ToRGB_8u_P3AC4R(const BYTE* WINPR_RESTRICT const pSrc[3], +static pstatus_t neon_YUV420ToRGB_8u_P3AC4R(const BYTE* WINPR_RESTRICT pSrc[3], const UINT32 srcStep[3], BYTE* WINPR_RESTRICT pDst, UINT32 dstStep, UINT32 DstFormat, const prim_size_t* WINPR_RESTRICT roi) @@ -341,7 +341,7 @@ static INLINE pstatus_t neon_YUV444ToX(const BYTE* WINPR_RESTRICT pSrc[3], const return PRIMITIVES_SUCCESS; } -static pstatus_t neon_YUV444ToRGB_8u_P3AC4R(const BYTE* WINPR_RESTRICT const pSrc[3], +static pstatus_t neon_YUV444ToRGB_8u_P3AC4R(const BYTE* WINPR_RESTRICT pSrc[3], const UINT32 srcStep[3], BYTE* WINPR_RESTRICT pDst, UINT32 dstStep, UINT32 DstFormat, const prim_size_t* WINPR_RESTRICT roi) diff --git a/libfreerdp/primitives/neon/prim_colors_neon.c b/libfreerdp/primitives/neon/prim_colors_neon.c index a3b7ed539..87e75d2da 100644 --- a/libfreerdp/primitives/neon/prim_colors_neon.c +++ b/libfreerdp/primitives/neon/prim_colors_neon.c @@ -46,9 +46,9 @@ neon_yCbCrToRGB_16s16s_P3P3(const INT16* WINPR_RESTRICT pSrc[3], INT32 srcStep, int16x8_t g_cr = vdupq_n_s16(-11698); // -0.714 << 14 int16x8_t b_cb = vdupq_n_s16(28999); // 1.770 << 14 int16x8_t c4096 = vdupq_n_s16(4096); - int16x8_t* y_buf = (int16x8_t*)pSrc[0]; - int16x8_t* cb_buf = (int16x8_t*)pSrc[1]; - int16x8_t* cr_buf = (int16x8_t*)pSrc[2]; + const int16x8_t* y_buf = (const int16x8_t*)pSrc[0]; + const int16x8_t* cb_buf = (const int16x8_t*)pSrc[1]; + const int16x8_t* cr_buf = (const int16x8_t*)pSrc[2]; int16x8_t* r_buf = (int16x8_t*)pDst[0]; int16x8_t* g_buf = (int16x8_t*)pDst[1]; int16x8_t* b_buf = (int16x8_t*)pDst[2]; @@ -272,9 +272,9 @@ neon_RGBToRGB_16s8u_P3AC4R_X(const INT16* WINPR_RESTRICT pSrc[3], /* 16-bit R,G, for (UINT32 y = 0; y < roi->height; y++) { - const INT16* pr = (INT16*)(((BYTE*)pSrc[0]) + y * srcStep); - const INT16* pg = (INT16*)(((BYTE*)pSrc[1]) + y * srcStep); - const INT16* pb = (INT16*)(((BYTE*)pSrc[2]) + y * srcStep); + const INT16* pr = (const INT16*)(((BYTE*)pSrc[0]) + y * srcStep); + const INT16* pg = (const INT16*)(((BYTE*)pSrc[1]) + y * srcStep); + const INT16* pb = (const INT16*)(((BYTE*)pSrc[2]) + y * srcStep); BYTE* dst = pDst + y * dstStep; for (UINT32 x = 0; x < roi->width - pad; x += 8) diff --git a/server/Mac/mf_event.c b/server/Mac/mf_event.c index e30b9ac22..7ef315ea3 100644 --- a/server/Mac/mf_event.c +++ b/server/Mac/mf_event.c @@ -30,7 +30,7 @@ #include #define TAG SERVER_TAG("mac") -int mf_is_event_set(mfEventQueue* event_queue) +static int mf_is_event_set(mfEventQueue* event_queue) { fd_set rfds; int num_set; @@ -43,7 +43,7 @@ int mf_is_event_set(mfEventQueue* event_queue) return (num_set == 1); } -void mf_signal_event(mfEventQueue* event_queue) +static void mf_signal_event(mfEventQueue* event_queue) { int length; @@ -53,7 +53,7 @@ void mf_signal_event(mfEventQueue* event_queue) WLog_ERR(TAG, "mf_signal_event: error"); } -void mf_set_event(mfEventQueue* event_queue) +static void mf_set_event(mfEventQueue* event_queue) { int length; @@ -63,7 +63,7 @@ void mf_set_event(mfEventQueue* event_queue) WLog_ERR(TAG, "mf_set_event: error"); } -void mf_clear_events(mfEventQueue* event_queue) +static void mf_clear_events(mfEventQueue* event_queue) { int length; @@ -76,7 +76,7 @@ void mf_clear_events(mfEventQueue* event_queue) } } -void mf_clear_event(mfEventQueue* event_queue) +static void mf_clear_event(mfEventQueue* event_queue) { int length; diff --git a/server/Mac/mf_info.c b/server/Mac/mf_info.c index ab523e148..6da89cce9 100644 --- a/server/Mac/mf_info.c +++ b/server/Mac/mf_info.c @@ -88,7 +88,7 @@ int mf_info_unlock(mfInfo* mfi) return 1; } -mfInfo* mf_info_init() +static mfInfo* mf_info_init(void) { mfInfo* mfi; @@ -112,7 +112,7 @@ mfInfo* mf_info_init() return mfi; } -mfInfo* mf_info_get_instance() +mfInfo* mf_info_get_instance(void) { if (mfInfoInstance == NULL) mfInfoInstance = mf_info_init(); diff --git a/winpr/libwinpr/crt/unicode_android.c b/winpr/libwinpr/crt/unicode_android.c index 2e9bac55e..9fa16f6d4 100644 --- a/winpr/libwinpr/crt/unicode_android.c +++ b/winpr/libwinpr/crt/unicode_android.c @@ -23,6 +23,7 @@ #include #include "../utils/android.h" +#include "unicode.h" #ifndef MIN #define MIN(a, b) (a) < (b) ? (a) : (b) diff --git a/winpr/libwinpr/crt/unicode_apple.m b/winpr/libwinpr/crt/unicode_apple.m index 159252b5a..3b966634a 100644 --- a/winpr/libwinpr/crt/unicode_apple.m +++ b/winpr/libwinpr/crt/unicode_apple.m @@ -30,6 +30,8 @@ #include #include +#include "unicode.h" + #ifndef MIN #define MIN(a, b) (a) < (b) ? (a) : (b) #endif diff --git a/winpr/libwinpr/file/file.c b/winpr/libwinpr/file/file.c index b17b13949..046417f4c 100644 --- a/winpr/libwinpr/file/file.c +++ b/winpr/libwinpr/file/file.c @@ -648,8 +648,8 @@ static BOOL FileSetFileTime(HANDLE hFile, const FILETIME* lpCreationTime, // TODO: Creation time can not be handled! { - const int rc = utimes(pFile->lpFileName, timevals); - if (rc != 0) + const int res = utimes(pFile->lpFileName, timevals); + if (res != 0) return FALSE; } diff --git a/winpr/libwinpr/path/shell.c b/winpr/libwinpr/path/shell.c index 9fd60624d..1ab31fca8 100644 --- a/winpr/libwinpr/path/shell.c +++ b/winpr/libwinpr/path/shell.c @@ -218,20 +218,21 @@ static char* GetPath_XDG_CONFIG_HOME(void) static char* GetPath_XDG_CACHE_HOME(void) { char* path = NULL; - char* home = NULL; #if defined(WIN32) - home = GetPath_XDG_RUNTIME_DIR(); - - if (home) { - path = GetCombinedPath(home, "cache"); + char* home = GetPath_XDG_RUNTIME_DIR(); - if (!winpr_PathFileExists(path)) - if (!CreateDirectoryA(path, NULL)) - path = NULL; + if (home) + { + path = GetCombinedPath(home, "cache"); + + if (!winpr_PathFileExists(path)) + if (!CreateDirectoryA(path, NULL)) + path = NULL; + } + + free(home); } - - free(home); #elif defined(__IOS__) path = ios_get_cache(); #else @@ -249,7 +250,7 @@ static char* GetPath_XDG_CACHE_HOME(void) if (path) return path; - home = GetPath_HOME(); + char* home = GetPath_HOME(); if (!home) return NULL; diff --git a/winpr/libwinpr/path/shell_ios.m b/winpr/libwinpr/path/shell_ios.m index 7e1185b06..37353df6e 100644 --- a/winpr/libwinpr/path/shell_ios.m +++ b/winpr/libwinpr/path/shell_ios.m @@ -24,7 +24,7 @@ #include "shell_ios.h" -NSString *ios_get_directory_for_search_path(NSSearchPathDirectory searchPath) +static NSString *ios_get_directory_for_search_path(NSSearchPathDirectory searchPath) { return [NSSearchPathForDirectoriesInDomains(searchPath, NSUserDomainMask, YES) lastObject]; } diff --git a/winpr/libwinpr/synch/event.c b/winpr/libwinpr/synch/event.c index 7204add28..b18ea5677 100644 --- a/winpr/libwinpr/synch/event.c +++ b/winpr/libwinpr/synch/event.c @@ -111,8 +111,6 @@ BOOL winpr_event_init(WINPR_EVENT_IMPL* event) return event->fds[0] >= 0; #else - int flags; - if (pipe(event->fds) < 0) return FALSE; diff --git a/winpr/libwinpr/synch/timer.c b/winpr/libwinpr/synch/timer.c index 2e6753d60..120b933e0 100644 --- a/winpr/libwinpr/synch/timer.c +++ b/winpr/libwinpr/synch/timer.c @@ -64,8 +64,6 @@ static int TimerGetFd(HANDLE handle) static DWORD TimerCleanupHandle(HANDLE handle) { - SSIZE_T length = 0; - UINT64 expirations = 0; WINPR_TIMER* timer = (WINPR_TIMER*)handle; if (!TimerIsHandled(handle)) @@ -75,8 +73,10 @@ static DWORD TimerCleanupHandle(HANDLE handle) return WAIT_OBJECT_0; #ifdef TIMER_IMPL_TIMERFD + SSIZE_T length = 0; do { + UINT64 expirations = 0; length = read(timer->fd, (void*)&expirations, sizeof(UINT64)); } while (length < 0 && errno == EINTR); @@ -232,7 +232,6 @@ static BOOL InstallTimerSignalHandler(PINIT_ONCE InitOnce, PVOID Parameter, PVOI #ifdef TIMER_IMPL_DISPATCH static void WaitableTimerHandler(void* arg) { - UINT64 data = 1; WINPR_TIMER* timer = (WINPR_TIMER*)arg; if (!timer) diff --git a/winpr/libwinpr/thread/thread.c b/winpr/libwinpr/thread/thread.c index 1db889616..1773ec678 100644 --- a/winpr/libwinpr/thread/thread.c +++ b/winpr/libwinpr/thread/thread.c @@ -22,6 +22,7 @@ #include +#include #include #include @@ -628,8 +629,6 @@ BOOL SetThreadPriority(HANDLE hThread, int nPriority) if (!winpr_Handle_GetInfo(hThread, &Type, &Object) || Object->Type != HANDLE_TYPE_THREAD) return FALSE; - WINPR_THREAD* thread = (WINPR_THREAD*)Object; - const int min = 19; const int max = 0; const int diff = (max - min); @@ -663,6 +662,7 @@ BOOL SetThreadPriority(HANDLE hThread, int nPriority) break; } #if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L) && defined(PTHREAD_SETSCHEDPRIO) + WINPR_THREAD* thread = (WINPR_THREAD*)Object; const int rc = pthread_setschedprio(thread->thread, sched_priority); if (rc != 0) WLog_ERR(TAG, "pthread_setschedprio(%d) %s [%d]", sched_priority, strerror(rc), rc); @@ -906,7 +906,7 @@ DWORD GetCurrentThreadId(VOID) tid = pthread_self(); /* Since pthread_t can be 64-bits on some systems, take just the */ /* lower 32-bits of it for the thread ID returned by this function. */ - return (DWORD)tid & 0xffffffffUL; + return WINPR_REINTERPRET_CAST(tid, pthread_t, DWORD) & 0xffffffffUL; } typedef struct