freerdp: fix compilation on Windows

This commit is contained in:
Marc-André Moreau 2014-05-22 14:42:05 -04:00
parent af4a413287
commit ae368549ad
3 changed files with 23 additions and 19 deletions

View File

@ -1,25 +1,27 @@
set(MODULE_NAME "TestFreeRDPutils")
set(MODULE_NAME "TestFreeRDPUtils")
set(MODULE_PREFIX "TEST_FREERDP_UTILS")
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS
TestRingBuffer.c
)
TestRingBuffer.c)
create_test_sourcelist(${MODULE_PREFIX}_SRCS
${${MODULE_PREFIX}_DRIVER}
${${MODULE_PREFIX}_TESTS}
)
${${MODULE_PREFIX}_TESTS})
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}
MODULE winpr
MODULES winpr-thread winpr-synch winpr-file winpr-utils winpr-crt freerdp-utils
)
MODULES winpr-thread winpr-synch winpr-file winpr-utils winpr-crt)
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}
MODULE freerdp
MODULES freerdp-utils)
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})

View File

@ -48,7 +48,7 @@ BOOL test_overlaps(void)
for (i = 0, j = 2; i < nchunks; i++)
{
for (k = 0; k < chunks[i].size; k++, j++)
for (k = 0; k < (int) chunks[i].size; k++, j++)
{
if (chunks[i].data[k] != (BYTE)j)
goto error;
@ -123,7 +123,7 @@ int TestRingBuffer(int argc, char* argv[])
ringbuffer_commit_read_bytes(&ringBuffer, chunks[0].size);
/* check retrieved bytes */
for (i = 0; i < chunks[0].size; i++)
for (i = 0; i < (int) chunks[0].size; i++)
{
if (chunks[0].data[i] != i % 5)
{

View File

@ -152,7 +152,7 @@ static PVOID TestSynchCritical_Main(PVOID arg)
InitializeCriticalSection(&critical);
for (i=0; i<1000; i++)
for (i = 0; i < 1000; i++)
{
if (critical.RecursionCount != i)
{
@ -200,9 +200,9 @@ static PVOID TestSynchCritical_Main(PVOID arg)
dwThreadCount = sysinfo.dwNumberOfProcessors > 1 ? sysinfo.dwNumberOfProcessors : 2;
hThreads = (HANDLE*)calloc(dwThreadCount, sizeof(HANDLE));
hThreads = (HANDLE*) calloc(dwThreadCount, sizeof(HANDLE));
for (j=0; j < TEST_SYNC_CRITICAL_TEST1_RUNS; j++)
for (j = 0; j < TEST_SYNC_CRITICAL_TEST1_RUNS; j++)
{
dwSpinCount = j * 1000;
InitializeCriticalSectionAndSpinCount(&critical, dwSpinCount);
@ -212,14 +212,15 @@ static PVOID TestSynchCritical_Main(PVOID arg)
/* the TestSynchCritical_Test1 threads shall run until bTest1Running is FALSE */
bTest1Running = TRUE;
for (i=0; i<dwThreadCount; i++) {
for (i = 0; i < (int) dwThreadCount; i++) {
hThreads[i] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) TestSynchCritical_Test1, &bTest1Running, 0, NULL);
}
/* let it run for TEST_SYNC_CRITICAL_TEST1_RUNTIME_MS ... */
Sleep(TEST_SYNC_CRITICAL_TEST1_RUNTIME_MS);
bTest1Running = FALSE;
for (i=0; i<dwThreadCount; i++)
for (i = 0; i < (int) dwThreadCount; i++)
{
if (WaitForSingleObject(hThreads[i], INFINITE) != WAIT_OBJECT_0)
{
@ -288,7 +289,7 @@ int TestSynchCritical(int argc, char* argv[])
HANDLE hThread;
DWORD dwThreadExitCode;
DWORD dwDeadLockDetectionTimeMs;
int i;
DWORD i;
dwDeadLockDetectionTimeMs = 2 * TEST_SYNC_CRITICAL_TEST1_RUNTIME_MS * TEST_SYNC_CRITICAL_TEST1_RUNS;
@ -303,10 +304,11 @@ int TestSynchCritical(int argc, char* argv[])
* Workaround checking the value of bThreadTerminated which is passed in the thread arg
*/
for (i=0; i<dwDeadLockDetectionTimeMs; i+=100)
for (i = 0; i < dwDeadLockDetectionTimeMs; i += 100)
{
if (bThreadTerminated)
break;
Sleep(100);
}
@ -319,7 +321,7 @@ int TestSynchCritical(int argc, char* argv[])
GetExitCodeThread(hThread, &dwThreadExitCode);
CloseHandle(hThread);
if(dwThreadExitCode != 0)
if (dwThreadExitCode != 0)
{
return -1;
}