# HG changeset patch # User Matti Hamalainen # Date 1507817570 -10800 # Node ID 2991e6b52d95b914f4ad9c9c0298191fff5dc078 # Parent d19bd91842c77bbe735eb9c6f9de75d4fb9baa99 Get rid of trailing whitespace. diff -r d19bd91842c7 -r 2991e6b52d95 endianchk.c --- a/endianchk.c Fri Sep 15 04:49:57 2017 +0300 +++ b/endianchk.c Thu Oct 12 17:12:50 2017 +0300 @@ -36,4 +36,4 @@ ); return 0; } - + diff -r d19bd91842c7 -r 2991e6b52d95 tests.c --- a/tests.c Fri Sep 15 04:49:57 2017 +0300 +++ b/tests.c Thu Oct 12 17:12:50 2017 +0300 @@ -269,7 +269,7 @@ test_end(&ctx); } - va_end(ap); + va_end(ap); tprint(2, "-----------------------------------------------------\n"); } diff -r d19bd91842c7 -r 2991e6b52d95 th_args.c --- a/th_args.c Fri Sep 15 04:49:57 2017 +0300 +++ b/th_args.c Thu Oct 12 17:12:50 2017 +0300 @@ -79,7 +79,7 @@ (*argIndex)++; optArg = argv[*argIndex]; } - + if (optArg == NULL) { THERR("Option '%s%s' requires an argument.\n", @@ -88,7 +88,7 @@ return FALSE; } } - + // Option was given succesfully, try to process it if (doProcess && !handle_option(opt->id, optArg, currArg)) return FALSE; diff -r d19bd91842c7 -r 2991e6b52d95 th_config.c --- a/th_config.c Fri Sep 15 04:49:57 2017 +0300 +++ b/th_config.c Thu Oct 12 17:12:50 2017 +0300 @@ -835,7 +835,7 @@ while (item != NULL) { BOOL match = TRUE; - + if (item->type == ITEM_SECTION) { // Check section name if set @@ -860,7 +860,7 @@ if (*sect && match) return item; } - + return NULL; } diff -r d19bd91842c7 -r 2991e6b52d95 th_crypto.c --- a/th_crypto.c Fri Sep 15 04:49:57 2017 +0300 +++ b/th_crypto.c Thu Oct 12 17:12:50 2017 +0300 @@ -186,7 +186,7 @@ } -/* Final wrapup - pad to 64-byte boundary with the bit pattern +/* Final wrapup - pad to 64-byte boundary with the bit pattern * 1 0* (64-bit count of bits processed, MSB-first) */ void th_md5_finish(th_md5state_t *ctx, th_md5hash_t digest) diff -r d19bd91842c7 -r 2991e6b52d95 th_datastruct.c --- a/th_datastruct.c Fri Sep 15 04:49:57 2017 +0300 +++ b/th_datastruct.c Thu Oct 12 17:12:50 2017 +0300 @@ -152,8 +152,8 @@ 4) Remove last list <- list -> NULL - - + + */ void th_llist_delete_node_fast(th_llist_t **list, th_llist_t *node) { @@ -181,7 +181,7 @@ (*list)->num--; } - + node->next = node->prev = NULL; } @@ -253,7 +253,7 @@ curr = curr->next; } - + return -1; } @@ -284,7 +284,7 @@ } curr = curr->next; } - + return 0; } @@ -325,12 +325,12 @@ th_ringbuf_t * th_ringbuf_new(const size_t size, void (*mdeallocator)(void *data)) { th_ringbuf_t *res = th_malloc0(sizeof(th_ringbuf_t)); - + res->data = (char **) th_calloc(size, sizeof(char *)); res->size = size; res->n = 0; res->deallocator = mdeallocator; - + return res; } @@ -351,13 +351,13 @@ void th_ringbuf_free(th_ringbuf_t *buf) { int i; - + for (i = 0; i < buf->size; i++) { if (buf->data[i] != NULL) buf->deallocator(buf->data[i]); } - + th_free(buf->data); th_free(buf); } diff -r d19bd91842c7 -r 2991e6b52d95 th_network.c --- a/th_network.c Fri Sep 15 04:49:57 2017 +0300 +++ b/th_network.c Thu Oct 12 17:12:50 2017 +0300 @@ -120,7 +120,7 @@ base->bufsize = (bufsize <= 0) ? TH_CONNBUF_SIZE : bufsize; if ((base->buf = th_malloc(base->bufsize)) == NULL) return FALSE; - + return TRUE; } @@ -172,7 +172,7 @@ conn->proxy.type = type; conn->proxy.auth_type = auth_type; - + conn->proxy.conn.port = port; th_free(conn->proxy.conn.host); conn->proxy.conn.host = th_strdup(host); @@ -250,7 +250,7 @@ if (conn->base.total_bytes < want) status = TH_CONN_NO_DATA; break; - + default: return status; } @@ -294,13 +294,13 @@ th_growbuf_put_u8(&buf, 4); // Protocol version th_growbuf_put_u8(&buf, cmd); // Command th_growbuf_put_u16_be(&buf, port); - + switch (conn->proxy.addr_type) { case TH_PROXY_ADDR_IPV4: th_growbuf_put_str(&buf, (uint8_t *) &(conn->base.addr.s_addr), sizeof(conn->base.addr.s_addr)); break; - + case TH_PROXY_ADDR_DOMAIN: if (conn->proxy.type == TH_PROXY_SOCKS4A) th_growbuf_put_u32_be(&buf, 0x00000032); @@ -312,7 +312,7 @@ goto out; } break; - + default: err = THERR_INIT_FAIL; th_conn_err(conn, err, @@ -461,7 +461,7 @@ // Attempt user/pass authentication (RFC 1929) th_conn_msg(conn, THLOG_INFO, "Attempting SOCKS 5 user/pass authentication.\n"); th_growbuf_clear(&buf); - + th_growbuf_put_u8(&buf, 0x01); th_growbuf_put_u8(&buf, strlen(conn->proxy.userid)); th_growbuf_puts(&buf, conn->proxy.userid, FALSE); @@ -525,7 +525,7 @@ th_growbuf_put_u8(&buf, SOCKS5_ADDR_IPV6); //th_growbuf_put_str(&buf, (uint8_t *) &(conn->base.addr.s_addr), sizeof(conn->base.addr.s_addr)); break; - + case TH_PROXY_ADDR_DOMAIN: cmd = strlen(host); if (cmd < 1 || cmd > 255) @@ -597,7 +597,7 @@ conn->base.port = port; conn->base.host = th_strdup(host); conn->base.hst = th_resolve_host(conn, host); - + // If name resolving locally fails, force to domain addr type if (conn->base.hst == NULL) conn->proxy.addr_type = TH_PROXY_ADDR_DOMAIN; @@ -652,7 +652,7 @@ goto error; th_conn_msg(conn, THLOG_INFO, "SOCKS 4 connection established!\n"); break; - + case TH_PROXY_SOCKS5: if ((err = th_conn_socks5_negotiate(conn, port, host)) != THERR_OK) goto error; @@ -662,10 +662,10 @@ th_conn_reset(conn); conn->status = TH_CONN_OPEN; - + // Insert to connection list conn->node = th_llist_append(&th_conn_list, conn); - + return THERR_OK; error: @@ -711,7 +711,7 @@ // Remove from linked list if (conn->node != NULL) th_llist_delete_node_fast(&th_conn_list, conn->node); - + // Free connection data th_conn_free_nodelete(conn); } @@ -780,7 +780,7 @@ conn->base.total_bytes -= moved; } else - th_conn_reset(conn); + th_conn_reset(conn); } // Check for incoming data @@ -870,7 +870,7 @@ th_conn_free_nodelete(curr->data); curr = next; } - + #ifdef TH_PLAT_WINDOWS WSACleanup(); #endif @@ -939,14 +939,14 @@ { char *p; size_t offs, left; - + fprintf(f, "\n--------------------------------------------------------------\n" "err=%d, status=%d, got_bytes=%" PRIu_SIZE_T ", total_bytes=%" PRIu_SIZE_T "\n" "buf=0x%p, in_ptr=0x%04" PRIx_SIZE_T ", ptr=0x%04" PRIx_SIZE_T "\n", conn->err, conn->status, conn->base.got_bytes, conn->base.total_bytes, conn->base.buf, conn->base.in_ptr - conn->base.buf, conn->base.ptr - conn->base.buf); - + // Dump buffer contents as a hexdump for (offs = 0, left = conn->base.total_bytes, p = conn->base.buf; p < conn->base.in_ptr;) { diff -r d19bd91842c7 -r 2991e6b52d95 th_network.h --- a/th_network.h Fri Sep 15 04:49:57 2017 +0300 +++ b/th_network.h Thu Oct 12 17:12:50 2017 +0300 @@ -50,7 +50,7 @@ TH_CONN_PROXY_NEG, TH_CONN_OPEN, TH_CONN_CLOSED, - + TH_CONN_ERROR, TH_CONN_DATA_AVAIL, TH_CONN_NO_DATA, diff -r d19bd91842c7 -r 2991e6b52d95 th_util.c --- a/th_util.c Fri Sep 15 04:49:57 2017 +0300 +++ b/th_util.c Thu Oct 12 17:12:50 2017 +0300 @@ -167,7 +167,7 @@ { if (error >= TH_SYSTEM_ERRORS) return strerror(error - TH_SYSTEM_ERRORS); - + switch (error) { case THERR_OK: return "No error"; @@ -190,7 +190,7 @@ case THERR_BOUNDS: return "Bounds check failed"; case THERR_TIMED_OUT: return "Operation timed out"; - + case THERR_AUTH_FAILED: return "Authentication failed"; default: return "Unknown error";