From 43e388b7e5e6bea5c79a462afc24edbf91de91fd Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sat, 8 Feb 2014 21:48:44 -0800 Subject: [PATCH] remove some warning, move gethostname to os_calls --- common/os_calls.c | 14 +++++++++++++- common/os_calls.h | 1 + xrdp/xrdp.h | 4 ++++ xrdp/xrdp_login_wnd.c | 4 ++-- xrdp/xrdp_wm.c | 3 ++- 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/common/os_calls.c b/common/os_calls.c index ee9792b1..80b2d235 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -613,7 +613,11 @@ int APP_CC g_sck_get_peer_cred(int sck, int *pid, int *uid, int *gid) { #if defined(SO_PEERCRED) +#if defined(_WIN32) int ucred_length; +#else + unsigned int ucred_length; +#endif struct myucred { pid_t pid; @@ -3151,7 +3155,7 @@ g_shmat(int shmid) } /*****************************************************************************/ -/* returns -1 on error */ +/* returns -1 on error 0 on success */ int APP_CC g_shmdt(const void *shmaddr) { @@ -3161,3 +3165,11 @@ g_shmdt(const void *shmaddr) return shmdt(shmaddr); #endif } + +/*****************************************************************************/ +/* returns -1 on error 0 on success */ +int APP_CC +g_gethostname(char *name, int len) +{ + return gethostname(name, len); +} diff --git a/common/os_calls.h b/common/os_calls.h index 2bee6077..06ce8494 100644 --- a/common/os_calls.h +++ b/common/os_calls.h @@ -163,5 +163,6 @@ int APP_CC g_time3(void); int APP_CC g_text2bool(const char *s); void * APP_CC g_shmat(int shmid); int APP_CC g_shmdt(const void *shmaddr); +int APP_CC g_gethostname(char *name, int len); #endif diff --git a/xrdp/xrdp.h b/xrdp/xrdp.h index 172d417a..e04dea5f 100644 --- a/xrdp/xrdp.h +++ b/xrdp/xrdp.h @@ -108,6 +108,8 @@ xrdp_wm_send_bitmap(struct xrdp_wm* self, struct xrdp_bitmap* bitmap, int x, int y, int cx, int cy); int APP_CC xrdp_wm_set_pointer(struct xrdp_wm* self, int cache_idx); +unsigned int APP_CC +xrdp_wm_htoi (const char *ptr); int APP_CC xrdp_wm_set_focused(struct xrdp_wm* self, struct xrdp_bitmap* wnd); int APP_CC @@ -349,6 +351,8 @@ get_keymaps(int keylayout, struct xrdp_keymap* keymap); /* xrdp_login_wnd.c */ int APP_CC xrdp_login_wnd_create(struct xrdp_wm* self); +int APP_CC +load_xrdp_config(struct xrdp_config *config); /* xrdp_bitmap_compress.c */ int APP_CC diff --git a/xrdp/xrdp_login_wnd.c b/xrdp/xrdp_login_wnd.c index 8011b468..bd63b0ec 100644 --- a/xrdp/xrdp_login_wnd.c +++ b/xrdp/xrdp_login_wnd.c @@ -559,7 +559,7 @@ xrdp_login_wnd_create(struct xrdp_wm *self) self->login_window->notify = xrdp_wm_login_notify; - gethostname(buf1, 256); + g_gethostname(buf1, 256); g_sprintf(buf, "Login to %s", buf1); set_string(&self->login_window->caption1, buf); @@ -642,7 +642,7 @@ xrdp_login_wnd_create(struct xrdp_wm *self) * * @return 0 on success, -1 on failure *****************************************************************************/ - +int APP_CC load_xrdp_config(struct xrdp_config *config) { struct xrdp_cfg_globals *globals; diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c index 547a01bf..e0657fac 100644 --- a/xrdp/xrdp_wm.c +++ b/xrdp/xrdp_wm.c @@ -323,7 +323,8 @@ xrdp_wm_set_pointer(struct xrdp_wm *self, int cache_idx) /*****************************************************************************/ /* convert hex string to int */ -unsigned int xrdp_wm_htoi (const char *ptr) +unsigned int APP_CC +xrdp_wm_htoi (const char *ptr) { unsigned int value = 0; char ch = *ptr;