]> git.meshlink.io Git - utcp/blobdiff - selftest.c
Fix warnings when compiling with -Wall -W.
[utcp] / selftest.c
index f6e4c8c4ce5abfa488964fca5776282fe46d58c3..48d397c3d876ce1efaf3f20b4166a955a8af050b 100644 (file)
@@ -30,6 +30,7 @@ ssize_t do_recv(struct utcp_connection *x, const void *data, size_t len) {
 }
 
 bool do_pre_accept(struct utcp *utcp, uint16_t port) {
+       (void)utcp;
        fprintf(stderr, "pre-accept\n");
        if(port != 7)
                return false;
@@ -37,6 +38,7 @@ bool do_pre_accept(struct utcp *utcp, uint16_t port) {
 }
 
 void do_accept(struct utcp_connection *c, uint16_t port) {
+       (void)port;
        fprintf(stderr, "accept\n");
        utcp_accept(c, do_recv, NULL);
 }
@@ -55,6 +57,9 @@ ssize_t do_send(struct utcp *utcp, const void *data, size_t len) {
 }
 
 int main(int argc, char *argv[]) {
+       (void)argc;
+       (void)argv;
+
        srand(time(NULL));
 
        a = utcp_init(do_accept, do_pre_accept, do_send, NULL);
@@ -82,7 +87,7 @@ int main(int argc, char *argv[]) {
        ssize_t len = utcp_send(c, "Hello world!\n", 13);
 
        if(len != 13) {
-               if(len < 0)
+               if(len == -1)
                        fprintf(stderr, "Error: %s\n", strerror(errno));
                else
                        fprintf(stderr, "Short write %zd!\n", len);
@@ -90,7 +95,7 @@ int main(int argc, char *argv[]) {
        len = utcp_send(c, "This is a test.\n", 16);
 
        if(len != 16) {
-               if(len < 0)
+               if(len == -1)
                        fprintf(stderr, "Error: %s\n", strerror(errno));
                else
                        fprintf(stderr, "Short write %zd!\n", len);