summaryrefslogtreecommitdiffstats
path: root/common/os_calls.c
diff options
context:
space:
mode:
authorjsorg71 <jay.sorg@gmail.com>2016-08-05 14:38:41 -0700
committerGitHub <noreply@github.com>2016-08-05 14:38:41 -0700
commit8353baab3d361bcdebb32f1677dd066e0b255dc9 (patch)
tree38bd74dc119bdc115d5876383d7a65ff3e19debd /common/os_calls.c
parent81fe939dd346420d41eb2afcd6c8c05a422a9e7b (diff)
parentace7d2c822937a9cb0637946f85d1fbd63562c44 (diff)
downloadxrdp-proprietary-8353baab3d361bcdebb32f1677dd066e0b255dc9.tar.gz
xrdp-proprietary-8353baab3d361bcdebb32f1677dd066e0b255dc9.zip
Merge pull request #390 from proski/june21
Cleanups and C++ compatibility
Diffstat (limited to 'common/os_calls.c')
-rw-r--r--common/os_calls.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/common/os_calls.c b/common/os_calls.c
index 2c8e37cd..234e01c7 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -402,7 +402,7 @@ g_tcp_set_keepalive(int sck)
/*****************************************************************************/
/* returns a newly created socket or -1 on error */
-/* in win32 a socket is an unsigned int, in linux, its an int */
+/* in win32 a socket is an unsigned int, in linux, it's an int */
int APP_CC
g_tcp_socket(void)
{
@@ -671,7 +671,6 @@ int APP_CC
g_tcp_connect(int sck, const char *address, const char *port)
{
int res = 0;
- char errorMsg[256];
struct addrinfo p;
struct addrinfo *h = (struct addrinfo *)NULL;
struct addrinfo *rp = (struct addrinfo *)NULL;
@@ -699,9 +698,8 @@ g_tcp_connect(int sck, const char *address, const char *port)
}
if (res != 0)
{
- snprintf(errorMsg, 255, "g_tcp_connect: getaddrinfo() failed: %s",
- gai_strerror(res));
- log_message(LOG_LEVEL_ERROR, errorMsg);
+ log_message(LOG_LEVEL_ERROR, "g_tcp_connect: getaddrinfo() failed: %s",
+ gai_strerror(res));
}
if (res > -1)
{
@@ -991,7 +989,7 @@ g_tcp_accept(int sck)
{
snprintf(ipAddr, 255, "A connection received from: %s port %d",
inet_ntoa(s.sin_addr), ntohs(s.sin_port));
- log_message(LOG_LEVEL_INFO,ipAddr);
+ log_message(LOG_LEVEL_INFO, "%s", ipAddr);
}
return ret ;
}
@@ -1016,7 +1014,7 @@ g_sck_accept(int sck, char *addr, int addr_bytes, char *port, int port_bytes)
{
g_snprintf(ipAddr, 255, "A connection received from: %s port %d",
inet_ntoa(s.sin_addr), ntohs(s.sin_port));
- log_message(LOG_LEVEL_INFO,ipAddr);
+ log_message(LOG_LEVEL_INFO, "%s", ipAddr);
if (s.sin_family == AF_INET)
{
g_snprintf(addr, addr_bytes, "%s", inet_ntoa(s.sin_addr));
@@ -1815,7 +1813,7 @@ g_file_read(int fd, char *ptr, int len)
/*****************************************************************************/
/* write to file, returns the number of bytes written or -1 on error */
int APP_CC
-g_file_write(int fd, char *ptr, int len)
+g_file_write(int fd, const char *ptr, int len)
{
#if defined(_WIN32)
@@ -1952,7 +1950,7 @@ g_get_current_dir(char *dirname, int maxlen)
/*****************************************************************************/
/* returns error, zero on success and -1 on failure */
int APP_CC
-g_set_current_dir(char *dirname)
+g_set_current_dir(const char *dirname)
{
#if defined(_WIN32)
@@ -2121,7 +2119,7 @@ g_strlen(const char *text)
/*****************************************************************************/
/* locates char in text */
-char* APP_CC
+const char *APP_CC
g_strchr(const char* text, int c)
{
if (text == NULL)
@@ -2218,7 +2216,7 @@ g_strdup(const char *in)
char *APP_CC
g_strndup(const char *in, const unsigned int maxlen)
{
- int len;
+ unsigned int len;
char *p;
if (in == 0)
@@ -2400,7 +2398,7 @@ g_htoi(char *str)
int APP_CC
g_pos(const char *str, const char *to_find)
{
- char *pp;
+ const char *pp;
pp = strstr(str, to_find);
@@ -3269,7 +3267,7 @@ g_save_to_bmp(const char* filename, char* data, int stride_bytes,
data -= stride_bytes;
if ((depth == 24) && (bits_per_pixel == 32))
{
- line = malloc(file_stride_bytes);
+ line = (char *) malloc(file_stride_bytes);
memset(line, 0, file_stride_bytes);
for (index = 0; index < height; index++)
{