aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common/vli_reverse_decoder.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/liblzma/common/vli_reverse_decoder.c55
1 files changed, 0 insertions, 55 deletions
diff --git a/src/liblzma/common/vli_reverse_decoder.c b/src/liblzma/common/vli_reverse_decoder.c
deleted file mode 100644
index 68ca6a42..00000000
--- a/src/liblzma/common/vli_reverse_decoder.c
+++ /dev/null
@@ -1,55 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-//
-/// \file vli_reverse_decoder.c
-/// \brief Decodes variable-length integers starting at end of the buffer
-//
-// Copyright (C) 2007 Lasse Collin
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-///////////////////////////////////////////////////////////////////////////////
-
-#include "common.h"
-
-
-extern LZMA_API lzma_ret
-lzma_vli_reverse_decode(lzma_vli *vli, const uint8_t *in, size_t *in_size)
-{
- if (*in_size == 0)
- return LZMA_BUF_ERROR;
-
- size_t i = *in_size - 1;
- *vli = in[i] & 0x7F;
-
- if (!(in[i] & 0x80)) {
- *in_size = i;
- return LZMA_OK;
- }
-
- const size_t end = *in_size > LZMA_VLI_BYTES_MAX
- ? *in_size - LZMA_VLI_BYTES_MAX : 0;
-
- do {
- if (i-- == end) {
- if (*in_size < LZMA_VLI_BYTES_MAX)
- return LZMA_BUF_ERROR;
-
- return LZMA_DATA_ERROR;
- }
-
- *vli <<= 7;
- *vli = in[i] & 0x7F;
-
- } while (!(in[i] & 0x80));
-
- *in_size = i;
- return LZMA_OK;
-}