aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common/version.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2008-08-28 22:53:15 +0300
committerLasse Collin <lasse.collin@tukaani.org>2008-08-28 22:53:15 +0300
commit3b34851de1eaf358cf9268922fa0eeed8278d680 (patch)
tree7bab212af647541df64227a8d350d17a2e789f6b /src/liblzma/common/version.c
parentFix test_filter_flags to match the new restriction of lc+lp. (diff)
downloadxz-3b34851de1eaf358cf9268922fa0eeed8278d680.tar.xz
Sort of garbage collection commit. :-| Many things are still
broken. API has changed a lot and it will still change a little more here and there. The command line tool doesn't have all the required changes to reflect the API changes, so it's easy to get "internal error" or trigger assertions.
Diffstat (limited to '')
-rw-r--r--src/liblzma/common/vli_size.c (renamed from src/liblzma/common/version.c)22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/liblzma/common/version.c b/src/liblzma/common/vli_size.c
index dffec7ff..547bba0b 100644
--- a/src/liblzma/common/version.c
+++ b/src/liblzma/common/vli_size.c
@@ -1,9 +1,9 @@
///////////////////////////////////////////////////////////////////////////////
//
-/// \file version.c
-/// \brief liblzma version number
+/// \file vli_size.c
+/// \brief Calculates the encoded size of a variable-length integer
//
-// Copyright (C) 2007 Lasse Collin
+// Copyright (C) 2007-2008 Lasse Collin
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -20,6 +20,18 @@
#include "common.h"
-LZMA_API const uint32_t lzma_version_number = LZMA_VERSION;
+extern LZMA_API uint32_t
+lzma_vli_size(lzma_vli vli)
+{
+ if (vli > LZMA_VLI_VALUE_MAX)
+ return 0;
-LZMA_API const char *const lzma_version_string = PACKAGE_VERSION;
+ uint32_t i = 0;
+ do {
+ vli >>= 7;
+ ++i;
+ } while (vli != 0);
+
+ assert(i <= LZMA_VLI_BYTES_MAX);
+ return i;
+}