diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/grfio.c | 2 | ||||
-rw-r--r-- | src/common/socket.c | 1 | ||||
-rw-r--r-- | src/common/strlib.c | 18 | ||||
-rw-r--r-- | src/common/strlib.h | 3 |
4 files changed, 23 insertions, 1 deletions
diff --git a/src/common/grfio.c b/src/common/grfio.c index 2d47ff4e4..0c628d163 100644 --- a/src/common/grfio.c +++ b/src/common/grfio.c @@ -33,7 +33,7 @@ #ifdef _WIN32 #include <windows.h> - #include "zlib_win32.h" + #include "../lib/zlib_win32.h" HINSTANCE zlib_dll; #define zlib_inflateInit(strm) zlib_inflateInit_((strm),ZLIB_VERSION, sizeof(z_stream)) #define zlib_deflateInit(strm, level) zlib_deflateInit_((strm),(level),ZLIB_VERSION,sizeof(z_stream)) diff --git a/src/common/socket.c b/src/common/socket.c index f43ca108c..02ba49cb9 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -10,6 +10,7 @@ #include <windows.h> #include <winsock2.h> #include <io.h> +typedef int socklen_t; #else #include <sys/socket.h> #include <netinet/in.h> diff --git a/src/common/strlib.c b/src/common/strlib.c index 64c8e154f..2b130e76d 100644 --- a/src/common/strlib.c +++ b/src/common/strlib.c @@ -78,3 +78,21 @@ int jmemescapecpy (char* pt,char* spt, int size) { // copy size is 0 ~ (j-1) return j; } + +//----------------------------------------------------- +// Function to suppress control characters in a string. +//----------------------------------------------------- +//int remove_control_chars(char *str) { +int remove_control_chars(unsigned char *str) { + int i; + int change = 0; + + for(i = 0; str[i]; i++) { + if (str[i] < 32) { + str[i] = '_'; + change = 1; + } + } + + return change; +} diff --git a/src/common/strlib.h b/src/common/strlib.h index 54c52cf94..55920f823 100644 --- a/src/common/strlib.h +++ b/src/common/strlib.h @@ -7,4 +7,7 @@ char* jstrescape (char* pt); char* jstrescapecpy (char* pt,char* spt); int jmemescapecpy (char* pt,char* spt, int size); + +// custom functions +int remove_control_chars(unsigned char *); #endif |