Skip to main content
summaryrefslogtreecommitdiffstats
path: root/agent/tcf
diff options
context:
space:
mode:
Diffstat (limited to 'agent/tcf')
-rw-r--r--agent/tcf/config.h2
-rw-r--r--agent/tcf/framework/asyncreq.c4
-rw-r--r--agent/tcf/framework/asyncreq.h2
-rw-r--r--agent/tcf/framework/channel.c4
-rw-r--r--agent/tcf/framework/channel_pipe.c14
-rw-r--r--agent/tcf/framework/channel_tcp.c18
-rw-r--r--agent/tcf/framework/errors.c12
-rw-r--r--agent/tcf/framework/errors.h4
-rw-r--r--agent/tcf/framework/events.c2
-rw-r--r--agent/tcf/framework/exceptions.h2
-rw-r--r--agent/tcf/framework/ip_ifc.c4
-rw-r--r--agent/tcf/framework/mdep-inet.h4
-rw-r--r--agent/tcf/framework/mdep-threads.h2
-rw-r--r--agent/tcf/framework/mdep.c20
-rw-r--r--agent/tcf/framework/mdep.h10
-rw-r--r--agent/tcf/framework/myalloc.c10
-rw-r--r--agent/tcf/framework/peer.c8
-rw-r--r--agent/tcf/framework/peer.h6
-rw-r--r--agent/tcf/framework/plugins.c2
-rw-r--r--agent/tcf/framework/signames.c2
-rw-r--r--agent/tcf/framework/trace.c4
-rw-r--r--agent/tcf/framework/waitpid.c2
-rw-r--r--agent/tcf/main/cmdline.c2
-rw-r--r--agent/tcf/main/main.c4
-rw-r--r--agent/tcf/main/main_lua.c4
-rw-r--r--agent/tcf/main/test.c8
-rw-r--r--agent/tcf/services/discovery.c2
-rw-r--r--agent/tcf/services/discovery_udp.c2
-rw-r--r--agent/tcf/services/filesystem.c44
-rw-r--r--agent/tcf/services/linenumbers_win32.c2
-rw-r--r--agent/tcf/services/processes.c14
-rw-r--r--agent/tcf/services/symbols_win32.c4
-rw-r--r--agent/tcf/services/sysmon.c13
-rw-r--r--agent/tcf/services/tcf_elf.c10
-rw-r--r--agent/tcf/services/tcf_elf.h8
-rw-r--r--agent/tcf/services/terminals.c12
-rw-r--r--agent/tcf/services/vm.c4
37 files changed, 137 insertions, 134 deletions
diff --git a/agent/tcf/config.h b/agent/tcf/config.h
index c8da0eaa..92a64971 100644
--- a/agent/tcf/config.h
+++ b/agent/tcf/config.h
@@ -23,7 +23,7 @@
#include <tcf/framework/mdep.h>
-#if defined(WIN32)
+#if defined(_WIN32)
# define TARGET_WINDOWS 1
# define TARGET_VXWORKS 0
# define TARGET_UNIX 0
diff --git a/agent/tcf/framework/asyncreq.c b/agent/tcf/framework/asyncreq.c
index c4e9b525..44838ca9 100644
--- a/agent/tcf/framework/asyncreq.c
+++ b/agent/tcf/framework/asyncreq.c
@@ -21,7 +21,7 @@
#include <tcf/config.h>
#include <assert.h>
#include <stddef.h>
-#if defined(WIN32)
+#if defined(_WIN32)
#elif defined(_WRS_KERNEL)
#else
# include <sys/wait.h>
@@ -143,7 +143,7 @@ static void * worker_thread_handler(void * x) {
break;
/* Platform dependant IO methods */
-#if defined(WIN32)
+#if defined(_WIN32)
case AsyncReqConnectPipe:
req->u.cnp.rval = ConnectNamedPipe(req->u.cnp.pipe, NULL);
if (!req->u.cnp.rval) {
diff --git a/agent/tcf/framework/asyncreq.h b/agent/tcf/framework/asyncreq.h
index 888baf9c..6e711016 100644
--- a/agent/tcf/framework/asyncreq.h
+++ b/agent/tcf/framework/asyncreq.h
@@ -106,7 +106,7 @@ struct AsyncReqInfo {
/* Out */
int rval;
} con;
-#ifdef WIN32
+#ifdef _WIN32
struct {
/* In */
HANDLE pipe;
diff --git a/agent/tcf/framework/channel.c b/agent/tcf/framework/channel.c
index 7b48db5f..f164c5cd 100644
--- a/agent/tcf/framework/channel.c
+++ b/agent/tcf/framework/channel.c
@@ -219,8 +219,8 @@ PeerServer * channel_peer_from_url(const char * url) {
}
char * channel_peer_to_json(PeerServer * ps) {
- int i;
- char *rval;
+ unsigned i;
+ char * rval;
ByteArrayOutputStream buf;
OutputStream * out;
diff --git a/agent/tcf/framework/channel_pipe.c b/agent/tcf/framework/channel_pipe.c
index d6f9aa98..fb0dc702 100644
--- a/agent/tcf/framework/channel_pipe.c
+++ b/agent/tcf/framework/channel_pipe.c
@@ -19,7 +19,7 @@
#include <tcf/config.h>
-#if defined(WIN32)
+#if defined(_WIN32)
#include <fcntl.h>
#include <errno.h>
@@ -78,7 +78,7 @@ struct ServerInstance {
int index;
int fd_inp;
int fd_out;
-#if defined(WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32) && !defined(__CYGWIN__)
HANDLE pipe;
AsyncReqInfo req;
#endif
@@ -550,7 +550,7 @@ void channel_pipe_connect(PeerServer * ps, ChannelConnectCallBack callback, void
post_event(channel_pipe_connect_done, info);
}
-#if defined(WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32) && !defined(__CYGWIN__)
#define check_error_win32(ok) { if (!(ok)) check_error(set_win32_errno(GetLastError())); }
@@ -564,7 +564,7 @@ static void pipe_client_connected(void * args) {
if (req->error) error = req->error;
if (!error) {
- int l = 0;
+ size_t l = 0;
HANDLE h = NULL;
OVERLAPPED overlap;
char inp_path[FILE_PATH_SIZE];
@@ -659,7 +659,7 @@ static void close_output_pipe(ChannelPIPE * c) {
}
static void register_server(ServerPIPE * s) {
- int i;
+ size_t i;
PeerServer * ps = s->serv.ps;
PeerServer * ps2 = peer_server_alloc();
const char * transport = peer_server_getprop(ps, "TransportName", NULL);
@@ -705,7 +705,7 @@ static void server_close(ChannelServer * serv) {
if (ins->fd_inp >= 0 && close(ins->fd_inp) < 0) check_error(errno);
if (ins->fd_out >= 0 && close(ins->fd_out) < 0) check_error(errno);
ins->fd_inp = ins->fd_out = -1;
-#if defined(WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32) && !defined(__CYGWIN__)
ins->pipe = NULL;
#endif
}
@@ -714,7 +714,7 @@ static void server_close(ChannelServer * serv) {
ChannelServer * channel_pipe_server(PeerServer * ps) {
ServerPIPE * s = (ServerPIPE *)loc_alloc_zero(sizeof(ServerPIPE));
-#if defined(WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32) && !defined(__CYGWIN__)
{
int i;
const char * path = peer_server_getprop(ps, attr_pipe_name, def_pipe_name);
diff --git a/agent/tcf/framework/channel_tcp.c b/agent/tcf/framework/channel_tcp.c
index 6971a27e..ae7c359c 100644
--- a/agent/tcf/framework/channel_tcp.c
+++ b/agent/tcf/framework/channel_tcp.c
@@ -41,7 +41,7 @@
# ifndef _MSC_VER
# include <dirent.h>
# endif
-# ifdef WIN32
+# ifdef _WIN32
# include <ShlObj.h>
# endif
#else
@@ -69,7 +69,7 @@
#define MSG_MORE 0
#endif
-#ifdef WIN32
+#ifdef _WIN32
# define FD_SETX(a,b) FD_SET((unsigned)a, b)
# define MKDIR_MODE_TCF 0
# define MKDIR_MODE_SSL 0
@@ -89,7 +89,7 @@
#define MAX_IFC 10
#if !defined(ENABLE_OutputQueue)
-# if ENABLE_SSL || ENABLE_ContextProxy || defined(WIN32)
+# if ENABLE_SSL || ENABLE_ContextProxy || defined(_WIN32)
# define ENABLE_OutputQueue 1
# else
# define ENABLE_OutputQueue 0
@@ -175,7 +175,7 @@ static void ini_ssl(void) {
RAND_add(&ts.tv_nsec, sizeof(ts.tv_nsec), 0.1);
}
inited = 1;
-#ifdef WIN32
+#ifdef _WIN32
{
WCHAR fnm[MAX_PATH];
char buf[MAX_PATH];
@@ -815,7 +815,7 @@ static ChannelTCP * create_channel(int sock, int en_ssl, int server, int unix_do
}
}
-#ifdef WIN32
+#ifdef _WIN32
{
unsigned long opts = 1;
if (ioctlsocket((SOCKET)sock, FIONBIO, &opts) != 0) {
@@ -897,7 +897,7 @@ static ChannelTCP * create_channel(int sock, int en_ssl, int server, int unix_do
}
static void refresh_peer_server(int sock, PeerServer * ps) {
- int i;
+ unsigned i;
const char * transport = peer_server_getprop(ps, "TransportName", NULL);
assert(transport != NULL);
if (strcmp(transport, "UNIX") == 0) {
@@ -1183,7 +1183,7 @@ ChannelServer * channel_tcp_server(PeerServer * ps) {
reason = "create";
continue;
}
-#if !defined(WIN32)
+#if !defined(_WIN32)
{
const int i = 1;
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&i, sizeof(i)) < 0) {
@@ -1435,14 +1435,14 @@ void generate_ssl_certificate(void) {
if (!err && (fp = fopen(fnm, "w")) == NULL) err = errno;
if (!err && !PEM_write_PKCS8PrivateKey(fp, rsa_key, NULL, NULL, 0, NULL, NULL)) err = set_ssl_errno();
if (!err && fclose(fp) != 0) err = errno;
-#ifndef WIN32
+#ifndef _WIN32
if (!err && chmod(fnm, S_IRWXU) != 0) err = errno;
#endif
snprintf(fnm, sizeof(fnm), "%s/ssl/local.cert", tcf_dir);
if (!err && (fp = fopen(fnm, "w")) == NULL) err = errno;
if (!err && !PEM_write_X509(fp, cert)) err = set_ssl_errno();
if (!err && fclose(fp) != 0) err = errno;
-#ifndef WIN32
+#ifndef _WIN32
if (!err && chmod(fnm, S_IRWXU) != 0) err = errno;
#endif
if (err) {
diff --git a/agent/tcf/framework/errors.c b/agent/tcf/framework/errors.c
index 9ef8bf44..a231e3a4 100644
--- a/agent/tcf/framework/errors.c
+++ b/agent/tcf/framework/errors.c
@@ -42,7 +42,7 @@
#define MESSAGE_CNT (ERR_MESSAGE_MAX - ERR_MESSAGE_MIN + 1)
-#ifdef WIN32
+#ifdef _WIN32
# define ERR_WINDOWS_MIN (STD_ERR_BASE + 0x10000)
# define ERR_WINDOWS_MAX (ERR_WINDOWS_MIN + 0xffff)
# define ERR_WINDOWS_CNT (ERR_WINDOWS_MAX - ERR_WINDOWS_MIN + 1)
@@ -115,7 +115,7 @@ static ErrorMessage * alloc_msg(int source) {
return m;
}
-#ifdef WIN32
+#ifdef _WIN32
static char * system_strerror(DWORD error_code, HMODULE module) {
WCHAR * buf = NULL;
@@ -134,7 +134,7 @@ static char * system_strerror(DWORD error_code, HMODULE module) {
msg_len = WideCharToMultiByte(CP_UTF8, 0, buf, -1, NULL, 0, NULL, NULL);
if (msg_len > 0) {
realloc_msg_buf();
- msg_len = WideCharToMultiByte(CP_UTF8, 0, buf, -1, msg_buf, msg_max, NULL, NULL);
+ msg_len = WideCharToMultiByte(CP_UTF8, 0, buf, -1, msg_buf, (int)msg_max, NULL, NULL);
}
}
if (msg_len == 0) {
@@ -351,7 +351,7 @@ const char * errno_to_str(int err) {
return "Cannot get error message text: errno_to_str() must be called from the main thread";
}
}
-#ifdef WIN32
+#ifdef _WIN32
if (err >= ERR_WINDOWS_MIN && err <= ERR_WINDOWS_MAX) {
if (is_dispatch_thread()) {
return system_strerror(err - ERR_WINDOWS_MIN, NULL);
@@ -495,10 +495,10 @@ ErrorReport * get_error_report(int err) {
report->pub.format = loc_strdup(errno_to_str(err));
-#ifdef WIN32
+#ifdef _WIN32
if (err >= ERR_WINDOWS_MIN && err <= ERR_WINDOWS_MAX) {
add_report_prop_int(report, "AltCode", err - ERR_WINDOWS_MIN);
- add_report_prop_str(report, "AltOrg", "WIN32");
+ add_report_prop_str(report, "AltOrg", "_WIN32");
err = ERR_OTHER;
}
#endif
diff --git a/agent/tcf/framework/errors.h b/agent/tcf/framework/errors.h
index ce772eb7..57b016d5 100644
--- a/agent/tcf/framework/errors.h
+++ b/agent/tcf/framework/errors.h
@@ -104,9 +104,9 @@ extern int set_fmt_errno(int no, const char * fmt, ...);
*/
extern int set_gai_errno(int gai_error_code);
-#ifdef WIN32
+#ifdef _WIN32
/*
- * Set errno to indicate WIN32 error code.
+ * Set errno to indicate _WIN32 error code.
* This function is thread-safe - can be called from background threads.
* Return new value of errno.
*/
diff --git a/agent/tcf/framework/events.c b/agent/tcf/framework/events.c
index 99c32dfd..0f51c1c6 100644
--- a/agent/tcf/framework/events.c
+++ b/agent/tcf/framework/events.c
@@ -45,7 +45,7 @@ struct event_node {
void * arg;
};
-#if defined(WIN32)
+#if defined(_WIN32)
static DWORD event_thread;
# define current_thread GetCurrentThreadId()
# define is_event_thread (event_thread == current_thread)
diff --git a/agent/tcf/framework/exceptions.h b/agent/tcf/framework/exceptions.h
index 6d988dcb..9f44ac20 100644
--- a/agent/tcf/framework/exceptions.h
+++ b/agent/tcf/framework/exceptions.h
@@ -40,9 +40,9 @@
typedef struct Trap Trap;
struct Trap {
- int error;
jmp_buf env;
Trap * next;
+ int error;
};
#define set_trap(trap) (set_trap_a(trap), setjmp((trap)->env), set_trap_b(trap))
diff --git a/agent/tcf/framework/ip_ifc.c b/agent/tcf/framework/ip_ifc.c
index 9f984fda..f4bdc3f5 100644
--- a/agent/tcf/framework/ip_ifc.c
+++ b/agent/tcf/framework/ip_ifc.c
@@ -31,12 +31,12 @@
#define MAX(x,y) ((x) > (y) ? (x) : (y))
-#if !defined(WIN32) && !defined(ifr_netmask)
+#if !defined(_WIN32) && !defined(ifr_netmask)
# define ifr_netmask ifr_addr
#endif
int build_ifclist(int sock, int max, ip_ifc_info * list) {
-#ifdef WIN32
+#ifdef _WIN32
int i;
int ind;
MIB_IPADDRTABLE * info;
diff --git a/agent/tcf/framework/mdep-inet.h b/agent/tcf/framework/mdep-inet.h
index 1e643eb0..faabbf1a 100644
--- a/agent/tcf/framework/mdep-inet.h
+++ b/agent/tcf/framework/mdep-inet.h
@@ -21,7 +21,7 @@
#ifndef D_mdep_inet
#define D_mdep_inet
-#if defined(WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32) || defined(__CYGWIN__)
#include <ws2tcpip.h>
#include <iphlpapi.h>
@@ -63,7 +63,7 @@ extern int wsa_bind(int socket, const struct sockaddr * addr, int addr_size);
extern int wsa_listen(int socket, int size);
extern int wsa_recv(int socket, void * buf, size_t size, int flags);
extern int wsa_recvfrom(int socket, void * buf, size_t size, int flags,
- struct sockaddr * addr, socklen_t * addr_size);
+ struct sockaddr * addr, socklen_t * addr_size);
extern int wsa_send(int socket, const void * buf, size_t size, int flags);
extern int wsa_sendto(int socket, const void * buf, size_t size, int flags,
const struct sockaddr * dest_addr, socklen_t dest_size);
diff --git a/agent/tcf/framework/mdep-threads.h b/agent/tcf/framework/mdep-threads.h
index 8247d613..02b0b992 100644
--- a/agent/tcf/framework/mdep-threads.h
+++ b/agent/tcf/framework/mdep-threads.h
@@ -21,7 +21,7 @@
#ifndef D_mdep_threads
#define D_mdep_threads
-#if defined(WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32) || defined(__CYGWIN__)
#ifdef DISABLE_PTHREADS_WIN32
# include <pthread.h>
diff --git a/agent/tcf/framework/mdep.c b/agent/tcf/framework/mdep.c
index f73ecebc..ca01fe40 100644
--- a/agent/tcf/framework/mdep.c
+++ b/agent/tcf/framework/mdep.c
@@ -35,7 +35,7 @@
pthread_attr_t pthread_create_attr;
int utf8_locale = 0;
-#if defined(WIN32)
+#if defined(_WIN32)
#ifndef SIO_UDP_CONNRESET
#define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12)
@@ -215,9 +215,9 @@ int inet_pton(int af, const char * src, void * dst) {
return 1;
}
-#endif /* WIN32 */
+#endif /* _WIN32 */
-#if defined(WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32) && !defined(__CYGWIN__)
static __int64 file_time_to_unix_time(const FILETIME * ft) {
__int64 res = (__int64)ft->dwHighDateTime << 32;
@@ -504,9 +504,9 @@ int utf8_closedir(DIR * d) {
return r;
}
-#endif /* defined(WIN32) && !defined(__CYGWIN__) */
+#endif /* defined(_WIN32) && !defined(__CYGWIN__) */
-#if defined(WIN32) && !defined(__CYGWIN__) || defined(_WRS_KERNEL) || defined(__SYMBIAN32__)
+#if defined(_WIN32) && !defined(__CYGWIN__) || defined(_WRS_KERNEL) || defined(__SYMBIAN32__)
ssize_t pread(int fd, void * buf, size_t size, off_t offset) {
off_t offs0;
@@ -528,7 +528,7 @@ ssize_t pwrite(int fd, const void * buf, size_t size, off_t offset) {
return wr;
}
-#endif /* defined(WIN32) && !defined(__CYGWIN__) || defined(_WRS_KERNEL) || defined(__SYMBIAN32__) */
+#endif /* defined(_WIN32) && !defined(__CYGWIN__) || defined(_WRS_KERNEL) || defined(__SYMBIAN32__) */
#ifndef big_endian_host
extern int big_endian_host(void) {
@@ -538,7 +538,7 @@ extern int big_endian_host(void) {
}
#endif
-#if defined(WIN32)
+#if defined(_WIN32)
#include <shlobj.h>
@@ -810,7 +810,7 @@ void ini_mdep(void) {
/** canonicalize_file_name ****************************************************/
-#if defined(WIN32)
+#if defined(_WIN32)
char * canonicalize_file_name(const char * name) {
DWORD len;
@@ -1092,7 +1092,7 @@ const char * loc_gai_strerror(int ecode) {
return buf;
}
-#elif defined(WIN32)
+#elif defined(_WIN32)
const char * loc_gai_strerror(int ecode) {
WCHAR * buf = NULL;
@@ -1126,7 +1126,7 @@ const char * loc_gai_strerror(int ecode) {
#endif
-#if defined(WIN32) || defined(_WRS_KERNEL) || defined (__SYMBIAN32__)
+#if defined(_WIN32) || defined(_WRS_KERNEL) || defined (__SYMBIAN32__)
int is_daemon(void) {
return 0;
diff --git a/agent/tcf/framework/mdep.h b/agent/tcf/framework/mdep.h
index b37de2a1..007acdd6 100644
--- a/agent/tcf/framework/mdep.h
+++ b/agent/tcf/framework/mdep.h
@@ -27,7 +27,7 @@
#define __STDC_FORMAT_MACROS 1
-#if defined(WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32) || defined(__CYGWIN__)
/* MS Windows NT/XP */
#ifndef _WIN32_WINNT
@@ -114,7 +114,11 @@ struct timespec {
#if defined(__MINGW32__)
typedef unsigned int useconds_t;
#elif defined(_MSC_VER)
-#define __i386__
+#if defined(_M_IX86)
+# define __i386__
+#elif defined(_M_AMD64)
+# define __x86_64__
+#endif
#define strcasecmp(x,y) stricmp(x,y)
typedef unsigned long pid_t;
typedef unsigned long useconds_t;
@@ -181,7 +185,7 @@ extern int utf8_rename(const char * path1, const char * path2);
* readdir() emulation with UTF-8 support
*/
struct UTF8_DIR {
- long hdl;
+ intptr_t hdl;
struct _wfinddatai64_t blk;
wchar_t * path;
};
diff --git a/agent/tcf/framework/myalloc.c b/agent/tcf/framework/myalloc.c
index 785e20cb..3e4525d3 100644
--- a/agent/tcf/framework/myalloc.c
+++ b/agent/tcf/framework/myalloc.c
@@ -29,10 +29,10 @@
#define POOL_SIZE (0x100000 * MEM_USAGE_FACTOR)
static char * tmp_pool = NULL;
-static unsigned tmp_pool_pos = 0;
-static unsigned tmp_pool_max = 0;
-static unsigned tmp_pool_avr = 0;
-static unsigned tmp_alloc_size = 0;
+static size_t tmp_pool_pos = 0;
+static size_t tmp_pool_max = 0;
+static size_t tmp_pool_avr = 0;
+static size_t tmp_alloc_size = 0;
static LINK tmp_alloc_list = TCF_LIST_INIT(tmp_alloc_list);
static int tmp_gc_posted = 0;
@@ -95,7 +95,7 @@ void * tmp_realloc(void * ptr, size_t size) {
if (ptr == NULL) return tmp_alloc(size);
if ((char *)ptr >= tmp_pool && (char *)ptr <= tmp_pool + tmp_pool_max) {
size_t m = *((size_t *)ptr - 1);
- unsigned pos = tmp_pool_pos - m;
+ size_t pos = tmp_pool_pos - m;
if (ptr == tmp_pool + pos && pos + size <= tmp_pool_max) {
tmp_pool_pos = pos + size;
*((size_t *)ptr - 1) = size;
diff --git a/agent/tcf/framework/peer.c b/agent/tcf/framework/peer.c
index e69e3766..fdb99bf6 100644
--- a/agent/tcf/framework/peer.c
+++ b/agent/tcf/framework/peer.c
@@ -50,8 +50,8 @@ static void notify_listeners(PeerServer * ps, int type) {
}
static int is_same(PeerServer * a, PeerServer * b) {
- int i;
- int j;
+ unsigned i;
+ unsigned j;
if (a->ind != b->ind) {
return 0;
@@ -109,7 +109,7 @@ PeerServer * peer_server_alloc(void) {
}
void peer_server_addprop(PeerServer * s, const char * name, const char * value) {
- int i;
+ unsigned i;
if (strcmp(name, "ID") == 0) {
loc_free(name);
@@ -134,7 +134,7 @@ void peer_server_addprop(PeerServer * s, const char * name, const char * value)
}
const char * peer_server_getprop(PeerServer * s, const char * name, const char * default_value) {
- int i;
+ unsigned i;
for (i = 0; i < s->ind; i++) {
if (strcmp(s->list[i].name, name) == 0) {
diff --git a/agent/tcf/framework/peer.h b/agent/tcf/framework/peer.h
index 1aca9762..2937562b 100644
--- a/agent/tcf/framework/peer.h
+++ b/agent/tcf/framework/peer.h
@@ -33,10 +33,10 @@ struct PeerServerList {
struct PeerServer {
const char * id;
- int max;
- int ind;
+ unsigned max;
+ unsigned ind;
PeerServerList * list;
- unsigned int flags;
+ unsigned flags;
time_t creation_time;
time_t expiration_time;
PeerServer * next;
diff --git a/agent/tcf/framework/plugins.c b/agent/tcf/framework/plugins.c
index c820d6a1..6d3b71e2 100644
--- a/agent/tcf/framework/plugins.c
+++ b/agent/tcf/framework/plugins.c
@@ -43,7 +43,7 @@
#define _QUOTEME(x) #x
#define QUOTE(x) _QUOTEME(x)
-#if defined(WIN32)
+#if defined(_WIN32)
#define PLUGINS_DEF_EXT "dll" /* Default plugins' extension */
#else
#define PLUGINS_DEF_EXT "so" /* Default plugins' extension */
diff --git a/agent/tcf/framework/signames.c b/agent/tcf/framework/signames.c
index 8cab1c8e..d100960b 100644
--- a/agent/tcf/framework/signames.c
+++ b/agent/tcf/framework/signames.c
@@ -22,7 +22,7 @@
#include <signal.h>
#include <tcf/framework/signames.h>
-#if defined(WIN32)
+#if defined(_WIN32)
typedef struct ExceptionName {
DWORD code;
diff --git a/agent/tcf/framework/trace.c b/agent/tcf/framework/trace.c
index 636f6076..b2c3b2cb 100644
--- a/agent/tcf/framework/trace.c
+++ b/agent/tcf/framework/trace.c
@@ -27,7 +27,7 @@ int log_mode = LOG_EVENTS | LOG_CHILD | LOG_WAITPID | LOG_CONTEXT | LOG_PROTOCOL
#include <string.h>
#include <tcf/framework/mdep-threads.h>
-#if defined(WIN32)
+#if defined(_WIN32)
#elif defined(_WRS_KERNEL)
#elif defined(__SYMBIAN32__)
#else
@@ -46,7 +46,7 @@ int print_trace(int mode, const char * fmt, ...) {
va_start(ap, fmt);
if (is_daemon()) {
-#if defined(WIN32)
+#if defined(_WIN32)
#elif defined(_WRS_KERNEL)
#elif defined(__SYMBIAN32__)
#else
diff --git a/agent/tcf/framework/waitpid.c b/agent/tcf/framework/waitpid.c
index e8e07e40..b64f84d4 100644
--- a/agent/tcf/framework/waitpid.c
+++ b/agent/tcf/framework/waitpid.c
@@ -50,7 +50,7 @@ void add_waitpid_listener(WaitPIDListener * listener, void * args) {
listener_cnt++;
}
-#if defined(WIN32)
+#if defined(_WIN32)
#define MAX_HANDLES 64
diff --git a/agent/tcf/main/cmdline.c b/agent/tcf/main/cmdline.c
index 741dc0de..c04dfa30 100644
--- a/agent/tcf/main/cmdline.c
+++ b/agent/tcf/main/cmdline.c
@@ -200,7 +200,7 @@ static int cmd_peers(char * s) {
static int cmd_peerinfo(char * s) {
PeerServer * ps;
- int i;
+ unsigned i;
printf("Peer information: %s\n", s);
ps = peer_server_find(s);
diff --git a/agent/tcf/main/main.c b/agent/tcf/main/main.c
index 1d4099fc..d60a3540 100644
--- a/agent/tcf/main/main.c
+++ b/agent/tcf/main/main.c
@@ -82,7 +82,7 @@ static void signal_handler(int sig) {
}
}
-#if defined(WIN32)
+#if defined(_WIN32)
static LONG NTAPI VectoredExceptionHandler(PEXCEPTION_POINTERS x) {
if (is_dispatch_thread()) {
DWORD exception_code = x->ExceptionRecord->ExceptionCode;
@@ -308,7 +308,7 @@ int main(int argc, char ** argv) {
signal(SIGILL, signal_handler);
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
-#if defined(WIN32)
+#if defined(_WIN32)
SetConsoleCtrlHandler((PHANDLER_ROUTINE)CtrlHandler, TRUE);
AddVectoredExceptionHandler(1, VectoredExceptionHandler);
#endif
diff --git a/agent/tcf/main/main_lua.c b/agent/tcf/main/main_lua.c
index 87050493..0b300784 100644
--- a/agent/tcf/main/main_lua.c
+++ b/agent/tcf/main/main_lua.c
@@ -1261,7 +1261,7 @@ static int lua_peer_getid(lua_State *L)
static int lua_peer_getnames(lua_State *L)
{
- int i;
+ unsigned i;
struct peer_extra *pse = NULL;
assert(L == luastate);
@@ -1455,7 +1455,7 @@ int main(int argc, char ** argv) {
log_mode = 0;
-#ifndef WIN32
+#ifndef _WIN32
signal(SIGPIPE, SIG_IGN);
#endif
ini_mdep();
diff --git a/agent/tcf/main/test.c b/agent/tcf/main/test.c
index 77ac3d8a..cb6ccffe 100644
--- a/agent/tcf/main/test.c
+++ b/agent/tcf/main/test.c
@@ -32,7 +32,7 @@
#include <tcf/framework/errors.h>
#include <tcf/services/diagnostics.h>
#include <tcf/main/test.h>
-#if defined(WIN32)
+#if defined(_WIN32)
# include <system/Windows/tcf/context-win32.h>
#endif
@@ -190,7 +190,7 @@ int find_test_symbol(Context * ctx, const char * name, void ** addr, int * sym_c
return -1;
}
-#if defined(WIN32)
+#if defined(_WIN32)
typedef struct ContextAttachArgs {
ContextAttachCallBack * done;
void * data;
@@ -206,10 +206,10 @@ static void done_context_attach(int error, Context * ctx, void * data) {
CloseHandle(args->process);
loc_free(args);
}
-#endif /* defined(WIN32) */
+#endif /* defined(_WIN32) */
int run_test_process(ContextAttachCallBack * done, void * data) {
-#if defined(WIN32)
+#if defined(_WIN32)
char fnm[FILE_PATH_SIZE];
char cmd[FILE_PATH_SIZE];
int res = 0;
diff --git a/agent/tcf/services/discovery.c b/agent/tcf/services/discovery.c
index 35dcd6ec..9fbac909 100644
--- a/agent/tcf/services/discovery.c
+++ b/agent/tcf/services/discovery.c
@@ -41,7 +41,7 @@ static const char * LOCATOR = "Locator";
static int peer_cnt = 0;
static int write_peer_properties(PeerServer * ps, void * arg) {
- int i;
+ unsigned i;
OutputStream * out = (OutputStream *)arg;
if (peer_cnt > 0) write_stream(out, ',');
diff --git a/agent/tcf/services/discovery_udp.c b/agent/tcf/services/discovery_udp.c
index df26dbc0..e310cf5b 100644
--- a/agent/tcf/services/discovery_udp.c
+++ b/agent/tcf/services/discovery_udp.c
@@ -409,7 +409,7 @@ static int udp_send_peer_info(PeerServer * ps, void * arg) {
}
if (send_size == 8) {
- int i;
+ unsigned i;
send_buf[4] = UDP_ACK_INFO;
app_str("ID=");
app_strz(ps->id);
diff --git a/agent/tcf/services/filesystem.c b/agent/tcf/services/filesystem.c
index 36458ced..bf6127ad 100644
--- a/agent/tcf/services/filesystem.c
+++ b/agent/tcf/services/filesystem.c
@@ -35,11 +35,11 @@
#if defined(__CYGWIN__)
# include <ctype.h>
#endif
-#if !defined(WIN32) || defined(__CYGWIN__)
+#if !defined(_WIN32) || defined(__CYGWIN__)
# include <utime.h>
# include <dirent.h>
#endif
-#if defined(WIN32)
+#if defined(_WIN32)
# include <Windows.h>
#endif
#if defined(_WRS_KERNEL)
@@ -97,7 +97,7 @@ struct FileAttrs {
int permissions;
uint64_t atime;
uint64_t mtime;
-#if defined(WIN32)
+#if defined(_WIN32)
DWORD win32_attrs;
#endif
};
@@ -297,7 +297,7 @@ static void read_file_attrs(InputStream * inp, const char * nm, void * arg) {
attrs->mtime = json_read_uint64(inp);
attrs->flags |= ATTR_ACMODTIME;
}
-#if defined(WIN32)
+#if defined(_WIN32)
else if (strcmp(nm, "Win32Attrs") == 0) {
attrs->win32_attrs = json_read_ulong(inp);
}
@@ -352,7 +352,7 @@ static void write_file_attrs(OutputStream * out, FileAttrs * attrs) {
cnt++;
}
-#if defined(WIN32)
+#if defined(_WIN32)
if (attrs->win32_attrs != INVALID_FILE_ATTRIBUTES) {
if (cnt) write_stream(out, ',');
json_write_string(out, "Win32Attrs");
@@ -401,7 +401,7 @@ static void read_path(InputStream * inp, char * path, int size) {
}
strlcpy(path, buf, size);
}
-#elif defined(WIN32)
+#elif defined(_WIN32)
if (path[0] != 0 && path[1] == ':' && path[2] == '/') return;
#elif defined(_WRS_KERNEL)
{
@@ -435,7 +435,7 @@ static void command_open(char * token, Channel * c) {
flags = json_read_ulong(&c->inp);
if (read_stream(&c->inp) != 0) exception(ERR_JSON_SYNTAX);
memset(&attrs, 0, sizeof(FileAttrs));
-#if defined(WIN32)
+#if defined(_WIN32)
attrs.win32_attrs = INVALID_FILE_ATTRIBUTES;
#endif
json_read_struct(&c->inp, read_file_attrs, &attrs);
@@ -451,7 +451,7 @@ static void command_open(char * token, Channel * c) {
err = errno;
}
else {
-#if defined(WIN32)
+#if defined(_WIN32)
if (attrs.win32_attrs != INVALID_FILE_ATTRIBUTES) {
if (SetFileAttributes(path, attrs.win32_attrs) == 0)
err = set_win32_errno(GetLastError());
@@ -498,7 +498,7 @@ static void reply_stat(char * token, OutputStream * out, int err, struct stat *
if (err == 0) fill_attrs(&attrs, buf);
else memset(&attrs, 0, sizeof(attrs));
-#if defined(WIN32)
+#if defined(_WIN32)
attrs.win32_attrs = err ? INVALID_FILE_ATTRIBUTES : GetFileAttributes(path);
#endif
@@ -629,11 +629,11 @@ static void post_io_request(OpenFileInfo * handle) {
if (attrs.flags & ATTR_SIZE) {
if (ftruncate(handle->file, attrs.size) < 0) err = errno;
}
-#if defined(WIN32) || defined(_WRS_KERNEL)
+#if defined(_WIN32) || defined(_WRS_KERNEL)
if (attrs.flags & ATTR_PERMISSIONS) {
if (chmod(handle->path, attrs.permissions) < 0) err = errno;
}
-#if defined(WIN32)
+#if defined(_WIN32)
if (attrs.win32_attrs != INVALID_FILE_ATTRIBUTES) {
if (SetFileAttributes(handle->path, attrs.win32_attrs) == 0)
err = set_win32_errno(GetLastError());
@@ -849,7 +849,7 @@ static void command_setstat(char * token, Channel * c) {
read_path(&c->inp, path, sizeof(path));
if (read_stream(&c->inp) != 0) exception(ERR_JSON_SYNTAX);
memset(&attrs, 0, sizeof(FileAttrs));
-#if defined(WIN32)
+#if defined(_WIN32)
attrs.win32_attrs = INVALID_FILE_ATTRIBUTES;
#endif
json_read_struct(&c->inp, read_file_attrs, &attrs);
@@ -859,7 +859,7 @@ static void command_setstat(char * token, Channel * c) {
if (attrs.flags & ATTR_SIZE) {
if (truncate(path, attrs.size) < 0) err = errno;
}
-#if !defined(WIN32) && !defined(_WRS_KERNEL)
+#if !defined(_WIN32) && !defined(_WRS_KERNEL)
if (attrs.flags & ATTR_UIDGID) {
if (chown(path, attrs.uid, attrs.gid) < 0) err = errno;
}
@@ -873,7 +873,7 @@ static void command_setstat(char * token, Channel * c) {
buf.modtime = (time_t)(attrs.mtime / 1000);
if (utime(path, &buf) < 0) err = errno;
}
-#if defined(WIN32)
+#if defined(_WIN32)
if (attrs.win32_attrs != INVALID_FILE_ATTRIBUTES) {
if (SetFileAttributes(path, attrs.win32_attrs) == 0)
err = set_win32_errno(GetLastError());
@@ -891,7 +891,7 @@ static void command_fsetstat(char * token, Channel * c) {
json_read_string(&c->inp, id, sizeof(id));
if (read_stream(&c->inp) != 0) exception(ERR_JSON_SYNTAX);
memset(&attrs, 0, sizeof(FileAttrs));
-#if defined(WIN32)
+#if defined(_WIN32)
attrs.win32_attrs = INVALID_FILE_ATTRIBUTES;
#endif
json_read_struct(&c->inp, read_file_attrs, &attrs);
@@ -978,7 +978,7 @@ static void command_readdir(char * token, Channel * c) {
snprintf(path, sizeof(path), "%s/%s", h->path, e->d_name);
if (stat(path, &st) == 0) {
fill_attrs(&attrs, &st);
-#if defined(WIN32)
+#if defined(_WIN32)
attrs.win32_attrs = GetFileAttributes(path);
#endif
write_stream(&c->out, ',');
@@ -1040,7 +1040,7 @@ static void command_mkdir(char * token, Channel * c) {
read_path(&c->inp, path, sizeof(path));
if (read_stream(&c->inp) != 0) exception(ERR_JSON_SYNTAX);
memset(&attrs, 0, sizeof(FileAttrs));
-#if defined(WIN32)
+#if defined(_WIN32)
attrs.win32_attrs = INVALID_FILE_ATTRIBUTES;
#endif
json_read_struct(&c->inp, read_file_attrs, &attrs);
@@ -1055,7 +1055,7 @@ static void command_mkdir(char * token, Channel * c) {
#else
if (mkdir(path, mode) < 0) err = errno;
#endif
-#if defined(WIN32)
+#if defined(_WIN32)
if (attrs.win32_attrs != INVALID_FILE_ATTRIBUTES) {
if (SetFileAttributes(path, attrs.win32_attrs) == 0)
err = set_win32_errno(GetLastError());
@@ -1126,7 +1126,7 @@ static void command_readlink(char * token, Channel * c) {
if (read_stream(&c->inp) != MARKER_EOM) exception(ERR_JSON_SYNTAX);
link[0] = 0;
-#if defined(WIN32) || defined(_WRS_KERNEL)
+#if defined(_WIN32) || defined(_WRS_KERNEL)
err = ENOSYS;
#else
if (readlink(path, link, sizeof(link)) < 0) err = errno;
@@ -1151,7 +1151,7 @@ static void command_symlink(char * token, Channel * c) {
if (read_stream(&c->inp) != 0) exception(ERR_JSON_SYNTAX);
if (read_stream(&c->inp) != MARKER_EOM) exception(ERR_JSON_SYNTAX);
-#if defined(WIN32) || defined(_WRS_KERNEL)
+#if defined(_WIN32) || defined(_WRS_KERNEL)
err = ENOSYS;
#else
if (symlink(target, link) < 0) err = errno;
@@ -1219,7 +1219,7 @@ static void command_copy(char * token, Channel * c) {
if (utime(dst, &buf) < 0) err = errno;
}
if (err == 0 && copy_perms && chmod(dst, st.st_mode) < 0) err = errno;
-#if !defined(WIN32) && !defined(_WRS_KERNEL)
+#if !defined(_WIN32) && !defined(_WRS_KERNEL)
if (err == 0 && copy_uidgid && chown(dst, st.st_uid, st.st_gid) < 0) err = errno;
#endif
@@ -1256,7 +1256,7 @@ static void command_roots(char * token, Channel * c) {
write_stringz(&c->out, token);
write_stream(&c->out, '[');
-#ifdef WIN32
+#ifdef _WIN32
{
int cnt = 0;
int disk = 0;
diff --git a/agent/tcf/services/linenumbers_win32.c b/agent/tcf/services/linenumbers_win32.c
index 830beac5..fac43d7d 100644
--- a/agent/tcf/services/linenumbers_win32.c
+++ b/agent/tcf/services/linenumbers_win32.c
@@ -21,7 +21,7 @@
#include <tcf/config.h>
-#if SERVICE_LineNumbers && !ENABLE_LineNumbersProxy && defined(WIN32) && !ENABLE_ELF
+#if SERVICE_LineNumbers && !ENABLE_LineNumbersProxy && defined(_WIN32) && !ENABLE_ELF
#include <errno.h>
#include <assert.h>
diff --git a/agent/tcf/services/processes.c b/agent/tcf/services/processes.c
index ac2f32c7..1f897400 100644
--- a/agent/tcf/services/processes.c
+++ b/agent/tcf/services/processes.c
@@ -55,7 +55,7 @@
static const char * PROCESSES[2] = { "Processes", "ProcessesV1" };
#endif
-#if defined(WIN32)
+#if defined(_WIN32)
# include <tlhelp32.h>
# ifdef _MSC_VER
# pragma warning(disable:4201) /* nonstandard extension used : nameless struct/union (in winternl.h) */
@@ -309,7 +309,7 @@ static void command_get_context(char * token, Channel * c) {
write_stringz(&c->out, token);
if (pid != 0 && parent == 0) {
-#if defined(WIN32)
+#if defined(_WIN32)
#elif defined(_WRS_KERNEL)
if (TASK_ID_VERIFY(pid) == ERROR) err = ERR_INV_CONTEXT;
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__)
@@ -353,7 +353,7 @@ static void command_get_children(char * token, Channel * c) {
write_stringz(&c->out, "null");
}
else {
-#if defined(WIN32)
+#if defined(_WIN32)
DWORD err = 0;
HANDLE snapshot;
PROCESSENTRY32 pe32;
@@ -611,7 +611,7 @@ static void command_terminate(char * token, Channel * c) {
err = ERR_INV_CONTEXT;
}
else {
-#if defined(WIN32)
+#if defined(_WIN32)
HANDLE h = OpenProcess(PROCESS_TERMINATE, FALSE, pid);
if (h == NULL) {
err = set_win32_errno(GetLastError());
@@ -645,7 +645,7 @@ static void command_signal(char * token, Channel * c) {
write_stringz(&c->out, "R");
write_stringz(&c->out, token);
-#if defined(WIN32)
+#if defined(_WIN32)
err = ENOSYS;
#elif defined(_WRS_KERNEL)
if (kill(pid, signal) < 0) err = errno;
@@ -922,7 +922,7 @@ static ProcessOutput * read_process_output(ChildProcess * prs, int fd) {
# define context_attach_self() (errno = ERR_UNSUPPORTED, -1)
#endif
-#if defined(WIN32)
+#if defined(_WIN32)
static int start_process_imp(Channel * c, char ** envp, const char * dir, const char * exe, char ** args,
ProcessStartParams * params, int * selfattach, ChildProcess ** prs) {
@@ -997,7 +997,7 @@ static int start_process_imp(Channel * c, char ** envp, const char * dir, const
DWORD id = GetCurrentProcessId();
for (i = 0; i < hi->Count; i++) {
if (hi->Handles[i].ProcessId != id) continue;
- SetHandleInformation((HANDLE)(int)hi->Handles[i].Handle, HANDLE_FLAG_INHERIT, FALSE);
+ SetHandleInformation((HANDLE)(uintptr_t)hi->Handles[i].Handle, HANDLE_FLAG_INHERIT, FALSE);
}
}
else {
diff --git a/agent/tcf/services/symbols_win32.c b/agent/tcf/services/symbols_win32.c
index b6fb6633..d9c24952 100644
--- a/agent/tcf/services/symbols_win32.c
+++ b/agent/tcf/services/symbols_win32.c
@@ -19,7 +19,7 @@
#include <tcf/config.h>
-#if SERVICE_Symbols && !ENABLE_SymbolsProxy && defined(WIN32) && !ENABLE_ELF
+#if SERVICE_Symbols && !ENABLE_SymbolsProxy && defined(_WIN32) && !ENABLE_ELF
#include <errno.h>
#include <assert.h>
@@ -249,7 +249,7 @@ const char * symbol2id(const Symbol * sym) {
snprintf(buf, sizeof(buf), "@P%"PRIX64".%s", (uint64_t)sym->length, base);
}
else {
- int i = sym->info ? sym->info - basic_type_info + 1 : 0;
+ int i = sym->info ? (int)(sym->info - basic_type_info) + 1 : 0;
snprintf(buf, sizeof(buf), "@S%"PRIX64".%lX.%X.%X.%s",
(uint64_t)sym->module, sym->index, sym->frame, i, sym->ctx->id);
}
diff --git a/agent/tcf/services/sysmon.c b/agent/tcf/services/sysmon.c
index 7a710072..ce70c17d 100644
--- a/agent/tcf/services/sysmon.c
+++ b/agent/tcf/services/sysmon.c
@@ -408,7 +408,7 @@ static void command_get_environment(char * token, Channel * c) {
write_stream(&c->out, MARKER_EOM);
}
-#elif defined(WIN32)
+#elif defined(_WIN32)
#include <windows.h>
#include <wchar.h>
@@ -540,7 +540,6 @@ static RTL_USER_PROCESS_PARAMETERS upa;
static int get_process_info(HANDLE prs) {
static LONG (NTAPI * QueryInformationProcessProc)(HANDLE, PROCESSINFOCLASS, PVOID, ULONG, PULONG) = NULL;
- SIZE_T len = 0;
memset(&pbi, 0, sizeof(pbi));
memset(&peb, 0, sizeof(peb));
@@ -553,19 +552,19 @@ static int get_process_info(HANDLE prs) {
return -1;
}
}
- if (QueryInformationProcessProc(prs, ProcessBasicInformation, &pbi, sizeof(pbi), &len) < 0) {
+ if (QueryInformationProcessProc(prs, ProcessBasicInformation, &pbi, sizeof(pbi), NULL) < 0) {
set_win32_errno(GetLastError());
return -1;
}
if (pbi.PebBaseAddress != NULL) {
- if (ReadProcessMemory(prs, (LPCVOID)pbi.PebBaseAddress, &peb, sizeof(peb), &len) == 0) {
+ if (ReadProcessMemory(prs, (LPCVOID)pbi.PebBaseAddress, &peb, sizeof(peb), NULL) == 0) {
set_win32_errno(GetLastError());
return -1;
}
if (peb.ProcessParameters != NULL) {
- if (ReadProcessMemory(prs, (LPCVOID)peb.ProcessParameters, &upa, sizeof(upa), &len) == 0) {
+ if (ReadProcessMemory(prs, (LPCVOID)peb.ProcessParameters, &upa, sizeof(upa), NULL) == 0) {
set_win32_errno(GetLastError());
return -1;
}
@@ -584,8 +583,8 @@ static int write_unicode_string(OutputStream * out, HANDLE prs, UNICODE_STRING s
if (buff_size > sizeof(w_fnm)) buff_size = sizeof(w_fnm);
if (ReadProcessMemory(prs, (LPCVOID)str.Buffer, w_fnm, buff_size, &read_size)) {
char a_fnm[FILE_PATH_SIZE * 4];
- DWORD k = wcslen(w_fnm);
- int n = WideCharToMultiByte(CP_UTF8, 0, w_fnm, k, a_fnm, sizeof(a_fnm), NULL, NULL);
+ size_t k = wcslen(w_fnm);
+ int n = WideCharToMultiByte(CP_UTF8, 0, w_fnm, (int)k, a_fnm, sizeof(a_fnm), NULL, NULL);
a_fnm[n] = 0;
write_stream(out, ',');
json_write_string(out, name);
diff --git a/agent/tcf/services/tcf_elf.c b/agent/tcf/services/tcf_elf.c
index 8c6e9db9..2e69e43b 100644
--- a/agent/tcf/services/tcf_elf.c
+++ b/agent/tcf/services/tcf_elf.c
@@ -44,7 +44,7 @@
#if defined(_WRS_KERNEL)
#elif defined(_MSC_VER)
# define USE_MMAP
-#elif defined(WIN32)
+#elif defined(_WIN32)
#else
# include <sys/mman.h>
# define USE_MMAP
@@ -97,7 +97,7 @@ static void elf_dispose(ELF_File * file) {
ELF_Section * s = file->sections + n;
#if !defined(USE_MMAP)
loc_free(s->data);
-#elif defined(WIN32)
+#elif defined(_WIN32)
UnmapViewOfFile(s->data);
#else
if (s->mmap_addr != NULL) munmap(s->mmap_addr, s->mmap_size);
@@ -108,7 +108,7 @@ static void elf_dispose(ELF_File * file) {
}
loc_free(file->sections);
}
-#if defined(WIN32)
+#if defined(_WIN32)
if (file->mmap_handle != NULL) CloseHandle(file->mmap_handle);
#endif
release_error_report(file->error);
@@ -302,7 +302,7 @@ static char * get_debug_info_file_name(ELF_File * file, int * error) {
char * lnm = fnm;
struct stat buf;
char * name = (char *)sec->data;
- int l = strlen(file->name);
+ int l = (int)strlen(file->name);
while (l > 0 && file->name[l - 1] != '/' && file->name[l - 1] != '\\') l--;
if (strcmp(file->name + l, name) != 0) {
snprintf(fnm, sizeof(fnm), "%.*s%s", l, file->name, name);
@@ -657,7 +657,7 @@ int elf_load(ELF_Section * s) {
}
#ifdef USE_MMAP
-#ifdef WIN32
+#ifdef _WIN32
{
ELF_File * file = s->file;
if (file->mmap_handle == NULL) {
diff --git a/agent/tcf/services/tcf_elf.h b/agent/tcf/services/tcf_elf.h
index 643544a3..c9b2b5b1 100644
--- a/agent/tcf/services/tcf_elf.h
+++ b/agent/tcf/services/tcf_elf.h
@@ -23,12 +23,12 @@
#if ENABLE_ELF
-#if !defined(WIN32) && !defined(__APPLE__)
+#if !defined(_WIN32) && !defined(__APPLE__)
# include <elf.h>
#endif
#include <tcf/framework/context.h>
-#if defined(WIN32) || defined(__APPLE__)
+#if defined(_WIN32) || defined(__APPLE__)
#define EI_MAG0 0
#define EI_MAG1 1
@@ -252,7 +252,7 @@ typedef struct {
#endif
-#if defined(_WRS_KERNEL) || defined(WIN32) || defined(__APPLE__)
+#if defined(_WRS_KERNEL) || defined(_WIN32) || defined(__APPLE__)
typedef uint64_t Elf64_Addr;
typedef uint16_t Elf64_Half;
@@ -389,7 +389,7 @@ struct ELF_File {
ErrorReport * error;
int fd;
-#if defined(WIN32)
+#if defined(_WIN32)
HANDLE mmap_handle;
#endif
diff --git a/agent/tcf/services/terminals.c b/agent/tcf/services/terminals.c
index 48e8d59d..fbe7aed6 100644
--- a/agent/tcf/services/terminals.c
+++ b/agent/tcf/services/terminals.c
@@ -48,7 +48,7 @@
static const char * TERMINALS = "Terminals";
-#if defined(WIN32)
+#if defined(_WIN32)
# define TERM_LAUNCH_EXEC "cmd"
# define TERM_LAUNCH_ARGS {TERM_LAUNCH_EXEC, NULL}
struct winsize {
@@ -232,7 +232,7 @@ static int kill_term(Terminal * term) {
int err = 0;
int pid = get_process_pid(term->prs);
-#if defined(WIN32)
+#if defined(_WIN32)
HANDLE h = OpenProcess(PROCESS_TERMINATE, FALSE, pid);
if (h == NULL) {
err = set_win32_errno(GetLastError());
@@ -291,7 +291,7 @@ static void terminal_exited(void * args) {
loc_free(term);
}
-#if !defined(WIN32)
+#if !defined(_WIN32)
/*
* Set the environment variable "name" to the value "value". If the variable
* exists already, override it or just skip.
@@ -420,7 +420,7 @@ static void command_launch(char * token, Channel * c) {
if (read_stream(&c->inp) != 0) exception(ERR_JSON_SYNTAX);
if (read_stream(&c->inp) != MARKER_EOM) exception(ERR_JSON_SYNTAX);
-#if !defined(WIN32)
+#if !defined(_WIN32)
{
struct stat st;
if (err == 0 && stat(exec, &st) != 0) {
@@ -461,7 +461,7 @@ static void command_launch(char * token, Channel * c) {
if (err == 0 && start_process(c, &prms, &selfattach, &term->prs) < 0) err = errno;
if (!err) {
-#if !defined(WIN32)
+#if !defined(_WIN32)
struct winsize size;
int tty = get_process_tty(term->prs);
memset(&size, 0, sizeof(struct winsize));
@@ -525,7 +525,7 @@ static void command_set_win_size(char * token, Channel * c) {
err = ERR_INV_CONTEXT;
}
else if (term->width != size.ws_col || term->height != size.ws_row) {
-#if defined(WIN32)
+#if defined(_WIN32)
#else
int tty = get_process_tty(term->prs);
if (ioctl(tty, TIOCSWINSZ, &size) < 0) err = errno;
diff --git a/agent/tcf/services/vm.c b/agent/tcf/services/vm.c
index 58f21697..4bf94809 100644
--- a/agent/tcf/services/vm.c
+++ b/agent/tcf/services/vm.c
@@ -29,8 +29,8 @@
static VMState * state = NULL;
static uint8_t * code = NULL;
-static unsigned code_pos = 0;
-static unsigned code_len = 0;
+static size_t code_pos = 0;
+static size_t code_len = 0;
static void inv_dwarf(const char * msg) {
str_exception(ERR_INV_DWARF, msg);

Back to the top