diff th_network.c @ 457:85fa3d333556

Actually, revert the boolean changes .. meh.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 02 Jan 2018 23:09:29 +0200
parents 347bfd3e017e
children e4ce60239d16
line wrap: on
line diff
--- a/th_network.c	Tue Jan 02 22:57:47 2018 +0200
+++ b/th_network.c	Tue Jan 02 23:09:29 2018 +0200
@@ -10,7 +10,7 @@
 #include <errno.h>
 
 
-static bool th_network_inited = false;
+static BOOL th_network_inited = FALSE;
 static th_llist_t *th_conn_list = NULL;
 
 
@@ -114,14 +114,14 @@
 }
 
 
-bool th_base_conn_init(th_base_conn_t *base, ssize_t bufsize)
+BOOL th_base_conn_init(th_base_conn_t *base, ssize_t bufsize)
 {
     // Allocate connection data buffer
     base->bufsize = (bufsize <= 0) ? TH_CONNBUF_SIZE : bufsize;
     if ((base->buf = th_malloc(base->bufsize)) == NULL)
-        return false;
+        return FALSE;
 
-    return true;
+    return TRUE;
 }
 
 
@@ -150,17 +150,17 @@
 }
 
 
-static bool th_get_addr(struct in_addr *addr, struct hostent *hst)
+static BOOL th_get_addr(struct in_addr *addr, struct hostent *hst)
 {
     if (hst != NULL)
     {
         *addr = *(struct in_addr *) (hst->h_addr_list[0]);
-        return true;
+        return TRUE;
     }
     else
     {
         addr->s_addr = 0;
-        return false;
+        return FALSE;
     }
 }
 
@@ -320,9 +320,9 @@
             goto out;
     }
 
-    th_growbuf_puts(&buf, conn->proxy.userid, true);
+    th_growbuf_puts(&buf, conn->proxy.userid, TRUE);
     if (conn->proxy.addr_type == TH_PROXY_ADDR_DOMAIN)
-        th_growbuf_puts(&buf, host, true);
+        th_growbuf_puts(&buf, host, TRUE);
 
     // Send request
     if ((err = th_conn_proxy_send(conn, &buf)) != THERR_OK)
@@ -464,9 +464,9 @@
 
         th_growbuf_put_u8(&buf, 0x01);
         th_growbuf_put_u8(&buf, strlen(conn->proxy.userid));
-        th_growbuf_puts(&buf, conn->proxy.userid, false);
+        th_growbuf_puts(&buf, conn->proxy.userid, FALSE);
         th_growbuf_put_u8(&buf, strlen(conn->proxy.passwd));
-        th_growbuf_puts(&buf, conn->proxy.passwd, false);
+        th_growbuf_puts(&buf, conn->proxy.passwd, FALSE);
 
         // Send request
         if ((err = th_conn_proxy_send(conn, &buf)) != THERR_OK)
@@ -828,10 +828,10 @@
 }
 
 
-bool th_conn_check(th_conn_t *conn)
+BOOL th_conn_check(th_conn_t *conn)
 {
     if (conn == NULL)
-        return false;
+        return FALSE;
 
     return conn->err == 0 && conn->status == TH_CONN_OPEN;
 }
@@ -850,7 +850,7 @@
     }
 #endif
 
-    th_network_inited = true;
+    th_network_inited = TRUE;
 
     th_conn_list = NULL;
 
@@ -876,25 +876,25 @@
 #endif
     }
 
-    th_network_inited = false;
+    th_network_inited = FALSE;
 }
 
 
-bool th_conn_buf_check(th_conn_t *conn, size_t n)
+BOOL th_conn_buf_check(th_conn_t *conn, size_t n)
 {
     return conn && (conn->base.ptr + n <= conn->base.in_ptr);
 }
 
 
-bool th_conn_buf_skip(th_conn_t *conn, size_t n)
+BOOL th_conn_buf_skip(th_conn_t *conn, size_t n)
 {
     if (th_conn_buf_check(conn, n))
     {
         conn->base.ptr += n;
-        return true;
+        return TRUE;
     }
     else
-        return false;
+        return FALSE;
 }