mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2024-11-23 18:03:30 +08:00
Removed winpr_exit
As the cleanup functions are called by atexit a dedicated cleanup call is no longer required.
This commit is contained in:
parent
e1b53a282f
commit
d249335708
@ -422,7 +422,7 @@ int main(int argc, char* argv[])
|
||||
if (!(g_sem = CreateSemaphore(NULL, 0, 1, NULL)))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to create semaphore");
|
||||
return winpr_exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
instance = freerdp_new();
|
||||
@ -437,7 +437,7 @@ int main(int argc, char* argv[])
|
||||
if (!freerdp_context_new(instance))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to create FreeRDP context");
|
||||
return winpr_exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
context = (dfContext*) instance->context;
|
||||
@ -449,11 +449,11 @@ int main(int argc, char* argv[])
|
||||
argv, FALSE);
|
||||
|
||||
if (status < 0)
|
||||
return winpr_exit(0);
|
||||
return 0;
|
||||
|
||||
if (!freerdp_client_load_addins(instance->context->channels,
|
||||
instance->settings))
|
||||
return winpr_exit(-1);
|
||||
return -1;
|
||||
|
||||
data = (struct thread_data*) malloc(sizeof(struct thread_data));
|
||||
ZeroMemory(data, sizeof(sizeof(struct thread_data)));
|
||||
@ -466,5 +466,5 @@ int main(int argc, char* argv[])
|
||||
WaitForSingleObject(g_sem, INFINITE);
|
||||
}
|
||||
|
||||
return winpr_exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ int main(int argc, char* argv[])
|
||||
if (!instance)
|
||||
{
|
||||
WLog_ERR(TAG, "Couldn't create instance");
|
||||
winpr_exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
instance->PreConnect = tf_pre_connect;
|
||||
@ -182,7 +182,7 @@ int main(int argc, char* argv[])
|
||||
if (!freerdp_context_new(instance))
|
||||
{
|
||||
WLog_ERR(TAG, "Couldn't create context");
|
||||
return winpr_exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = freerdp_client_settings_parse_command_line(instance->settings, argc,
|
||||
@ -190,12 +190,12 @@ int main(int argc, char* argv[])
|
||||
|
||||
if (status < 0)
|
||||
{
|
||||
return winpr_exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!freerdp_client_load_addins(instance->context->channels,
|
||||
instance->settings))
|
||||
return winpr_exit(-1);
|
||||
return -1;
|
||||
|
||||
if (!(thread = CreateThread(NULL, 0, tf_client_thread_proc, instance, 0, NULL)))
|
||||
{
|
||||
@ -208,5 +208,5 @@ int main(int argc, char* argv[])
|
||||
|
||||
freerdp_context_free(instance);
|
||||
freerdp_free(instance);
|
||||
return winpr_exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -474,5 +474,5 @@ int main(int argc, char* argv[])
|
||||
|
||||
fail:
|
||||
freerdp_client_context_free(context);
|
||||
return winpr_exit(rc);
|
||||
return rc;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
context = freerdp_client_context_new(&clientEntryPoints);
|
||||
if (!context)
|
||||
return winpr_exit(1);
|
||||
return 1;
|
||||
|
||||
settings = context->settings;
|
||||
xfc = (xfContext*) context;
|
||||
@ -65,7 +65,7 @@ int main(int argc, char* argv[])
|
||||
xf_list_monitors(xfc);
|
||||
|
||||
freerdp_client_context_free(context);
|
||||
return winpr_exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
freerdp_client_start(context);
|
||||
@ -79,5 +79,5 @@ int main(int argc, char* argv[])
|
||||
|
||||
freerdp_client_context_free(context);
|
||||
|
||||
return winpr_exit(xf_exit_code_from_disconnect_reason(dwExitCode));
|
||||
return xf_exit_code_from_disconnect_reason(dwExitCode);
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ int main(int argc, char** argv)
|
||||
if (!display)
|
||||
{
|
||||
WLog_ERR(TAG, "Cannot open display");
|
||||
return winpr_exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
x = 10;
|
||||
@ -97,12 +97,12 @@ int main(int argc, char** argv)
|
||||
|
||||
engine = rdtk_engine_new();
|
||||
if (!engine)
|
||||
return winpr_exit(1);
|
||||
return 1;
|
||||
|
||||
scanline = width * 4;
|
||||
buffer = (BYTE*) calloc(height, scanline);
|
||||
if (!buffer)
|
||||
return winpr_exit(1);
|
||||
return 1;
|
||||
|
||||
surface = rdtk_surface_new(engine, buffer, width, height, scanline);
|
||||
|
||||
@ -152,5 +152,5 @@ int main(int argc, char** argv)
|
||||
|
||||
rdtk_engine_free(engine);
|
||||
|
||||
return winpr_exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ int main(int argc, char* argv[])
|
||||
WTSRegisterWtsApiFunctionTable(FreeRDP_InitWtsApi());
|
||||
|
||||
if (!(instance = freerdp_listener_new()))
|
||||
return winpr_exit(1);
|
||||
return 1;
|
||||
|
||||
instance->PeerAccepted = mf_peer_accepted;
|
||||
|
||||
@ -120,5 +120,5 @@ int main(int argc, char* argv[])
|
||||
|
||||
freerdp_listener_free(instance);
|
||||
|
||||
return winpr_exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -926,14 +926,14 @@ int main(int argc, char* argv[])
|
||||
instance = freerdp_listener_new();
|
||||
|
||||
if (!instance)
|
||||
return winpr_exit(-1);
|
||||
return -1;
|
||||
|
||||
instance->PeerAccepted = test_peer_accepted;
|
||||
|
||||
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0)
|
||||
{
|
||||
freerdp_listener_free(instance);
|
||||
return winpr_exit(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Open the server socket and start listening. */
|
||||
@ -944,7 +944,7 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
freerdp_listener_free(instance);
|
||||
WSACleanup();
|
||||
return winpr_exit(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((localOnly || instance->Open(instance, NULL, port)) &&
|
||||
@ -957,6 +957,6 @@ int main(int argc, char* argv[])
|
||||
free(file);
|
||||
freerdp_listener_free(instance);
|
||||
WSACleanup();
|
||||
return winpr_exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ int main(int argc, char* argv[])
|
||||
WLog_INFO(TAG, "Virtual Screen = %dx%d", vscreen_w, vscreen_h);
|
||||
}
|
||||
|
||||
return winpr_exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp("--screen", argv[index]) == 0)
|
||||
@ -110,13 +110,13 @@ int main(int argc, char* argv[])
|
||||
if (index == argc)
|
||||
{
|
||||
WLog_INFO(TAG, "missing screen id parameter");
|
||||
return winpr_exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
val = strtoul(argv[index], NULL, 0);
|
||||
|
||||
if ((errno != 0) || (val > UINT32_MAX))
|
||||
return winpr_exit(-1);
|
||||
return -1;
|
||||
|
||||
set_screen_id(val);
|
||||
index++;
|
||||
@ -127,7 +127,7 @@ int main(int argc, char* argv[])
|
||||
UINT32 val = strtoul(argv[index], NULL, 0);
|
||||
|
||||
if ((errno != 0) || (val > UINT32_MAX))
|
||||
return winpr_exit(-1);
|
||||
return -1;
|
||||
|
||||
server->port = val;
|
||||
break;
|
||||
@ -170,5 +170,5 @@ int main(int argc, char* argv[])
|
||||
WLog_INFO(TAG, "Stopping server");
|
||||
wfreerdp_server_stop(server);
|
||||
wfreerdp_server_free(server);
|
||||
return winpr_exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -110,6 +110,6 @@ fail_server_init:
|
||||
fail_parse_command_line:
|
||||
shadow_server_free(server);
|
||||
fail_server_new:
|
||||
return winpr_exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,6 @@ WINPR_API const char* winpr_get_version_string(void);
|
||||
WINPR_API const char* winpr_get_build_date(void);
|
||||
WINPR_API const char* winpr_get_build_revision(void);
|
||||
WINPR_API const char* winpr_get_build_config(void);
|
||||
WINPR_API int winpr_exit(int status);
|
||||
|
||||
#define WINPR_UNUSED(x) (void)(x)
|
||||
|
||||
|
@ -38,7 +38,7 @@ int TestSmartCardStatus(int argc, char* argv[])
|
||||
if (err != SCARD_S_SUCCESS)
|
||||
{
|
||||
printf("ScardEstablishedContext: 0x%08x\n", err);
|
||||
return winpr_exit(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = SCardListReaders(hContext, "SCard$AllReaders", NULL, &cchReaders);
|
||||
@ -46,7 +46,7 @@ int TestSmartCardStatus(int argc, char* argv[])
|
||||
if (err != 0)
|
||||
{
|
||||
printf("ScardListReaders: 0x%08x\n", err);
|
||||
return winpr_exit(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
mszReaders = calloc(cchReaders, sizeof(char));
|
||||
@ -54,7 +54,7 @@ int TestSmartCardStatus(int argc, char* argv[])
|
||||
if (!mszReaders)
|
||||
{
|
||||
printf("calloc\n");
|
||||
return winpr_exit(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = SCardListReaders(hContext, "SCard$AllReaders", mszReaders, &cchReaders);
|
||||
@ -62,7 +62,7 @@ int TestSmartCardStatus(int argc, char* argv[])
|
||||
if (err != SCARD_S_SUCCESS)
|
||||
{
|
||||
printf("ScardListReaders: 0x%08x\n", err);
|
||||
return winpr_exit(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("Reader: %s\n", mszReaders);
|
||||
@ -72,7 +72,7 @@ int TestSmartCardStatus(int argc, char* argv[])
|
||||
if (err != SCARD_S_SUCCESS)
|
||||
{
|
||||
printf("ScardConnect: 0x%08x\n", err);
|
||||
return winpr_exit(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
free(mszReaders);
|
||||
@ -83,7 +83,7 @@ int TestSmartCardStatus(int argc, char* argv[])
|
||||
if (err != SCARD_S_SUCCESS)
|
||||
{
|
||||
printf("SCardStatus: 0x%08x\n", err);
|
||||
return winpr_exit(-1);
|
||||
return -1;
|
||||
}
|
||||
printf("reader name length: %u\n", len);
|
||||
|
||||
@ -93,7 +93,7 @@ int TestSmartCardStatus(int argc, char* argv[])
|
||||
if (err != SCARD_S_SUCCESS)
|
||||
{
|
||||
printf("SCardStatus: 0x%08x\n", err);
|
||||
return winpr_exit(-1);
|
||||
return -1;
|
||||
}
|
||||
printf("Reader name: %s (%ld)\n", name, strlen(name));
|
||||
|
||||
@ -103,7 +103,7 @@ int TestSmartCardStatus(int argc, char* argv[])
|
||||
if (err != SCARD_S_SUCCESS)
|
||||
{
|
||||
printf("SCardStatus: 0x%08x\n", err);
|
||||
return winpr_exit(-1);
|
||||
return -1;
|
||||
}
|
||||
printf("Reader name: %s (%ld/len %u)\n", name, strlen(name), len);
|
||||
printf("status: 0x%08X\n", status);
|
||||
@ -117,7 +117,7 @@ int TestSmartCardStatus(int argc, char* argv[])
|
||||
if (err != SCARD_S_SUCCESS)
|
||||
{
|
||||
printf("SCardStatus: 0x%08x\n", err);
|
||||
return winpr_exit(-1);
|
||||
return -1;
|
||||
}
|
||||
printf("Reader name: %s (%ld/%u)\n", aname, strlen(aname), len);
|
||||
printf("status: 0x%08X\n", status);
|
||||
@ -132,7 +132,7 @@ int TestSmartCardStatus(int argc, char* argv[])
|
||||
if (err != SCARD_S_SUCCESS)
|
||||
{
|
||||
printf("SCardStatus: 0x%08x\n", err);
|
||||
return winpr_exit(-1);
|
||||
return -1;
|
||||
}
|
||||
printf("status: 0x%08X\n", status);
|
||||
printf("proto: 0x%08X\n", protocol);
|
||||
@ -144,7 +144,7 @@ int TestSmartCardStatus(int argc, char* argv[])
|
||||
if (err != SCARD_S_SUCCESS)
|
||||
{
|
||||
printf("SCardStatus: 0x%08x\n", err);
|
||||
return winpr_exit(-1);
|
||||
return -1;
|
||||
}
|
||||
printf("atrlen: %u\n", atrlen);
|
||||
SCardFreeMemory(hContext, aatr);
|
||||
@ -156,11 +156,11 @@ int TestSmartCardStatus(int argc, char* argv[])
|
||||
if (err != SCARD_S_SUCCESS)
|
||||
{
|
||||
printf("SCardStatus: 0x%08x\n", err);
|
||||
return winpr_exit(-1);
|
||||
return -1;
|
||||
}
|
||||
printf("atrlen: %u\n", atrlen);
|
||||
SCardDisconnect(hCard, SCARD_LEAVE_CARD);
|
||||
SCardReleaseContext(hContext);
|
||||
|
||||
return winpr_exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -75,13 +75,3 @@ const char* winpr_get_build_config(void)
|
||||
return build_config;
|
||||
}
|
||||
|
||||
int winpr_exit(int status)
|
||||
{
|
||||
WLog_Uninit();
|
||||
#if defined(WIN32)
|
||||
return status;
|
||||
#else
|
||||
pthread_exit(&status);
|
||||
return status;
|
||||
#endif
|
||||
}
|
||||
|
@ -195,5 +195,5 @@ int main(int argc, char* argv[])
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
return winpr_exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -34,12 +34,12 @@ int main(int argc, char* argv[])
|
||||
|
||||
context = makecert_context_new();
|
||||
if (!context)
|
||||
return winpr_exit(1);
|
||||
return 1;
|
||||
|
||||
if (makecert_context_process(context, argc, argv) < 0)
|
||||
ret = 1;
|
||||
|
||||
makecert_context_free(context);
|
||||
|
||||
return winpr_exit(ret);
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user