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
*/
static UINT rdpsnd_server_send_samples(RdpsndServerContext* context, const void* buf, int nframes,
UINT16 wTimestamp)
static UINT rdpsnd_server_send_samples(RdpsndServerContext* context, const void* buf,
size_t nframes, UINT16 wTimestamp)
{
int cframes;
int cframesize;
UINT error = CHANNEL_RC_OK;
EnterCriticalSection(&context->priv->lock);
@ -566,8 +564,9 @@ static UINT rdpsnd_server_send_samples(RdpsndServerContext* context, const void*
while (nframes > 0)
{
cframes = MIN(nframes, context->priv->out_frames - context->priv->out_pending_frames);
cframesize = cframes * context->priv->src_bytes_per_frame;
const size_t cframes =
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 +
(context->priv->out_pending_frames * context->priv->src_bytes_per_frame),
buf, cframesize);

View File

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

View File

@ -194,23 +194,7 @@ enum RDPDR_PRINTER_ANNOUNCE_FLAG
/* [MS-FSCC] FileAttributes */
#ifndef _WIN32
#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
/* Included with winpr/file.h */
/* [MS-FSCC] FSCTL Structures */

View File

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

View File

@ -268,7 +268,7 @@ struct _SHADOW_MSG_OUT_AUDIO_OUT_SAMPLES
SHADOW_MSG_OUT common;
AUDIO_FORMAT* audio_format;
void* buf;
int nFrames;
size_t nFrames;
UINT16 wTimestamp;
};
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 status;
pServerContext* ps;
rdpContext* pc;
proxyData* pdata;
freerdp_peer* client = (freerdp_peer*)arg;
proxyServer* server;

View File

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

View File

@ -86,14 +86,6 @@ typedef enum
/* Deprecated, here for compatibility */
#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
extern "C"
{

View File

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

View File

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