diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-06-21 13:57:13 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-06-21 13:57:13 -0400 |
commit | 8918bd90e9ddc135c0519177a07cd7a8c18859ed (patch) | |
tree | dec556e3289d121b085b620f14a68dea70786b7d /src/common/compress_none.c | |
parent | 471418befb9d1b30b17acd1e07a9d3de034db261 (diff) | |
parent | 3305ae50442aaed13a9e15c392439c348e6182be (diff) | |
download | tor-8918bd90e9ddc135c0519177a07cd7a8c18859ed.tar.gz tor-8918bd90e9ddc135c0519177a07cd7a8c18859ed.zip |
Merge branch 'extract_easy_common_libs'
Diffstat (limited to 'src/common/compress_none.c')
-rw-r--r-- | src/common/compress_none.c | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/src/common/compress_none.c b/src/common/compress_none.c deleted file mode 100644 index 7e67046d34..0000000000 --- a/src/common/compress_none.c +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (c) 2004, Roger Dingledine. - * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ -/* See LICENSE for licensing information */ - -/** - * \file compress_none.c - * \brief Compression backend for identity compression. - * - * We actually define this backend so that we can treat the identity transform - * as another case of compression. - * - * This module should never be invoked directly. Use the compress module - * instead. - **/ - -#include "orconfig.h" - -#include "common/util.h" -#include "common/torlog.h" -#include "common/compress.h" -#include "common/compress_none.h" - -/** Transfer some bytes using the identity transformation. Read up to - * *<b>in_len</b> bytes from *<b>in</b>, and write up to *<b>out_len</b> bytes - * to *<b>out</b>, adjusting the values as we go. If <b>finish</b> is true, - * we've reached the end of the input. - * - * Return TOR_COMPRESS_DONE if we've finished the entire - * compression/decompression. - * Return TOR_COMPRESS_OK if we're processed everything from the input. - * Return TOR_COMPRESS_BUFFER_FULL if we're out of space on <b>out</b>. - * Return TOR_COMPRESS_ERROR if the stream is corrupt. - */ -tor_compress_output_t -tor_cnone_compress_process(char **out, size_t *out_len, - const char **in, size_t *in_len, - int finish) -{ - size_t n_to_copy = MIN(*in_len, *out_len); - - memcpy(*out, *in, n_to_copy); - *out += n_to_copy; - *in += n_to_copy; - *out_len -= n_to_copy; - *in_len -= n_to_copy; - if (*in_len == 0) { - return finish ? TOR_COMPRESS_DONE : TOR_COMPRESS_OK; - } else { - return TOR_COMPRESS_BUFFER_FULL; - } -} - |