mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 00:14:11 +09:00
[warnings] fix various clang warnings
This commit is contained in:
@@ -164,7 +164,7 @@ fail:
|
||||
return fullpath;
|
||||
}
|
||||
|
||||
static BOOL drive_file_set_fullpath(DRIVE_FILE* file, WCHAR* fullpath)
|
||||
static BOOL drive_file_set_fullpath(DRIVE_FILE* file, const WCHAR* fullpath)
|
||||
{
|
||||
if (!file || !fullpath)
|
||||
return FALSE;
|
||||
@@ -176,7 +176,9 @@ static BOOL drive_file_set_fullpath(DRIVE_FILE* file, WCHAR* fullpath)
|
||||
if (len == 0)
|
||||
return TRUE;
|
||||
|
||||
file->fullpath = fullpath;
|
||||
file->fullpath = _wcsdup(fullpath);
|
||||
if (!file->fullpath)
|
||||
return FALSE;
|
||||
|
||||
const WCHAR sep[] = { PathGetSeparatorW(PATH_STYLE_NATIVE), '\0' };
|
||||
WCHAR* filename = _wcsrchr(file->fullpath, *sep);
|
||||
@@ -317,12 +319,10 @@ DRIVE_FILE* drive_file_new(const WCHAR* base_path, const WCHAR* path, UINT32 Pat
|
||||
UINT32 id, UINT32 DesiredAccess, UINT32 CreateDisposition,
|
||||
UINT32 CreateOptions, UINT32 FileAttributes, UINT32 SharedAccess)
|
||||
{
|
||||
DRIVE_FILE* file = NULL;
|
||||
|
||||
if (!base_path || (!path && (PathWCharLength > 0)))
|
||||
return NULL;
|
||||
|
||||
file = (DRIVE_FILE*)calloc(1, sizeof(DRIVE_FILE));
|
||||
DRIVE_FILE* file = (DRIVE_FILE*)calloc(1, sizeof(DRIVE_FILE));
|
||||
|
||||
if (!file)
|
||||
{
|
||||
@@ -339,7 +339,10 @@ DRIVE_FILE* drive_file_new(const WCHAR* base_path, const WCHAR* path, UINT32 Pat
|
||||
file->CreateDisposition = CreateDisposition;
|
||||
file->CreateOptions = CreateOptions;
|
||||
file->SharedAccess = SharedAccess;
|
||||
drive_file_set_fullpath(file, drive_file_combine_fullpath(base_path, path, PathWCharLength));
|
||||
|
||||
WCHAR* p = drive_file_combine_fullpath(base_path, path, PathWCharLength);
|
||||
(void)drive_file_set_fullpath(file, p);
|
||||
free(p);
|
||||
|
||||
if (!drive_file_init(file))
|
||||
{
|
||||
@@ -615,7 +618,6 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
|
||||
wStream* input)
|
||||
{
|
||||
INT64 size = 0;
|
||||
WCHAR* fullpath = NULL;
|
||||
ULARGE_INTEGER liCreationTime = { 0 };
|
||||
ULARGE_INTEGER liLastAccessTime = { 0 };
|
||||
ULARGE_INTEGER liLastWriteTime = { 0 };
|
||||
@@ -769,6 +771,7 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
|
||||
break;
|
||||
|
||||
case FileRenameInformation:
|
||||
{
|
||||
if (!Stream_CheckAndLogRequiredLength(TAG, input, 6))
|
||||
return FALSE;
|
||||
|
||||
@@ -780,8 +783,8 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
|
||||
if (!Stream_CheckAndLogRequiredLength(TAG, input, FileNameLength))
|
||||
return FALSE;
|
||||
|
||||
fullpath = drive_file_combine_fullpath(file->basepath, Stream_ConstPointer(input),
|
||||
FileNameLength / sizeof(WCHAR));
|
||||
WCHAR* fullpath = drive_file_combine_fullpath(
|
||||
file->basepath, Stream_ConstPointer(input), FileNameLength / sizeof(WCHAR));
|
||||
|
||||
if (!fullpath)
|
||||
return FALSE;
|
||||
@@ -801,7 +804,9 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
|
||||
MOVEFILE_COPY_ALLOWED |
|
||||
(ReplaceIfExists ? MOVEFILE_REPLACE_EXISTING : 0)))
|
||||
{
|
||||
if (!drive_file_set_fullpath(file, fullpath))
|
||||
const BOOL rc = drive_file_set_fullpath(file, fullpath);
|
||||
free(fullpath);
|
||||
if (!rc)
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
@@ -813,7 +818,8 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
|
||||
#ifdef _WIN32
|
||||
drive_file_init(file);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
@@ -822,9 +828,137 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL drive_file_query_dir_info(DRIVE_FILE* file, wStream* output, size_t length)
|
||||
{
|
||||
WINPR_ASSERT(file);
|
||||
WINPR_ASSERT(output);
|
||||
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232097.aspx */
|
||||
if (!Stream_EnsureRemainingCapacity(output, 4 + 64 + length))
|
||||
return FALSE;
|
||||
|
||||
if (length > UINT32_MAX - 64)
|
||||
return FALSE;
|
||||
|
||||
Stream_Write_UINT32(output, (UINT32)(64 + length)); /* Length */
|
||||
Stream_Write_UINT32(output, 0); /* NextEntryOffset */
|
||||
Stream_Write_UINT32(output, 0); /* FileIndex */
|
||||
Stream_Write_UINT32(output, file->find_data.ftCreationTime.dwLowDateTime); /* CreationTime */
|
||||
Stream_Write_UINT32(output, file->find_data.ftCreationTime.dwHighDateTime); /* CreationTime */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftLastAccessTime.dwLowDateTime); /* LastAccessTime */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftLastAccessTime.dwHighDateTime); /* LastAccessTime */
|
||||
Stream_Write_UINT32(output, file->find_data.ftLastWriteTime.dwLowDateTime); /* LastWriteTime */
|
||||
Stream_Write_UINT32(output, file->find_data.ftLastWriteTime.dwHighDateTime); /* LastWriteTime */
|
||||
Stream_Write_UINT32(output, file->find_data.ftLastWriteTime.dwLowDateTime); /* ChangeTime */
|
||||
Stream_Write_UINT32(output, file->find_data.ftLastWriteTime.dwHighDateTime); /* ChangeTime */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeLow); /* EndOfFile */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeHigh); /* EndOfFile */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeLow); /* AllocationSize */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeHigh); /* AllocationSize */
|
||||
Stream_Write_UINT32(output, file->find_data.dwFileAttributes); /* FileAttributes */
|
||||
Stream_Write_UINT32(output, (UINT32)length); /* FileNameLength */
|
||||
Stream_Write(output, file->find_data.cFileName, length);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL drive_file_query_full_dir_info(DRIVE_FILE* file, wStream* output, size_t length)
|
||||
{
|
||||
WINPR_ASSERT(file);
|
||||
WINPR_ASSERT(output);
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232068.aspx */
|
||||
if (!Stream_EnsureRemainingCapacity(output, 4 + 68 + length))
|
||||
return FALSE;
|
||||
|
||||
if (length > UINT32_MAX - 68)
|
||||
return FALSE;
|
||||
|
||||
Stream_Write_UINT32(output, (UINT32)(68 + length)); /* Length */
|
||||
Stream_Write_UINT32(output, 0); /* NextEntryOffset */
|
||||
Stream_Write_UINT32(output, 0); /* FileIndex */
|
||||
Stream_Write_UINT32(output, file->find_data.ftCreationTime.dwLowDateTime); /* CreationTime */
|
||||
Stream_Write_UINT32(output, file->find_data.ftCreationTime.dwHighDateTime); /* CreationTime */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftLastAccessTime.dwLowDateTime); /* LastAccessTime */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftLastAccessTime.dwHighDateTime); /* LastAccessTime */
|
||||
Stream_Write_UINT32(output, file->find_data.ftLastWriteTime.dwLowDateTime); /* LastWriteTime */
|
||||
Stream_Write_UINT32(output, file->find_data.ftLastWriteTime.dwHighDateTime); /* LastWriteTime */
|
||||
Stream_Write_UINT32(output, file->find_data.ftLastWriteTime.dwLowDateTime); /* ChangeTime */
|
||||
Stream_Write_UINT32(output, file->find_data.ftLastWriteTime.dwHighDateTime); /* ChangeTime */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeLow); /* EndOfFile */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeHigh); /* EndOfFile */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeLow); /* AllocationSize */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeHigh); /* AllocationSize */
|
||||
Stream_Write_UINT32(output, file->find_data.dwFileAttributes); /* FileAttributes */
|
||||
Stream_Write_UINT32(output, (UINT32)length); /* FileNameLength */
|
||||
Stream_Write_UINT32(output, 0); /* EaSize */
|
||||
Stream_Write(output, file->find_data.cFileName, length);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL drive_file_query_both_dir_info(DRIVE_FILE* file, wStream* output, size_t length)
|
||||
{
|
||||
WINPR_ASSERT(file);
|
||||
WINPR_ASSERT(output);
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232095.aspx */
|
||||
if (!Stream_EnsureRemainingCapacity(output, 4 + 93 + length))
|
||||
return FALSE;
|
||||
|
||||
if (length > UINT32_MAX - 93)
|
||||
return FALSE;
|
||||
|
||||
Stream_Write_UINT32(output, (UINT32)(93 + length)); /* Length */
|
||||
Stream_Write_UINT32(output, 0); /* NextEntryOffset */
|
||||
Stream_Write_UINT32(output, 0); /* FileIndex */
|
||||
Stream_Write_UINT32(output, file->find_data.ftCreationTime.dwLowDateTime); /* CreationTime */
|
||||
Stream_Write_UINT32(output, file->find_data.ftCreationTime.dwHighDateTime); /* CreationTime */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftLastAccessTime.dwLowDateTime); /* LastAccessTime */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftLastAccessTime.dwHighDateTime); /* LastAccessTime */
|
||||
Stream_Write_UINT32(output, file->find_data.ftLastWriteTime.dwLowDateTime); /* LastWriteTime */
|
||||
Stream_Write_UINT32(output, file->find_data.ftLastWriteTime.dwHighDateTime); /* LastWriteTime */
|
||||
Stream_Write_UINT32(output, file->find_data.ftLastWriteTime.dwLowDateTime); /* ChangeTime */
|
||||
Stream_Write_UINT32(output, file->find_data.ftLastWriteTime.dwHighDateTime); /* ChangeTime */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeLow); /* EndOfFile */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeHigh); /* EndOfFile */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeLow); /* AllocationSize */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeHigh); /* AllocationSize */
|
||||
Stream_Write_UINT32(output, file->find_data.dwFileAttributes); /* FileAttributes */
|
||||
Stream_Write_UINT32(output, (UINT32)length); /* FileNameLength */
|
||||
Stream_Write_UINT32(output, 0); /* EaSize */
|
||||
Stream_Write_UINT8(output, 0); /* ShortNameLength */
|
||||
/* Reserved(1), MUST NOT be added! */
|
||||
Stream_Zero(output, 24); /* ShortName */
|
||||
Stream_Write(output, file->find_data.cFileName, length);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL drive_file_query_names_info(DRIVE_FILE* file, wStream* output, size_t length)
|
||||
{
|
||||
WINPR_ASSERT(file);
|
||||
WINPR_ASSERT(output);
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232077.aspx */
|
||||
if (!Stream_EnsureRemainingCapacity(output, 4 + 12 + length))
|
||||
return FALSE;
|
||||
|
||||
if (length > UINT32_MAX - 12)
|
||||
return FALSE;
|
||||
|
||||
Stream_Write_UINT32(output, (UINT32)(12 + length)); /* Length */
|
||||
Stream_Write_UINT32(output, 0); /* NextEntryOffset */
|
||||
Stream_Write_UINT32(output, 0); /* FileIndex */
|
||||
Stream_Write_UINT32(output, (UINT32)length); /* FileNameLength */
|
||||
Stream_Write(output, file->find_data.cFileName, length);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL drive_file_query_directory(DRIVE_FILE* file, UINT32 FsInformationClass, BYTE InitialQuery,
|
||||
const WCHAR* path, UINT32 PathWCharLength, wStream* output)
|
||||
{
|
||||
BOOL rc = FALSE;
|
||||
size_t length = 0;
|
||||
WCHAR* ent_path = NULL;
|
||||
|
||||
@@ -853,135 +987,19 @@ BOOL drive_file_query_directory(DRIVE_FILE* file, UINT32 FsInformationClass, BYT
|
||||
switch (FsInformationClass)
|
||||
{
|
||||
case FileDirectoryInformation:
|
||||
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232097.aspx */
|
||||
if (!Stream_EnsureRemainingCapacity(output, 4 + 64 + length))
|
||||
goto out_fail;
|
||||
|
||||
if (length > UINT32_MAX - 64)
|
||||
goto out_fail;
|
||||
|
||||
Stream_Write_UINT32(output, (UINT32)(64 + length)); /* Length */
|
||||
Stream_Write_UINT32(output, 0); /* NextEntryOffset */
|
||||
Stream_Write_UINT32(output, 0); /* FileIndex */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftCreationTime.dwLowDateTime); /* CreationTime */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftCreationTime.dwHighDateTime); /* CreationTime */
|
||||
Stream_Write_UINT32(
|
||||
output, file->find_data.ftLastAccessTime.dwLowDateTime); /* LastAccessTime */
|
||||
Stream_Write_UINT32(
|
||||
output, file->find_data.ftLastAccessTime.dwHighDateTime); /* LastAccessTime */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftLastWriteTime.dwLowDateTime); /* LastWriteTime */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftLastWriteTime.dwHighDateTime); /* LastWriteTime */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftLastWriteTime.dwLowDateTime); /* ChangeTime */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftLastWriteTime.dwHighDateTime); /* ChangeTime */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeLow); /* EndOfFile */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeHigh); /* EndOfFile */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeLow); /* AllocationSize */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeHigh); /* AllocationSize */
|
||||
Stream_Write_UINT32(output, file->find_data.dwFileAttributes); /* FileAttributes */
|
||||
Stream_Write_UINT32(output, (UINT32)length); /* FileNameLength */
|
||||
Stream_Write(output, file->find_data.cFileName, length);
|
||||
rc = drive_file_query_dir_info(file, output, length);
|
||||
break;
|
||||
|
||||
case FileFullDirectoryInformation:
|
||||
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232068.aspx */
|
||||
if (!Stream_EnsureRemainingCapacity(output, 4 + 68 + length))
|
||||
goto out_fail;
|
||||
|
||||
if (length > UINT32_MAX - 68)
|
||||
goto out_fail;
|
||||
|
||||
Stream_Write_UINT32(output, (UINT32)(68 + length)); /* Length */
|
||||
Stream_Write_UINT32(output, 0); /* NextEntryOffset */
|
||||
Stream_Write_UINT32(output, 0); /* FileIndex */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftCreationTime.dwLowDateTime); /* CreationTime */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftCreationTime.dwHighDateTime); /* CreationTime */
|
||||
Stream_Write_UINT32(
|
||||
output, file->find_data.ftLastAccessTime.dwLowDateTime); /* LastAccessTime */
|
||||
Stream_Write_UINT32(
|
||||
output, file->find_data.ftLastAccessTime.dwHighDateTime); /* LastAccessTime */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftLastWriteTime.dwLowDateTime); /* LastWriteTime */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftLastWriteTime.dwHighDateTime); /* LastWriteTime */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftLastWriteTime.dwLowDateTime); /* ChangeTime */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftLastWriteTime.dwHighDateTime); /* ChangeTime */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeLow); /* EndOfFile */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeHigh); /* EndOfFile */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeLow); /* AllocationSize */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeHigh); /* AllocationSize */
|
||||
Stream_Write_UINT32(output, file->find_data.dwFileAttributes); /* FileAttributes */
|
||||
Stream_Write_UINT32(output, (UINT32)length); /* FileNameLength */
|
||||
Stream_Write_UINT32(output, 0); /* EaSize */
|
||||
Stream_Write(output, file->find_data.cFileName, length);
|
||||
rc = drive_file_query_full_dir_info(file, output, length);
|
||||
break;
|
||||
|
||||
case FileBothDirectoryInformation:
|
||||
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232095.aspx */
|
||||
if (!Stream_EnsureRemainingCapacity(output, 4 + 93 + length))
|
||||
goto out_fail;
|
||||
|
||||
if (length > UINT32_MAX - 93)
|
||||
goto out_fail;
|
||||
|
||||
Stream_Write_UINT32(output, (UINT32)(93 + length)); /* Length */
|
||||
Stream_Write_UINT32(output, 0); /* NextEntryOffset */
|
||||
Stream_Write_UINT32(output, 0); /* FileIndex */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftCreationTime.dwLowDateTime); /* CreationTime */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftCreationTime.dwHighDateTime); /* CreationTime */
|
||||
Stream_Write_UINT32(
|
||||
output, file->find_data.ftLastAccessTime.dwLowDateTime); /* LastAccessTime */
|
||||
Stream_Write_UINT32(
|
||||
output, file->find_data.ftLastAccessTime.dwHighDateTime); /* LastAccessTime */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftLastWriteTime.dwLowDateTime); /* LastWriteTime */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftLastWriteTime.dwHighDateTime); /* LastWriteTime */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftLastWriteTime.dwLowDateTime); /* ChangeTime */
|
||||
Stream_Write_UINT32(output,
|
||||
file->find_data.ftLastWriteTime.dwHighDateTime); /* ChangeTime */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeLow); /* EndOfFile */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeHigh); /* EndOfFile */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeLow); /* AllocationSize */
|
||||
Stream_Write_UINT32(output, file->find_data.nFileSizeHigh); /* AllocationSize */
|
||||
Stream_Write_UINT32(output, file->find_data.dwFileAttributes); /* FileAttributes */
|
||||
Stream_Write_UINT32(output, (UINT32)length); /* FileNameLength */
|
||||
Stream_Write_UINT32(output, 0); /* EaSize */
|
||||
Stream_Write_UINT8(output, 0); /* ShortNameLength */
|
||||
/* Reserved(1), MUST NOT be added! */
|
||||
Stream_Zero(output, 24); /* ShortName */
|
||||
Stream_Write(output, file->find_data.cFileName, length);
|
||||
rc = drive_file_query_both_dir_info(file, output, length);
|
||||
break;
|
||||
|
||||
case FileNamesInformation:
|
||||
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232077.aspx */
|
||||
if (!Stream_EnsureRemainingCapacity(output, 4 + 12 + length))
|
||||
goto out_fail;
|
||||
|
||||
if (length > UINT32_MAX - 12)
|
||||
goto out_fail;
|
||||
|
||||
Stream_Write_UINT32(output, (UINT32)(12 + length)); /* Length */
|
||||
Stream_Write_UINT32(output, 0); /* NextEntryOffset */
|
||||
Stream_Write_UINT32(output, 0); /* FileIndex */
|
||||
Stream_Write_UINT32(output, (UINT32)length); /* FileNameLength */
|
||||
Stream_Write(output, file->find_data.cFileName, length);
|
||||
rc = drive_file_query_names_info(file, output, length);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -990,9 +1008,11 @@ BOOL drive_file_query_directory(DRIVE_FILE* file, UINT32 FsInformationClass, BYT
|
||||
goto out_fail;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
out_fail:
|
||||
Stream_Write_UINT32(output, 0); /* Length */
|
||||
Stream_Write_UINT8(output, 0); /* Padding */
|
||||
return FALSE;
|
||||
if (!rc)
|
||||
{
|
||||
Stream_Write_UINT32(output, 0); /* Length */
|
||||
Stream_Write_UINT8(output, 0); /* Padding */
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ static BOOL sdl_apply_display_properties(SdlContext* sdl)
|
||||
}
|
||||
}
|
||||
}
|
||||
SDL_free(modes);
|
||||
SDL_free(static_cast<void*>(modes));
|
||||
|
||||
const float dw = 1.0f * static_cast<float>(rect.w) / static_cast<float>(scaleRect.w);
|
||||
const float dh = 1.0f * static_cast<float>(rect.h) / static_cast<float>(scaleRect.h);
|
||||
|
||||
@@ -750,9 +750,11 @@ static BOOL request_file_size_async(CliprdrFileContext* file_context, CliprdrFus
|
||||
HashTable_Remove(file_context->request_table, (void*)(uintptr_t)fuse_request->stream_id);
|
||||
return FALSE;
|
||||
}
|
||||
// NOLINTNEXTLINE(clang-analyzer-unix.Malloc)
|
||||
DEBUG_CLIPRDR(file_context->log, "Requested file size for file \"%s\" with stream id %u",
|
||||
fuse_file->filename, fuse_request->stream_id);
|
||||
|
||||
// NOLINTNEXTLINE(clang-analyzer-unix.Malloc)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -757,10 +757,8 @@ static SSIZE_T freerdp_client_rdp_file_add_line(rdpFile* file)
|
||||
|
||||
while ((file->lineCount + 1) > file->lineSize)
|
||||
{
|
||||
size_t new_size = 0;
|
||||
rdpFileLine* new_line = NULL;
|
||||
new_size = file->lineSize * 2;
|
||||
new_line = (rdpFileLine*)realloc(file->lines, new_size * sizeof(rdpFileLine));
|
||||
size_t new_size = file->lineCount + 2048;
|
||||
rdpFileLine* new_line = (rdpFileLine*)realloc(file->lines, new_size * sizeof(rdpFileLine));
|
||||
|
||||
if (!new_line)
|
||||
return -1;
|
||||
|
||||
@@ -152,9 +152,9 @@ static int openh264_decompress(H264_CONTEXT* WINPR_RESTRICT h264,
|
||||
#endif
|
||||
|
||||
pSystemBuffer = &sBufferInfo.UsrData.sSystemBuffer;
|
||||
iStride[0] = pSystemBuffer->iStride[0];
|
||||
iStride[1] = pSystemBuffer->iStride[1];
|
||||
iStride[2] = pSystemBuffer->iStride[1];
|
||||
iStride[0] = WINPR_ASSERTING_INT_CAST(uint32_t, pSystemBuffer->iStride[0]);
|
||||
iStride[1] = WINPR_ASSERTING_INT_CAST(uint32_t, pSystemBuffer->iStride[1]);
|
||||
iStride[2] = WINPR_ASSERTING_INT_CAST(uint32_t, pSystemBuffer->iStride[1]);
|
||||
|
||||
if (sBufferInfo.iBufferStatus != 1)
|
||||
{
|
||||
@@ -254,13 +254,15 @@ static int openh264_compress(H264_CONTEXT* WINPR_RESTRICT h264,
|
||||
sys->EncParamExt.iUsageType = usageType;
|
||||
sys->EncParamExt.iPicWidth = WINPR_ASSERTING_INT_CAST(int, h264->width);
|
||||
sys->EncParamExt.iPicHeight = WINPR_ASSERTING_INT_CAST(int, h264->height);
|
||||
sys->EncParamExt.fMaxFrameRate = WINPR_ASSERTING_INT_CAST(int, h264->FrameRate);
|
||||
sys->EncParamExt.fMaxFrameRate = WINPR_ASSERTING_INT_CAST(short, h264->FrameRate);
|
||||
sys->EncParamExt.iMaxBitrate = UNSPECIFIED_BIT_RATE;
|
||||
sys->EncParamExt.bEnableDenoise = 0;
|
||||
sys->EncParamExt.bEnableLongTermReference = 0;
|
||||
sys->EncParamExt.iSpatialLayerNum = 1;
|
||||
sys->EncParamExt.iMultipleThreadIdc = (int)h264->NumberOfThreads;
|
||||
sys->EncParamExt.sSpatialLayers[0].fFrameRate = h264->FrameRate;
|
||||
sys->EncParamExt.iMultipleThreadIdc =
|
||||
WINPR_ASSERTING_INT_CAST(unsigned short, h264->NumberOfThreads);
|
||||
sys->EncParamExt.sSpatialLayers[0].fFrameRate =
|
||||
WINPR_ASSERTING_INT_CAST(short, h264->FrameRate);
|
||||
sys->EncParamExt.sSpatialLayers[0].iVideoWidth = sys->EncParamExt.iPicWidth;
|
||||
sys->EncParamExt.sSpatialLayers[0].iVideoHeight = sys->EncParamExt.iPicHeight;
|
||||
sys->EncParamExt.sSpatialLayers[0].iMaxSpatialBitrate = sys->EncParamExt.iMaxBitrate;
|
||||
@@ -280,6 +282,8 @@ static int openh264_compress(H264_CONTEXT* WINPR_RESTRICT h264,
|
||||
sys->EncParamExt.sSpatialLayers[0].iDLayerQp = (int)h264->QP;
|
||||
sys->EncParamExt.bEnableFrameSkip = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (sys->EncParamExt.iMultipleThreadIdc > 1)
|
||||
@@ -338,9 +342,9 @@ static int openh264_compress(H264_CONTEXT* WINPR_RESTRICT h264,
|
||||
}
|
||||
}
|
||||
|
||||
if (sys->EncParamExt.fMaxFrameRate != (int)h264->FrameRate)
|
||||
if ((uint32_t)sys->EncParamExt.fMaxFrameRate != h264->FrameRate)
|
||||
{
|
||||
sys->EncParamExt.fMaxFrameRate = (int)h264->FrameRate;
|
||||
sys->EncParamExt.fMaxFrameRate = WINPR_ASSERTING_INT_CAST(int, h264->FrameRate);
|
||||
|
||||
WINPR_ASSERT((*sys->pEncoder)->SetOption);
|
||||
status = (*sys->pEncoder)
|
||||
@@ -375,6 +379,8 @@ static int openh264_compress(H264_CONTEXT* WINPR_RESTRICT h264,
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -621,9 +627,9 @@ static BOOL openh264_init(H264_CONTEXT* h264)
|
||||
goto EXCEPTION;
|
||||
}
|
||||
|
||||
status =
|
||||
(*sys->pDecoder)
|
||||
->SetOption(sys->pDecoder, DECODER_OPTION_TRACE_CALLBACK_CONTEXT, &h264);
|
||||
status = (*sys->pDecoder)
|
||||
->SetOption(sys->pDecoder, DECODER_OPTION_TRACE_CALLBACK_CONTEXT,
|
||||
(void*)&h264);
|
||||
|
||||
if (status != 0)
|
||||
{
|
||||
@@ -634,9 +640,9 @@ static BOOL openh264_init(H264_CONTEXT* h264)
|
||||
goto EXCEPTION;
|
||||
}
|
||||
|
||||
status =
|
||||
(*sys->pDecoder)
|
||||
->SetOption(sys->pDecoder, DECODER_OPTION_TRACE_CALLBACK, &traceCallback);
|
||||
status = (*sys->pDecoder)
|
||||
->SetOption(sys->pDecoder, DECODER_OPTION_TRACE_CALLBACK,
|
||||
(void*)&traceCallback);
|
||||
|
||||
if (status != 0)
|
||||
{
|
||||
|
||||
@@ -471,6 +471,8 @@ static void certificate_free_x509_certificate_chain(rdpX509CertChain* x509_cert_
|
||||
}
|
||||
|
||||
free(x509_cert_chain->array);
|
||||
x509_cert_chain->array = NULL;
|
||||
x509_cert_chain->count = 0;
|
||||
}
|
||||
|
||||
#if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3)
|
||||
|
||||
@@ -129,7 +129,7 @@ static BOOL cl_kernel_set_sources(primitives_cl_kernel* ctx, const BYTE* WINPR_R
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ret = clSetKernelArg(ctx->kernel, i * 2, sizeof(cl_mem), &ctx->srcObjs[i]);
|
||||
ret = clSetKernelArg(ctx->kernel, i * 2, sizeof(cl_mem), (const void*)&ctx->srcObjs[i]);
|
||||
if (ret != CL_SUCCESS)
|
||||
{
|
||||
WLog_ERR(TAG, "unable to set arg for %sobj", sourceNames[i]);
|
||||
@@ -162,7 +162,7 @@ static BOOL cl_kernel_set_destination(primitives_cl_kernel* ctx, UINT32 dstStep)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ret = clSetKernelArg(ctx->kernel, 6, sizeof(cl_mem), &ctx->dstObj);
|
||||
ret = clSetKernelArg(ctx->kernel, 6, sizeof(cl_mem), (const void*)&ctx->dstObj);
|
||||
if (ret != CL_SUCCESS)
|
||||
{
|
||||
WLog_ERR(TAG, "unable to set arg destObj");
|
||||
|
||||
@@ -92,6 +92,10 @@ static BOOL similarRGB(size_t y, const BYTE* src, const BYTE* dst, size_t size,
|
||||
"[%s] Color value mismatch R[%02X %02X], G[%02X %02X], B[%02X %02X] at "
|
||||
"position %" PRIuz "\n",
|
||||
use444 ? "AVC444" : "AVC420", sR, dR, sG, dG, sA, dA, x);
|
||||
(void)fprintf(stderr,
|
||||
"[%s] Color value mismatch Y[%02X %02X], U[%02X %02X], V[%02X %02X] at "
|
||||
"position %" PRIuz "\n",
|
||||
use444 ? "AVC444" : "AVC420", sY, dY, sU, dU, sV, dV, x);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -207,15 +207,13 @@ static const char* freerdp_passphrase_read_tty(rdpContext* context, const char*
|
||||
}
|
||||
|
||||
if (terminal_fildes != STDIN_FILENO)
|
||||
{
|
||||
if (fclose(fp) == -1)
|
||||
goto error;
|
||||
}
|
||||
(void)fclose(fp);
|
||||
|
||||
return buf;
|
||||
|
||||
error:
|
||||
{
|
||||
// NOLINTNEXTLINE(clang-analyzer-unix.Stream)
|
||||
int saved_errno = errno;
|
||||
if (terminal_needs_reset)
|
||||
(void)tcsetattr(terminal_fildes, TCSAFLUSH, &orig_flags);
|
||||
@@ -225,9 +223,11 @@ error:
|
||||
if (fp)
|
||||
(void)fclose(fp);
|
||||
}
|
||||
// NOLINTNEXTLINE(clang-analyzer-unix.Stream)
|
||||
errno = saved_errno;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char* freerdp_passphrase_read_askpass(const char* prompt, char* buf, size_t bufsiz,
|
||||
|
||||
@@ -474,13 +474,13 @@ BOOL WINAPI GetFileAttributesExA(LPCSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfo
|
||||
LPVOID lpFileInformation)
|
||||
{
|
||||
LPWIN32_FILE_ATTRIBUTE_DATA fd = lpFileInformation;
|
||||
WIN32_FIND_DATAA findFileData;
|
||||
HANDLE hFind = NULL;
|
||||
WIN32_FIND_DATAA findFileData = { 0 };
|
||||
|
||||
if (!fd)
|
||||
return FALSE;
|
||||
|
||||
if ((hFind = FindFirstFileA(lpFileName, &findFileData)) == INVALID_HANDLE_VALUE)
|
||||
HANDLE hFind = FindFirstFileA(lpFileName, &findFileData);
|
||||
if (hFind == INVALID_HANDLE_VALUE)
|
||||
return FALSE;
|
||||
|
||||
FindClose(hFind);
|
||||
@@ -514,10 +514,10 @@ BOOL WINAPI GetFileAttributesExW(LPCWSTR lpFileName, GET_FILEEX_INFO_LEVELS fInf
|
||||
|
||||
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
|
||||
{
|
||||
WIN32_FIND_DATAA findFileData;
|
||||
HANDLE hFind = NULL;
|
||||
WIN32_FIND_DATAA findFileData = { 0 };
|
||||
HANDLE hFind = FindFirstFileA(lpFileName, &findFileData);
|
||||
|
||||
if ((hFind = FindFirstFileA(lpFileName, &findFileData)) == INVALID_HANDLE_VALUE)
|
||||
if (hFind == INVALID_HANDLE_VALUE)
|
||||
return INVALID_FILE_ATTRIBUTES;
|
||||
|
||||
FindClose(hFind);
|
||||
@@ -1217,6 +1217,7 @@ BOOL FindClose(HANDLE hFindFile)
|
||||
if (pFileSearch->pDir)
|
||||
closedir(pFileSearch->pDir);
|
||||
|
||||
// NOLINTNEXTLINE(clang-analyzer-unix.Malloc)
|
||||
free(pFileSearch);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1081,7 +1081,7 @@ static size_t WinPrAsn1DecReadMemoryChunkLike(WinPrAsn1Decoder* dec, WinPrAsn1_t
|
||||
ret += len;
|
||||
|
||||
target->len = len;
|
||||
if (allocate)
|
||||
if (allocate && (len > 0))
|
||||
{
|
||||
target->data = malloc(len);
|
||||
if (!target->data)
|
||||
|
||||
Reference in New Issue
Block a user