Merge pull request #1100 from bmiklautz/fix_warnings

Build and test fixes
This commit is contained in:
Marc-André Moreau 2013-03-15 15:42:38 -07:00
commit d19fba4a07
36 changed files with 112 additions and 260 deletions

View File

@ -635,7 +635,7 @@ BOOL WTSVirtualChannelQuery(
int fds_count = 0;
BOOL result = FALSE;
rdpPeerChannel* channel = (rdpPeerChannel*) hChannelHandle;
ZeroMemory(fds, sizeof(fds));
switch (WtsVirtualClass)
{
case WTSVirtualFileHandle:

View File

@ -545,7 +545,7 @@ MRDPRailView* g_mrdpRailView;
- (void) keyDown:(NSEvent *) event
{
int key;
BOOL extended;
USHORT extended;
DWORD vkcode;
DWORD scancode;
@ -565,7 +565,7 @@ MRDPRailView* g_mrdpRailView;
- (void) keyUp:(NSEvent *) event
{
int key;
BOOL extended;
USHORT extended;
DWORD vkcode;
DWORD scancode;
@ -573,7 +573,7 @@ MRDPRailView* g_mrdpRailView;
vkcode = GetVirtualKeyCodeFromKeycode(key, KEYCODE_TYPE_APPLE);
scancode = GetVirtualScanCodeFromVirtualKeyCode(vkcode, 4);
extended = (scancode & KBDEXT) ? KBDEXT : 0;
extended = (scancode & KBDEXT) ? TRUE : FALSE;
rdp_instance->input->KeyboardEvent(rdp_instance->input, extended | KBD_FLAGS_RELEASE, scancode & 0xFF);
}

View File

@ -370,7 +370,7 @@ const char* error_code_names[] =
- (void) keyDown:(NSEvent *) event
{
int key;
BOOL extended;
USHORT extended;
DWORD vkcode;
DWORD scancode;
@ -393,7 +393,7 @@ const char* error_code_names[] =
- (void) keyUp:(NSEvent *) event
{
int key;
BOOL extended;
USHORT extended;
DWORD vkcode;
DWORD scancode;
@ -595,7 +595,7 @@ const char* error_code_names[] =
* save state info for use by other methods later on
***********************************************************************/
- (void) saveStateInfo:(freerdp *) instance:(rdpContext *) context
- (void) saveStateInfo:(freerdp *) instance :(rdpContext *) context
{
rdp_instance = instance;
rdp_context = context;

View File

@ -64,6 +64,7 @@
#include <winpr/crt.h>
#include <winpr/synch.h>
#include <winpr/file.h>
#include "xf_gdi.h"
#include "xf_rail.h"
@ -1204,7 +1205,7 @@ int xfreerdp_run(freerdp* instance)
fd_set rfds_set;
fd_set wfds_set;
int fd_input_event;
HANDLE input_event;
HANDLE input_event = INVALID_HANDLE_VALUE;
int select_status;
BOOL async_update;
BOOL async_input;

View File

@ -963,19 +963,19 @@ int freerdp_client_parse_command_line_arguments(int argc, char** argv, rdpSettin
layouts = freerdp_keyboard_get_layouts(RDP_KEYBOARD_LAYOUT_TYPE_STANDARD);
printf("\nKeyboard Layouts\n");
for (i = 0; layouts[i].code; i++)
printf("0x%08X\t%s\n", layouts[i].code, layouts[i].name);
printf("0x%08lX\t%s\n", layouts[i].code, layouts[i].name);
free(layouts);
layouts = freerdp_keyboard_get_layouts(RDP_KEYBOARD_LAYOUT_TYPE_VARIANT);
printf("\nKeyboard Layout Variants\n");
for (i = 0; layouts[i].code; i++)
printf("0x%08X\t%s\n", layouts[i].code, layouts[i].name);
printf("0x%08lX\t%s\n", layouts[i].code, layouts[i].name);
free(layouts);
layouts = freerdp_keyboard_get_layouts(RDP_KEYBOARD_LAYOUT_TYPE_IME);
printf("\nKeyboard Input Method Editors (IMEs)\n");
for (i = 0; layouts[i].code; i++)
printf("0x%08X\t%s\n", layouts[i].code, layouts[i].name);
printf("0x%08lX\t%s\n", layouts[i].code, layouts[i].name);
free(layouts);
printf("\n");

View File

@ -269,19 +269,19 @@ int TestClientRdpFile(int argc, char* argv[])
if (file->UseMultiMon != 0)
{
printf("UseMultiMon mismatch: Actual: %d, Expected: %d\n", file->UseMultiMon, 0);
printf("UseMultiMon mismatch: Actual: %ld, Expected: %d\n", file->UseMultiMon, 0);
return -1;
}
if (file->ScreenModeId != 2)
{
printf("ScreenModeId mismatch: Actual: %d, Expected: %d\n", file->ScreenModeId, 2);
printf("ScreenModeId mismatch: Actual: %ld, Expected: %d\n", file->ScreenModeId, 2);
return -1;
}
if (file->GatewayProfileUsageMethod != 1)
{
printf("GatewayProfileUsageMethod mismatch: Actual: %d, Expected: %d\n", file->GatewayProfileUsageMethod, 1);
printf("GatewayProfileUsageMethod mismatch: Actual: %ld, Expected: %d\n", file->GatewayProfileUsageMethod, 1);
return -1;
}
@ -301,19 +301,19 @@ int TestClientRdpFile(int argc, char* argv[])
if (file->UseMultiMon != 0)
{
printf("UseMultiMon mismatch: Actual: %d, Expected: %d\n", file->UseMultiMon, 0);
printf("UseMultiMon mismatch: Actual: %ld, Expected: %d\n", file->UseMultiMon, 0);
return -1;
}
if (file->ScreenModeId != 2)
{
printf("ScreenModeId mismatch: Actual: %d, Expected: %d\n", file->ScreenModeId, 2);
printf("ScreenModeId mismatch: Actual: %ld, Expected: %d\n", file->ScreenModeId, 2);
return -1;
}
if (file->GatewayProfileUsageMethod != 1)
{
printf("GatewayProfileUsageMethod mismatch: Actual: %d, Expected: %d\n", file->GatewayProfileUsageMethod, 1);
printf("GatewayProfileUsageMethod mismatch: Actual: %ld, Expected: %d\n", file->GatewayProfileUsageMethod, 1);
return -1;
}

View File

@ -39,10 +39,16 @@
#define CACHE_LINE_BYTES 64
#ifndef __clang__
#define ATTRIBUTES __gnu_inline__, __always_inline__, __artificial__
#else
#define ATTRIBUTES __gnu_inline__, __always_inline__
#endif
#define _mm_between_epi16(_val, _min, _max) \
do { _val = _mm_min_epi16(_max, _mm_max_epi16(_val, _min)); } while (0)
static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
static __inline void __attribute__((ATTRIBUTES))
_mm_prefetch_buffer(char * buffer, int num_bytes)
{
__m128i * buf = (__m128i*) buffer;
@ -56,7 +62,7 @@ _mm_prefetch_buffer(char * buffer, int num_bytes)
/* rfx_decode_ycbcr_to_rgb_sse2 code now resides in the primitives library. */
/* rfx_encode_rgb_to_ycbcr_sse2 code now resides in the primitives library. */
static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
static __inline void __attribute__((ATTRIBUTES))
rfx_quantization_decode_block_sse2(INT16* buffer, const int buffer_size, const UINT32 factor)
{
__m128i a;
@ -94,7 +100,7 @@ static void rfx_quantization_decode_sse2(INT16* buffer, const UINT32* quantizati
rfx_quantization_decode_block_sse2(buffer + 4032, 64, quantization_values[0] - 6); /* LL3 */
}
static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
static __inline void __attribute__((ATTRIBUTES))
rfx_quantization_encode_block_sse2(INT16* buffer, const int buffer_size, const UINT32 factor)
{
__m128i a;
@ -135,7 +141,7 @@ static void rfx_quantization_encode_sse2(INT16* buffer, const UINT32* quantizati
rfx_quantization_encode_block_sse2(buffer, 4096, 5);
}
static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
static __inline void __attribute__((ATTRIBUTES))
rfx_dwt_2d_decode_block_horiz_sse2(INT16* l, INT16* h, INT16* dst, int subband_width)
{
int y, n;
@ -222,7 +228,7 @@ rfx_dwt_2d_decode_block_horiz_sse2(INT16* l, INT16* h, INT16* dst, int subband_w
}
}
static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
static __inline void __attribute__((ATTRIBUTES))
rfx_dwt_2d_decode_block_vert_sse2(INT16* l, INT16* h, INT16* dst, int subband_width)
{
int x, n;
@ -303,7 +309,7 @@ rfx_dwt_2d_decode_block_vert_sse2(INT16* l, INT16* h, INT16* dst, int subband_wi
}
}
static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
static __inline void __attribute__((ATTRIBUTES))
rfx_dwt_2d_decode_block_sse2(INT16* buffer, INT16* idwt, int subband_width)
{
INT16 *hl, *lh, *hh, *ll;
@ -341,7 +347,7 @@ static void rfx_dwt_2d_decode_sse2(INT16* buffer, INT16* dwt_buffer)
rfx_dwt_2d_decode_block_sse2(buffer, dwt_buffer, 32);
}
static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
static __inline void __attribute__((ATTRIBUTES))
rfx_dwt_2d_encode_block_vert_sse2(INT16* src, INT16* l, INT16* h, int subband_width)
{
int total_width;
@ -397,7 +403,7 @@ rfx_dwt_2d_encode_block_vert_sse2(INT16* src, INT16* l, INT16* h, int subband_wi
}
}
static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
static __inline void __attribute__((ATTRIBUTES))
rfx_dwt_2d_encode_block_horiz_sse2(INT16* src, INT16* l, INT16* h, int subband_width)
{
int y;
@ -451,7 +457,7 @@ rfx_dwt_2d_encode_block_horiz_sse2(INT16* src, INT16* l, INT16* h, int subband_w
}
}
static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
static __inline void __attribute__((ATTRIBUTES))
rfx_dwt_2d_encode_block_sse2(INT16* buffer, INT16* dwt, int subband_width)
{
INT16 *hl, *lh, *hh, *ll;

View File

@ -105,6 +105,7 @@ char* gdi_convert_postfix_to_infix(char* postfix)
wStack* stack;
int al, bl, cl, dl;
char *a, *b, *c, *d;
al = bl = cl = dl =0;
stack = Stack_New(FALSE);
@ -153,7 +154,7 @@ char* gdi_convert_postfix_to_infix(char* postfix)
}
else
{
printf("invalid operator: %s\n", c[0]);
printf("invalid operator: %c\n", c[0]);
}
//printf("Operator: %s\n", c);

View File

@ -44,12 +44,6 @@
static char* test_pcap_file = NULL;
static BOOL test_dump_rfx_realtime = TRUE;
/* HL1, LH1, HH1, HL2, LH2, HH2, HL3, LH3, HH3, LL3 */
static const unsigned int test_quantization_values[] =
{
6, 6, 6, 6, 7, 7, 8, 8, 8, 9
};
void test_peer_context_new(freerdp_peer* client, testPeerContext* context)
{
context->rfx_context = rfx_context_new();

View File

@ -26,7 +26,7 @@ int TestCredUICmdLinePromptForCredentials(int argc, char* argv[])
if (status != NO_ERROR)
{
printf("CredUIPromptForCredentials unexpected status: 0x%08X\n", status);
printf("CredUIPromptForCredentials unexpected status: 0x%08lX\n", status);
return -1;
}

View File

@ -22,7 +22,7 @@ int TestCredUIParseUserName(int argc, char* argv[])
status = CredUIParseUserName(testUserName1, User, sizeof(User) / sizeof(TCHAR),
Domain, sizeof(Domain) / sizeof(TCHAR));
printf("CredUIParseUserName status: 0x%08X\n", status);
printf("CredUIParseUserName status: 0x%08lX\n", status);
_tprintf(_T("UserName: %s -> Domain: %s User: %s\n"), testUserName1, Domain, User);
@ -34,7 +34,7 @@ int TestCredUIParseUserName(int argc, char* argv[])
status = CredUIParseUserName(testUserName2, User, sizeof(User) / sizeof(TCHAR),
Domain, sizeof(Domain) / sizeof(TCHAR));
printf("CredUIParseUserName status: 0x%08X\n", status);
printf("CredUIParseUserName status: 0x%08lX\n", status);
_tprintf(_T("UserName: %s -> Domain: %s User: %s\n"), testUserName2, Domain, User);

View File

@ -35,7 +35,7 @@ int TestCredUIPromptForCredentials(int argc, char* argv[])
if (status != NO_ERROR)
{
printf("CredUIPromptForCredentials unexpected status: 0x%08X\n", status);
printf("CredUIPromptForCredentials unexpected status: 0x%08lX\n", status);
return -1;
}

View File

@ -98,6 +98,9 @@ size_t _wcslen(const WCHAR* str)
{
WCHAR* p = (WCHAR*) str;
if (!p)
return 0;
while (*p)
p++;

View File

@ -26,7 +26,7 @@ int TestAlignment(int argc, char* argv[])
if (((size_t) ptr % alignment) != 0)
{
printf("This pointer, %d, is not aligned on %d\n", ptr, alignment);
printf("This pointer, %p, is not aligned on %lu\n", ptr, (unsigned long)alignment);
return -1;
}
@ -36,7 +36,7 @@ int TestAlignment(int argc, char* argv[])
if (((size_t) ptr % alignment) != 0)
{
printf("This pointer, %d, is not aligned on %d\n", ptr, alignment);
printf("This pointer, %p, is not aligned on %lu\n", ptr, (unsigned long)alignment);
return -1;
}
@ -54,7 +54,8 @@ int TestAlignment(int argc, char* argv[])
if (((((size_t) ptr) + offset) % alignment) != 0)
{
printf("This pointer, %d, does not satisfy offset %d and alignment %d\n", ptr, offset, alignment);
printf("This pointer, %p, does not satisfy offset %lu and alignment %lu\n", ptr, (unsigned
long)offset, (unsigned long)alignment);
return -1;
}
@ -70,7 +71,8 @@ int TestAlignment(int argc, char* argv[])
if (((((size_t) ptr) + offset) % alignment) != 0)
{
printf("This pointer, %d, does not satisfy offset %d and alignment %d\n", ptr, offset, alignment);
printf("This pointer, %p, does not satisfy offset %lu and alignment %lu\n", ptr, (unsigned
long)offset, (unsigned long)alignment);
return -1;
}

View File

@ -38,7 +38,8 @@ int TestString(int argc, char* argv[])
if (length != testStringW_Length)
{
printf("_wcslen error: length mismatch: Actual: %d, Expected: %d\n", length, testStringW_Length);
printf("_wcslen error: length mismatch: Actual: %lu, Expected: %lu\n", (unsigned long) length,
(unsigned long) testStringW_Length);
return -1;
}
@ -49,7 +50,8 @@ int TestString(int argc, char* argv[])
if (pos != 11)
{
printf("_wcschr error: position mismatch: Actual: %d, Expected: %d\n", pos, 11);
printf("_wcschr error: position mismatch: Actual: %lu, Expected: %u\n", (unsigned long)pos,
11);
return -1;
}
@ -58,7 +60,7 @@ int TestString(int argc, char* argv[])
if (pos != 29)
{
printf("_wcschr error: position mismatch: Actual: %d, Expected: %d\n", pos, 29);
printf("_wcschr error: position mismatch: Actual: %lu, Expected: %u\n", (unsigned long)pos, 29);
return -1;
}
@ -66,7 +68,8 @@ int TestString(int argc, char* argv[])
if (p != NULL)
{
printf("_wcschr error: return value mismatch: Actual: 0x%08X, Expected: 0x%08X\n", (size_t) p, (size_t) NULL);
printf("_wcschr error: return value mismatch: Actual: 0x%08lX, Expected: 0x%08lX\n", (unsigned
long) p, (unsigned long) NULL);
return -1;
}

View File

@ -139,7 +139,7 @@ int convert_utf8_to_utf16(BYTE* lpMultiByteStr, BYTE* expected_lpWideCharStr, in
if (!length)
{
DWORD error = GetLastError();
printf("MultiByteToWideChar error: 0x%08X\n", error);
printf("MultiByteToWideChar error: 0x%08lX\n", error);
return -1;
}
@ -206,7 +206,7 @@ int convert_utf16_to_utf8(BYTE* lpWideCharStr, BYTE* expected_lpMultiByteStr, in
if (!length)
{
DWORD error = GetLastError();
printf("WideCharToMultiByte error: 0x%08X\n", error);
printf("WideCharToMultiByte error: 0x%08lX\n", error);
return -1;
}

View File

@ -1,2 +1,4 @@
TestDs
TestDs.c
TestDsParse
TestDsParse.c

View File

@ -35,7 +35,7 @@ int TestDsMakeSpn(int argc, char* argv[])
if (SpnLength != 37)
{
_tprintf(_T("DsMakeSpn: SpnLength mismatch: Actual: %d, Expected: %d\n"), SpnLength, 37);
_tprintf(_T("DsMakeSpn: SpnLength mismatch: Actual: %ld, Expected: %d\n"), SpnLength, 37);
return -1;
}

View File

@ -1,165 +0,0 @@
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* Forward declare test functions. */
int TestDsMakeSpn(int, char*[]);
int TestDsCrackNames(int, char*[]);
/* Create map. */
typedef int (*MainFuncPointer)(int , char*[]);
typedef struct
{
const char* name;
MainFuncPointer func;
} functionMapEntry;
functionMapEntry cmakeGeneratedFunctionMapEntries[] = {
{
"TestDsMakeSpn",
TestDsMakeSpn
},
{
"TestDsCrackNames",
TestDsCrackNames
},
{0,0}
};
/* Allocate and create a lowercased copy of string
(note that it has to be free'd manually) */
char* lowercase(const char *string)
{
char *new_string, *p;
#ifdef __cplusplus
new_string = static_cast<char *>(malloc(sizeof(char) *
static_cast<size_t>(strlen(string) + 1)));
#else
new_string = (char *)(malloc(sizeof(char) * (size_t)(strlen(string) + 1)));
#endif
if (!new_string)
{
return 0;
}
strcpy(new_string, string);
p = new_string;
while (*p != 0)
{
#ifdef __cplusplus
*p = static_cast<char>(tolower(*p));
#else
*p = (char)(tolower(*p));
#endif
++p;
}
return new_string;
}
int main(int ac, char *av[])
{
int i, NumTests, testNum, partial_match;
char *arg, *test_name;
int count;
int testToRun = -1;
for(count =0; cmakeGeneratedFunctionMapEntries[count].name != 0; count++)
{
}
NumTests = count;
/* If no test name was given */
/* process command line with user function. */
if (ac < 2)
{
/* Ask for a test. */
printf("Available tests:\n");
for (i =0; i < NumTests; ++i)
{
printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name);
}
printf("To run a test, enter the test number: ");
fflush(stdout);
testNum = 0;
if( scanf("%d", &testNum) != 1 )
{
printf("Couldn't parse that input as a number\n");
return -1;
}
if (testNum >= NumTests)
{
printf("%3d is an invalid test number.\n", testNum);
return -1;
}
testToRun = testNum;
ac--;
av++;
}
partial_match = 0;
arg = 0;
/* If partial match is requested. */
if(testToRun == -1 && ac > 1)
{
partial_match = (strcmp(av[1], "-R") == 0) ? 1 : 0;
}
if (partial_match && ac < 3)
{
printf("-R needs an additional parameter.\n");
return -1;
}
if(testToRun == -1)
{
arg = lowercase(av[1 + partial_match]);
}
for (i =0; i < NumTests && testToRun == -1; ++i)
{
test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);
if (partial_match && strstr(test_name, arg) != NULL)
{
testToRun = i;
ac -=2;
av += 2;
}
else if (!partial_match && strcmp(test_name, arg) == 0)
{
testToRun = i;
ac--;
av++;
}
free(test_name);
}
if(arg)
{
free(arg);
}
if(testToRun != -1)
{
int result;
result = (*cmakeGeneratedFunctionMapEntries[testToRun].func)(ac, av);
return result;
}
/* Nothing was run, display the test names. */
printf("Available tests:\n");
for (i =0; i < NumTests; ++i)
{
printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name);
}
printf("Failed: %s is an invalid test name.\n", av[1]);
return -1;
}

View File

@ -41,7 +41,7 @@ int TestFileFindFirstFile(int argc, char* argv[])
if (hFind == INVALID_HANDLE_VALUE)
{
_tprintf(_T("FindFirstFile failure: %s (%d)\n"), FilePath, hFind);
_tprintf(_T("FindFirstFile failure: %s (INVALID_HANDLE_VALUE -1)\n"), FilePath);
return -1;
}
@ -49,7 +49,7 @@ int TestFileFindFirstFile(int argc, char* argv[])
if (_tcscmp(FindData.cFileName, testFile1) != 0)
{
_tprintf(_T("FindFirstFile failure: Expected: %d, Actual: %s\n"),
_tprintf(_T("FindFirstFile failure: Expected: %s, Actual: %s\n"),
testFile1, FindData.cFileName);
return -1;
}

View File

@ -73,7 +73,7 @@ int TestFileFindNextFile(int argc, char* argv[])
if ((_tcscmp(FindData.cFileName, testDirectory2File1) != 0) && (_tcscmp(FindData.cFileName, testDirectory2File2) != 0))
{
_tprintf(_T("FindNextFile failure: Expected: %d, Actual: %s\n"),
_tprintf(_T("FindNextFile failure: Expected: %s, Actual: %s\n"),
testDirectory2File2, FindData.cFileName);
return -1;
}

View File

@ -23,7 +23,7 @@ int TestPathAllocCombine(int argc, char* argv[])
if (status != S_OK)
{
_tprintf(_T("PathAllocCombine status: 0x%08X\n"), status);
_tprintf(_T("PathAllocCombine status: 0x%08lX\n"), status);
return -1;
}
@ -41,7 +41,7 @@ int TestPathAllocCombine(int argc, char* argv[])
if (status != S_OK)
{
_tprintf(_T("PathAllocCombine status: 0x%08X\n"), status);
_tprintf(_T("PathAllocCombine status: 0x%08lX\n"), status);
return -1;
}
@ -59,7 +59,7 @@ int TestPathAllocCombine(int argc, char* argv[])
if (status != S_OK)
{
_tprintf(_T("PathAllocCombine status: 0x%08X\n"), status);
_tprintf(_T("PathAllocCombine status: 0x%08lX\n"), status);
return -1;
}
@ -77,7 +77,7 @@ int TestPathAllocCombine(int argc, char* argv[])
if (status != S_OK)
{
_tprintf(_T("PathAllocCombine status: 0x%08X\n"), status);
_tprintf(_T("PathAllocCombine status: 0x%08lX\n"), status);
return -1;
}

View File

@ -23,7 +23,7 @@ int TestPathCchAddBackslashEx(int argc, char* argv[])
if (status != S_OK)
{
_tprintf(_T("PathCchAddBackslash status: 0x%08X\n"), status);
_tprintf(_T("PathCchAddBackslash status: 0x%08lX\n"), status);
return -1;
}
@ -41,7 +41,7 @@ int TestPathCchAddBackslashEx(int argc, char* argv[])
if (status != S_FALSE)
{
_tprintf(_T("PathCchAddBackslash status: 0x%08X\n"), status);
_tprintf(_T("PathCchAddBackslash status: 0x%08lX\n"), status);
return -1;
}

View File

@ -23,7 +23,7 @@ int TestPathCchAddExtension(int argc, char* argv[])
if (status != S_OK)
{
_tprintf(_T("PathCchAddExtension status: 0x%08X\n"), status);
_tprintf(_T("PathCchAddExtension status: 0x%08lX\n"), status);
return -1;
}
@ -41,7 +41,7 @@ int TestPathCchAddExtension(int argc, char* argv[])
if (status != S_OK)
{
_tprintf(_T("PathCchAddExtension status: 0x%08X\n"), status);
_tprintf(_T("PathCchAddExtension status: 0x%08lX\n"), status);
return -1;
}
@ -59,7 +59,7 @@ int TestPathCchAddExtension(int argc, char* argv[])
if (status != S_FALSE)
{
_tprintf(_T("PathCchAddExtension status: 0x%08X\n"), status);
_tprintf(_T("PathCchAddExtension status: 0x%08lX\n"), status);
return -1;
}
@ -77,7 +77,7 @@ int TestPathCchAddExtension(int argc, char* argv[])
if (status != S_FALSE)
{
_tprintf(_T("PathCchAddExtension status: 0x%08X\n"), status);
_tprintf(_T("PathCchAddExtension status: 0x%08lX\n"), status);
return -1;
}

View File

@ -24,7 +24,7 @@ int TestPathCchAppend(int argc, char* argv[])
if (status != S_OK)
{
_tprintf(_T("PathCchAppend status: 0x%08X\n"), status);
_tprintf(_T("PathCchAppend status: 0x%08lX\n"), status);
return -1;
}
@ -42,7 +42,7 @@ int TestPathCchAppend(int argc, char* argv[])
if (status != S_OK)
{
_tprintf(_T("PathCchAppend status: 0x%08X\n"), status);
_tprintf(_T("PathCchAppend status: 0x%08lX\n"), status);
return -1;
}
@ -60,7 +60,7 @@ int TestPathCchAppend(int argc, char* argv[])
if (status != S_OK)
{
_tprintf(_T("PathCchAppend status: 0x%08X\n"), status);
_tprintf(_T("PathCchAppend status: 0x%08lX\n"), status);
return -1;
}
@ -78,7 +78,7 @@ int TestPathCchAppend(int argc, char* argv[])
if (status != S_OK)
{
_tprintf(_T("PathCchAppend status: 0x%08X\n"), status);
_tprintf(_T("PathCchAppend status: 0x%08lX\n"), status);
return -1;
}

View File

@ -28,7 +28,7 @@ int TestPathCchStripPrefix(int argc, char* argv[])
if (status != S_OK)
{
_tprintf(_T("PathCchStripPrefix status: 0x%08X\n"), status);
_tprintf(_T("PathCchStripPrefix status: 0x%08lX\n"), status);
return -1;
}
@ -46,7 +46,7 @@ int TestPathCchStripPrefix(int argc, char* argv[])
if (status != S_FALSE)
{
_tprintf(_T("PathCchStripPrefix status: 0x%08X\n"), status);
_tprintf(_T("PathCchStripPrefix status: 0x%08lX\n"), status);
return -1;
}

View File

@ -36,8 +36,8 @@ int TestPipeCreatePipe(int argc, char* argv[])
if (dwWrite != sizeof(writeBuffer))
{
_tprintf(_T("WriteFile: unexpected number of bytes written: Actual: %d, Expected: %d\n"),
dwWrite, sizeof(writeBuffer));
_tprintf(_T("WriteFile: unexpected number of bytes written: Actual: %ld, Expected: %ld\n"),
dwWrite, (long int)sizeof(writeBuffer));
return -1;
}
@ -52,8 +52,8 @@ int TestPipeCreatePipe(int argc, char* argv[])
if (dwRead != sizeof(readBuffer))
{
_tprintf(_T("ReadFile: unexpected number of bytes read: Actual: %d, Expected: %d\n"),
dwWrite, sizeof(readBuffer));
_tprintf(_T("ReadFile: unexpected number of bytes read: Actual: %ld, Expected: %ld\n"),
dwWrite, (long int)sizeof(readBuffer));
return -1;
}

View File

@ -12,7 +12,7 @@ void CALLBACK test_WorkCallback(PTP_CALLBACK_INSTANCE instance, void* context, P
BYTE b[1024];
BYTE c[1024];
printf("Hello %s: %d (thread: %d)\n", context,
printf("Hello %s: %ld (thread: %lu)\n", (char *)context,
InterlockedIncrement(&count), GetCurrentThreadId());
for (index = 0; index < 100; index++)

View File

@ -582,7 +582,7 @@ RPC_STATUS UuidToStringA(UUID* Uuid, RPC_CSTR* StringUuid)
* xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
*/
sprintf_s((char*) *StringUuid, 36 + 1, "%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
sprintf_s((char*) *StringUuid, 36 + 1, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
Uuid->Data1, Uuid->Data2, Uuid->Data3,
Uuid->Data4[0], Uuid->Data4[1],
Uuid->Data4[2], Uuid->Data4[3], Uuid->Data4[4],

View File

@ -63,6 +63,11 @@ void ntlm_SetContextWorkstation(NTLM_CONTEXT* context, char* Workstation)
void ntlm_SetContextServicePrincipalNameW(NTLM_CONTEXT* context, LPWSTR ServicePrincipalName)
{
context->ServicePrincipalName.Length = _wcslen(ServicePrincipalName) * 2;
if (!ServicePrincipalName)
{
context->ServicePrincipalName.Buffer = NULL;
return;
}
context->ServicePrincipalName.Buffer = (PWSTR) malloc(context->ServicePrincipalName.Length + 2);
CopyMemory(context->ServicePrincipalName.Buffer, ServicePrincipalName, context->ServicePrincipalName.Length + 2);
}

View File

@ -9,7 +9,6 @@ set(${MODULE_PREFIX}_TESTS
TestEnumerateSecurityPackages.c
TestInitializeSecurityContext.c
TestAcquireCredentialsHandle.c
TestSchannel.c
TestNTLM.c)
create_test_sourcelist(${MODULE_PREFIX}_SRCS

View File

@ -81,7 +81,7 @@ int schannel_send(PSecurityFunctionTable table, HANDLE hPipe, PCtxtHandle phCont
printf("EncryptMessage status: 0x%08X\n", status);
printf("EncryptMessage output: cBuffers: %d [0]: %d / %d [1]: %d / %d [2]: %d / %d [3]: %d / %d\n", Message.cBuffers,
printf("EncryptMessage output: cBuffers: %ld [0]: %lu / %lu [1]: %lu / %lu [2]: %lu / %lu [3]: %lu / %lu\n", Message.cBuffers,
Message.pBuffers[0].cbBuffer, Message.pBuffers[0].BufferType,
Message.pBuffers[1].cbBuffer, Message.pBuffers[1].BufferType,
Message.pBuffers[2].cbBuffer, Message.pBuffers[2].BufferType,
@ -150,7 +150,7 @@ int schannel_recv(PSecurityFunctionTable table, HANDLE hPipe, PCtxtHandle phCont
printf("DecryptMessage status: 0x%08X\n", status);
printf("DecryptMessage output: cBuffers: %d [0]: %d / %d [1]: %d / %d [2]: %d / %d [3]: %d / %d\n", Message.cBuffers,
printf("DecryptMessage output: cBuffers: %ld [0]: %lu / %lu [1]: %lu / %lu [2]: %lu / %lu [3]: %lu / %lu\n", Message.cBuffers,
Message.pBuffers[0].cbBuffer, Message.pBuffers[0].BufferType,
Message.pBuffers[1].cbBuffer, Message.pBuffers[1].BufferType,
Message.pBuffers[2].cbBuffer, Message.pBuffers[2].BufferType,
@ -159,7 +159,7 @@ int schannel_recv(PSecurityFunctionTable table, HANDLE hPipe, PCtxtHandle phCont
if (status != SEC_E_OK)
return -1;
printf("Decrypted Message (%d)\n", Message.pBuffers[1].cbBuffer);
printf("Decrypted Message (%ld)\n", Message.pBuffers[1].cbBuffer);
winpr_HexDump((BYTE*) Message.pBuffers[1].pvBuffer, Message.pBuffers[1].cbBuffer);
if (memcmp(Message.pBuffers[1].pvBuffer, test_LastDummyMessage, sizeof(test_LastDummyMessage)) == 0)
@ -330,9 +330,9 @@ static void* schannel_test_server_thread(void* arg)
else if (status == SEC_E_INCOMPLETE_MESSAGE)
printf("AcceptSecurityContext status: SEC_E_INCOMPLETE_MESSAGE\n");
printf("Server cBuffers: %d pBuffers[0]: %d type: %d\n",
printf("Server cBuffers: %lu pBuffers[0]: %lu type: %lu\n",
SecBufferDesc_out.cBuffers, SecBufferDesc_out.pBuffers[0].cbBuffer, SecBufferDesc_out.pBuffers[0].BufferType);
printf("Server Input cBuffers: %d pBuffers[0]: %d type: %d pBuffers[1]: %d type: %d\n", SecBufferDesc_in.cBuffers,
printf("Server Input cBuffers: %ld pBuffers[0]: %lu type: %lu pBuffers[1]: %lu type: %lu\n", SecBufferDesc_in.cBuffers,
SecBufferDesc_in.pBuffers[0].cbBuffer, SecBufferDesc_in.pBuffers[0].BufferType,
SecBufferDesc_in.pBuffers[1].cbBuffer, SecBufferDesc_in.pBuffers[1].BufferType);
@ -351,7 +351,7 @@ static void* schannel_test_server_thread(void* arg)
if (pSecBuffer->cbBuffer > 0)
{
printf("Server > Client (%d)\n", pSecBuffer->cbBuffer);
printf("Server > Client (%ld)\n", pSecBuffer->cbBuffer);
winpr_HexDump((BYTE*) pSecBuffer->pvBuffer, pSecBuffer->cbBuffer);
if (!WriteFile(g_ClientWritePipe, pSecBuffer->pvBuffer, pSecBuffer->cbBuffer, &NumberOfBytesWritten, NULL))
@ -479,7 +479,7 @@ int TestSchannel(int argc, char* argv[])
* 0x800C 0x800D 0x800E 0x2400 0xAA02 0xAE06 0x2200 0x2203
*/
printf("SupportedAlgs: %d\n", SupportedAlgs.cSupportedAlgs);
printf("SupportedAlgs: %ld\n", SupportedAlgs.cSupportedAlgs);
for (index = 0; index < SupportedAlgs.cSupportedAlgs; index++)
{
@ -500,7 +500,7 @@ int TestSchannel(int argc, char* argv[])
/* CipherStrengths: Minimum: 40 Maximum: 256 */
printf("CipherStrengths: Minimum: %d Maximum: %d\n",
printf("CipherStrengths: Minimum: %ld Maximum: %ld\n",
CipherStrengths.dwMinimumCipherStrength, CipherStrengths.dwMaximumCipherStrength);
ZeroMemory(&SupportedProtocols, sizeof(SecPkgCred_SupportedProtocols));
@ -514,7 +514,7 @@ int TestSchannel(int argc, char* argv[])
/* SupportedProtocols: 0x208A0 */
printf("SupportedProtocols: 0x%04X\n", SupportedProtocols.grbitProtocol);
printf("SupportedProtocols: 0x%04lX\n", SupportedProtocols.grbitProtocol);
fContextReq = ISC_REQ_STREAM |
ISC_REQ_SEQUENCE_DETECT | ISC_REQ_REPLAY_DETECT |
@ -547,7 +547,7 @@ int TestSchannel(int argc, char* argv[])
}
g_ClientWait = TRUE;
printf("NumberOfBytesRead: %d\n", NumberOfBytesRead);
printf("NumberOfBytesRead: %ld\n", NumberOfBytesRead);
SecBuffer_in[0].BufferType = SECBUFFER_TOKEN;
SecBuffer_in[0].pvBuffer = lpTokenIn;
@ -587,9 +587,9 @@ int TestSchannel(int argc, char* argv[])
else if (status == SEC_E_INCOMPLETE_MESSAGE)
printf("InitializeSecurityContext status: SEC_E_INCOMPLETE_MESSAGE\n");
printf("Client Output cBuffers: %d pBuffers[0]: %d type: %d\n",
printf("Client Output cBuffers: %ld pBuffers[0]: %ld type: %ld\n",
SecBufferDesc_out.cBuffers, SecBufferDesc_out.pBuffers[0].cbBuffer, SecBufferDesc_out.pBuffers[0].BufferType);
printf("Client Input cBuffers: %d pBuffers[0]: %d type: %d pBuffers[1]: %d type: %d\n", SecBufferDesc_in.cBuffers,
printf("Client Input cBuffers: %ld pBuffers[0]: %ld type: %ld pBuffers[1]: %ld type: %ld\n", SecBufferDesc_in.cBuffers,
SecBufferDesc_in.pBuffers[0].cbBuffer, SecBufferDesc_in.pBuffers[0].BufferType,
SecBufferDesc_in.pBuffers[1].cbBuffer, SecBufferDesc_in.pBuffers[1].BufferType);
@ -599,7 +599,7 @@ int TestSchannel(int argc, char* argv[])
if (pSecBuffer->cbBuffer > 0)
{
printf("Client > Server (%d)\n", pSecBuffer->cbBuffer);
printf("Client > Server (%ld)\n", pSecBuffer->cbBuffer);
winpr_HexDump((BYTE*) pSecBuffer->pvBuffer, pSecBuffer->cbBuffer);
if (!WriteFile(g_ServerWritePipe, pSecBuffer->pvBuffer, pSecBuffer->cbBuffer, &NumberOfBytesWritten, NULL))

View File

@ -148,7 +148,7 @@ DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
}
else
{
printf("WaitForSingleObject: unknown handle type %d\n", Type);
printf("WaitForSingleObject: unknown handle type %lu\n", Type);
}
return WAIT_OBJECT_0;

View File

@ -11,13 +11,13 @@ int TestGetNativeSystemInfo(int argc, char* argv[])
printf("SystemInfo:\n");
printf("\twProcessorArchitecture: %d\n", sysinfo.wProcessorArchitecture);
printf("\twReserved: %d\n", sysinfo.wReserved);
printf("\tdwPageSize: 0x%08X\n", sysinfo.dwPageSize);
printf("\tdwPageSize: 0x%08lX\n", sysinfo.dwPageSize);
printf("\tlpMinimumApplicationAddress: %p\n", sysinfo.lpMinimumApplicationAddress);
printf("\tlpMaximumApplicationAddress: %p\n", sysinfo.lpMaximumApplicationAddress);
printf("\tdwActiveProcessorMask: 0x%08X\n", sysinfo.dwActiveProcessorMask);
printf("\tdwNumberOfProcessors: %d\n", sysinfo.dwNumberOfProcessors);
printf("\tdwProcessorType: %d\n", sysinfo.dwProcessorType);
printf("\tdwAllocationGranularity: %d\n", sysinfo.dwAllocationGranularity);
printf("\tdwActiveProcessorMask: 0x%08llX\n", (unsigned long long)sysinfo.dwActiveProcessorMask);
printf("\tdwNumberOfProcessors: %ld\n", sysinfo.dwNumberOfProcessors);
printf("\tdwProcessorType: %ld\n", sysinfo.dwProcessorType);
printf("\tdwAllocationGranularity: %ld\n", sysinfo.dwAllocationGranularity);
printf("\twProcessorLevel: %d\n", sysinfo.wProcessorLevel);
printf("\twProcessorRevision: %d\n", sysinfo.wProcessorRevision);
printf("\n");

View File

@ -50,7 +50,7 @@ int TestArrayList(int argc, char* argv[])
ArrayList_RemoveAt(arrayList, 0);
if (val != index)
{
printf("ArrayList: shifted %d entries, expected value %d, got %d\n", index, index, val);
printf("ArrayList: shifted %d entries, expected value %d, got %ld\n", index, index, (long int)val);
return -1;
}
}

View File

@ -60,7 +60,8 @@ int TestCmdLine(int argc, char* argv[])
{
int status;
DWORD flags;
int width, height;
int width = 0;
int height = 0;
COMMAND_LINE_ARGUMENT_A* arg;
flags = COMMAND_LINE_SIGIL_SLASH | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_SIGIL_PLUS_MINUS;