Fixed compilation warnings and duplicate defines

This commit is contained in:
Armin Novak 2021-09-07 14:40:21 +02:00 committed by akallabeth
parent 5bd096cfc2
commit ba0da04217
10 changed files with 39 additions and 63 deletions

View File

@ -548,11 +548,9 @@ static UINT rdpsnd_server_send_audio_pdu(RdpsndServerContext* context, UINT16 wT
* *
* @return 0 on success, otherwise a Win32 error code * @return 0 on success, otherwise a Win32 error code
*/ */
static UINT rdpsnd_server_send_samples(RdpsndServerContext* context, const void* buf, int nframes, static UINT rdpsnd_server_send_samples(RdpsndServerContext* context, const void* buf,
UINT16 wTimestamp) size_t nframes, UINT16 wTimestamp)
{ {
int cframes;
int cframesize;
UINT error = CHANNEL_RC_OK; UINT error = CHANNEL_RC_OK;
EnterCriticalSection(&context->priv->lock); EnterCriticalSection(&context->priv->lock);
@ -566,8 +564,9 @@ static UINT rdpsnd_server_send_samples(RdpsndServerContext* context, const void*
while (nframes > 0) while (nframes > 0)
{ {
cframes = MIN(nframes, context->priv->out_frames - context->priv->out_pending_frames); const size_t cframes =
cframesize = cframes * context->priv->src_bytes_per_frame; MIN(nframes, context->priv->out_frames - context->priv->out_pending_frames);
size_t cframesize = cframes * context->priv->src_bytes_per_frame;
CopyMemory(context->priv->out_buffer + CopyMemory(context->priv->out_buffer +
(context->priv->out_pending_frames * context->priv->src_bytes_per_frame), (context->priv->out_pending_frames * context->priv->src_bytes_per_frame),
buf, cframesize); buf, cframesize);

View File

@ -46,9 +46,9 @@ struct _rdpsnd_server_private
wStream* input_stream; wStream* input_stream;
wStream* rdpsnd_pdu; wStream* rdpsnd_pdu;
BYTE* out_buffer; BYTE* out_buffer;
int out_buffer_size; size_t out_buffer_size;
int out_frames; size_t out_frames;
int out_pending_frames; size_t out_pending_frames;
UINT32 src_bytes_per_sample; UINT32 src_bytes_per_sample;
UINT32 src_bytes_per_frame; UINT32 src_bytes_per_frame;
FREERDP_DSP_CONTEXT* dsp_context; FREERDP_DSP_CONTEXT* dsp_context;

View File

@ -194,23 +194,7 @@ enum RDPDR_PRINTER_ANNOUNCE_FLAG
/* [MS-FSCC] FileAttributes */ /* [MS-FSCC] FileAttributes */
#ifndef _WIN32 /* Included with winpr/file.h */
#define FILE_ATTRIBUTE_ARCHIVE 0x00000020
#define FILE_ATTRIBUTE_COMPRESSED 0x00000800
#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
#define FILE_ATTRIBUTE_HIDDEN 0x00000002
#define FILE_ATTRIBUTE_NORMAL 0x00000080
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
#define FILE_ATTRIBUTE_OFFLINE 0x00001000
#define FILE_ATTRIBUTE_READONLY 0x00000001
#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
#define FILE_ATTRIBUTE_SYSTEM 0x00000004
#define FILE_ATTRIBUTE_TEMPORARY 0x00000100
#endif
/* [MS-FSCC] FSCTL Structures */ /* [MS-FSCC] FSCTL Structures */

View File

@ -36,7 +36,7 @@ typedef UINT (*psRdpsndServerInitialize)(RdpsndServerContext* context, BOOL ownT
typedef UINT (*psRdpsndServerSelectFormat)(RdpsndServerContext* context, typedef UINT (*psRdpsndServerSelectFormat)(RdpsndServerContext* context,
UINT16 client_format_index); UINT16 client_format_index);
typedef UINT (*psRdpsndServerSendSamples)(RdpsndServerContext* context, const void* buf, typedef UINT (*psRdpsndServerSendSamples)(RdpsndServerContext* context, const void* buf,
int nframes, UINT16 wTimestamp); size_t nframes, UINT16 wTimestamp);
typedef UINT (*psRdpsndServerConfirmBlock)(RdpsndServerContext* context, BYTE confirmBlockNum, typedef UINT (*psRdpsndServerConfirmBlock)(RdpsndServerContext* context, BYTE confirmBlockNum,
UINT16 wtimestamp); UINT16 wtimestamp);
typedef UINT (*psRdpsndServerSetVolume)(RdpsndServerContext* context, int left, int right); typedef UINT (*psRdpsndServerSetVolume)(RdpsndServerContext* context, int left, int right);
@ -64,7 +64,7 @@ struct _rdpsnd_server_context
AUDIO_FORMAT* src_format; AUDIO_FORMAT* src_format;
/* Server audio latency, or buffer size, in milli-seconds. Set by server. */ /* Server audio latency, or buffer size, in milli-seconds. Set by server. */
int latency; UINT32 latency;
/* Client supported formats. */ /* Client supported formats. */
AUDIO_FORMAT* client_formats; AUDIO_FORMAT* client_formats;

View File

@ -268,7 +268,7 @@ struct _SHADOW_MSG_OUT_AUDIO_OUT_SAMPLES
SHADOW_MSG_OUT common; SHADOW_MSG_OUT common;
AUDIO_FORMAT* audio_format; AUDIO_FORMAT* audio_format;
void* buf; void* buf;
int nFrames; size_t nFrames;
UINT16 wTimestamp; UINT16 wTimestamp;
}; };
typedef struct _SHADOW_MSG_OUT_AUDIO_OUT_SAMPLES SHADOW_MSG_OUT_AUDIO_OUT_SAMPLES; typedef struct _SHADOW_MSG_OUT_AUDIO_OUT_SAMPLES SHADOW_MSG_OUT_AUDIO_OUT_SAMPLES;

View File

@ -453,7 +453,6 @@ static DWORD WINAPI pf_server_handle_peer(LPVOID arg)
DWORD tmp; DWORD tmp;
DWORD status; DWORD status;
pServerContext* ps; pServerContext* ps;
rdpContext* pc;
proxyData* pdata; proxyData* pdata;
freerdp_peer* client = (freerdp_peer*)arg; freerdp_peer* client = (freerdp_peer*)arg;
proxyServer* server; proxyServer* server;

View File

@ -41,21 +41,21 @@
#define INVALID_SET_FILE_POINTER ((DWORD)-1) #define INVALID_SET_FILE_POINTER ((DWORD)-1)
#define INVALID_FILE_ATTRIBUTES ((DWORD)-1) #define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
#define FILE_ATTRIBUTE_READONLY 0x00000001 #define FILE_ATTRIBUTE_READONLY 0x00000001u
#define FILE_ATTRIBUTE_HIDDEN 0x00000002 #define FILE_ATTRIBUTE_HIDDEN 0x00000002u
#define FILE_ATTRIBUTE_SYSTEM 0x00000004 #define FILE_ATTRIBUTE_SYSTEM 0x00000004u
#define FILE_ATTRIBUTE_DIRECTORY 0x00000010 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010u
#define FILE_ATTRIBUTE_ARCHIVE 0x00000020 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020u
#define FILE_ATTRIBUTE_DEVICE 0x00000040 #define FILE_ATTRIBUTE_DEVICE 0x00000040u
#define FILE_ATTRIBUTE_NORMAL 0x00000080 #define FILE_ATTRIBUTE_NORMAL 0x00000080u
#define FILE_ATTRIBUTE_TEMPORARY 0x00000100 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100u
#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200u
#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400u
#define FILE_ATTRIBUTE_COMPRESSED 0x00000800 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800u
#define FILE_ATTRIBUTE_OFFLINE 0x00001000 #define FILE_ATTRIBUTE_OFFLINE 0x00001000u
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000u
#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000u
#define FILE_ATTRIBUTE_VIRTUAL 0x00010000 #define FILE_ATTRIBUTE_VIRTUAL 0x00010000u
#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002

View File

@ -86,14 +86,6 @@ typedef enum
/* Deprecated, here for compatibility */ /* Deprecated, here for compatibility */
#define FD_SHOWPROGRESSUI FD_PROGRESSUI #define FD_SHOWPROGRESSUI FD_PROGRESSUI
/* FILEDESCRIPTOR.dwFileAttributes */
#define FILE_ATTRIBUTE_READONLY 0x00000001
#define FILE_ATTRIBUTE_HIDDEN 0x00000002
#define FILE_ATTRIBUTE_SYSTEM 0x00000004
#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
#define FILE_ATTRIBUTE_ARCHIVE 0x00000020
#define FILE_ATTRIBUTE_NORMAL 0x00000080
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {

View File

@ -26,14 +26,12 @@
#include <winpr/crt.h> #include <winpr/crt.h>
#include <winpr/platform.h> #include <winpr/platform.h>
#include <winpr/error.h> #include <winpr/error.h>
#include <winpr/string.h>
#include <winpr/environment.h> #include <winpr/environment.h>
#ifndef _WIN32 #ifndef _WIN32
#define stricmp strcasecmp
#define strnicmp strncasecmp
#include <winpr/crt.h> #include <winpr/crt.h>
#include <winpr/platform.h> #include <winpr/platform.h>

View File

@ -57,6 +57,10 @@
#include <sys/statvfs.h> #include <sys/statvfs.h>
#endif #endif
#ifndef MIN
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#endif
static BOOL FileIsHandled(HANDLE handle) static BOOL FileIsHandled(HANDLE handle)
{ {
WINPR_FILE* pFile = (WINPR_FILE*)handle; WINPR_FILE* pFile = (WINPR_FILE*)handle;
@ -840,11 +844,11 @@ static HANDLE FileCreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dw
#endif #endif
{ {
#ifdef __sun #ifdef __sun
WLog_ERR(TAG, "F_SETLKW failed with %s [0x%08X]", WLog_ERR(TAG, "F_SETLKW failed with %s [0x%08X]", strerror(errno), errno);
#else #else
WLog_ERR(TAG, "flock failed with %s [0x%08X]", WLog_ERR(TAG, "flock failed with %s [0x%08X]", strerror(errno), errno);
#endif #endif
strerror(errno), errno);
SetLastError(map_posix_err(errno)); SetLastError(map_posix_err(errno));
FileCloseHandle(pFile); FileCloseHandle(pFile);
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;
@ -940,12 +944,12 @@ BOOL GetDiskFreeSpaceA(LPCSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWO
#define STATVFS statvfs #define STATVFS statvfs
#endif #endif
struct STATVFS svfst; struct STATVFS svfst = { 0 };
STATVFS(lpRootPathName, &svfst); STATVFS(lpRootPathName, &svfst);
*lpSectorsPerCluster = svfst.f_frsize; *lpSectorsPerCluster = (UINT32)MIN(svfst.f_frsize, UINT32_MAX);
*lpBytesPerSector = 1; *lpBytesPerSector = 1;
*lpNumberOfFreeClusters = svfst.f_bavail; *lpNumberOfFreeClusters = (UINT32)MIN(svfst.f_bavail, UINT32_MAX);
*lpTotalNumberOfClusters = svfst.f_blocks; *lpTotalNumberOfClusters = (UINT32)MIN(svfst.f_blocks, UINT32_MAX);
return TRUE; return TRUE;
} }