summaryrefslogtreecommitdiffstats
path: root/third_party/lzma_sdk/7zBuf.c
diff options
context:
space:
mode:
authorbashi@chromium.org <bashi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-22 23:01:02 +0000
committerbashi@chromium.org <bashi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-22 23:01:02 +0000
commitc2a4e52708caf2c92e8f783ffb79e7212ad3f853 (patch)
treebf761d0b82ad8c5a456240edf38fbb11623964ec /third_party/lzma_sdk/7zBuf.c
parent4a4e3477010dceec7df3313ec20c6d0915ef4fca (diff)
downloadchromium_src-c2a4e52708caf2c92e8f783ffb79e7212ad3f853.zip
chromium_src-c2a4e52708caf2c92e8f783ffb79e7212ad3f853.tar.gz
chromium_src-c2a4e52708caf2c92e8f783ffb79e7212ad3f853.tar.bz2
Second attempt to update lzma_sdk to 9.20
The first attempt (r132887) was reverted because the CL caused build failure on Linux. This is second attempt. Copied only C code required to open 7z archive files and uncompress LZMA compression. CpuArch.c was modified to fix an compile error on 32bit Linux. Updated chrome/installer/util/lzma_util.cc to follow API changes. BUG=None TEST=installer_util_unittests --gtest_filter='LzmaUtilTest.*' Review URL: http://codereview.chromium.org/10152012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133393 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/lzma_sdk/7zBuf.c')
-rw-r--r--third_party/lzma_sdk/7zBuf.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/third_party/lzma_sdk/7zBuf.c b/third_party/lzma_sdk/7zBuf.c
new file mode 100644
index 0000000..14e7f4e
--- /dev/null
+++ b/third_party/lzma_sdk/7zBuf.c
@@ -0,0 +1,36 @@
+/* 7zBuf.c -- Byte Buffer
+2008-03-28
+Igor Pavlov
+Public domain */
+
+#include "7zBuf.h"
+
+void Buf_Init(CBuf *p)
+{
+ p->data = 0;
+ p->size = 0;
+}
+
+int Buf_Create(CBuf *p, size_t size, ISzAlloc *alloc)
+{
+ p->size = 0;
+ if (size == 0)
+ {
+ p->data = 0;
+ return 1;
+ }
+ p->data = (Byte *)alloc->Alloc(alloc, size);
+ if (p->data != 0)
+ {
+ p->size = size;
+ return 1;
+ }
+ return 0;
+}
+
+void Buf_Free(CBuf *p, ISzAlloc *alloc)
+{
+ alloc->Free(alloc, p->data);
+ p->data = 0;
+ p->size = 0;
+}