summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/file.c2
-rw-r--r--common/file.h2
-rw-r--r--common/log.c4
-rw-r--r--common/os_calls.c135
-rw-r--r--common/os_calls.h79
-rw-r--r--common/ssl_calls.c7
-rw-r--r--common/ssl_calls.h2
-rw-r--r--common/thread_calls.c1
-rw-r--r--common/thread_calls.h2
-rw-r--r--xrdp/funcs.c2
-rw-r--r--xrdp/xrdp.h6
-rw-r--r--xrdp/xrdp_bitmap.c2
-rw-r--r--xrdp/xrdp_painter.c2
13 files changed, 94 insertions, 152 deletions
diff --git a/common/file.c b/common/file.c
index c12fa325..34a35bc3 100644
--- a/common/file.c
+++ b/common/file.c
@@ -180,7 +180,7 @@ file_split_name_value(char* text, char* name, char* value)
/*****************************************************************************/
/* return error */
int APP_CC
-file_read_section(int fd, char* section, struct list* names,
+file_read_section(int fd, const char* section, struct list* names,
struct list* values)
{
struct stream* s;
diff --git a/common/file.h b/common/file.h
index 6b1e40c0..4484be21 100644
--- a/common/file.h
+++ b/common/file.h
@@ -30,7 +30,7 @@
int APP_CC
file_read_sections(int fd, struct list* names);
int APP_CC
-file_read_section(int fd, char* section, struct list* names,
+file_read_section(int fd, const char* section, struct list* names,
struct list* values);
#endif
diff --git a/common/log.c b/common/log.c
index eb9e9feb..1c532666 100644
--- a/common/log.c
+++ b/common/log.c
@@ -212,7 +212,7 @@ log_start(const char* progname, const char* logfile, const unsigned int loglvl,
}
else
{
- l_cfg->log_file = g_strdup((char*) logfile);
+ l_cfg->log_file = g_strdup(logfile);
}
/* if progname is NULL, we use a default name */
@@ -222,7 +222,7 @@ log_start(const char* progname, const char* logfile, const unsigned int loglvl,
}
else
{
- l_cfg->program_name = g_strdup((char*) progname);
+ l_cfg->program_name = g_strdup(progname);
}
/* setting log level */
diff --git a/common/os_calls.c b/common/os_calls.c
index 2295745d..ebdf5491 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -57,6 +57,9 @@
#include <stdarg.h>
#include <stdio.h>
+#include "os_calls.h"
+#include "arch.h"
+
/* for clearenv() */
#if defined(_WIN32)
#else
@@ -102,7 +105,7 @@ g_free(void* ptr)
/* output text to stdout, try to use g_write / g_writeln instead to avoid
linux / windows EOL problems */
void
-g_printf(char* format, ...)
+g_printf(const char* format, ...)
{
va_list ap;
@@ -113,7 +116,7 @@ g_printf(char* format, ...)
/*****************************************************************************/
void
-g_sprintf(char* dest, char* format, ...)
+g_sprintf(char* dest, const char* format, ...)
{
va_list ap;
@@ -124,7 +127,7 @@ g_sprintf(char* dest, char* format, ...)
/*****************************************************************************/
void
-g_snprintf(char* dest, int len, char* format, ...)
+g_snprintf(char* dest, int len, const char* format, ...)
{
va_list ap;
@@ -135,7 +138,7 @@ g_snprintf(char* dest, int len, char* format, ...)
/*****************************************************************************/
void
-g_writeln(char* format, ...)
+g_writeln(const char* format, ...)
{
va_list ap;
@@ -151,7 +154,7 @@ g_writeln(char* format, ...)
/*****************************************************************************/
void
-g_write(char* format, ...)
+g_write(const char* format, ...)
{
va_list ap;
@@ -289,7 +292,7 @@ g_tcp_close(int sck)
/*****************************************************************************/
int
-g_tcp_connect(int sck, char* address, char* port)
+g_tcp_connect(int sck, const char* address, const char* port)
{
struct sockaddr_in s;
struct hostent* h;
@@ -422,10 +425,10 @@ g_tcp_recv(int sck, void* ptr, int len, int flags)
/*****************************************************************************/
int
-g_tcp_send(int sck, void* ptr, int len, int flags)
+g_tcp_send(int sck, const void* ptr, int len, int flags)
{
#if defined(_WIN32)
- return send(sck, (char*)ptr, len, flags);
+ return send(sck, (const char*)ptr, len, flags);
#else
return send(sck, ptr, len, flags);
#endif
@@ -508,7 +511,7 @@ g_abs(int i)
/*****************************************************************************/
int
-g_memcmp(void* s1, void* s2, int len)
+g_memcmp(const void* s1, const void* s2, int len)
{
return memcmp(s1, s2, len);
}
@@ -516,7 +519,7 @@ g_memcmp(void* s1, void* s2, int len)
/*****************************************************************************/
/* returns -1 on error, else return handle or file descriptor */
int
-g_file_open(char* file_name)
+g_file_open(const char* file_name)
{
#if defined(_WIN32)
return (int)CreateFile(file_name, GENERIC_READ | GENERIC_WRITE,
@@ -634,7 +637,7 @@ g_file_lock(int fd, int start, int len)
/*****************************************************************************/
/* returns error, always zero */
int
-g_set_file_rights(char* filename, int read, int write)
+g_set_file_rights(const char* filename, int read, int write)
{
#if defined(_WIN32)
return 0;
@@ -651,7 +654,7 @@ g_set_file_rights(char* filename, int read, int write)
/*****************************************************************************/
/* returns error */
int
-g_chmod_hex(char* filename, int flags)
+g_chmod_hex(const char* filename, int flags)
{
#if defined(_WIN32)
return 0;
@@ -678,7 +681,7 @@ g_chmod_hex(char* filename, int flags)
/*****************************************************************************/
/* returns error, always zero */
int
-g_mkdir(char* dirname)
+g_mkdir(const char* dirname)
{
#if defined(_WIN32)
return 0;
@@ -726,7 +729,7 @@ g_set_current_dir(char* dirname)
/*****************************************************************************/
/* returns boolean, non zero if the file exists */
int
-g_file_exist(char* filename)
+g_file_exist(const char* filename)
{
#if defined(_WIN32)
return 0; // use FileAge(filename) <> -1
@@ -738,7 +741,7 @@ g_file_exist(char* filename)
/*****************************************************************************/
/* returns boolean, non zero if the directory exists */
int
-g_directory_exist(char* dirname)
+g_directory_exist(const char* dirname)
{
#if defined(_WIN32)
return 0; // use GetFileAttributes and check return value
@@ -760,7 +763,7 @@ g_directory_exist(char* dirname)
/*****************************************************************************/
/* returns boolean */
int
-g_create_dir(char* dirname)
+g_create_dir(const char* dirname)
{
#if defined(_WIN32)
return CreateDirectory(dirname, 0); // test this
@@ -772,7 +775,7 @@ g_create_dir(char* dirname)
/*****************************************************************************/
/* returns boolean */
int
-g_remove_dir(char* dirname)
+g_remove_dir(const char* dirname)
{
#if defined(_WIN32)
return RemoveDirectory(dirname); // test this
@@ -784,7 +787,7 @@ g_remove_dir(char* dirname)
/*****************************************************************************/
/* returns non zero if the file was deleted */
int
-g_file_delete(char* filename)
+g_file_delete(const char* filename)
{
#if defined(_WIN32)
return DeleteFile(filename);
@@ -796,7 +799,7 @@ g_file_delete(char* filename)
/*****************************************************************************/
/* returns length of text */
int
-g_strlen(char* text)
+g_strlen(const char* text)
{
if (text == 0)
{
@@ -808,7 +811,7 @@ g_strlen(char* text)
/*****************************************************************************/
/* returns dest */
char*
-g_strcpy(char* dest, char* src)
+g_strcpy(char* dest, const char* src)
{
if (src == 0 && dest != 0)
{
@@ -825,7 +828,7 @@ g_strcpy(char* dest, char* src)
/*****************************************************************************/
/* returns dest */
char*
-g_strncpy(char* dest, char* src, int len)
+g_strncpy(char* dest, const char* src, int len)
{
char* rv;
@@ -846,7 +849,7 @@ g_strncpy(char* dest, char* src, int len)
/*****************************************************************************/
/* returns dest */
char*
-g_strcat(char* dest, char* src)
+g_strcat(char* dest, const char* src)
{
if (dest == 0 || src == 0)
{
@@ -858,7 +861,7 @@ g_strcat(char* dest, char* src)
/*****************************************************************************/
/* if in = 0, return 0 else return newly alloced copy of in */
char*
-g_strdup(char* in)
+g_strdup(const char* in)
{
int len;
char* p;
@@ -875,21 +878,21 @@ g_strdup(char* in)
/*****************************************************************************/
int
-g_strcmp(char* c1, char* c2)
+g_strcmp(const char* c1, const char* c2)
{
return strcmp(c1, c2);
}
/*****************************************************************************/
int
-g_strncmp(char* c1, char* c2, int len)
+g_strncmp(const char* c1, const char* c2, int len)
{
return strncmp(c1, c2, len);
}
/*****************************************************************************/
int
-g_strcasecmp(char* c1, char* c2)
+g_strcasecmp(const char* c1, const char* c2)
{
#if defined(_WIN32)
return stricmp(c1, c2);
@@ -900,7 +903,7 @@ g_strcasecmp(char* c1, char* c2)
/*****************************************************************************/
int
-g_strncasecmp(char* c1, char* c2, int len)
+g_strncasecmp(const char* c1, const char* c2, int len)
{
#if defined(_WIN32)
return strnicmp(c1, c2, len);
@@ -918,7 +921,7 @@ g_atoi(char* str)
/*****************************************************************************/
int
-g_pos(char* str, char* to_find)
+g_pos(char* str, const char* to_find)
{
char* pp;
@@ -959,7 +962,7 @@ g_free_library(long lib)
/*****************************************************************************/
/* returns NULL if not found */
void*
-g_get_proc_address(long lib, char* name)
+g_get_proc_address(long lib, const char* name)
{
if (lib == 0)
{
@@ -996,7 +999,7 @@ g_get_strerror(void)
/*****************************************************************************/
int
-g_execvp(char* p1, char* args[])
+g_execvp(const char* p1, char* args[])
{
#if defined(_WIN32)
return 0;
@@ -1006,40 +1009,8 @@ g_execvp(char* p1, char* args[])
}
/*****************************************************************************/
-/* takes up to 30 parameters */
-int
-g_execlp(int num_params, char* param1, ...)
-{
-#if defined(_WIN32)
- return 0;
-#else
- va_list ap;
- char* p[32];
- int index;
-
- if (num_params > 30)
- {
- return 0;
- }
- memset(p, 0, sizeof(p));
- p[0] = param1;
- va_start(ap, param1);
- for (index = 1; index < num_params; index++)
- {
- p[index] = va_arg(ap, char*);
- }
- va_end(ap);
- return execlp(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
- p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15],
- p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23],
- p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31],
- (void*)0);
-#endif
-}
-
-/*****************************************************************************/
int
-g_execlp3(char* a1, char* a2, char* a3)
+g_execlp3(const char* a1, const char* a2, const char* a3)
{
#if defined(_WIN32)
return 0;
@@ -1049,32 +1020,6 @@ g_execlp3(char* a1, char* a2, char* a3)
}
/*****************************************************************************/
-int
-g_execlp11(char* a1, char* a2, char* a3, char* a4, char* a5, char* a6,
- char* a7, char* a8, char* a9, char* a10, char* a11)
-{
-#if defined(_WIN32)
- return 0;
-#else
- return execlp(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, (void*)0);
-#endif
-}
-
-/*****************************************************************************/
-int
-g_execlp13(char* a1, char* a2, char* a3, char* a4, char* a5, char* a6,
- char* a7, char* a8, char* a9, char* a10, char* a11,
- char* a12, char* a13)
-{
-#if defined(_WIN32)
- return 0;
-#else
- return execlp(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11,
- a12, a13, (void*)0);
-#endif
-}
-
-/*****************************************************************************/
void
g_signal(int sig_num, void (*func)(int))
{
@@ -1188,7 +1133,7 @@ g_clearenv(void)
/*****************************************************************************/
int
-g_setenv(char* name, char* value, int rewrite)
+g_setenv(const char* name, const char* value, int rewrite)
{
#if defined(_WIN32)
return 0;
@@ -1199,7 +1144,7 @@ g_setenv(char* name, char* value, int rewrite)
/*****************************************************************************/
char*
-g_getenv(char* name)
+g_getenv(const char* name)
{
#if defined(_WIN32)
return 0;
@@ -1241,8 +1186,8 @@ g_sigterm(int pid)
/*****************************************************************************/
/* returns 0 if ok */
int
-g_getuser_info(char* username, int* gid, int* uid, char* shell, char* dir,
- char* gecos)
+g_getuser_info(const char* username, int* gid, int* uid, char* shell,
+ char* dir, char* gecos)
{
#if defined(_WIN32)
return 1;
@@ -1281,7 +1226,7 @@ g_getuser_info(char* username, int* gid, int* uid, char* shell, char* dir,
/*****************************************************************************/
/* returns 0 if ok */
int
-g_getgroup_info(char* groupname, int* gid)
+g_getgroup_info(const char* groupname, int* gid)
{
#if defined(_WIN32)
return 1;
@@ -1305,7 +1250,7 @@ g_getgroup_info(char* groupname, int* gid)
/* returns error */
/* if zero is returned, then ok is set */
int
-g_check_user_in_group(char* username, int gid, int* ok)
+g_check_user_in_group(const char* username, int gid, int* ok)
{
#if defined(_WIN32)
return 1;
diff --git a/common/os_calls.h b/common/os_calls.h
index 26c7cb09..a833569a 100644
--- a/common/os_calls.h
+++ b/common/os_calls.h
@@ -30,13 +30,13 @@ g_malloc(int size, int zero);
void
g_free(void* ptr);
void
-g_printf(char *format, ...);
+g_printf(const char *format, ...);
void
-g_sprintf(char* dest, char* format, ...);
+g_sprintf(char* dest, const char* format, ...);
void
-g_writeln(char* format, ...);
+g_writeln(const char* format, ...);
void
-g_write(char* format, ...);
+g_write(const char* format, ...);
void
g_hexdump(char* p, int len);
void
@@ -54,7 +54,7 @@ g_tcp_local_socket(void);
void
g_tcp_close(int sck);
int
-g_tcp_connect(int sck, char* address, char* port);
+g_tcp_connect(int sck, const char* address, const char* port);
int
g_tcp_force_send(int sck, char* data, int len);
int
@@ -72,7 +72,7 @@ g_tcp_accept(int sck);
int
g_tcp_recv(int sck, void* ptr, int len, int flags);
int
-g_tcp_send(int sck, void* ptr, int len, int flags);
+g_tcp_send(int sck, const void* ptr, int len, int flags);
int
g_tcp_last_error_would_block(int sck);
int
@@ -84,9 +84,9 @@ g_random(char* data, int len);
int
g_abs(int i);
int
-g_memcmp(void* s1, void* s2, int len);
+g_memcmp(const void* s1, const void* s2, int len);
int
-g_file_open(char* file_name);
+g_file_open(const char* file_name);
int
g_file_close(int fd);
int
@@ -98,70 +98,61 @@ g_file_seek(int fd, int offset);
int
g_file_lock(int fd, int start, int len);
int
-g_set_file_rights(char* filename, int read, int write);
+g_set_file_rights(const char* filename, int read, int write);
int
-g_chmod_hex(char* filename, int flags);
+g_chmod_hex(const char* filename, int flags);
int
-g_mkdir(char* dirname);
+g_mkdir(const char* dirname);
char*
g_get_current_dir(char* dirname, int maxlen);
int
g_set_current_dir(char* dirname);
int
-g_file_exist(char* filename);
+g_file_exist(const char* filename);
int
-g_directory_exist(char* dirname);
+g_directory_exist(const char* dirname);
int
-g_create_dir(char* dirname);
+g_create_dir(const char* dirname);
int
-g_remove_dir(char* dirname);
+g_remove_dir(const char* dirname);
int
-g_file_delete(char* filename);
+g_file_delete(const char* filename);
int
-g_strlen(char* text);
+g_strlen(const char* text);
char*
-g_strcpy(char* dest, char* src);
+g_strcpy(char* dest, const char* src);
char*
-g_strncpy(char* dest, char* src, int len);
+g_strncpy(char* dest, const char* src, int len);
char*
-g_strcat(char* dest, char* src);
+g_strcat(char* dest, const char* src);
char*
-g_strdup(char* in);
+g_strdup(const char* in);
int
-g_strcmp(char* c1, char* c2);
+g_strcmp(const char* c1, const char* c2);
int
-g_strncmp(char* c1, char* c2, int len);
+g_strncmp(const char* c1, const char* c2, int len);
int
-g_strcasecmp(char* c1, char* c2);
+g_strcasecmp(const char* c1, const char* c2);
int
-g_strncasecmp(char* c1, char* c2, int len);
+g_strncasecmp(const char* c1, const char* c2, int len);
int
g_atoi(char* str);
int
-g_pos(char* str, char* to_find);
+g_pos(char* str, const char* to_find);
long
g_load_library(char* in);
int
g_free_library(long lib);
void*
-g_get_proc_address(long lib, char* name);
+g_get_proc_address(long lib, const char* name);
int
g_system(char* aexec);
char*
g_get_strerror(void);
int
-g_execvp(char* p1, char* args[]);
+g_execvp(const char* p1, char* args[]);
int
-g_execlp(int num_params, char* param1, ...);
-int
-g_execlp3(char* a1, char* a2, char* a3);
-int
-g_execlp11(char* a1, char* a2, char* a3, char* a4, char* a5, char* a6,
- char* a7, char* a8, char* a9, char* a10, char* a11);
-int
-g_execlp13(char* a1, char* a2, char* a3, char* a4, char* a5, char* a6,
- char* a7, char* a8, char* a9, char* a10, char* a11,
- char* a12, char* a13);
+g_execlp3(const char* a1, const char* a2, const char* a3);
void
g_signal(int sig_num, void (*func)(int));
void
@@ -183,9 +174,9 @@ g_waitpid(int pid);
void
g_clearenv(void);
int
-g_setenv(char* name, char* value, int rewrite);
+g_setenv(const char* name, const char* value, int rewrite);
char*
-g_getenv(char* name);
+g_getenv(const char* name);
int
g_exit(int exit_code);
int
@@ -193,12 +184,12 @@ g_getpid(void);
int
g_sigterm(int pid);
int
-g_getuser_info(char* username, int* gid, int* uid, char* shell, char* dir,
- char* gecos);
+g_getuser_info(const char* username, int* gid, int* uid, char* shell,
+ char* dir, char* gecos);
int
-g_getgroup_info(char* groupname, int* gid);
+g_getgroup_info(const char* groupname, int* gid);
int
-g_check_user_in_group(char* username, int gid, int* ok);
+g_check_user_in_group(const char* username, int gid, int* ok);
int
g_time1(void);
diff --git a/common/ssl_calls.c b/common/ssl_calls.c
index ce0ba5b9..19f70e53 100644
--- a/common/ssl_calls.c
+++ b/common/ssl_calls.c
@@ -20,15 +20,16 @@
*/
-#include "os_calls.h"
-#include "arch.h"
-
#include <stdlib.h> /* needed for openssl headers */
#include <openssl/rc4.h>
#include <openssl/md5.h>
#include <openssl/sha.h>
#include <openssl/bn.h>
+#include "os_calls.h"
+#include "arch.h"
+#include "ssl_calls.h"
+
/* rc4 stuff */
/*****************************************************************************/
diff --git a/common/ssl_calls.h b/common/ssl_calls.h
index d4e26e2c..b7ef109c 100644
--- a/common/ssl_calls.h
+++ b/common/ssl_calls.h
@@ -21,6 +21,8 @@
#if !defined(SSL_CALLS_H)
#define SSL_CALLS_H
+#include "arch.h"
+
void* APP_CC
ssl_rc4_info_create(void);
void APP_CC
diff --git a/common/thread_calls.c b/common/thread_calls.c
index 0a22b180..ba7db3f1 100644
--- a/common/thread_calls.c
+++ b/common/thread_calls.c
@@ -26,6 +26,7 @@
#include <pthread.h>
#endif
#include "arch.h"
+#include "thread_calls.h"
/*****************************************************************************/
/* returns error */
diff --git a/common/thread_calls.h b/common/thread_calls.h
index 8702c7e2..cf04b832 100644
--- a/common/thread_calls.h
+++ b/common/thread_calls.h
@@ -21,6 +21,8 @@
#if !defined(THREAD_CALLS_H)
#define THREAD_CALLS_H
+#include "arch.h"
+
int APP_CC
g_thread_create(THREAD_RV (THREAD_CC * start_routine)(void*), void* arg);
long APP_CC
diff --git a/xrdp/funcs.c b/xrdp/funcs.c
index 21e20ce6..54355efe 100644
--- a/xrdp/funcs.c
+++ b/xrdp/funcs.c
@@ -197,7 +197,7 @@ remove_char_at(char* text, int index)
/*****************************************************************************/
int APP_CC
-set_string(char** in_str, char* in)
+set_string(char** in_str, const char* in)
{
if (in_str == 0)
{
diff --git a/xrdp/xrdp.h b/xrdp/xrdp.h
index bc7622c4..22501954 100644
--- a/xrdp/xrdp.h
+++ b/xrdp/xrdp.h
@@ -169,7 +169,7 @@ xrdp_bitmap_set_focus(struct xrdp_bitmap* self, int focused);
int APP_CC
xrdp_bitmap_resize(struct xrdp_bitmap* self, int width, int height);
int APP_CC
-xrdp_bitmap_load(struct xrdp_bitmap* self, char* filename, int* palette);
+xrdp_bitmap_load(struct xrdp_bitmap* self, const char* filename, int* palette);
int APP_CC
xrdp_bitmap_get_pixel(struct xrdp_bitmap* self, int x, int y);
int APP_CC
@@ -239,7 +239,7 @@ xrdp_painter_text_height(struct xrdp_painter* self, char* text);
int APP_CC
xrdp_painter_draw_text(struct xrdp_painter* self,
struct xrdp_bitmap* bitmap,
- int x, int y, char* text);
+ int x, int y, const char* text);
int APP_CC
xrdp_painter_draw_text2(struct xrdp_painter* self,
struct xrdp_bitmap* bitmap,
@@ -285,7 +285,7 @@ add_char_at(char* text, char ch, int index);
int APP_CC
remove_char_at(char* text, int index);
int APP_CC
-set_string(char** in_str, char* in);
+set_string(char** in_str, const char* in);
/* in lang.c */
char APP_CC
diff --git a/xrdp/xrdp_bitmap.c b/xrdp/xrdp_bitmap.c
index a709985f..625f7113 100644
--- a/xrdp/xrdp_bitmap.c
+++ b/xrdp/xrdp_bitmap.c
@@ -330,7 +330,7 @@ xrdp_bitmap_resize(struct xrdp_bitmap* self, int width, int height)
/* return 0 ok */
/* return 1 error */
int APP_CC
-xrdp_bitmap_load(struct xrdp_bitmap* self, char* filename, int* palette)
+xrdp_bitmap_load(struct xrdp_bitmap* self, const char* filename, int* palette)
{
int fd;
int i;
diff --git a/xrdp/xrdp_painter.c b/xrdp/xrdp_painter.c
index 2f1600c1..d87142e2 100644
--- a/xrdp/xrdp_painter.c
+++ b/xrdp/xrdp_painter.c
@@ -326,7 +326,7 @@ xrdp_painter_fill_rect(struct xrdp_painter* self,
int APP_CC
xrdp_painter_draw_text(struct xrdp_painter* self,
struct xrdp_bitmap* bitmap,
- int x, int y, char* text)
+ int x, int y, const char* text)
{
int i;
int f;