summaryrefslogtreecommitdiffstats
path: root/third_party/lzma_sdk/Alloc.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/Alloc.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/Alloc.c')
-rw-r--r--third_party/lzma_sdk/Alloc.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/third_party/lzma_sdk/Alloc.c b/third_party/lzma_sdk/Alloc.c
index 7b5af42..358a7b5 100644
--- a/third_party/lzma_sdk/Alloc.c
+++ b/third_party/lzma_sdk/Alloc.c
@@ -1,4 +1,7 @@
-/* Alloc.c */
+/* Alloc.c -- Memory allocation functions
+2008-09-24
+Igor Pavlov
+Public domain */
#ifdef _WIN32
#include <windows.h>
@@ -22,16 +25,21 @@ void *MyAlloc(size_t size)
if (size == 0)
return 0;
#ifdef _SZ_ALLOC_DEBUG
- fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, g_allocCount++);
- #endif
+ {
+ void *p = malloc(size);
+ fprintf(stderr, "\nAlloc %10d bytes, count = %10d, addr = %8X", size, g_allocCount++, (unsigned)p);
+ return p;
+ }
+ #else
return malloc(size);
+ #endif
}
void MyFree(void *address)
{
#ifdef _SZ_ALLOC_DEBUG
if (address != 0)
- fprintf(stderr, "\nFree; count = %10d", --g_allocCount);
+ fprintf(stderr, "\nFree; count = %10d, addr = %8X", --g_allocCount, (unsigned)address);
#endif
free(address);
}
@@ -95,7 +103,7 @@ void *BigAlloc(size_t size)
#ifdef _7ZIP_LARGE_PAGES
if (g_LargePageSize != 0 && g_LargePageSize <= (1 << 30) && size >= (1 << 18))
{
- void *res = VirtualAlloc(0, (size + g_LargePageSize - 1) & (~(g_LargePageSize - 1)),
+ void *res = VirtualAlloc(0, (size + g_LargePageSize - 1) & (~(g_LargePageSize - 1)),
MEM_COMMIT | MEM_LARGE_PAGES, PAGE_READWRITE);
if (res != 0)
return res;