+++ /dev/null
-/* 7zCrc.c */
-
-#include "7zCrc.h"
-
-#define kCrcPoly 0xEDB88320
-UInt32 g_CrcTable[256];
-
-void MY_FAST_CALL CrcGenerateTable(void)
-{
- UInt32 i;
- for (i = 0; i < 256; i++)
- {
- UInt32 r = i;
- int j;
- for (j = 0; j < 8; j++)
- r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1));
- g_CrcTable[i] = r;
- }
-}
-
-UInt32 MY_FAST_CALL CrcUpdate(UInt32 v, const void *data, size_t size)
-{
- const Byte *p = (const Byte *)data;
- for (; size > 0 ; size--, p++)
- v = CRC_UPDATE_BYTE(v, *p);
- return v;
-}
-
-UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size)
-{
- return CrcUpdate(CRC_INIT_VAL, data, size) ^ 0xFFFFFFFF;
-}
+++ /dev/null
-/* 7zCrc.h */
-
-#ifndef __7Z_CRC_H
-#define __7Z_CRC_H
-
-#include <stddef.h>
-
-#include "Types.h"
-
-extern UInt32 g_CrcTable[];
-
-void MY_FAST_CALL CrcGenerateTable(void);
-
-#define CRC_INIT_VAL 0xFFFFFFFF
-#define CRC_GET_DIGEST(crc) ((crc) ^ 0xFFFFFFFF)
-#define CRC_UPDATE_BYTE(crc, b) (g_CrcTable[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
-
-UInt32 MY_FAST_CALL CrcUpdate(UInt32 crc, const void *data, size_t size);
-UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size);
-
-#endif
+++ /dev/null
-/* Alloc.c */
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-#include <stdlib.h>
-
-#include "Alloc.h"
-
-/* #define _SZ_ALLOC_DEBUG */
-
-/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */
-#ifdef _SZ_ALLOC_DEBUG
-#include <stdio.h>
-int g_allocCount = 0;
-int g_allocCountMid = 0;
-int g_allocCountBig = 0;
-#endif
-
-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
- return malloc(size);
-}
-
-void MyFree(void *address)
-{
- #ifdef _SZ_ALLOC_DEBUG
- if (address != 0)
- fprintf(stderr, "\nFree; count = %10d", --g_allocCount);
- #endif
- free(address);
-}
-
-#ifdef _WIN32
-
-void *MidAlloc(size_t size)
-{
- if (size == 0)
- return 0;
- #ifdef _SZ_ALLOC_DEBUG
- fprintf(stderr, "\nAlloc_Mid %10d bytes; count = %10d", size, g_allocCountMid++);
- #endif
- return VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
-}
-
-void MidFree(void *address)
-{
- #ifdef _SZ_ALLOC_DEBUG
- if (address != 0)
- fprintf(stderr, "\nFree_Mid; count = %10d", --g_allocCountMid);
- #endif
- if (address == 0)
- return;
- VirtualFree(address, 0, MEM_RELEASE);
-}
-
-#ifndef MEM_LARGE_PAGES
-#undef _7ZIP_LARGE_PAGES
-#endif
-
-#ifdef _7ZIP_LARGE_PAGES
-SIZE_T g_LargePageSize = 0;
-typedef SIZE_T (WINAPI *GetLargePageMinimumP)();
-#endif
-
-void SetLargePageSize()
-{
- #ifdef _7ZIP_LARGE_PAGES
- SIZE_T size = 0;
- GetLargePageMinimumP largePageMinimum = (GetLargePageMinimumP)
- GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetLargePageMinimum");
- if (largePageMinimum == 0)
- return;
- size = largePageMinimum();
- if (size == 0 || (size & (size - 1)) != 0)
- return;
- g_LargePageSize = size;
- #endif
-}
-
-
-void *BigAlloc(size_t size)
-{
- if (size == 0)
- return 0;
- #ifdef _SZ_ALLOC_DEBUG
- fprintf(stderr, "\nAlloc_Big %10d bytes; count = %10d", size, g_allocCountBig++);
- #endif
-
- #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)),
- MEM_COMMIT | MEM_LARGE_PAGES, PAGE_READWRITE);
- if (res != 0)
- return res;
- }
- #endif
- return VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
-}
-
-void BigFree(void *address)
-{
- #ifdef _SZ_ALLOC_DEBUG
- if (address != 0)
- fprintf(stderr, "\nFree_Big; count = %10d", --g_allocCountBig);
- #endif
-
- if (address == 0)
- return;
- VirtualFree(address, 0, MEM_RELEASE);
-}
-
-#endif
+++ /dev/null
-/* Alloc.h */
-
-#ifndef __COMMON_ALLOC_H
-#define __COMMON_ALLOC_H
-
-#include <stddef.h>
-
-void *MyAlloc(size_t size);
-void MyFree(void *address);
-
-#ifdef _WIN32
-
-void SetLargePageSize();
-
-void *MidAlloc(size_t size);
-void MidFree(void *address);
-void *BigAlloc(size_t size);
-void BigFree(void *address);
-
-#else
-
-#define MidAlloc(size) MyAlloc(size)
-#define MidFree(address) MyFree(address)
-#define BigAlloc(size) MyAlloc(size)
-#define BigFree(address) MyFree(address)
-
-#endif
-
-#endif
+++ /dev/null
-/* 7zAlloc.c */
-
-#include <stdlib.h>
-#include "7zAlloc.h"
-
-/* #define _SZ_ALLOC_DEBUG */
-/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */
-
-#ifdef _SZ_ALLOC_DEBUG
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-#include <stdio.h>
-int g_allocCount = 0;
-int g_allocCountTemp = 0;
-#endif
-
-void *SzAlloc(size_t size)
-{
- if (size == 0)
- return 0;
- #ifdef _SZ_ALLOC_DEBUG
- fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, g_allocCount);
- g_allocCount++;
- #endif
- return malloc(size);
-}
-
-void SzFree(void *address)
-{
- #ifdef _SZ_ALLOC_DEBUG
- if (address != 0)
- {
- g_allocCount--;
- fprintf(stderr, "\nFree; count = %10d", g_allocCount);
- }
- #endif
- free(address);
-}
-
-void *SzAllocTemp(size_t size)
-{
- if (size == 0)
- return 0;
- #ifdef _SZ_ALLOC_DEBUG
- fprintf(stderr, "\nAlloc_temp %10d bytes; count = %10d", size, g_allocCountTemp);
- g_allocCountTemp++;
- #ifdef _WIN32
- return HeapAlloc(GetProcessHeap(), 0, size);
- #endif
- #endif
- return malloc(size);
-}
-
-void SzFreeTemp(void *address)
-{
- #ifdef _SZ_ALLOC_DEBUG
- if (address != 0)
- {
- g_allocCountTemp--;
- fprintf(stderr, "\nFree_temp; count = %10d", g_allocCountTemp);
- }
- #ifdef _WIN32
- HeapFree(GetProcessHeap(), 0, address);
- return;
- #endif
- #endif
- free(address);
-}
+++ /dev/null
-/* 7zAlloc.h */
-
-#ifndef __7Z_ALLOC_H
-#define __7Z_ALLOC_H
-
-#include <stddef.h>
-
-typedef struct _ISzAlloc
-{
- void *(*Alloc)(size_t size);
- void (*Free)(void *address); /* address can be 0 */
-} ISzAlloc;
-
-void *SzAlloc(size_t size);
-void SzFree(void *address);
-
-void *SzAllocTemp(size_t size);
-void SzFreeTemp(void *address);
-
-#endif
+++ /dev/null
-/* 7zBuffer.c */
-
-#include "7zBuffer.h"
-#include "7zAlloc.h"
-
-void SzByteBufferInit(CSzByteBuffer *buffer)
-{
- buffer->Capacity = 0;
- buffer->Items = 0;
-}
-
-int SzByteBufferCreate(CSzByteBuffer *buffer, size_t newCapacity, void * (*allocFunc)(size_t size))
-{
- buffer->Capacity = newCapacity;
- if (newCapacity == 0)
- {
- buffer->Items = 0;
- return 1;
- }
- buffer->Items = (Byte *)allocFunc(newCapacity);
- return (buffer->Items != 0);
-}
-
-void SzByteBufferFree(CSzByteBuffer *buffer, void (*freeFunc)(void *))
-{
- freeFunc(buffer->Items);
- buffer->Items = 0;
- buffer->Capacity = 0;
-}
+++ /dev/null
-/* 7zBuffer.h */
-
-#ifndef __7Z_BUFFER_H
-#define __7Z_BUFFER_H
-
-#include <stddef.h>
-#include "../../Types.h"
-
-typedef struct _CSzByteBuffer
-{
- size_t Capacity;
- Byte *Items;
-}CSzByteBuffer;
-
-void SzByteBufferInit(CSzByteBuffer *buffer);
-int SzByteBufferCreate(CSzByteBuffer *buffer, size_t newCapacity, void * (*allocFunc)(size_t size));
-void SzByteBufferFree(CSzByteBuffer *buffer, void (*freeFunc)(void *));
-
-#endif
+++ /dev/null
-/* 7zDecode.c */
-
-#include <memory.h>
-
-#include "7zDecode.h"
-#ifdef _SZ_ONE_DIRECTORY
-#include "LzmaDecode.h"
-#else
-#include "../../Compress/Lzma/LzmaDecode.h"
-#include "../../Compress/Branch/BranchX86.h"
-#include "../../Compress/Branch/BranchX86_2.h"
-#endif
-
-#define k_Copy 0
-#define k_LZMA 0x30101
-#define k_BCJ 0x03030103
-#define k_BCJ2 0x0303011B
-
-#ifdef _LZMA_IN_CB
-
-typedef struct _CLzmaInCallbackImp
-{
- ILzmaInCallback InCallback;
- ISzInStream *InStream;
- CFileSize Size;
-} CLzmaInCallbackImp;
-
-int LzmaReadImp(void *object, const unsigned char **buffer, SizeT *size)
-{
- CLzmaInCallbackImp *cb = (CLzmaInCallbackImp *)object;
- size_t processedSize;
- SZ_RESULT res;
- size_t curSize = (1 << 20);
- if (curSize > cb->Size)
- curSize = (size_t)cb->Size;
- *size = 0;
- res = cb->InStream->Read((void *)cb->InStream, (void **)buffer, curSize, &processedSize);
- *size = (SizeT)processedSize;
- if (processedSize > curSize)
- return (int)SZE_FAIL;
- cb->Size -= processedSize;
- if (res == SZ_OK)
- return 0;
- return (int)res;
-}
-
-#endif
-
-SZ_RESULT SzDecodeLzma(CCoderInfo *coder, CFileSize inSize,
- #ifdef _LZMA_IN_CB
- ISzInStream *inStream,
- #else
- const Byte *inBuffer,
- #endif
- Byte *outBuffer, size_t outSize, ISzAlloc *allocMain)
-{
- #ifdef _LZMA_IN_CB
- CLzmaInCallbackImp lzmaCallback;
- #else
- SizeT inProcessed;
- #endif
-
- CLzmaDecoderState state; /* it's about 24-80 bytes structure, if int is 32-bit */
- int result;
- SizeT outSizeProcessedLoc;
-
- #ifdef _LZMA_IN_CB
- lzmaCallback.Size = inSize;
- lzmaCallback.InStream = inStream;
- lzmaCallback.InCallback.Read = LzmaReadImp;
- #endif
-
- if (LzmaDecodeProperties(&state.Properties, coder->Properties.Items,
- (unsigned)coder->Properties.Capacity) != LZMA_RESULT_OK)
- return SZE_FAIL;
-
- state.Probs = (CProb *)allocMain->Alloc(LzmaGetNumProbs(&state.Properties) * sizeof(CProb));
- if (state.Probs == 0)
- return SZE_OUTOFMEMORY;
-
- #ifdef _LZMA_OUT_READ
- if (state.Properties.DictionarySize == 0)
- state.Dictionary = 0;
- else
- {
- state.Dictionary = (unsigned char *)allocMain->Alloc(state.Properties.DictionarySize);
- if (state.Dictionary == 0)
- {
- allocMain->Free(state.Probs);
- return SZE_OUTOFMEMORY;
- }
- }
- LzmaDecoderInit(&state);
- #endif
-
- result = LzmaDecode(&state,
- #ifdef _LZMA_IN_CB
- &lzmaCallback.InCallback,
- #else
- inBuffer, (SizeT)inSize, &inProcessed,
- #endif
- outBuffer, (SizeT)outSize, &outSizeProcessedLoc);
- allocMain->Free(state.Probs);
- #ifdef _LZMA_OUT_READ
- allocMain->Free(state.Dictionary);
- #endif
- if (result == LZMA_RESULT_DATA_ERROR)
- return SZE_DATA_ERROR;
- if (result != LZMA_RESULT_OK)
- return SZE_FAIL;
- return (outSizeProcessedLoc == outSize) ? SZ_OK : SZE_DATA_ERROR;
-}
-
-#ifdef _LZMA_IN_CB
-SZ_RESULT SzDecodeCopy(CFileSize inSize, ISzInStream *inStream, Byte *outBuffer)
-{
- while (inSize > 0)
- {
- void *inBuffer;
- size_t processedSize, curSize = (1 << 18);
- if (curSize > inSize)
- curSize = (size_t)(inSize);
- RINOK(inStream->Read((void *)inStream, (void **)&inBuffer, curSize, &processedSize));
- if (processedSize == 0)
- return SZE_DATA_ERROR;
- if (processedSize > curSize)
- return SZE_FAIL;
- memcpy(outBuffer, inBuffer, processedSize);
- outBuffer += processedSize;
- inSize -= processedSize;
- }
- return SZ_OK;
-}
-#endif
-
-#define IS_UNSUPPORTED_METHOD(m) ((m) != k_Copy && (m) != k_LZMA)
-#define IS_UNSUPPORTED_CODER(c) (IS_UNSUPPORTED_METHOD(c.MethodID) || c.NumInStreams != 1 || c.NumOutStreams != 1)
-#define IS_NO_BCJ(c) (c.MethodID != k_BCJ || c.NumInStreams != 1 || c.NumOutStreams != 1)
-#define IS_NO_BCJ2(c) (c.MethodID != k_BCJ2 || c.NumInStreams != 4 || c.NumOutStreams != 1)
-
-SZ_RESULT CheckSupportedFolder(const CFolder *f)
-{
- if (f->NumCoders < 1 || f->NumCoders > 4)
- return SZE_NOTIMPL;
- if (IS_UNSUPPORTED_CODER(f->Coders[0]))
- return SZE_NOTIMPL;
- if (f->NumCoders == 1)
- {
- if (f->NumPackStreams != 1 || f->PackStreams[0] != 0 || f->NumBindPairs != 0)
- return SZE_NOTIMPL;
- return SZ_OK;
- }
- if (f->NumCoders == 2)
- {
- if (IS_NO_BCJ(f->Coders[1]) ||
- f->NumPackStreams != 1 || f->PackStreams[0] != 0 ||
- f->NumBindPairs != 1 ||
- f->BindPairs[0].InIndex != 1 || f->BindPairs[0].OutIndex != 0)
- return SZE_NOTIMPL;
- return SZ_OK;
- }
- if (f->NumCoders == 4)
- {
- if (IS_UNSUPPORTED_CODER(f->Coders[1]) ||
- IS_UNSUPPORTED_CODER(f->Coders[2]) ||
- IS_NO_BCJ2(f->Coders[3]))
- return SZE_NOTIMPL;
- if (f->NumPackStreams != 4 ||
- f->PackStreams[0] != 2 ||
- f->PackStreams[1] != 6 ||
- f->PackStreams[2] != 1 ||
- f->PackStreams[3] != 0 ||
- f->NumBindPairs != 3 ||
- f->BindPairs[0].InIndex != 5 || f->BindPairs[0].OutIndex != 0 ||
- f->BindPairs[1].InIndex != 4 || f->BindPairs[1].OutIndex != 1 ||
- f->BindPairs[2].InIndex != 3 || f->BindPairs[2].OutIndex != 2)
- return SZE_NOTIMPL;
- return SZ_OK;
- }
- return SZE_NOTIMPL;
-}
-
-CFileSize GetSum(const CFileSize *values, UInt32 index)
-{
- CFileSize sum = 0;
- UInt32 i;
- for (i = 0; i < index; i++)
- sum += values[i];
- return sum;
-}
-
-SZ_RESULT SzDecode2(const CFileSize *packSizes, const CFolder *folder,
- #ifdef _LZMA_IN_CB
- ISzInStream *inStream, CFileSize startPos,
- #else
- const Byte *inBuffer,
- #endif
- Byte *outBuffer, size_t outSize, ISzAlloc *allocMain,
- Byte *tempBuf[])
-{
- UInt32 ci;
- size_t tempSizes[3] = { 0, 0, 0};
- size_t tempSize3 = 0;
- Byte *tempBuf3 = 0;
-
- RINOK(CheckSupportedFolder(folder));
-
- for (ci = 0; ci < folder->NumCoders; ci++)
- {
- CCoderInfo *coder = &folder->Coders[ci];
-
- if (coder->MethodID == k_Copy || coder->MethodID == k_LZMA)
- {
- UInt32 si = 0;
- CFileSize offset;
- CFileSize inSize;
- Byte *outBufCur = outBuffer;
- size_t outSizeCur = outSize;
- if (folder->NumCoders == 4)
- {
- UInt32 indices[] = { 3, 2, 0 };
- CFileSize unpackSize = folder->UnPackSizes[ci];
- si = indices[ci];
- if (ci < 2)
- {
- Byte *temp;
- outSizeCur = (size_t)unpackSize;
- if (outSizeCur != unpackSize)
- return SZE_OUTOFMEMORY;
- temp = (Byte *)allocMain->Alloc(outSizeCur);
- if (temp == 0 && outSizeCur != 0)
- return SZE_OUTOFMEMORY;
- outBufCur = tempBuf[1 - ci] = temp;
- tempSizes[1 - ci] = outSizeCur;
- }
- else if (ci == 2)
- {
- if (unpackSize > outSize)
- return SZE_OUTOFMEMORY;
- tempBuf3 = outBufCur = outBuffer + (outSize - (size_t)unpackSize);
- tempSize3 = outSizeCur = (size_t)unpackSize;
- }
- else
- return SZE_NOTIMPL;
- }
- offset = GetSum(packSizes, si);
- inSize = packSizes[si];
- #ifdef _LZMA_IN_CB
- RINOK(inStream->Seek(inStream, startPos + offset));
- #endif
-
- if (coder->MethodID == k_Copy)
- {
- if (inSize != outSizeCur)
- return SZE_DATA_ERROR;
-
- #ifdef _LZMA_IN_CB
- RINOK(SzDecodeCopy(inSize, inStream, outBufCur));
- #else
- memcpy(outBufCur, inBuffer + (size_t)offset, (size_t)inSize);
- #endif
- }
- else
- {
- SZ_RESULT res = SzDecodeLzma(coder, inSize,
- #ifdef _LZMA_IN_CB
- inStream,
- #else
- inBuffer + (size_t)offset,
- #endif
- outBufCur, outSizeCur, allocMain);
- RINOK(res)
- }
- }
- else if (coder->MethodID == k_BCJ)
- {
- UInt32 state;
- if (ci != 1)
- return SZE_NOTIMPL;
- x86_Convert_Init(state);
- x86_Convert(outBuffer, outSize, 0, &state, 0);
- }
- else if (coder->MethodID == k_BCJ2)
- {
- CFileSize offset = GetSum(packSizes, 1);
- CFileSize s3Size = packSizes[1];
- SZ_RESULT res;
- if (ci != 3)
- return SZE_NOTIMPL;
-
- #ifdef _LZMA_IN_CB
- RINOK(inStream->Seek(inStream, startPos + offset));
- tempSizes[2] = (size_t)s3Size;
- if (tempSizes[2] != s3Size)
- return SZE_OUTOFMEMORY;
- tempBuf[2] = (Byte *)allocMain->Alloc(tempSizes[2]);
- if (tempBuf[2] == 0 && tempSizes[2] != 0)
- return SZE_OUTOFMEMORY;
- res = SzDecodeCopy(s3Size, inStream, tempBuf[2]);
- RINOK(res)
- #endif
-
- res = x86_2_Decode(
- tempBuf3, tempSize3,
- tempBuf[0], tempSizes[0],
- tempBuf[1], tempSizes[1],
- #ifdef _LZMA_IN_CB
- tempBuf[2], tempSizes[2],
- #else
- inBuffer + (size_t)offset, (size_t)s3Size,
- #endif
- outBuffer, outSize);
- RINOK(res)
- }
- else
- return SZE_NOTIMPL;
- }
- return SZ_OK;
-}
-
-SZ_RESULT SzDecode(const CFileSize *packSizes, const CFolder *folder,
- #ifdef _LZMA_IN_CB
- ISzInStream *inStream, CFileSize startPos,
- #else
- const Byte *inBuffer,
- #endif
- Byte *outBuffer, size_t outSize, ISzAlloc *allocMain)
-{
- Byte *tempBuf[3] = { 0, 0, 0};
- int i;
- SZ_RESULT res = SzDecode2(packSizes, folder,
- #ifdef _LZMA_IN_CB
- inStream, startPos,
- #else
- inBuffer,
- #endif
- outBuffer, outSize, allocMain, tempBuf);
- for (i = 0; i < 3; i++)
- allocMain->Free(tempBuf[i]);
- return res;
-}
+++ /dev/null
-/* 7zDecode.h */
-
-#ifndef __7Z_DECODE_H
-#define __7Z_DECODE_H
-
-#include "7zItem.h"
-#include "7zAlloc.h"
-#ifdef _LZMA_IN_CB
-#include "7zIn.h"
-#endif
-
-SZ_RESULT SzDecode(const CFileSize *packSizes, const CFolder *folder,
- #ifdef _LZMA_IN_CB
- ISzInStream *stream, CFileSize startPos,
- #else
- const Byte *inBuffer,
- #endif
- Byte *outBuffer, size_t outSize, ISzAlloc *allocMain);
-
-#endif
+++ /dev/null
-/* 7zExtract.c */
-
-#include "7zExtract.h"
-#include "7zDecode.h"
-#include "../../7zCrc.h"
-
-SZ_RESULT SzExtract(
- ISzInStream *inStream,
- CArchiveDatabaseEx *db,
- UInt32 fileIndex,
- UInt32 *blockIndex,
- Byte **outBuffer,
- size_t *outBufferSize,
- size_t *offset,
- size_t *outSizeProcessed,
- ISzAlloc *allocMain,
- ISzAlloc *allocTemp)
-{
- UInt32 folderIndex = db->FileIndexToFolderIndexMap[fileIndex];
- SZ_RESULT res = SZ_OK;
- *offset = 0;
- *outSizeProcessed = 0;
- if (folderIndex == (UInt32)-1)
- {
- allocMain->Free(*outBuffer);
- *blockIndex = folderIndex;
- *outBuffer = 0;
- *outBufferSize = 0;
- return SZ_OK;
- }
-
- if (*outBuffer == 0 || *blockIndex != folderIndex)
- {
- CFolder *folder = db->Database.Folders + folderIndex;
- CFileSize unPackSizeSpec = SzFolderGetUnPackSize(folder);
- size_t unPackSize = (size_t)unPackSizeSpec;
- CFileSize startOffset = SzArDbGetFolderStreamPos(db, folderIndex, 0);
- #ifndef _LZMA_IN_CB
- Byte *inBuffer = 0;
- size_t processedSize;
- CFileSize packSizeSpec;
- size_t packSize;
- RINOK(SzArDbGetFolderFullPackSize(db, folderIndex, &packSizeSpec));
- packSize = (size_t)packSizeSpec;
- if (packSize != packSizeSpec)
- return SZE_OUTOFMEMORY;
- #endif
- if (unPackSize != unPackSizeSpec)
- return SZE_OUTOFMEMORY;
- *blockIndex = folderIndex;
- allocMain->Free(*outBuffer);
- *outBuffer = 0;
-
- RINOK(inStream->Seek(inStream, startOffset));
-
- #ifndef _LZMA_IN_CB
- if (packSize != 0)
- {
- inBuffer = (Byte *)allocTemp->Alloc(packSize);
- if (inBuffer == 0)
- return SZE_OUTOFMEMORY;
- }
- res = inStream->Read(inStream, inBuffer, packSize, &processedSize);
- if (res == SZ_OK && processedSize != packSize)
- res = SZE_FAIL;
- #endif
- if (res == SZ_OK)
- {
- *outBufferSize = unPackSize;
- if (unPackSize != 0)
- {
- *outBuffer = (Byte *)allocMain->Alloc(unPackSize);
- if (*outBuffer == 0)
- res = SZE_OUTOFMEMORY;
- }
- if (res == SZ_OK)
- {
- res = SzDecode(db->Database.PackSizes +
- db->FolderStartPackStreamIndex[folderIndex], folder,
- #ifdef _LZMA_IN_CB
- inStream, startOffset,
- #else
- inBuffer,
- #endif
- *outBuffer, unPackSize, allocTemp);
- if (res == SZ_OK)
- {
- if (folder->UnPackCRCDefined)
- {
- if (CrcCalc(*outBuffer, unPackSize) != folder->UnPackCRC)
- res = SZE_CRC_ERROR;
- }
- }
- }
- }
- #ifndef _LZMA_IN_CB
- allocTemp->Free(inBuffer);
- #endif
- }
- if (res == SZ_OK)
- {
- UInt32 i;
- CFileItem *fileItem = db->Database.Files + fileIndex;
- *offset = 0;
- for(i = db->FolderStartFileIndex[folderIndex]; i < fileIndex; i++)
- *offset += (UInt32)db->Database.Files[i].Size;
- *outSizeProcessed = (size_t)fileItem->Size;
- if (*offset + *outSizeProcessed > *outBufferSize)
- return SZE_FAIL;
- {
- if (fileItem->IsFileCRCDefined)
- {
- if (CrcCalc(*outBuffer + *offset, *outSizeProcessed) != fileItem->FileCRC)
- res = SZE_CRC_ERROR;
- }
- }
- }
- return res;
-}
+++ /dev/null
-/* 7zExtract.h */
-
-#ifndef __7Z_EXTRACT_H
-#define __7Z_EXTRACT_H
-
-#include "7zIn.h"
-
-/*
- SzExtract extracts file from archive
-
- *outBuffer must be 0 before first call for each new archive.
-
- Extracting cache:
- If you need to decompress more than one file, you can send
- these values from previous call:
- *blockIndex,
- *outBuffer,
- *outBufferSize
- You can consider "*outBuffer" as cache of solid block. If your archive is solid,
- it will increase decompression speed.
-
- If you use external function, you can declare these 3 cache variables
- (blockIndex, outBuffer, outBufferSize) as static in that external function.
-
- Free *outBuffer and set *outBuffer to 0, if you want to flush cache.
-*/
-
-SZ_RESULT SzExtract(
- ISzInStream *inStream,
- CArchiveDatabaseEx *db,
- UInt32 fileIndex, /* index of file */
- UInt32 *blockIndex, /* index of solid block */
- Byte **outBuffer, /* pointer to pointer to output buffer (allocated with allocMain) */
- size_t *outBufferSize, /* buffer size for output buffer */
- size_t *offset, /* offset of stream for required file in *outBuffer */
- size_t *outSizeProcessed, /* size of file in *outBuffer */
- ISzAlloc *allocMain,
- ISzAlloc *allocTemp);
-
-#endif
+++ /dev/null
-/* 7zHeader.c */
-
-#include "7zHeader.h"
-
-Byte k7zSignature[k7zSignatureSize] = {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C};
+++ /dev/null
-/* 7zHeader.h */
-
-#ifndef __7Z_HEADER_H
-#define __7Z_HEADER_H
-
-#include "../../Types.h"
-
-#define k7zSignatureSize 6
-extern Byte k7zSignature[k7zSignatureSize];
-
-#define k7zMajorVersion 0
-
-#define k7zStartHeaderSize 0x20
-
-enum EIdEnum
-{
- k7zIdEnd,
-
- k7zIdHeader,
-
- k7zIdArchiveProperties,
-
- k7zIdAdditionalStreamsInfo,
- k7zIdMainStreamsInfo,
- k7zIdFilesInfo,
-
- k7zIdPackInfo,
- k7zIdUnPackInfo,
- k7zIdSubStreamsInfo,
-
- k7zIdSize,
- k7zIdCRC,
-
- k7zIdFolder,
-
- k7zIdCodersUnPackSize,
- k7zIdNumUnPackStream,
-
- k7zIdEmptyStream,
- k7zIdEmptyFile,
- k7zIdAnti,
-
- k7zIdName,
- k7zIdCreationTime,
- k7zIdLastAccessTime,
- k7zIdLastWriteTime,
- k7zIdWinAttributes,
- k7zIdComment,
-
- k7zIdEncodedHeader,
-
- k7zIdStartPos
-};
-
-#endif
+++ /dev/null
-/* 7zIn.c */
-/* Modified by JohnE 2008-07-13: Add attributes reading */
-
-#include "7zIn.h"
-#include "7zDecode.h"
-#include "../../7zCrc.h"
-
-#define RINOM(x) { if((x) == 0) return SZE_OUTOFMEMORY; }
-
-void SzArDbExInit(CArchiveDatabaseEx *db)
-{
- SzArchiveDatabaseInit(&db->Database);
- db->FolderStartPackStreamIndex = 0;
- db->PackStreamStartPositions = 0;
- db->FolderStartFileIndex = 0;
- db->FileIndexToFolderIndexMap = 0;
-}
-
-void SzArDbExFree(CArchiveDatabaseEx *db, void (*freeFunc)(void *))
-{
- freeFunc(db->FolderStartPackStreamIndex);
- freeFunc(db->PackStreamStartPositions);
- freeFunc(db->FolderStartFileIndex);
- freeFunc(db->FileIndexToFolderIndexMap);
- SzArchiveDatabaseFree(&db->Database, freeFunc);
- SzArDbExInit(db);
-}
-
-/*
-CFileSize GetFolderPackStreamSize(int folderIndex, int streamIndex) const
-{
- return PackSizes[FolderStartPackStreamIndex[folderIndex] + streamIndex];
-}
-
-CFileSize GetFilePackSize(int fileIndex) const
-{
- int folderIndex = FileIndexToFolderIndexMap[fileIndex];
- if (folderIndex >= 0)
- {
- const CFolder &folderInfo = Folders[folderIndex];
- if (FolderStartFileIndex[folderIndex] == fileIndex)
- return GetFolderFullPackSize(folderIndex);
- }
- return 0;
-}
-*/
-
-#define MY_ALLOC(T, p, size, allocFunc) { if ((size) == 0) p = 0; else \
- if ((p = (T *)allocFunc((size) * sizeof(T))) == 0) return SZE_OUTOFMEMORY; }
-
-SZ_RESULT SzArDbExFill(CArchiveDatabaseEx *db, void * (*allocFunc)(size_t size))
-{
- UInt32 startPos = 0;
- CFileSize startPosSize = 0;
- UInt32 i;
- UInt32 folderIndex = 0;
- UInt32 indexInFolder = 0;
- MY_ALLOC(UInt32, db->FolderStartPackStreamIndex, db->Database.NumFolders, allocFunc);
- for(i = 0; i < db->Database.NumFolders; i++)
- {
- db->FolderStartPackStreamIndex[i] = startPos;
- startPos += db->Database.Folders[i].NumPackStreams;
- }
-
- MY_ALLOC(CFileSize, db->PackStreamStartPositions, db->Database.NumPackStreams, allocFunc);
-
- for(i = 0; i < db->Database.NumPackStreams; i++)
- {
- db->PackStreamStartPositions[i] = startPosSize;
- startPosSize += db->Database.PackSizes[i];
- }
-
- MY_ALLOC(UInt32, db->FolderStartFileIndex, db->Database.NumFolders, allocFunc);
- MY_ALLOC(UInt32, db->FileIndexToFolderIndexMap, db->Database.NumFiles, allocFunc);
-
- for (i = 0; i < db->Database.NumFiles; i++)
- {
- CFileItem *file = db->Database.Files + i;
- int emptyStream = !file->HasStream;
- if (emptyStream && indexInFolder == 0)
- {
- db->FileIndexToFolderIndexMap[i] = (UInt32)-1;
- continue;
- }
- if (indexInFolder == 0)
- {
- /*
- v3.13 incorrectly worked with empty folders
- v4.07: Loop for skipping empty folders
- */
- for (;;)
- {
- if (folderIndex >= db->Database.NumFolders)
- return SZE_ARCHIVE_ERROR;
- db->FolderStartFileIndex[folderIndex] = i;
- if (db->Database.Folders[folderIndex].NumUnPackStreams != 0)
- break;
- folderIndex++;
- }
- }
- db->FileIndexToFolderIndexMap[i] = folderIndex;
- if (emptyStream)
- continue;
- indexInFolder++;
- if (indexInFolder >= db->Database.Folders[folderIndex].NumUnPackStreams)
- {
- folderIndex++;
- indexInFolder = 0;
- }
- }
- return SZ_OK;
-}
-
-
-CFileSize SzArDbGetFolderStreamPos(CArchiveDatabaseEx *db, UInt32 folderIndex, UInt32 indexInFolder)
-{
- return db->ArchiveInfo.DataStartPosition +
- db->PackStreamStartPositions[db->FolderStartPackStreamIndex[folderIndex] + indexInFolder];
-}
-
-int SzArDbGetFolderFullPackSize(CArchiveDatabaseEx *db, UInt32 folderIndex, CFileSize *resSize)
-{
- UInt32 packStreamIndex = db->FolderStartPackStreamIndex[folderIndex];
- CFolder *folder = db->Database.Folders + folderIndex;
- CFileSize size = 0;
- UInt32 i;
- for (i = 0; i < folder->NumPackStreams; i++)
- {
- CFileSize t = size + db->Database.PackSizes[packStreamIndex + i];
- if (t < size)
- return SZE_FAIL;
- size = t;
- }
- *resSize = size;
- return SZ_OK;
-}
-
-
-/*
-SZ_RESULT SzReadTime(const CObjectVector<CSzByteBuffer> &dataVector,
- CObjectVector<CFileItem> &files, UInt64 type)
-{
- CBoolVector boolVector;
- RINOK(ReadBoolVector2(files.Size(), boolVector))
-
- CStreamSwitch streamSwitch;
- RINOK(streamSwitch.Set(this, &dataVector));
-
- for(int i = 0; i < files.Size(); i++)
- {
- CFileItem &file = files[i];
- CArchiveFileTime fileTime;
- bool defined = boolVector[i];
- if (defined)
- {
- UInt32 low, high;
- RINOK(SzReadUInt32(low));
- RINOK(SzReadUInt32(high));
- fileTime.dwLowDateTime = low;
- fileTime.dwHighDateTime = high;
- }
- switch(type)
- {
- case k7zIdCreationTime:
- file.IsCreationTimeDefined = defined;
- if (defined)
- file.CreationTime = fileTime;
- break;
- case k7zIdLastWriteTime:
- file.IsLastWriteTimeDefined = defined;
- if (defined)
- file.LastWriteTime = fileTime;
- break;
- case k7zIdLastAccessTime:
- file.IsLastAccessTimeDefined = defined;
- if (defined)
- file.LastAccessTime = fileTime;
- break;
- }
- }
- return SZ_OK;
-}
-*/
-
-SZ_RESULT SafeReadDirect(ISzInStream *inStream, Byte *data, size_t size)
-{
- #ifdef _LZMA_IN_CB
- while (size > 0)
- {
- void *inBufferSpec;
- size_t processedSize;
- const Byte *inBuffer;
- RINOK(inStream->Read(inStream, (void **)&inBufferSpec, size, &processedSize));
- inBuffer = (const Byte *)inBufferSpec;
- if (processedSize == 0 || processedSize > size)
- return SZE_FAIL;
- size -= processedSize;
- do
- {
- *data++ = *inBuffer++;
- }
- while (--processedSize != 0);
- }
- #else
- size_t processedSize;
- RINOK(inStream->Read(inStream, data, size, &processedSize));
- if (processedSize != size)
- return SZE_FAIL;
- #endif
- return SZ_OK;
-}
-
-SZ_RESULT SafeReadDirectByte(ISzInStream *inStream, Byte *data)
-{
- return SafeReadDirect(inStream, data, 1);
-}
-
-SZ_RESULT SafeReadDirectUInt32(ISzInStream *inStream, UInt32 *value, UInt32 *crc)
-{
- int i;
- *value = 0;
- for (i = 0; i < 4; i++)
- {
- Byte b;
- RINOK(SafeReadDirectByte(inStream, &b));
- *value |= ((UInt32)b << (8 * i));
- *crc = CRC_UPDATE_BYTE(*crc, b);
- }
- return SZ_OK;
-}
-
-SZ_RESULT SafeReadDirectUInt64(ISzInStream *inStream, UInt64 *value, UInt32 *crc)
-{
- int i;
- *value = 0;
- for (i = 0; i < 8; i++)
- {
- Byte b;
- RINOK(SafeReadDirectByte(inStream, &b));
- *value |= ((UInt64)b << (8 * i));
- *crc = CRC_UPDATE_BYTE(*crc, b);
- }
- return SZ_OK;
-}
-
-int TestSignatureCandidate(Byte *testBytes)
-{
- size_t i;
- for (i = 0; i < k7zSignatureSize; i++)
- if (testBytes[i] != k7zSignature[i])
- return 0;
- return 1;
-}
-
-typedef struct _CSzState
-{
- Byte *Data;
- size_t Size;
-}CSzData;
-
-SZ_RESULT SzReadByte(CSzData *sd, Byte *b)
-{
- if (sd->Size == 0)
- return SZE_ARCHIVE_ERROR;
- sd->Size--;
- *b = *sd->Data++;
- return SZ_OK;
-}
-
-SZ_RESULT SzReadBytes(CSzData *sd, Byte *data, size_t size)
-{
- size_t i;
- for (i = 0; i < size; i++)
- {
- RINOK(SzReadByte(sd, data + i));
- }
- return SZ_OK;
-}
-
-SZ_RESULT SzReadUInt32(CSzData *sd, UInt32 *value)
-{
- int i;
- *value = 0;
- for (i = 0; i < 4; i++)
- {
- Byte b;
- RINOK(SzReadByte(sd, &b));
- *value |= ((UInt32)(b) << (8 * i));
- }
- return SZ_OK;
-}
-
-SZ_RESULT SzReadNumber(CSzData *sd, UInt64 *value)
-{
- Byte firstByte;
- Byte mask = 0x80;
- int i;
- RINOK(SzReadByte(sd, &firstByte));
- *value = 0;
- for (i = 0; i < 8; i++)
- {
- Byte b;
- if ((firstByte & mask) == 0)
- {
- UInt64 highPart = firstByte & (mask - 1);
- *value += (highPart << (8 * i));
- return SZ_OK;
- }
- RINOK(SzReadByte(sd, &b));
- *value |= ((UInt64)b << (8 * i));
- mask >>= 1;
- }
- return SZ_OK;
-}
-
-SZ_RESULT SzReadSize(CSzData *sd, CFileSize *value)
-{
- UInt64 value64;
- RINOK(SzReadNumber(sd, &value64));
- *value = (CFileSize)value64;
- return SZ_OK;
-}
-
-SZ_RESULT SzReadNumber32(CSzData *sd, UInt32 *value)
-{
- UInt64 value64;
- RINOK(SzReadNumber(sd, &value64));
- if (value64 >= 0x80000000)
- return SZE_NOTIMPL;
- if (value64 >= ((UInt64)(1) << ((sizeof(size_t) - 1) * 8 + 2)))
- return SZE_NOTIMPL;
- *value = (UInt32)value64;
- return SZ_OK;
-}
-
-SZ_RESULT SzReadID(CSzData *sd, UInt64 *value)
-{
- return SzReadNumber(sd, value);
-}
-
-SZ_RESULT SzSkeepDataSize(CSzData *sd, UInt64 size)
-{
- if (size > sd->Size)
- return SZE_ARCHIVE_ERROR;
- sd->Size -= (size_t)size;
- sd->Data += (size_t)size;
- return SZ_OK;
-}
-
-SZ_RESULT SzSkeepData(CSzData *sd)
-{
- UInt64 size;
- RINOK(SzReadNumber(sd, &size));
- return SzSkeepDataSize(sd, size);
-}
-
-SZ_RESULT SzReadArchiveProperties(CSzData *sd)
-{
- for (;;)
- {
- UInt64 type;
- RINOK(SzReadID(sd, &type));
- if (type == k7zIdEnd)
- break;
- SzSkeepData(sd);
- }
- return SZ_OK;
-}
-
-SZ_RESULT SzWaitAttribute(CSzData *sd, UInt64 attribute)
-{
- for (;;)
- {
- UInt64 type;
- RINOK(SzReadID(sd, &type));
- if (type == attribute)
- return SZ_OK;
- if (type == k7zIdEnd)
- return SZE_ARCHIVE_ERROR;
- RINOK(SzSkeepData(sd));
- }
-}
-
-SZ_RESULT SzReadBoolVector(CSzData *sd, size_t numItems, Byte **v, void * (*allocFunc)(size_t size))
-{
- Byte b = 0;
- Byte mask = 0;
- size_t i;
- MY_ALLOC(Byte, *v, numItems, allocFunc);
- for (i = 0; i < numItems; i++)
- {
- if (mask == 0)
- {
- RINOK(SzReadByte(sd, &b));
- mask = 0x80;
- }
- (*v)[i] = (Byte)(((b & mask) != 0) ? 1 : 0);
- mask >>= 1;
- }
- return SZ_OK;
-}
-
-SZ_RESULT SzReadBoolVector2(CSzData *sd, size_t numItems, Byte **v, void * (*allocFunc)(size_t size))
-{
- Byte allAreDefined;
- size_t i;
- RINOK(SzReadByte(sd, &allAreDefined));
- if (allAreDefined == 0)
- return SzReadBoolVector(sd, numItems, v, allocFunc);
- MY_ALLOC(Byte, *v, numItems, allocFunc);
- for(i = 0; i < numItems; i++)
- (*v)[i] = 1;
- return SZ_OK;
-}
-
-SZ_RESULT SzReadHashDigests(
- CSzData *sd,
- size_t numItems,
- Byte **digestsDefined,
- UInt32 **digests,
- void * (*allocFunc)(size_t size))
-{
- size_t i;
- RINOK(SzReadBoolVector2(sd, numItems, digestsDefined, allocFunc));
- MY_ALLOC(UInt32, *digests, numItems, allocFunc);
- for(i = 0; i < numItems; i++)
- if ((*digestsDefined)[i])
- {
- RINOK(SzReadUInt32(sd, (*digests) + i));
- }
- return SZ_OK;
-}
-
-SZ_RESULT SzReadPackInfo(
- CSzData *sd,
- CFileSize *dataOffset,
- UInt32 *numPackStreams,
- CFileSize **packSizes,
- Byte **packCRCsDefined,
- UInt32 **packCRCs,
- void * (*allocFunc)(size_t size))
-{
- UInt32 i;
- RINOK(SzReadSize(sd, dataOffset));
- RINOK(SzReadNumber32(sd, numPackStreams));
-
- RINOK(SzWaitAttribute(sd, k7zIdSize));
-
- MY_ALLOC(CFileSize, *packSizes, (size_t)*numPackStreams, allocFunc);
-
- for(i = 0; i < *numPackStreams; i++)
- {
- RINOK(SzReadSize(sd, (*packSizes) + i));
- }
-
- for (;;)
- {
- UInt64 type;
- RINOK(SzReadID(sd, &type));
- if (type == k7zIdEnd)
- break;
- if (type == k7zIdCRC)
- {
- RINOK(SzReadHashDigests(sd, (size_t)*numPackStreams, packCRCsDefined, packCRCs, allocFunc));
- continue;
- }
- RINOK(SzSkeepData(sd));
- }
- if (*packCRCsDefined == 0)
- {
- MY_ALLOC(Byte, *packCRCsDefined, (size_t)*numPackStreams, allocFunc);
- MY_ALLOC(UInt32, *packCRCs, (size_t)*numPackStreams, allocFunc);
- for(i = 0; i < *numPackStreams; i++)
- {
- (*packCRCsDefined)[i] = 0;
- (*packCRCs)[i] = 0;
- }
- }
- return SZ_OK;
-}
-
-SZ_RESULT SzReadSwitch(CSzData *sd)
-{
- Byte external;
- RINOK(SzReadByte(sd, &external));
- return (external == 0) ? SZ_OK: SZE_ARCHIVE_ERROR;
-}
-
-SZ_RESULT SzGetNextFolderItem(CSzData *sd, CFolder *folder, void * (*allocFunc)(size_t size))
-{
- UInt32 numCoders;
- UInt32 numBindPairs;
- UInt32 numPackedStreams;
- UInt32 i;
- UInt32 numInStreams = 0;
- UInt32 numOutStreams = 0;
- RINOK(SzReadNumber32(sd, &numCoders));
- folder->NumCoders = numCoders;
-
- MY_ALLOC(CCoderInfo, folder->Coders, (size_t)numCoders, allocFunc);
-
- for (i = 0; i < numCoders; i++)
- SzCoderInfoInit(folder->Coders + i);
-
- for (i = 0; i < numCoders; i++)
- {
- Byte mainByte;
- CCoderInfo *coder = folder->Coders + i;
- {
- unsigned idSize, j;
- Byte longID[15];
- RINOK(SzReadByte(sd, &mainByte));
- idSize = (unsigned)(mainByte & 0xF);
- RINOK(SzReadBytes(sd, longID, idSize));
- if (idSize > sizeof(coder->MethodID))
- return SZE_NOTIMPL;
- coder->MethodID = 0;
- for (j = 0; j < idSize; j++)
- coder->MethodID |= (CMethodID)longID[idSize - 1 - j] << (8 * j);
-
- if ((mainByte & 0x10) != 0)
- {
- RINOK(SzReadNumber32(sd, &coder->NumInStreams));
- RINOK(SzReadNumber32(sd, &coder->NumOutStreams));
- }
- else
- {
- coder->NumInStreams = 1;
- coder->NumOutStreams = 1;
- }
- if ((mainByte & 0x20) != 0)
- {
- UInt64 propertiesSize = 0;
- RINOK(SzReadNumber(sd, &propertiesSize));
- if (!SzByteBufferCreate(&coder->Properties, (size_t)propertiesSize, allocFunc))
- return SZE_OUTOFMEMORY;
- RINOK(SzReadBytes(sd, coder->Properties.Items, (size_t)propertiesSize));
- }
- }
- while ((mainByte & 0x80) != 0)
- {
- RINOK(SzReadByte(sd, &mainByte));
- RINOK(SzSkeepDataSize(sd, (mainByte & 0xF)));
- if ((mainByte & 0x10) != 0)
- {
- UInt32 n;
- RINOK(SzReadNumber32(sd, &n));
- RINOK(SzReadNumber32(sd, &n));
- }
- if ((mainByte & 0x20) != 0)
- {
- UInt64 propertiesSize = 0;
- RINOK(SzReadNumber(sd, &propertiesSize));
- RINOK(SzSkeepDataSize(sd, propertiesSize));
- }
- }
- numInStreams += (UInt32)coder->NumInStreams;
- numOutStreams += (UInt32)coder->NumOutStreams;
- }
-
- numBindPairs = numOutStreams - 1;
- folder->NumBindPairs = numBindPairs;
-
-
- MY_ALLOC(CBindPair, folder->BindPairs, (size_t)numBindPairs, allocFunc);
-
- for (i = 0; i < numBindPairs; i++)
- {
- CBindPair *bindPair = folder->BindPairs + i;;
- RINOK(SzReadNumber32(sd, &bindPair->InIndex));
- RINOK(SzReadNumber32(sd, &bindPair->OutIndex));
- }
-
- numPackedStreams = numInStreams - (UInt32)numBindPairs;
-
- folder->NumPackStreams = numPackedStreams;
- MY_ALLOC(UInt32, folder->PackStreams, (size_t)numPackedStreams, allocFunc);
-
- if (numPackedStreams == 1)
- {
- UInt32 j;
- UInt32 pi = 0;
- for (j = 0; j < numInStreams; j++)
- if (SzFolderFindBindPairForInStream(folder, j) < 0)
- {
- folder->PackStreams[pi++] = j;
- break;
- }
- }
- else
- for(i = 0; i < numPackedStreams; i++)
- {
- RINOK(SzReadNumber32(sd, folder->PackStreams + i));
- }
- return SZ_OK;
-}
-
-SZ_RESULT SzReadUnPackInfo(
- CSzData *sd,
- UInt32 *numFolders,
- CFolder **folders, /* for allocFunc */
- void * (*allocFunc)(size_t size),
- ISzAlloc *allocTemp)
-{
- UInt32 i;
- RINOK(SzWaitAttribute(sd, k7zIdFolder));
- RINOK(SzReadNumber32(sd, numFolders));
- {
- RINOK(SzReadSwitch(sd));
-
- MY_ALLOC(CFolder, *folders, (size_t)*numFolders, allocFunc);
-
- for(i = 0; i < *numFolders; i++)
- SzFolderInit((*folders) + i);
-
- for(i = 0; i < *numFolders; i++)
- {
- RINOK(SzGetNextFolderItem(sd, (*folders) + i, allocFunc));
- }
- }
-
- RINOK(SzWaitAttribute(sd, k7zIdCodersUnPackSize));
-
- for(i = 0; i < *numFolders; i++)
- {
- UInt32 j;
- CFolder *folder = (*folders) + i;
- UInt32 numOutStreams = SzFolderGetNumOutStreams(folder);
-
- MY_ALLOC(CFileSize, folder->UnPackSizes, (size_t)numOutStreams, allocFunc);
-
- for(j = 0; j < numOutStreams; j++)
- {
- RINOK(SzReadSize(sd, folder->UnPackSizes + j));
- }
- }
-
- for (;;)
- {
- UInt64 type;
- RINOK(SzReadID(sd, &type));
- if (type == k7zIdEnd)
- return SZ_OK;
- if (type == k7zIdCRC)
- {
- SZ_RESULT res;
- Byte *crcsDefined = 0;
- UInt32 *crcs = 0;
- res = SzReadHashDigests(sd, *numFolders, &crcsDefined, &crcs, allocTemp->Alloc);
- if (res == SZ_OK)
- {
- for(i = 0; i < *numFolders; i++)
- {
- CFolder *folder = (*folders) + i;
- folder->UnPackCRCDefined = crcsDefined[i];
- folder->UnPackCRC = crcs[i];
- }
- }
- allocTemp->Free(crcs);
- allocTemp->Free(crcsDefined);
- RINOK(res);
- continue;
- }
- RINOK(SzSkeepData(sd));
- }
-}
-
-SZ_RESULT SzReadSubStreamsInfo(
- CSzData *sd,
- UInt32 numFolders,
- CFolder *folders,
- UInt32 *numUnPackStreams,
- CFileSize **unPackSizes,
- Byte **digestsDefined,
- UInt32 **digests,
- ISzAlloc *allocTemp)
-{
- UInt64 type = 0;
- UInt32 i;
- UInt32 si = 0;
- UInt32 numDigests = 0;
-
- for(i = 0; i < numFolders; i++)
- folders[i].NumUnPackStreams = 1;
- *numUnPackStreams = numFolders;
-
- for (;;)
- {
- RINOK(SzReadID(sd, &type));
- if (type == k7zIdNumUnPackStream)
- {
- *numUnPackStreams = 0;
- for(i = 0; i < numFolders; i++)
- {
- UInt32 numStreams;
- RINOK(SzReadNumber32(sd, &numStreams));
- folders[i].NumUnPackStreams = numStreams;
- *numUnPackStreams += numStreams;
- }
- continue;
- }
- if (type == k7zIdCRC || type == k7zIdSize)
- break;
- if (type == k7zIdEnd)
- break;
- RINOK(SzSkeepData(sd));
- }
-
- if (*numUnPackStreams == 0)
- {
- *unPackSizes = 0;
- *digestsDefined = 0;
- *digests = 0;
- }
- else
- {
- *unPackSizes = (CFileSize *)allocTemp->Alloc((size_t)*numUnPackStreams * sizeof(CFileSize));
- RINOM(*unPackSizes);
- *digestsDefined = (Byte *)allocTemp->Alloc((size_t)*numUnPackStreams * sizeof(Byte));
- RINOM(*digestsDefined);
- *digests = (UInt32 *)allocTemp->Alloc((size_t)*numUnPackStreams * sizeof(UInt32));
- RINOM(*digests);
- }
-
- for(i = 0; i < numFolders; i++)
- {
- /*
- v3.13 incorrectly worked with empty folders
- v4.07: we check that folder is empty
- */
- CFileSize sum = 0;
- UInt32 j;
- UInt32 numSubstreams = folders[i].NumUnPackStreams;
- if (numSubstreams == 0)
- continue;
- if (type == k7zIdSize)
- for (j = 1; j < numSubstreams; j++)
- {
- CFileSize size;
- RINOK(SzReadSize(sd, &size));
- (*unPackSizes)[si++] = size;
- sum += size;
- }
- (*unPackSizes)[si++] = SzFolderGetUnPackSize(folders + i) - sum;
- }
- if (type == k7zIdSize)
- {
- RINOK(SzReadID(sd, &type));
- }
-
- for(i = 0; i < *numUnPackStreams; i++)
- {
- (*digestsDefined)[i] = 0;
- (*digests)[i] = 0;
- }
-
-
- for(i = 0; i < numFolders; i++)
- {
- UInt32 numSubstreams = folders[i].NumUnPackStreams;
- if (numSubstreams != 1 || !folders[i].UnPackCRCDefined)
- numDigests += numSubstreams;
- }
-
-
- si = 0;
- for (;;)
- {
- if (type == k7zIdCRC)
- {
- int digestIndex = 0;
- Byte *digestsDefined2 = 0;
- UInt32 *digests2 = 0;
- SZ_RESULT res = SzReadHashDigests(sd, numDigests, &digestsDefined2, &digests2, allocTemp->Alloc);
- if (res == SZ_OK)
- {
- for (i = 0; i < numFolders; i++)
- {
- CFolder *folder = folders + i;
- UInt32 numSubstreams = folder->NumUnPackStreams;
- if (numSubstreams == 1 && folder->UnPackCRCDefined)
- {
- (*digestsDefined)[si] = 1;
- (*digests)[si] = folder->UnPackCRC;
- si++;
- }
- else
- {
- UInt32 j;
- for (j = 0; j < numSubstreams; j++, digestIndex++)
- {
- (*digestsDefined)[si] = digestsDefined2[digestIndex];
- (*digests)[si] = digests2[digestIndex];
- si++;
- }
- }
- }
- }
- allocTemp->Free(digestsDefined2);
- allocTemp->Free(digests2);
- RINOK(res);
- }
- else if (type == k7zIdEnd)
- return SZ_OK;
- else
- {
- RINOK(SzSkeepData(sd));
- }
- RINOK(SzReadID(sd, &type));
- }
-}
-
-
-SZ_RESULT SzReadStreamsInfo(
- CSzData *sd,
- CFileSize *dataOffset,
- CArchiveDatabase *db,
- UInt32 *numUnPackStreams,
- CFileSize **unPackSizes, /* allocTemp */
- Byte **digestsDefined, /* allocTemp */
- UInt32 **digests, /* allocTemp */
- void * (*allocFunc)(size_t size),
- ISzAlloc *allocTemp)
-{
- for (;;)
- {
- UInt64 type;
- RINOK(SzReadID(sd, &type));
- if ((UInt64)(int)type != type)
- return SZE_FAIL;
- switch((int)type)
- {
- case k7zIdEnd:
- return SZ_OK;
- case k7zIdPackInfo:
- {
- RINOK(SzReadPackInfo(sd, dataOffset, &db->NumPackStreams,
- &db->PackSizes, &db->PackCRCsDefined, &db->PackCRCs, allocFunc));
- break;
- }
- case k7zIdUnPackInfo:
- {
- RINOK(SzReadUnPackInfo(sd, &db->NumFolders, &db->Folders, allocFunc, allocTemp));
- break;
- }
- case k7zIdSubStreamsInfo:
- {
- RINOK(SzReadSubStreamsInfo(sd, db->NumFolders, db->Folders,
- numUnPackStreams, unPackSizes, digestsDefined, digests, allocTemp));
- break;
- }
- default:
- return SZE_FAIL;
- }
- }
-}
-
-Byte kUtf8Limits[5] = { 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
-
-SZ_RESULT SzReadFileNames(CSzData *sd, UInt32 numFiles, CFileItem *files,
- void * (*allocFunc)(size_t size))
-{
- UInt32 i;
- for(i = 0; i < numFiles; i++)
- {
- UInt32 len = 0;
- UInt32 pos = 0;
- CFileItem *file = files + i;
- while(pos + 2 <= sd->Size)
- {
- int numAdds;
- UInt32 value = (UInt32)(sd->Data[pos] | (((UInt32)sd->Data[pos + 1]) << 8));
- pos += 2;
- len++;
- if (value == 0)
- break;
- if (value < 0x80)
- continue;
- if (value >= 0xD800 && value < 0xE000)
- {
- UInt32 c2;
- if (value >= 0xDC00)
- return SZE_ARCHIVE_ERROR;
- if (pos + 2 > sd->Size)
- return SZE_ARCHIVE_ERROR;
- c2 = (UInt32)(sd->Data[pos] | (((UInt32)sd->Data[pos + 1]) << 8));
- pos += 2;
- if (c2 < 0xDC00 || c2 >= 0xE000)
- return SZE_ARCHIVE_ERROR;
- value = ((value - 0xD800) << 10) | (c2 - 0xDC00);
- }
- for (numAdds = 1; numAdds < 5; numAdds++)
- if (value < (((UInt32)1) << (numAdds * 5 + 6)))
- break;
- len += numAdds;
- }
-
- MY_ALLOC(char, file->Name, (size_t)len, allocFunc);
-
- len = 0;
- while(2 <= sd->Size)
- {
- int numAdds;
- UInt32 value = (UInt32)(sd->Data[0] | (((UInt32)sd->Data[1]) << 8));
- SzSkeepDataSize(sd, 2);
- if (value < 0x80)
- {
- file->Name[len++] = (char)value;
- if (value == 0)
- break;
- continue;
- }
- if (value >= 0xD800 && value < 0xE000)
- {
- UInt32 c2 = (UInt32)(sd->Data[0] | (((UInt32)sd->Data[1]) << 8));
- SzSkeepDataSize(sd, 2);
- value = ((value - 0xD800) << 10) | (c2 - 0xDC00);
- }
- for (numAdds = 1; numAdds < 5; numAdds++)
- if (value < (((UInt32)1) << (numAdds * 5 + 6)))
- break;
- file->Name[len++] = (char)(kUtf8Limits[numAdds - 1] + (value >> (6 * numAdds)));
- do
- {
- numAdds--;
- file->Name[len++] = (char)(0x80 + ((value >> (6 * numAdds)) & 0x3F));
- }
- while(numAdds > 0);
-
- len += numAdds;
- }
- }
- return SZ_OK;
-}
-
-SZ_RESULT SzReadHeader2(
- CSzData *sd,
- CArchiveDatabaseEx *db, /* allocMain */
- CFileSize **unPackSizes, /* allocTemp */
- Byte **digestsDefined, /* allocTemp */
- UInt32 **digests, /* allocTemp */
- Byte **emptyStreamVector, /* allocTemp */
- Byte **emptyFileVector, /* allocTemp */
- Byte **lwtVector, /* allocTemp */
- ISzAlloc *allocMain,
- ISzAlloc *allocTemp)
-{
- UInt64 type;
- UInt32 numUnPackStreams = 0;
- UInt32 numFiles = 0;
- CFileItem *files = 0;
- UInt32 numEmptyStreams = 0;
- UInt32 i;
-
- Byte *attributesDefined = NULL;
- UInt32 *attributes = NULL;
-
- RINOK(SzReadID(sd, &type));
-
- if (type == k7zIdArchiveProperties)
- {
- RINOK(SzReadArchiveProperties(sd));
- RINOK(SzReadID(sd, &type));
- }
-
-
- if (type == k7zIdMainStreamsInfo)
- {
- RINOK(SzReadStreamsInfo(sd,
- &db->ArchiveInfo.DataStartPosition,
- &db->Database,
- &numUnPackStreams,
- unPackSizes,
- digestsDefined,
- digests, allocMain->Alloc, allocTemp));
- db->ArchiveInfo.DataStartPosition += db->ArchiveInfo.StartPositionAfterHeader;
- RINOK(SzReadID(sd, &type));
- }
-
- if (type == k7zIdEnd)
- return SZ_OK;
- if (type != k7zIdFilesInfo)
- return SZE_ARCHIVE_ERROR;
-
- RINOK(SzReadNumber32(sd, &numFiles));
- db->Database.NumFiles = numFiles;
-
- MY_ALLOC(CFileItem, files, (size_t)numFiles, allocMain->Alloc);
-
- db->Database.Files = files;
- for(i = 0; i < numFiles; i++)
- SzFileInit(files + i);
-
- for (;;)
- {
- UInt64 type;
- UInt64 size;
- RINOK(SzReadID(sd, &type));
- if (type == k7zIdEnd)
- break;
- RINOK(SzReadNumber(sd, &size));
-
- if ((UInt64)(int)type != type)
- {
- RINOK(SzSkeepDataSize(sd, size));
- }
- else
- switch((int)type)
- {
- case k7zIdName:
- {
- RINOK(SzReadSwitch(sd));
- RINOK(SzReadFileNames(sd, numFiles, files, allocMain->Alloc))
- break;
- }
- case k7zIdEmptyStream:
- {
- RINOK(SzReadBoolVector(sd, numFiles, emptyStreamVector, allocTemp->Alloc));
- numEmptyStreams = 0;
- for (i = 0; i < numFiles; i++)
- if ((*emptyStreamVector)[i])
- numEmptyStreams++;
- break;
- }
- case k7zIdEmptyFile:
- {
- RINOK(SzReadBoolVector(sd, numEmptyStreams, emptyFileVector, allocTemp->Alloc));
- break;
- }
- case k7zIdLastWriteTime:
- {
- RINOK(SzReadBoolVector2(sd, numFiles, lwtVector, allocTemp->Alloc));
- RINOK(SzReadSwitch(sd));
- for (i = 0; i < numFiles; i++)
- {
- CFileItem *f = &files[i];
- Byte defined = (*lwtVector)[i];
- f->IsLastWriteTimeDefined = defined;
- f->LastWriteTime.Low = f->LastWriteTime.High = 0;
- if (defined)
- {
- RINOK(SzReadUInt32(sd, &f->LastWriteTime.Low));
- RINOK(SzReadUInt32(sd, &f->LastWriteTime.High));
- }
- }
- break;
- }
- case k7zIdWinAttributes:
- {
- Byte external;
- RINOK(SzReadBoolVector2(sd, (UInt32) numFiles, &attributesDefined, allocMain->Alloc))
-
- RINOK(SzReadByte(sd, &external));
-
- if (external != 0) {
- UInt64 attributes;
- RINOK(SzReadNumber(sd, &attributes));
- }
-
- attributes = (UInt32 *)allocMain->Alloc(numFiles * sizeof(UInt32));
- for (i = 0; i < numFiles; i++) {
- if (attributesDefined[i]) {
- RINOK(SzReadUInt32(sd, &(attributes[i])));
- }
- }
- break;
- }
- default:
- {
- RINOK(SzSkeepDataSize(sd, size));
- }
- }
- }
-
- {
- UInt32 emptyFileIndex = 0;
- UInt32 sizeIndex = 0;
- for(i = 0; i < numFiles; i++)
- {
- CFileItem *file = files + i;
- file->IsAnti = 0;
- if (*emptyStreamVector == 0)
- file->HasStream = 1;
- else
- file->HasStream = (Byte)((*emptyStreamVector)[i] ? 0 : 1);
- if(file->HasStream)
- {
- file->IsDirectory = 0;
- file->Size = (*unPackSizes)[sizeIndex];
- file->FileCRC = (*digests)[sizeIndex];
- file->IsFileCRCDefined = (Byte)(*digestsDefined)[sizeIndex];
- sizeIndex++;
- }
- else
- {
- if (*emptyFileVector == 0)
- file->IsDirectory = 1;
- else
- file->IsDirectory = (Byte)((*emptyFileVector)[emptyFileIndex] ? 0 : 1);
- emptyFileIndex++;
- file->Size = 0;
- file->IsFileCRCDefined = 0;
- }
- if (attributesDefined[i]) {
- file->AreAttributesDefined = 1;
- file->Attributes = attributes[i];
- }
- else
- file->AreAttributesDefined = 0;
- }
- }
- return SzArDbExFill(db, allocMain->Alloc);
-}
-
-SZ_RESULT SzReadHeader(
- CSzData *sd,
- CArchiveDatabaseEx *db,
- ISzAlloc *allocMain,
- ISzAlloc *allocTemp)
-{
- CFileSize *unPackSizes = 0;
- Byte *digestsDefined = 0;
- UInt32 *digests = 0;
- Byte *emptyStreamVector = 0;
- Byte *emptyFileVector = 0;
- Byte *lwtVector = 0;
- SZ_RESULT res = SzReadHeader2(sd, db,
- &unPackSizes, &digestsDefined, &digests,
- &emptyStreamVector, &emptyFileVector, &lwtVector,
- allocMain, allocTemp);
- allocTemp->Free(unPackSizes);
- allocTemp->Free(digestsDefined);
- allocTemp->Free(digests);
- allocTemp->Free(emptyStreamVector);
- allocTemp->Free(emptyFileVector);
- allocTemp->Free(lwtVector);
- return res;
-}
-
-SZ_RESULT SzReadAndDecodePackedStreams2(
- ISzInStream *inStream,
- CSzData *sd,
- CSzByteBuffer *outBuffer,
- CFileSize baseOffset,
- CArchiveDatabase *db,
- CFileSize **unPackSizes,
- Byte **digestsDefined,
- UInt32 **digests,
- #ifndef _LZMA_IN_CB
- Byte **inBuffer,
- #endif
- ISzAlloc *allocTemp)
-{
-
- UInt32 numUnPackStreams = 0;
- CFileSize dataStartPos;
- CFolder *folder;
- #ifndef _LZMA_IN_CB
- CFileSize packSize = 0;
- UInt32 i = 0;
- #endif
- CFileSize unPackSize;
- SZ_RESULT res;
-
- RINOK(SzReadStreamsInfo(sd, &dataStartPos, db,
- &numUnPackStreams, unPackSizes, digestsDefined, digests,
- allocTemp->Alloc, allocTemp));
-
- dataStartPos += baseOffset;
- if (db->NumFolders != 1)
- return SZE_ARCHIVE_ERROR;
-
- folder = db->Folders;
- unPackSize = SzFolderGetUnPackSize(folder);
-
- RINOK(inStream->Seek(inStream, dataStartPos));
-
- #ifndef _LZMA_IN_CB
- for (i = 0; i < db->NumPackStreams; i++)
- packSize += db->PackSizes[i];
-
- MY_ALLOC(Byte, *inBuffer, (size_t)packSize, allocTemp->Alloc);
-
- RINOK(SafeReadDirect(inStream, *inBuffer, (size_t)packSize));
- #endif
-
- if (!SzByteBufferCreate(outBuffer, (size_t)unPackSize, allocTemp->Alloc))
- return SZE_OUTOFMEMORY;
-
- res = SzDecode(db->PackSizes, folder,
- #ifdef _LZMA_IN_CB
- inStream, dataStartPos,
- #else
- *inBuffer,
- #endif
- outBuffer->Items, (size_t)unPackSize, allocTemp);
- RINOK(res)
- if (folder->UnPackCRCDefined)
- if (CrcCalc(outBuffer->Items, (size_t)unPackSize) != folder->UnPackCRC)
- return SZE_FAIL;
- return SZ_OK;
-}
-
-SZ_RESULT SzReadAndDecodePackedStreams(
- ISzInStream *inStream,
- CSzData *sd,
- CSzByteBuffer *outBuffer,
- CFileSize baseOffset,
- ISzAlloc *allocTemp)
-{
- CArchiveDatabase db;
- CFileSize *unPackSizes = 0;
- Byte *digestsDefined = 0;
- UInt32 *digests = 0;
- #ifndef _LZMA_IN_CB
- Byte *inBuffer = 0;
- #endif
- SZ_RESULT res;
- SzArchiveDatabaseInit(&db);
- res = SzReadAndDecodePackedStreams2(inStream, sd, outBuffer, baseOffset,
- &db, &unPackSizes, &digestsDefined, &digests,
- #ifndef _LZMA_IN_CB
- &inBuffer,
- #endif
- allocTemp);
- SzArchiveDatabaseFree(&db, allocTemp->Free);
- allocTemp->Free(unPackSizes);
- allocTemp->Free(digestsDefined);
- allocTemp->Free(digests);
- #ifndef _LZMA_IN_CB
- allocTemp->Free(inBuffer);
- #endif
- return res;
-}
-
-SZ_RESULT SzArchiveOpen2(
- ISzInStream *inStream,
- CArchiveDatabaseEx *db,
- ISzAlloc *allocMain,
- ISzAlloc *allocTemp)
-{
- Byte signature[k7zSignatureSize];
- Byte version;
- UInt32 crcFromArchive;
- UInt64 nextHeaderOffset;
- UInt64 nextHeaderSize;
- UInt32 nextHeaderCRC;
- UInt32 crc = 0;
- CFileSize pos = 0;
- CSzByteBuffer buffer;
- CSzData sd;
- SZ_RESULT res;
-
- RINOK(SafeReadDirect(inStream, signature, k7zSignatureSize));
-
- if (!TestSignatureCandidate(signature))
- return SZE_ARCHIVE_ERROR;
-
- /*
- db.Clear();
- db.ArchiveInfo.StartPosition = _arhiveBeginStreamPosition;
- */
- RINOK(SafeReadDirectByte(inStream, &version));
- if (version != k7zMajorVersion)
- return SZE_ARCHIVE_ERROR;
- RINOK(SafeReadDirectByte(inStream, &version));
-
- RINOK(SafeReadDirectUInt32(inStream, &crcFromArchive, &crc));
-
- crc = CRC_INIT_VAL;
- RINOK(SafeReadDirectUInt64(inStream, &nextHeaderOffset, &crc));
- RINOK(SafeReadDirectUInt64(inStream, &nextHeaderSize, &crc));
- RINOK(SafeReadDirectUInt32(inStream, &nextHeaderCRC, &crc));
-
- pos = k7zStartHeaderSize;
- db->ArchiveInfo.StartPositionAfterHeader = pos;
-
- if (CRC_GET_DIGEST(crc) != crcFromArchive)
- return SZE_ARCHIVE_ERROR;
-
- if (nextHeaderSize == 0)
- return SZ_OK;
-
- RINOK(inStream->Seek(inStream, (CFileSize)(pos + nextHeaderOffset)));
-
- if (!SzByteBufferCreate(&buffer, (size_t)nextHeaderSize, allocTemp->Alloc))
- return SZE_OUTOFMEMORY;
-
- res = SafeReadDirect(inStream, buffer.Items, (size_t)nextHeaderSize);
- if (res == SZ_OK)
- {
- res = SZE_ARCHIVE_ERROR;
- if (CrcCalc(buffer.Items, (UInt32)nextHeaderSize) == nextHeaderCRC)
- {
- for (;;)
- {
- UInt64 type;
- sd.Data = buffer.Items;
- sd.Size = buffer.Capacity;
- res = SzReadID(&sd, &type);
- if (res != SZ_OK)
- break;
- if (type == k7zIdHeader)
- {
- res = SzReadHeader(&sd, db, allocMain, allocTemp);
- break;
- }
- if (type != k7zIdEncodedHeader)
- {
- res = SZE_ARCHIVE_ERROR;
- break;
- }
- {
- CSzByteBuffer outBuffer;
- res = SzReadAndDecodePackedStreams(inStream, &sd, &outBuffer,
- db->ArchiveInfo.StartPositionAfterHeader,
- allocTemp);
- if (res != SZ_OK)
- {
- SzByteBufferFree(&outBuffer, allocTemp->Free);
- break;
- }
- SzByteBufferFree(&buffer, allocTemp->Free);
- buffer.Items = outBuffer.Items;
- buffer.Capacity = outBuffer.Capacity;
- }
- }
- }
- }
- SzByteBufferFree(&buffer, allocTemp->Free);
- return res;
-}
-
-SZ_RESULT SzArchiveOpen(
- ISzInStream *inStream,
- CArchiveDatabaseEx *db,
- ISzAlloc *allocMain,
- ISzAlloc *allocTemp)
-{
- SZ_RESULT res = SzArchiveOpen2(inStream, db, allocMain, allocTemp);
- if (res != SZ_OK)
- SzArDbExFree(db, allocMain->Free);
- return res;
-}
+++ /dev/null
-/* 7zIn.h */
-
-#ifndef __7Z_IN_H
-#define __7Z_IN_H
-
-#include "7zHeader.h"
-#include "7zItem.h"
-#include "7zAlloc.h"
-
-typedef struct _CInArchiveInfo
-{
- CFileSize StartPositionAfterHeader;
- CFileSize DataStartPosition;
-}CInArchiveInfo;
-
-typedef struct _CArchiveDatabaseEx
-{
- CArchiveDatabase Database;
- CInArchiveInfo ArchiveInfo;
- UInt32 *FolderStartPackStreamIndex;
- CFileSize *PackStreamStartPositions;
- UInt32 *FolderStartFileIndex;
- UInt32 *FileIndexToFolderIndexMap;
-}CArchiveDatabaseEx;
-
-void SzArDbExInit(CArchiveDatabaseEx *db);
-void SzArDbExFree(CArchiveDatabaseEx *db, void (*freeFunc)(void *));
-CFileSize SzArDbGetFolderStreamPos(CArchiveDatabaseEx *db, UInt32 folderIndex, UInt32 indexInFolder);
-int SzArDbGetFolderFullPackSize(CArchiveDatabaseEx *db, UInt32 folderIndex, CFileSize *resSize);
-
-typedef struct _ISzInStream
-{
- #ifdef _LZMA_IN_CB
- SZ_RESULT (*Read)(
- void *object, /* pointer to ISzInStream itself */
- void **buffer, /* out: pointer to buffer with data */
- size_t maxRequiredSize, /* max required size to read */
- size_t *processedSize); /* real processed size.
- processedSize can be less than maxRequiredSize.
- If processedSize == 0, then there are no more
- bytes in stream. */
- #else
- SZ_RESULT (*Read)(void *object, void *buffer, size_t size, size_t *processedSize);
- #endif
- SZ_RESULT (*Seek)(void *object, CFileSize pos);
-} ISzInStream;
-
-
-int SzArchiveOpen(
- ISzInStream *inStream,
- CArchiveDatabaseEx *db,
- ISzAlloc *allocMain,
- ISzAlloc *allocTemp);
-
-#endif
+++ /dev/null
-/* 7zItem.c */
-
-#include "7zItem.h"
-#include "7zAlloc.h"
-
-void SzCoderInfoInit(CCoderInfo *coder)
-{
- SzByteBufferInit(&coder->Properties);
-}
-
-void SzCoderInfoFree(CCoderInfo *coder, void (*freeFunc)(void *p))
-{
- SzByteBufferFree(&coder->Properties, freeFunc);
- SzCoderInfoInit(coder);
-}
-
-void SzFolderInit(CFolder *folder)
-{
- folder->NumCoders = 0;
- folder->Coders = 0;
- folder->NumBindPairs = 0;
- folder->BindPairs = 0;
- folder->NumPackStreams = 0;
- folder->PackStreams = 0;
- folder->UnPackSizes = 0;
- folder->UnPackCRCDefined = 0;
- folder->UnPackCRC = 0;
- folder->NumUnPackStreams = 0;
-}
-
-void SzFolderFree(CFolder *folder, void (*freeFunc)(void *p))
-{
- UInt32 i;
- for (i = 0; i < folder->NumCoders; i++)
- SzCoderInfoFree(&folder->Coders[i], freeFunc);
- freeFunc(folder->Coders);
- freeFunc(folder->BindPairs);
- freeFunc(folder->PackStreams);
- freeFunc(folder->UnPackSizes);
- SzFolderInit(folder);
-}
-
-UInt32 SzFolderGetNumOutStreams(CFolder *folder)
-{
- UInt32 result = 0;
- UInt32 i;
- for (i = 0; i < folder->NumCoders; i++)
- result += folder->Coders[i].NumOutStreams;
- return result;
-}
-
-int SzFolderFindBindPairForInStream(CFolder *folder, UInt32 inStreamIndex)
-{
- UInt32 i;
- for(i = 0; i < folder->NumBindPairs; i++)
- if (folder->BindPairs[i].InIndex == inStreamIndex)
- return i;
- return -1;
-}
-
-
-int SzFolderFindBindPairForOutStream(CFolder *folder, UInt32 outStreamIndex)
-{
- UInt32 i;
- for(i = 0; i < folder->NumBindPairs; i++)
- if (folder->BindPairs[i].OutIndex == outStreamIndex)
- return i;
- return -1;
-}
-
-CFileSize SzFolderGetUnPackSize(CFolder *folder)
-{
- int i = (int)SzFolderGetNumOutStreams(folder);
- if (i == 0)
- return 0;
- for (i--; i >= 0; i--)
- if (SzFolderFindBindPairForOutStream(folder, i) < 0)
- return folder->UnPackSizes[i];
- /* throw 1; */
- return 0;
-}
-
-/*
-int FindPackStreamArrayIndex(int inStreamIndex) const
-{
- for(int i = 0; i < PackStreams.Size(); i++)
- if (PackStreams[i] == inStreamIndex)
- return i;
- return -1;
-}
-*/
-
-void SzFileInit(CFileItem *fileItem)
-{
- fileItem->IsFileCRCDefined = 0;
- fileItem->HasStream = 1;
- fileItem->IsDirectory = 0;
- fileItem->IsAnti = 0;
- fileItem->IsLastWriteTimeDefined = 0;
- fileItem->Name = 0;
-}
-
-void SzFileFree(CFileItem *fileItem, void (*freeFunc)(void *p))
-{
- freeFunc(fileItem->Name);
- SzFileInit(fileItem);
-}
-
-void SzArchiveDatabaseInit(CArchiveDatabase *db)
-{
- db->NumPackStreams = 0;
- db->PackSizes = 0;
- db->PackCRCsDefined = 0;
- db->PackCRCs = 0;
- db->NumFolders = 0;
- db->Folders = 0;
- db->NumFiles = 0;
- db->Files = 0;
-}
-
-void SzArchiveDatabaseFree(CArchiveDatabase *db, void (*freeFunc)(void *))
-{
- UInt32 i;
- for (i = 0; i < db->NumFolders; i++)
- SzFolderFree(&db->Folders[i], freeFunc);
- for (i = 0; i < db->NumFiles; i++)
- SzFileFree(&db->Files[i], freeFunc);
- freeFunc(db->PackSizes);
- freeFunc(db->PackCRCsDefined);
- freeFunc(db->PackCRCs);
- freeFunc(db->Folders);
- freeFunc(db->Files);
- SzArchiveDatabaseInit(db);
-}
+++ /dev/null
-/* 7zItem.h */
-/* Modified by JohnE 2008-07-13: Added file attributes */
-
-#ifndef __7Z_ITEM_H
-#define __7Z_ITEM_H
-
-#include "7zMethodID.h"
-#include "7zHeader.h"
-#include "7zBuffer.h"
-
-typedef struct _CCoderInfo
-{
- UInt32 NumInStreams;
- UInt32 NumOutStreams;
- CMethodID MethodID;
- CSzByteBuffer Properties;
-}CCoderInfo;
-
-void SzCoderInfoInit(CCoderInfo *coder);
-void SzCoderInfoFree(CCoderInfo *coder, void (*freeFunc)(void *p));
-
-typedef struct _CBindPair
-{
- UInt32 InIndex;
- UInt32 OutIndex;
-}CBindPair;
-
-typedef struct _CFolder
-{
- UInt32 NumCoders;
- CCoderInfo *Coders;
- UInt32 NumBindPairs;
- CBindPair *BindPairs;
- UInt32 NumPackStreams;
- UInt32 *PackStreams;
- CFileSize *UnPackSizes;
- int UnPackCRCDefined;
- UInt32 UnPackCRC;
-
- UInt32 NumUnPackStreams;
-}CFolder;
-
-void SzFolderInit(CFolder *folder);
-CFileSize SzFolderGetUnPackSize(CFolder *folder);
-int SzFolderFindBindPairForInStream(CFolder *folder, UInt32 inStreamIndex);
-UInt32 SzFolderGetNumOutStreams(CFolder *folder);
-CFileSize SzFolderGetUnPackSize(CFolder *folder);
-
-typedef struct _CArchiveFileTime
-{
- UInt32 Low;
- UInt32 High;
-} CArchiveFileTime;
-
-typedef struct _CFileItem
-{
- CArchiveFileTime LastWriteTime;
- /*
- CFileSize StartPos;
- UInt32 Attributes;
- */
- CFileSize Size;
- UInt32 FileCRC;
- char *Name;
-
- Byte IsFileCRCDefined;
- Byte HasStream;
- Byte IsDirectory;
- Byte IsAnti;
- Byte IsLastWriteTimeDefined;
-
- int AreAttributesDefined;
- UInt32 Attributes;
- /*
- int IsLastWriteTimeDefined;
- int IsStartPosDefined;
- */
-}CFileItem;
-
-void SzFileInit(CFileItem *fileItem);
-
-typedef struct _CArchiveDatabase
-{
- UInt32 NumPackStreams;
- CFileSize *PackSizes;
- Byte *PackCRCsDefined;
- UInt32 *PackCRCs;
- UInt32 NumFolders;
- CFolder *Folders;
- UInt32 NumFiles;
- CFileItem *Files;
-}CArchiveDatabase;
-
-void SzArchiveDatabaseInit(CArchiveDatabase *db);
-void SzArchiveDatabaseFree(CArchiveDatabase *db, void (*freeFunc)(void *));
-
-
-#endif
+++ /dev/null
-/* 7zMethodID.h */
-
-#ifndef __7Z_METHOD_ID_H
-#define __7Z_METHOD_ID_H
-
-#include "../../Types.h"
-
-typedef UInt64 CMethodID;
-
-#endif
+++ /dev/null
-/* BranchTypes.h */
-
-#ifndef __BRANCHTYPES_H
-#define __BRANCHTYPES_H
-
-#ifndef _7ZIP_BYTE_DEFINED
-#define _7ZIP_BYTE_DEFINED
-typedef unsigned char Byte;
-#endif
-
-#ifndef _7ZIP_UINT16_DEFINED
-#define _7ZIP_UINT16_DEFINED
-typedef unsigned short UInt16;
-#endif
-
-#ifndef _7ZIP_UINT32_DEFINED
-#define _7ZIP_UINT32_DEFINED
-#ifdef _LZMA_UINT32_IS_ULONG
-typedef unsigned long UInt32;
-#else
-typedef unsigned int UInt32;
-#endif
-#endif
-
-#ifndef _7ZIP_UINT64_DEFINED
-#define _7ZIP_UINT64_DEFINED
-#ifdef _SZ_NO_INT_64
-typedef unsigned long UInt64;
-#else
-#if defined(_MSC_VER) || defined(__BORLANDC__)
-typedef unsigned __int64 UInt64;
-#else
-typedef unsigned long long int UInt64;
-#endif
-#endif
-#endif
-
-/* #define _LZMA_NO_SYSTEM_SIZE_T */
-/* You can use it, if you don't want <stddef.h> */
-
-#ifndef _7ZIP_SIZET_DEFINED
-#define _7ZIP_SIZET_DEFINED
-#ifdef _LZMA_NO_SYSTEM_SIZE_T
-typedef UInt32 SizeT;
-#else
-#include <stddef.h>
-typedef size_t SizeT;
-#endif
-#endif
-
-#endif
+++ /dev/null
-/* BranchX86.c */
-
-#include "BranchX86.h"
-
-#define Test86MSByte(b) ((b) == 0 || (b) == 0xFF)
-
-const Byte kMaskToAllowedStatus[8] = {1, 1, 1, 0, 1, 0, 0, 0};
-const Byte kMaskToBitNumber[8] = {0, 1, 2, 2, 3, 3, 3, 3};
-
-SizeT x86_Convert(Byte *buffer, SizeT endPos, UInt32 nowPos, UInt32 *prevMaskMix, int encoding)
-{
- SizeT bufferPos = 0, prevPosT;
- UInt32 prevMask = *prevMaskMix & 0x7;
- if (endPos < 5)
- return 0;
- nowPos += 5;
- prevPosT = (SizeT)0 - 1;
-
- for(;;)
- {
- Byte *p = buffer + bufferPos;
- Byte *limit = buffer + endPos - 4;
- for (; p < limit; p++)
- if ((*p & 0xFE) == 0xE8)
- break;
- bufferPos = (SizeT)(p - buffer);
- if (p >= limit)
- break;
- prevPosT = bufferPos - prevPosT;
- if (prevPosT > 3)
- prevMask = 0;
- else
- {
- prevMask = (prevMask << ((int)prevPosT - 1)) & 0x7;
- if (prevMask != 0)
- {
- Byte b = p[4 - kMaskToBitNumber[prevMask]];
- if (!kMaskToAllowedStatus[prevMask] || Test86MSByte(b))
- {
- prevPosT = bufferPos;
- prevMask = ((prevMask << 1) & 0x7) | 1;
- bufferPos++;
- continue;
- }
- }
- }
- prevPosT = bufferPos;
-
- if (Test86MSByte(p[4]))
- {
- UInt32 src = ((UInt32)p[4] << 24) | ((UInt32)p[3] << 16) | ((UInt32)p[2] << 8) | ((UInt32)p[1]);
- UInt32 dest;
- for (;;)
- {
- Byte b;
- int index;
- if (encoding)
- dest = (nowPos + (UInt32)bufferPos) + src;
- else
- dest = src - (nowPos + (UInt32)bufferPos);
- if (prevMask == 0)
- break;
- index = kMaskToBitNumber[prevMask] * 8;
- b = (Byte)(dest >> (24 - index));
- if (!Test86MSByte(b))
- break;
- src = dest ^ ((1 << (32 - index)) - 1);
- }
- p[4] = (Byte)(~(((dest >> 24) & 1) - 1));
- p[3] = (Byte)(dest >> 16);
- p[2] = (Byte)(dest >> 8);
- p[1] = (Byte)dest;
- bufferPos += 5;
- }
- else
- {
- prevMask = ((prevMask << 1) & 0x7) | 1;
- bufferPos++;
- }
- }
- prevPosT = bufferPos - prevPosT;
- *prevMaskMix = ((prevPosT > 3) ? 0 : ((prevMask << ((int)prevPosT - 1)) & 0x7));
- return bufferPos;
-}
+++ /dev/null
-/* BranchX86.h */
-
-#ifndef __BRANCHX86_H
-#define __BRANCHX86_H
-
-#include "BranchTypes.h"
-
-#define x86_Convert_Init(state) { state = 0; }
-
-SizeT x86_Convert(Byte *buffer, SizeT endPos, UInt32 nowPos, UInt32 *state, int encoding);
-
-#endif
+++ /dev/null
-// BranchX86_2.c
-
-#include "BranchX86_2.h"
-
-#include "../../Alloc.h"
-
-#ifdef _LZMA_PROB32
-#define CProb UInt32
-#else
-#define CProb UInt16
-#endif
-
-#define IsJcc(b0, b1) ((b0) == 0x0F && ((b1) & 0xF0) == 0x80)
-#define IsJ(b0, b1) ((b1 & 0xFE) == 0xE8 || IsJcc(b0, b1))
-
-#define kNumTopBits 24
-#define kTopValue ((UInt32)1 << kNumTopBits)
-
-#define kNumBitModelTotalBits 11
-#define kBitModelTotal (1 << kNumBitModelTotalBits)
-#define kNumMoveBits 5
-
-#define RC_READ_BYTE (*Buffer++)
-
-#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \
- { int i; for(i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) | RC_READ_BYTE; }}
-
-#define RC_TEST { if (Buffer == BufferLim) return BCJ2_RESULT_DATA_ERROR; }
-
-#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2
-
-#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; }
-
-#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound)
-#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits;
-#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits;
-// #define UpdateBit0(p) Range = bound; *(p) = (CProb)(*(p) + ((kBitModelTotal - *(p)) >> kNumMoveBits));
-// #define UpdateBit1(p) Range -= bound; Code -= bound; *(p) = (CProb)(*(p) - (*(p) >> kNumMoveBits));
-
-int x86_2_Decode(
- const Byte *buf0, SizeT size0,
- const Byte *buf1, SizeT size1,
- const Byte *buf2, SizeT size2,
- const Byte *buf3, SizeT size3,
- Byte *outBuf, SizeT outSize)
-{
- CProb p[256 + 2];
- SizeT inPos = 0, outPos = 0;
-
- const Byte *Buffer, *BufferLim;
- UInt32 Range, Code;
- Byte prevByte = 0;
-
- unsigned int i;
- for (i = 0; i < sizeof(p) / sizeof(p[0]); i++)
- p[i] = kBitModelTotal >> 1;
- RC_INIT(buf3, size3);
-
- if (outSize == 0)
- return BCJ2_RESULT_OK;
-
- for (;;)
- {
- Byte b;
- CProb *prob;
- UInt32 bound;
-
- SizeT limit = size0 - inPos;
- if (outSize - outPos < limit)
- limit = outSize - outPos;
- while (limit != 0)
- {
- Byte b = buf0[inPos];
- outBuf[outPos++] = b;
- if (IsJ(prevByte, b))
- break;
- inPos++;
- prevByte = b;
- limit--;
- }
-
- if (limit == 0 || outPos == outSize)
- break;
-
- b = buf0[inPos++];
-
- if (b == 0xE8)
- prob = p + prevByte;
- else if (b == 0xE9)
- prob = p + 256;
- else
- prob = p + 257;
-
- IfBit0(prob)
- {
- UpdateBit0(prob)
- prevByte = b;
- }
- else
- {
- UInt32 dest;
- const Byte *v;
- UpdateBit1(prob)
- if (b == 0xE8)
- {
- v = buf1;
- if (size1 < 4)
- return BCJ2_RESULT_DATA_ERROR;
- buf1 += 4;
- size1 -= 4;
- }
- else
- {
- v = buf2;
- if (size2 < 4)
- return BCJ2_RESULT_DATA_ERROR;
- buf2 += 4;
- size2 -= 4;
- }
- dest = (((UInt32)v[0] << 24) | ((UInt32)v[1] << 16) |
- ((UInt32)v[2] << 8) | ((UInt32)v[3])) - ((UInt32)outPos + 4);
- outBuf[outPos++] = (Byte)dest;
- if (outPos == outSize)
- break;
- outBuf[outPos++] = (Byte)(dest >> 8);
- if (outPos == outSize)
- break;
- outBuf[outPos++] = (Byte)(dest >> 16);
- if (outPos == outSize)
- break;
- outBuf[outPos++] = prevByte = (Byte)(dest >> 24);
- }
- }
- return (outPos == outSize) ? BCJ2_RESULT_OK : BCJ2_RESULT_DATA_ERROR;
-}
+++ /dev/null
-// BranchX86_2.h
-
-#ifndef __BRANCHX86_2_H
-#define __BRANCHX86_2_H
-
-#include "BranchTypes.h"
-
-#define BCJ2_RESULT_OK 0
-#define BCJ2_RESULT_DATA_ERROR 1
-
-/*
-Conditions:
- outSize <= FullOutputSize,
- where FullOutputSize is full size of output stream of x86_2 filter.
-
-If buf0 overlaps outBuf, there are two required conditions:
- 1) (buf0 >= outBuf)
- 2) (buf0 + size0 >= outBuf + FullOutputSize).
-*/
-
-int x86_2_Decode(
- const Byte *buf0, SizeT size0,
- const Byte *buf1, SizeT size1,
- const Byte *buf2, SizeT size2,
- const Byte *buf3, SizeT size3,
- Byte *outBuf, SizeT outSize);
-
-#endif
+++ /dev/null
-/* Compress/HuffmanEncode.h */
-
-#ifndef __COMPRESS_HUFFMANENCODE_H
-#define __COMPRESS_HUFFMANENCODE_H
-
-#include "../../Types.h"
-
-/*
-Conditions:
- num <= 1024 = 2 ^ NUM_BITS
- Sum(freqs) < 4M = 2 ^ (32 - NUM_BITS)
- maxLen <= 16 = kMaxLen
- Num_Items(p) >= HUFFMAN_TEMP_SIZE(num)
-*/
-
-void Huffman_Generate(const UInt32 *freqs, UInt32 *p, Byte *lens, UInt32 num, UInt32 maxLen);
-
-#endif
+++ /dev/null
-/* LzHash.h */
-
-#ifndef __C_LZHASH_H
-#define __C_LZHASH_H
-
-#define kHash2Size (1 << 10)
-#define kHash3Size (1 << 16)
-#define kHash4Size (1 << 20)
-
-#define kFix3HashSize (kHash2Size)
-#define kFix4HashSize (kHash2Size + kHash3Size)
-#define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size)
-
-#define HASH2_CALC hashValue = cur[0] | ((UInt32)cur[1] << 8);
-
-#define HASH3_CALC { \
- UInt32 temp = g_CrcTable[cur[0]] ^ cur[1]; \
- hash2Value = temp & (kHash2Size - 1); \
- hashValue = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; }
-
-#define HASH4_CALC { \
- UInt32 temp = g_CrcTable[cur[0]] ^ cur[1]; \
- hash2Value = temp & (kHash2Size - 1); \
- hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
- hashValue = (temp ^ ((UInt32)cur[2] << 8) ^ (g_CrcTable[cur[3]] << 5)) & p->hashMask; }
-
-#define HASH5_CALC { \
- UInt32 temp = g_CrcTable[cur[0]] ^ cur[1]; \
- hash2Value = temp & (kHash2Size - 1); \
- hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
- hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (g_CrcTable[cur[3]] << 5)); \
- hashValue = (hash4Value ^ (g_CrcTable[cur[4]] << 3)) & p->hashMask; \
- hash4Value &= (kHash4Size - 1); }
-
-/* #define HASH_ZIP_CALC hashValue = ((cur[0] | ((UInt32)cur[1] << 8)) ^ g_CrcTable[cur[2]]) & 0xFFFF; */
-#define HASH_ZIP_CALC hashValue = ((cur[2] | ((UInt32)cur[0] << 8)) ^ g_CrcTable[cur[1]]) & 0xFFFF;
-
-
-#define MT_HASH2_CALC \
- hash2Value = (g_CrcTable[cur[0]] ^ cur[1]) & (kHash2Size - 1);
-
-#define MT_HASH3_CALC { \
- UInt32 temp = g_CrcTable[cur[0]] ^ cur[1]; \
- hash2Value = temp & (kHash2Size - 1); \
- hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); }
-
-#define MT_HASH4_CALC { \
- UInt32 temp = g_CrcTable[cur[0]] ^ cur[1]; \
- hash2Value = temp & (kHash2Size - 1); \
- hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
- hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (g_CrcTable[cur[3]] << 5)) & (kHash4Size - 1); }
-
-#endif
+++ /dev/null
-/* MatchFinder.h */
-
-#ifndef __MATCHFINDER_H
-#define __MATCHFINDER_H
-
-#include "../../IStream.h"
-
-typedef UInt32 CLzRef;
-
-typedef struct _CMatchFinder
-{
- Byte *buffer;
- UInt32 pos;
- UInt32 posLimit;
- UInt32 streamPos;
- UInt32 lenLimit;
-
- UInt32 cyclicBufferPos;
- UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */
-
- UInt32 matchMaxLen;
- CLzRef *hash;
- CLzRef *son;
- UInt32 hashMask;
- UInt32 cutValue;
-
- Byte *bufferBase;
- ISeqInStream *stream;
- int streamEndWasReached;
-
- UInt32 blockSize;
- UInt32 keepSizeBefore;
- UInt32 keepSizeAfter;
-
- UInt32 numHashBytes;
- int directInput;
- int btMode;
- /* int skipModeBits; */
- int bigHash;
- UInt32 historySize;
- UInt32 fixedHashSize;
- UInt32 hashSizeSum;
- UInt32 numSons;
-
- HRes result;
-} CMatchFinder;
-
-#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer)
-#define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)])
-
-#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
-
-int MatchFinder_NeedMove(CMatchFinder *p);
-Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
-void MatchFinder_MoveBlock(CMatchFinder *p);
-void MatchFinder_ReadIfRequired(CMatchFinder *p);
-
-void MatchFinder_Construct(CMatchFinder *p);
-
-/* Conditions:
- historySize <= 3 GB
- keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB
-*/
-int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
- UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
- ISzAlloc *alloc);
-void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc);
-void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems);
-void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
-
-UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,
- UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
- UInt32 *distances, UInt32 maxLen);
-
-/*
-Conditions:
- Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func.
- Mf_GetPointerToCurrentPos_Func's result must be used only before any other function
-*/
-
-typedef void (*Mf_Init_Func)(void *object);
-typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index);
-typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object);
-typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object);
-typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
-typedef void (*Mf_Skip_Func)(void *object, UInt32);
-
-typedef struct _IMatchFinder
-{
- Mf_Init_Func Init;
- Mf_GetIndexByte_Func GetIndexByte;
- Mf_GetNumAvailableBytes_Func GetNumAvailableBytes;
- Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos;
- Mf_GetMatches_Func GetMatches;
- Mf_Skip_Func Skip;
-} IMatchFinder;
-
-void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
-
-void MatchFinder_Init(CMatchFinder *p);
-UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
-UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
-void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
-void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
-
-#endif
+++ /dev/null
-/* MatchFinderMt.h */
-
-#ifndef __MATCHFINDERMT_H
-#define __MATCHFINDERMT_H
-
-#include "../../Threads.h"
-#include "MatchFinder.h"
-
-#define kMtHashBlockSize (1 << 13)
-#define kMtHashNumBlocks (1 << 3)
-#define kMtHashNumBlocksMask (kMtHashNumBlocks - 1)
-
-#define kMtBtBlockSize (1 << 14)
-#define kMtBtNumBlocks (1 << 6)
-#define kMtBtNumBlocksMask (kMtBtNumBlocks - 1)
-
-typedef struct _CMtSync
-{
- Bool wasCreated;
- Bool needStart;
- Bool exit;
- Bool stopWriting;
-
- CThread thread;
- CAutoResetEvent canStart;
- CAutoResetEvent wasStarted;
- CAutoResetEvent wasStopped;
- CSemaphore freeSemaphore;
- CSemaphore filledSemaphore;
- Bool csWasInitialized;
- Bool csWasEntered;
- CCriticalSection cs;
- UInt32 numProcessedBlocks;
-} CMtSync;
-
-typedef UInt32 * (*Mf_Mix_Matches)(void *p, UInt32 matchMinPos, UInt32 *distances);
-
-/* kMtCacheLineDummy must be >= size_of_CPU_cache_line */
-#define kMtCacheLineDummy 128
-
-typedef void (*Mf_GetHeads)(const Byte *buffer, UInt32 pos,
- UInt32 *hash, UInt32 hashMask, UInt32 *heads, UInt32 numHeads);
-
-typedef struct _CMatchFinderMt
-{
- /* LZ */
- const Byte *pointerToCurPos;
- UInt32 *btBuf;
- UInt32 btBufPos;
- UInt32 btBufPosLimit;
- UInt32 lzPos;
- UInt32 btNumAvailBytes;
-
- UInt32 *hash;
- UInt32 fixedHashSize;
- UInt32 historySize;
-
- Mf_Mix_Matches MixMatchesFunc;
-
- /* LZ + BT */
- CMtSync btSync;
- Byte btDummy[kMtCacheLineDummy];
-
- /* BT */
- UInt32 *hashBuf;
- UInt32 hashBufPos;
- UInt32 hashBufPosLimit;
- UInt32 hashNumAvail;
-
- CLzRef *son;
- UInt32 matchMaxLen;
- UInt32 numHashBytes;
- UInt32 pos;
- Byte *buffer;
- UInt32 cyclicBufferPos;
- UInt32 cyclicBufferSize; /* it must be historySize + 1 */
- UInt32 cutValue;
-
- /* BT + Hash */
- CMtSync hashSync;
- /* Byte hashDummy[kMtCacheLineDummy]; */
-
- /* Hash */
- Mf_GetHeads GetHeadsFunc;
- CMatchFinder *MatchFinder;
-} CMatchFinderMt;
-
-void MatchFinderMt_Construct(CMatchFinderMt *p);
-void MatchFinderMt_Destruct(CMatchFinderMt *p, ISzAlloc *alloc);
-HRes MatchFinderMt_Create(CMatchFinderMt *p, UInt32 historySize, UInt32 keepAddBufferBefore,
- UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ISzAlloc *alloc);
-void MatchFinderMt_CreateVTable(CMatchFinderMt *p, IMatchFinder *vTable);
-void MatchFinderMt_ReleaseStream(CMatchFinderMt *p);
-
-#endif
+++ /dev/null
-/*
- LzmaDecode.c
- LZMA Decoder (optimized for Speed version)
-
- LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01)
- http://www.7-zip.org/
-
- LZMA SDK is licensed under two licenses:
- 1) GNU Lesser General Public License (GNU LGPL)
- 2) Common Public License (CPL)
- It means that you can select one of these two licenses and
- follow rules of that license.
-
- SPECIAL EXCEPTION:
- Igor Pavlov, as the author of this Code, expressly permits you to
- statically or dynamically link your Code (or bind by name) to the
- interfaces of this file without subjecting your linked Code to the
- terms of the CPL or GNU LGPL. Any modifications or additions
- to this file, however, are subject to the LGPL or CPL terms.
-*/
-
-#include "LzmaDecode.h"
-
-#define kNumTopBits 24
-#define kTopValue ((UInt32)1 << kNumTopBits)
-
-#define kNumBitModelTotalBits 11
-#define kBitModelTotal (1 << kNumBitModelTotalBits)
-#define kNumMoveBits 5
-
-#define RC_READ_BYTE (*Buffer++)
-
-#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \
- { int i; for(i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) | RC_READ_BYTE; }}
-
-#ifdef _LZMA_IN_CB
-
-#define RC_TEST { if (Buffer == BufferLim) \
- { SizeT size; int result = InCallback->Read(InCallback, &Buffer, &size); if (result != LZMA_RESULT_OK) return result; \
- BufferLim = Buffer + size; if (size == 0) return LZMA_RESULT_DATA_ERROR; }}
-
-#define RC_INIT Buffer = BufferLim = 0; RC_INIT2
-
-#else
-
-#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; }
-
-#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2
-
-#endif
-
-#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; }
-
-#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound)
-#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits;
-#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits;
-
-#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \
- { UpdateBit0(p); mi <<= 1; A0; } else \
- { UpdateBit1(p); mi = (mi + mi) + 1; A1; }
-
-#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)
-
-#define RangeDecoderBitTreeDecode(probs, numLevels, res) \
- { int i = numLevels; res = 1; \
- do { CProb *p = probs + res; RC_GET_BIT(p, res) } while(--i != 0); \
- res -= (1 << numLevels); }
-
-
-#define kNumPosBitsMax 4
-#define kNumPosStatesMax (1 << kNumPosBitsMax)
-
-#define kLenNumLowBits 3
-#define kLenNumLowSymbols (1 << kLenNumLowBits)
-#define kLenNumMidBits 3
-#define kLenNumMidSymbols (1 << kLenNumMidBits)
-#define kLenNumHighBits 8
-#define kLenNumHighSymbols (1 << kLenNumHighBits)
-
-#define LenChoice 0
-#define LenChoice2 (LenChoice + 1)
-#define LenLow (LenChoice2 + 1)
-#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
-#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
-#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
-
-
-#define kNumStates 12
-#define kNumLitStates 7
-
-#define kStartPosModelIndex 4
-#define kEndPosModelIndex 14
-#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
-
-#define kNumPosSlotBits 6
-#define kNumLenToPosStates 4
-
-#define kNumAlignBits 4
-#define kAlignTableSize (1 << kNumAlignBits)
-
-#define kMatchMinLen 2
-
-#define IsMatch 0
-#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
-#define IsRepG0 (IsRep + kNumStates)
-#define IsRepG1 (IsRepG0 + kNumStates)
-#define IsRepG2 (IsRepG1 + kNumStates)
-#define IsRep0Long (IsRepG2 + kNumStates)
-#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
-#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
-#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
-#define LenCoder (Align + kAlignTableSize)
-#define RepLenCoder (LenCoder + kNumLenProbs)
-#define Literal (RepLenCoder + kNumLenProbs)
-
-#if Literal != LZMA_BASE_SIZE
-StopCompilingDueBUG
-#endif
-
-int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size)
-{
- unsigned char prop0;
- if (size < LZMA_PROPERTIES_SIZE)
- return LZMA_RESULT_DATA_ERROR;
- prop0 = propsData[0];
- if (prop0 >= (9 * 5 * 5))
- return LZMA_RESULT_DATA_ERROR;
- {
- for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5));
- for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9);
- propsRes->lc = prop0;
- /*
- unsigned char remainder = (unsigned char)(prop0 / 9);
- propsRes->lc = prop0 % 9;
- propsRes->pb = remainder / 5;
- propsRes->lp = remainder % 5;
- */
- }
-
- #ifdef _LZMA_OUT_READ
- {
- int i;
- propsRes->DictionarySize = 0;
- for (i = 0; i < 4; i++)
- propsRes->DictionarySize += (UInt32)(propsData[1 + i]) << (i * 8);
- if (propsRes->DictionarySize == 0)
- propsRes->DictionarySize = 1;
- }
- #endif
- return LZMA_RESULT_OK;
-}
-
-#define kLzmaStreamWasFinishedId (-1)
-
-int LzmaDecode(CLzmaDecoderState *vs,
- #ifdef _LZMA_IN_CB
- ILzmaInCallback *InCallback,
- #else
- const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
- #endif
- unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed)
-{
- CProb *p = vs->Probs;
- SizeT nowPos = 0;
- Byte previousByte = 0;
- UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1;
- UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1;
- int lc = vs->Properties.lc;
-
- #ifdef _LZMA_OUT_READ
-
- UInt32 Range = vs->Range;
- UInt32 Code = vs->Code;
- #ifdef _LZMA_IN_CB
- const Byte *Buffer = vs->Buffer;
- const Byte *BufferLim = vs->BufferLim;
- #else
- const Byte *Buffer = inStream;
- const Byte *BufferLim = inStream + inSize;
- #endif
- int state = vs->State;
- UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3];
- int len = vs->RemainLen;
- UInt32 globalPos = vs->GlobalPos;
- UInt32 distanceLimit = vs->DistanceLimit;
-
- Byte *dictionary = vs->Dictionary;
- UInt32 dictionarySize = vs->Properties.DictionarySize;
- UInt32 dictionaryPos = vs->DictionaryPos;
-
- Byte tempDictionary[4];
-
- #ifndef _LZMA_IN_CB
- *inSizeProcessed = 0;
- #endif
- *outSizeProcessed = 0;
- if (len == kLzmaStreamWasFinishedId)
- return LZMA_RESULT_OK;
-
- if (dictionarySize == 0)
- {
- dictionary = tempDictionary;
- dictionarySize = 1;
- tempDictionary[0] = vs->TempDictionary[0];
- }
-
- if (len == kLzmaNeedInitId)
- {
- {
- UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
- UInt32 i;
- for (i = 0; i < numProbs; i++)
- p[i] = kBitModelTotal >> 1;
- rep0 = rep1 = rep2 = rep3 = 1;
- state = 0;
- globalPos = 0;
- distanceLimit = 0;
- dictionaryPos = 0;
- dictionary[dictionarySize - 1] = 0;
- #ifdef _LZMA_IN_CB
- RC_INIT;
- #else
- RC_INIT(inStream, inSize);
- #endif
- }
- len = 0;
- }
- while(len != 0 && nowPos < outSize)
- {
- UInt32 pos = dictionaryPos - rep0;
- if (pos >= dictionarySize)
- pos += dictionarySize;
- outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos];
- if (++dictionaryPos == dictionarySize)
- dictionaryPos = 0;
- len--;
- }
- if (dictionaryPos == 0)
- previousByte = dictionary[dictionarySize - 1];
- else
- previousByte = dictionary[dictionaryPos - 1];
-
- #else /* if !_LZMA_OUT_READ */
-
- int state = 0;
- UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1;
- int len = 0;
- const Byte *Buffer;
- const Byte *BufferLim;
- UInt32 Range;
- UInt32 Code;
-
- #ifndef _LZMA_IN_CB
- *inSizeProcessed = 0;
- #endif
- *outSizeProcessed = 0;
-
- {
- UInt32 i;
- UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
- for (i = 0; i < numProbs; i++)
- p[i] = kBitModelTotal >> 1;
- }
-
- #ifdef _LZMA_IN_CB
- RC_INIT;
- #else
- RC_INIT(inStream, inSize);
- #endif
-
- #endif /* _LZMA_OUT_READ */
-
- while(nowPos < outSize)
- {
- CProb *prob;
- UInt32 bound;
- int posState = (int)(
- (nowPos
- #ifdef _LZMA_OUT_READ
- + globalPos
- #endif
- )
- & posStateMask);
-
- prob = p + IsMatch + (state << kNumPosBitsMax) + posState;
- IfBit0(prob)
- {
- int symbol = 1;
- UpdateBit0(prob)
- prob = p + Literal + (LZMA_LIT_SIZE *
- (((
- (nowPos
- #ifdef _LZMA_OUT_READ
- + globalPos
- #endif
- )
- & literalPosMask) << lc) + (previousByte >> (8 - lc))));
-
- if (state >= kNumLitStates)
- {
- int matchByte;
- #ifdef _LZMA_OUT_READ
- UInt32 pos = dictionaryPos - rep0;
- if (pos >= dictionarySize)
- pos += dictionarySize;
- matchByte = dictionary[pos];
- #else
- matchByte = outStream[nowPos - rep0];
- #endif
- do
- {
- int bit;
- CProb *probLit;
- matchByte <<= 1;
- bit = (matchByte & 0x100);
- probLit = prob + 0x100 + bit + symbol;
- RC_GET_BIT2(probLit, symbol, if (bit != 0) break, if (bit == 0) break)
- }
- while (symbol < 0x100);
- }
- while (symbol < 0x100)
- {
- CProb *probLit = prob + symbol;
- RC_GET_BIT(probLit, symbol)
- }
- previousByte = (Byte)symbol;
-
- outStream[nowPos++] = previousByte;
- #ifdef _LZMA_OUT_READ
- if (distanceLimit < dictionarySize)
- distanceLimit++;
-
- dictionary[dictionaryPos] = previousByte;
- if (++dictionaryPos == dictionarySize)
- dictionaryPos = 0;
- #endif
- if (state < 4) state = 0;
- else if (state < 10) state -= 3;
- else state -= 6;
- }
- else
- {
- UpdateBit1(prob);
- prob = p + IsRep + state;
- IfBit0(prob)
- {
- UpdateBit0(prob);
- rep3 = rep2;
- rep2 = rep1;
- rep1 = rep0;
- state = state < kNumLitStates ? 0 : 3;
- prob = p + LenCoder;
- }
- else
- {
- UpdateBit1(prob);
- prob = p + IsRepG0 + state;
- IfBit0(prob)
- {
- UpdateBit0(prob);
- prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState;
- IfBit0(prob)
- {
- #ifdef _LZMA_OUT_READ
- UInt32 pos;
- #endif
- UpdateBit0(prob);
-
- #ifdef _LZMA_OUT_READ
- if (distanceLimit == 0)
- #else
- if (nowPos == 0)
- #endif
- return LZMA_RESULT_DATA_ERROR;
-
- state = state < kNumLitStates ? 9 : 11;
- #ifdef _LZMA_OUT_READ
- pos = dictionaryPos - rep0;
- if (pos >= dictionarySize)
- pos += dictionarySize;
- previousByte = dictionary[pos];
- dictionary[dictionaryPos] = previousByte;
- if (++dictionaryPos == dictionarySize)
- dictionaryPos = 0;
- #else
- previousByte = outStream[nowPos - rep0];
- #endif
- outStream[nowPos++] = previousByte;
- #ifdef _LZMA_OUT_READ
- if (distanceLimit < dictionarySize)
- distanceLimit++;
- #endif
-
- continue;
- }
- else
- {
- UpdateBit1(prob);
- }
- }
- else
- {
- UInt32 distance;
- UpdateBit1(prob);
- prob = p + IsRepG1 + state;
- IfBit0(prob)
- {
- UpdateBit0(prob);
- distance = rep1;
- }
- else
- {
- UpdateBit1(prob);
- prob = p + IsRepG2 + state;
- IfBit0(prob)
- {
- UpdateBit0(prob);
- distance = rep2;
- }
- else
- {
- UpdateBit1(prob);
- distance = rep3;
- rep3 = rep2;
- }
- rep2 = rep1;
- }
- rep1 = rep0;
- rep0 = distance;
- }
- state = state < kNumLitStates ? 8 : 11;
- prob = p + RepLenCoder;
- }
- {
- int numBits, offset;
- CProb *probLen = prob + LenChoice;
- IfBit0(probLen)
- {
- UpdateBit0(probLen);
- probLen = prob + LenLow + (posState << kLenNumLowBits);
- offset = 0;
- numBits = kLenNumLowBits;
- }
- else
- {
- UpdateBit1(probLen);
- probLen = prob + LenChoice2;
- IfBit0(probLen)
- {
- UpdateBit0(probLen);
- probLen = prob + LenMid + (posState << kLenNumMidBits);
- offset = kLenNumLowSymbols;
- numBits = kLenNumMidBits;
- }
- else
- {
- UpdateBit1(probLen);
- probLen = prob + LenHigh;
- offset = kLenNumLowSymbols + kLenNumMidSymbols;
- numBits = kLenNumHighBits;
- }
- }
- RangeDecoderBitTreeDecode(probLen, numBits, len);
- len += offset;
- }
-
- if (state < 4)
- {
- int posSlot;
- state += kNumLitStates;
- prob = p + PosSlot +
- ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
- kNumPosSlotBits);
- RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot);
- if (posSlot >= kStartPosModelIndex)
- {
- int numDirectBits = ((posSlot >> 1) - 1);
- rep0 = (2 | ((UInt32)posSlot & 1));
- if (posSlot < kEndPosModelIndex)
- {
- rep0 <<= numDirectBits;
- prob = p + SpecPos + rep0 - posSlot - 1;
- }
- else
- {
- numDirectBits -= kNumAlignBits;
- do
- {
- RC_NORMALIZE
- Range >>= 1;
- rep0 <<= 1;
- if (Code >= Range)
- {
- Code -= Range;
- rep0 |= 1;
- }
- }
- while (--numDirectBits != 0);
- prob = p + Align;
- rep0 <<= kNumAlignBits;
- numDirectBits = kNumAlignBits;
- }
- {
- int i = 1;
- int mi = 1;
- do
- {
- CProb *prob3 = prob + mi;
- RC_GET_BIT2(prob3, mi, ; , rep0 |= i);
- i <<= 1;
- }
- while(--numDirectBits != 0);
- }
- }
- else
- rep0 = posSlot;
- if (++rep0 == (UInt32)(0))
- {
- /* it's for stream version */
- len = kLzmaStreamWasFinishedId;
- break;
- }
- }
-
- len += kMatchMinLen;
- #ifdef _LZMA_OUT_READ
- if (rep0 > distanceLimit)
- #else
- if (rep0 > nowPos)
- #endif
- return LZMA_RESULT_DATA_ERROR;
-
- #ifdef _LZMA_OUT_READ
- if (dictionarySize - distanceLimit > (UInt32)len)
- distanceLimit += len;
- else
- distanceLimit = dictionarySize;
- #endif
-
- do
- {
- #ifdef _LZMA_OUT_READ
- UInt32 pos = dictionaryPos - rep0;
- if (pos >= dictionarySize)
- pos += dictionarySize;
- previousByte = dictionary[pos];
- dictionary[dictionaryPos] = previousByte;
- if (++dictionaryPos == dictionarySize)
- dictionaryPos = 0;
- #else
- previousByte = outStream[nowPos - rep0];
- #endif
- len--;
- outStream[nowPos++] = previousByte;
- }
- while(len != 0 && nowPos < outSize);
- }
- }
- RC_NORMALIZE;
-
- #ifdef _LZMA_OUT_READ
- vs->Range = Range;
- vs->Code = Code;
- vs->DictionaryPos = dictionaryPos;
- vs->GlobalPos = globalPos + (UInt32)nowPos;
- vs->DistanceLimit = distanceLimit;
- vs->Reps[0] = rep0;
- vs->Reps[1] = rep1;
- vs->Reps[2] = rep2;
- vs->Reps[3] = rep3;
- vs->State = state;
- vs->RemainLen = len;
- vs->TempDictionary[0] = tempDictionary[0];
- #endif
-
- #ifdef _LZMA_IN_CB
- vs->Buffer = Buffer;
- vs->BufferLim = BufferLim;
- #else
- *inSizeProcessed = (SizeT)(Buffer - inStream);
- #endif
- *outSizeProcessed = nowPos;
- return LZMA_RESULT_OK;
-}
+++ /dev/null
-/*
- LzmaDecode.h
- LZMA Decoder interface
-
- LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01)
- http://www.7-zip.org/
-
- LZMA SDK is licensed under two licenses:
- 1) GNU Lesser General Public License (GNU LGPL)
- 2) Common Public License (CPL)
- It means that you can select one of these two licenses and
- follow rules of that license.
-
- SPECIAL EXCEPTION:
- Igor Pavlov, as the author of this code, expressly permits you to
- statically or dynamically link your code (or bind by name) to the
- interfaces of this file without subjecting your linked code to the
- terms of the CPL or GNU LGPL. Any modifications or additions
- to this file, however, are subject to the LGPL or CPL terms.
-*/
-
-#ifndef __LZMADECODE_H
-#define __LZMADECODE_H
-
-#include "LzmaTypes.h"
-
-/* #define _LZMA_IN_CB */
-/* Use callback for input data */
-
-/* #define _LZMA_OUT_READ */
-/* Use read function for output data */
-
-/* #define _LZMA_PROB32 */
-/* It can increase speed on some 32-bit CPUs,
- but memory usage will be doubled in that case */
-
-/* #define _LZMA_LOC_OPT */
-/* Enable local speed optimizations inside code */
-
-#ifdef _LZMA_PROB32
-#define CProb UInt32
-#else
-#define CProb UInt16
-#endif
-
-#define LZMA_RESULT_OK 0
-#define LZMA_RESULT_DATA_ERROR 1
-
-#ifdef _LZMA_IN_CB
-typedef struct _ILzmaInCallback
-{
- int (*Read)(void *object, const unsigned char **buffer, SizeT *bufferSize);
-} ILzmaInCallback;
-#endif
-
-#define LZMA_BASE_SIZE 1846
-#define LZMA_LIT_SIZE 768
-
-#define LZMA_PROPERTIES_SIZE 5
-
-typedef struct _CLzmaProperties
-{
- int lc;
- int lp;
- int pb;
- #ifdef _LZMA_OUT_READ
- UInt32 DictionarySize;
- #endif
-}CLzmaProperties;
-
-int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size);
-
-#define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp)))
-
-#define kLzmaNeedInitId (-2)
-
-typedef struct _CLzmaDecoderState
-{
- CLzmaProperties Properties;
- CProb *Probs;
-
- #ifdef _LZMA_IN_CB
- const unsigned char *Buffer;
- const unsigned char *BufferLim;
- #endif
-
- #ifdef _LZMA_OUT_READ
- unsigned char *Dictionary;
- UInt32 Range;
- UInt32 Code;
- UInt32 DictionaryPos;
- UInt32 GlobalPos;
- UInt32 DistanceLimit;
- UInt32 Reps[4];
- int State;
- int RemainLen;
- unsigned char TempDictionary[4];
- #endif
-} CLzmaDecoderState;
-
-#ifdef _LZMA_OUT_READ
-#define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; }
-#endif
-
-int LzmaDecode(CLzmaDecoderState *vs,
- #ifdef _LZMA_IN_CB
- ILzmaInCallback *inCallback,
- #else
- const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
- #endif
- unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed);
-
-#endif
+++ /dev/null
-/*
- LzmaStateDecode.h
- LZMA Decoder interface (State version)
-
- LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01)
- http://www.7-zip.org/
-
- LZMA SDK is licensed under two licenses:
- 1) GNU Lesser General Public License (GNU LGPL)
- 2) Common Public License (CPL)
- It means that you can select one of these two licenses and
- follow rules of that license.
-
- SPECIAL EXCEPTION:
- Igor Pavlov, as the author of this code, expressly permits you to
- statically or dynamically link your code (or bind by name) to the
- interfaces of this file without subjecting your linked code to the
- terms of the CPL or GNU LGPL. Any modifications or additions
- to this file, however, are subject to the LGPL or CPL terms.
-*/
-
-#ifndef __LZMASTATEDECODE_H
-#define __LZMASTATEDECODE_H
-
-#include "LzmaTypes.h"
-
-/* #define _LZMA_PROB32 */
-/* It can increase speed on some 32-bit CPUs,
- but memory usage will be doubled in that case */
-
-#ifdef _LZMA_PROB32
-#define CProb UInt32
-#else
-#define CProb UInt16
-#endif
-
-#define LZMA_RESULT_OK 0
-#define LZMA_RESULT_DATA_ERROR 1
-
-#define LZMA_BASE_SIZE 1846
-#define LZMA_LIT_SIZE 768
-
-#define LZMA_PROPERTIES_SIZE 5
-
-typedef struct _CLzmaProperties
-{
- int lc;
- int lp;
- int pb;
- UInt32 DictionarySize;
-}CLzmaProperties;
-
-int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size);
-
-#define LzmaGetNumProbs(lzmaProps) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((lzmaProps)->lc + (lzmaProps)->lp)))
-
-#define kLzmaInBufferSize 64 /* don't change it. it must be larger than kRequiredInBufferSize */
-
-#define kLzmaNeedInitId (-2)
-
-typedef struct _CLzmaDecoderState
-{
- CLzmaProperties Properties;
- CProb *Probs;
- unsigned char *Dictionary;
-
- unsigned char Buffer[kLzmaInBufferSize];
- int BufferSize;
-
- UInt32 Range;
- UInt32 Code;
- UInt32 DictionaryPos;
- UInt32 GlobalPos;
- UInt32 DistanceLimit;
- UInt32 Reps[4];
- int State;
- int RemainLen; /* -2: decoder needs internal initialization
- -1: stream was finished,
- 0: ok
- > 0: need to write RemainLen bytes as match Reps[0],
- */
- unsigned char TempDictionary[4]; /* it's required when DictionarySize = 0 */
-} CLzmaDecoderState;
-
-#define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; (vs)->BufferSize = 0; }
-
-/* LzmaDecode: decoding from input stream to output stream.
- If finishDecoding != 0, then there are no more bytes in input stream
- after inStream[inSize - 1]. */
-
-int LzmaDecode(CLzmaDecoderState *vs,
- const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
- unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed,
- int finishDecoding);
-
-#endif
+++ /dev/null
-/*
-LzmaTypes.h
-
-Types for LZMA Decoder
-
-This file written and distributed to public domain by Igor Pavlov.
-This file is part of LZMA SDK 4.40 (2006-05-01)
-*/
-
-#ifndef __LZMATYPES_H
-#define __LZMATYPES_H
-
-#ifndef _7ZIP_BYTE_DEFINED
-#define _7ZIP_BYTE_DEFINED
-typedef unsigned char Byte;
-#endif
-
-#ifndef _7ZIP_UINT16_DEFINED
-#define _7ZIP_UINT16_DEFINED
-typedef unsigned short UInt16;
-#endif
-
-#ifndef _7ZIP_UINT32_DEFINED
-#define _7ZIP_UINT32_DEFINED
-#ifdef _LZMA_UINT32_IS_ULONG
-typedef unsigned long UInt32;
-#else
-typedef unsigned int UInt32;
-#endif
-#endif
-
-/* #define _LZMA_NO_SYSTEM_SIZE_T */
-/* You can use it, if you don't want <stddef.h> */
-
-#ifndef _7ZIP_SIZET_DEFINED
-#define _7ZIP_SIZET_DEFINED
-#ifdef _LZMA_NO_SYSTEM_SIZE_T
-typedef UInt32 SizeT;
-#else
-#include <stddef.h>
-typedef size_t SizeT;
-#endif
-#endif
-
-#endif
+++ /dev/null
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-\f
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-\f
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-\f
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-\f
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-\f
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-\f
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-\f
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-\f
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-\f
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
+++ /dev/null
-MODIFIED LZMA
-
-This directory contains a modified version of the LZMA SDK by Igor Pavlov.
-
-This modified version is distributed under the terms of the GNU LGPL (Lesser
-General Public License) v2.1; please see LGPL.txt for details.
-
-A number of files present in the original SDK download have not been
-redistributed.
-
-The following files were modified:
- * Archive/7z/7zIn.c
- * Archive/7z/7zItem.h
-See these files' headings for further details.
+++ /dev/null
-/* 7zTypes.h */
-
-#ifndef __C_TYPES_H
-#define __C_TYPES_H
-
-#ifndef _7ZIP_BYTE_DEFINED
-#define _7ZIP_BYTE_DEFINED
-typedef unsigned char Byte;
-#endif
-
-#ifndef _7ZIP_UINT16_DEFINED
-#define _7ZIP_UINT16_DEFINED
-typedef unsigned short UInt16;
-#endif
-
-#ifndef _7ZIP_UINT32_DEFINED
-#define _7ZIP_UINT32_DEFINED
-#ifdef _LZMA_UINT32_IS_ULONG
-typedef unsigned long UInt32;
-#else
-typedef unsigned int UInt32;
-#endif
-#endif
-
-#ifndef _7ZIP_INT32_DEFINED
-#define _7ZIP_INT32_DEFINED
-#ifdef _LZMA_INT32_IS_ULONG
-typedef long Int32;
-#else
-typedef int Int32;
-#endif
-#endif
-
-/* #define _SZ_NO_INT_64 */
-/* define it your compiler doesn't support long long int */
-
-#ifndef _7ZIP_UINT64_DEFINED
-#define _7ZIP_UINT64_DEFINED
-#ifdef _SZ_NO_INT_64
-typedef unsigned long UInt64;
-#else
-#if defined(_MSC_VER) || defined(__BORLANDC__)
-typedef unsigned __int64 UInt64;
-#else
-typedef unsigned long long int UInt64;
-#endif
-#endif
-#endif
-
-
-/* #define _SZ_FILE_SIZE_32 */
-/* You can define _SZ_FILE_SIZE_32, if you don't need support for files larger than 4 GB*/
-
-#ifndef CFileSize
-#ifdef _SZ_FILE_SIZE_32
-typedef UInt32 CFileSize;
-#else
-typedef UInt64 CFileSize;
-#endif
-#endif
-
-#define SZ_RESULT int
-
-typedef int HRes;
-#define RES_OK (0)
-
-#define SZ_OK (0)
-#define SZE_DATA_ERROR (1)
-#define SZE_CRC_ERROR (3)
-#define SZE_ARCHIVE_ERROR (6)
-
-#define SZE_OUTOFMEMORY (0x8007000EL)
-#define SZE_NOTIMPL (0x80004001L)
-#define SZE_FAIL (0x80004005L)
-#define SZE_INVALIDARG (0x80070057L)
-
-
-#ifndef RINOK
-#define RINOK(x) { HRes __result_ = (x); if(__result_ != 0) return __result_; }
-#endif
-
-typedef int Bool;
-#define True 1
-#define False 0
-
-#ifdef _MSC_VER
-#define StdCall __stdcall
-#else
-#define StdCall
-#endif
-
-#if _MSC_VER >= 1300
-#define MY_FAST_CALL __declspec(noinline) __fastcall
-#elif defined( _MSC_VER)
-#define MY_FAST_CALL __fastcall
-#else
-#define MY_FAST_CALL
-#endif
-
-#endif
2011-03-11 Keith Marshall <keithmarshall@users.sourceforge.net>
+ Remove unused 7zip and boost source code from CVS trunk.
+
+ * 7z: Directory and all content removed.
+ * boost: Likewise.
+
+2011-03-11 Keith Marshall <keithmarshall@users.sourceforge.net>
+
Refactor and update existing installation and usage instructions.
* src/clistub.c (help_text): Updated.
+++ /dev/null
-Boost Software License - Version 1.0 - August 17th, 2003
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
+++ /dev/null
-MODIFIED BOOST
-
-This directory contains a modified version of the Boost library.
-
-This modified version is distributed under the terms of the license contained in
-the file LICENSE_1_0.txt.
-
-A number of files present in the original Boost release have not been
-redistributed.
+++ /dev/null
-//
-// boost/assert.hpp - BOOST_ASSERT(expr)
-//
-// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
-// Copyright (c) 2007 Peter Dimov
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-// Note: There are no include guards. This is intentional.
-//
-// See http://www.boost.org/libs/utility/assert.html for documentation.
-//
-
-#undef BOOST_ASSERT
-
-#if defined(BOOST_DISABLE_ASSERTS)
-
-# define BOOST_ASSERT(expr) ((void)0)
-
-#elif defined(BOOST_ENABLE_ASSERT_HANDLER)
-
-#include <boost/current_function.hpp>
-
-namespace boost
-{
-
-void assertion_failed(char const * expr, char const * function, char const * file, long line); // user defined
-
-} // namespace boost
-
-#define BOOST_ASSERT(expr) ((expr)? ((void)0): ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
-
-#else
-# include <assert.h> // .h to support old libraries w/o <cassert> - effect is the same
-# define BOOST_ASSERT(expr) assert(expr)
-#endif
-
-#undef BOOST_VERIFY
-
-#if defined(BOOST_DISABLE_ASSERTS) || ( !defined(BOOST_ENABLE_ASSERT_HANDLER) && defined(NDEBUG) )
-
-# define BOOST_VERIFY(expr) ((void)(expr))
-
-#else
-
-# define BOOST_VERIFY(expr) BOOST_ASSERT(expr)
-
-#endif
+++ /dev/null
-#ifndef BOOST_CHECKED_DELETE_HPP_INCLUDED
-#define BOOST_CHECKED_DELETE_HPP_INCLUDED
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-//
-// boost/checked_delete.hpp
-//
-// Copyright (c) 2002, 2003 Peter Dimov
-// Copyright (c) 2003 Daniel Frey
-// Copyright (c) 2003 Howard Hinnant
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-// See http://www.boost.org/libs/utility/checked_delete.html for documentation.
-//
-
-namespace boost
-{
-
-// verify that types are complete for increased safety
-
-template<class T> inline void checked_delete(T * x)
-{
- // intentionally complex - simplification causes regressions
- typedef char type_must_be_complete[ sizeof(T)? 1: -1 ];
- (void) sizeof(type_must_be_complete);
- delete x;
-}
-
-template<class T> inline void checked_array_delete(T * x)
-{
- typedef char type_must_be_complete[ sizeof(T)? 1: -1 ];
- (void) sizeof(type_must_be_complete);
- delete [] x;
-}
-
-template<class T> struct checked_deleter
-{
- typedef void result_type;
- typedef T * argument_type;
-
- void operator()(T * x) const
- {
- // boost:: disables ADL
- boost::checked_delete(x);
- }
-};
-
-template<class T> struct checked_array_deleter
-{
- typedef void result_type;
- typedef T * argument_type;
-
- void operator()(T * x) const
- {
- boost::checked_array_delete(x);
- }
-};
-
-} // namespace boost
-
-#endif // #ifndef BOOST_CHECKED_DELETE_HPP_INCLUDED
+++ /dev/null
-// Boost config.hpp configuration header file ------------------------------//
-
-// (C) Copyright John Maddock 2002.
-// Use, modification and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/libs/config for most recent version.
-
-// Boost config.hpp policy and rationale documentation has been moved to
-// http://www.boost.org/libs/config
-//
-// CAUTION: This file is intended to be completely stable -
-// DO NOT MODIFY THIS FILE!
-//
-
-#ifndef BOOST_CONFIG_HPP
-#define BOOST_CONFIG_HPP
-
-// if we don't have a user config, then use the default location:
-#if !defined(BOOST_USER_CONFIG) && !defined(BOOST_NO_USER_CONFIG)
-# define BOOST_USER_CONFIG <boost/config/user.hpp>
-#endif
-// include it first:
-#ifdef BOOST_USER_CONFIG
-# include BOOST_USER_CONFIG
-#endif
-
-// if we don't have a compiler config set, try and find one:
-#if !defined(BOOST_COMPILER_CONFIG) && !defined(BOOST_NO_COMPILER_CONFIG) && !defined(BOOST_NO_CONFIG)
-# include <boost/config/select_compiler_config.hpp>
-#endif
-// if we have a compiler config, include it now:
-#ifdef BOOST_COMPILER_CONFIG
-# include BOOST_COMPILER_CONFIG
-#endif
-
-// if we don't have a std library config set, try and find one:
-#if !defined(BOOST_STDLIB_CONFIG) && !defined(BOOST_NO_STDLIB_CONFIG) && !defined(BOOST_NO_CONFIG)
-# include <boost/config/select_stdlib_config.hpp>
-#endif
-// if we have a std library config, include it now:
-#ifdef BOOST_STDLIB_CONFIG
-# include BOOST_STDLIB_CONFIG
-#endif
-
-// if we don't have a platform config set, try and find one:
-#if !defined(BOOST_PLATFORM_CONFIG) && !defined(BOOST_NO_PLATFORM_CONFIG) && !defined(BOOST_NO_CONFIG)
-# include <boost/config/select_platform_config.hpp>
-#endif
-// if we have a platform config, include it now:
-#ifdef BOOST_PLATFORM_CONFIG
-# include BOOST_PLATFORM_CONFIG
-#endif
-
-// get config suffix code:
-#include <boost/config/suffix.hpp>
-
-#endif // BOOST_CONFIG_HPP
-
-
-
-
-
-
-
-
-
-
-
+++ /dev/null
-// (C) Copyright John Maddock 2001 - 2003.
-// (C) Copyright Darin Adler 2001 - 2002.
-// (C) Copyright Jens Maurer 2001 - 2002.
-// (C) Copyright Beman Dawes 2001 - 2003.
-// (C) Copyright Douglas Gregor 2002.
-// (C) Copyright David Abrahams 2002 - 2003.
-// (C) Copyright Synge Todo 2003.
-// Use, modification and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org for most recent version.
-
-// GNU C++ compiler setup:
-
-#if __GNUC__ < 3
-# if __GNUC_MINOR__ == 91
- // egcs 1.1 won't parse shared_ptr.hpp without this:
-# define BOOST_NO_AUTO_PTR
-# endif
-# if __GNUC_MINOR__ < 95
- //
- // Prior to gcc 2.95 member templates only partly
- // work - define BOOST_MSVC6_MEMBER_TEMPLATES
- // instead since inline member templates mostly work.
- //
-# define BOOST_NO_MEMBER_TEMPLATES
-# if __GNUC_MINOR__ >= 9
-# define BOOST_MSVC6_MEMBER_TEMPLATES
-# endif
-# endif
-
-# if __GNUC_MINOR__ < 96
-# define BOOST_NO_SFINAE
-# endif
-
-# if __GNUC_MINOR__ <= 97
-# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
-# define BOOST_NO_OPERATORS_IN_NAMESPACE
-# endif
-
-# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
-# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
-# define BOOST_NO_IS_ABSTRACT
-#elif __GNUC__ == 3
-# if defined (__PATHSCALE__)
-# define BOOST_NO_TWO_PHASE_NAME_LOOKUP
-# define BOOST_NO_IS_ABSTRACT
-# endif
- //
- // gcc-3.x problems:
- //
- // Bug specific to gcc 3.1 and 3.2:
- //
-# if ((__GNUC_MINOR__ == 1) || (__GNUC_MINOR__ == 2))
-# define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
-# endif
-# if __GNUC_MINOR__ < 4
-# define BOOST_NO_IS_ABSTRACT
-# endif
-#endif
-#if __GNUC__ < 4
-//
-// All problems to gcc-3.x and earlier here:
-//
-#define BOOST_NO_TWO_PHASE_NAME_LOOKUP
-#endif
-
-#ifndef __EXCEPTIONS
-# define BOOST_NO_EXCEPTIONS
-#endif
-
-
-//
-// Threading support: Turn this on unconditionally here (except for
-// those platforms where we can know for sure). It will get turned off again
-// later if no threading API is detected.
-//
-#if !defined(__MINGW32__) && !defined(linux) && !defined(__linux) && !defined(__linux__)
-# define BOOST_HAS_THREADS
-#endif
-
-//
-// gcc has "long long"
-//
-#define BOOST_HAS_LONG_LONG
-
-//
-// gcc implements the named return value optimization since version 3.1
-//
-#if __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 )
-#define BOOST_HAS_NRVO
-#endif
-
-//
-// C++0x features
-//
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)
-// C++0x features are only enabled when -std=c++0x or -std=gnu++0x are
-// passed on the command line, which in turn defines
-// __GXX_EXPERIMENTAL_CXX0X__.
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define BOOST_HAS_STATIC_ASSERT
-# define BOOST_HAS_VARIADIC_TMPL
-# define BOOST_HAS_RVALUE_REFS
-# define BOOST_HAS_DECLTYPE
-# endif
-#endif
-
-//
-// Potential C++0x features
-//
-
-// Variadic templates compiler:
-// http://www.generic-programming.org/~dgregor/cpp/variadic-templates.html
-#ifdef __VARIADIC_TEMPLATES
-# define BOOST_HAS_VARIADIC_TMPL
-#endif
-
-// ConceptGCC compiler:
-// http://www.generic-programming.org/software/ConceptGCC/
-#ifdef __GXX_CONCEPTS__
-# define BOOST_HAS_CONCEPTS
-# define BOOST_COMPILER "ConceptGCC version " __VERSION__
-#endif
-
-#ifndef BOOST_COMPILER
-# define BOOST_COMPILER "GNU C++ version " __VERSION__
-#endif
-
-//
-// versions check:
-// we don't know gcc prior to version 2.90:
-#if (__GNUC__ == 2) && (__GNUC_MINOR__ < 90)
-# error "Compiler not configured - please reconfigure"
-#endif
-//
-// last known and checked version is 4.3 (Pre-release):
-#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 3))
-# if defined(BOOST_ASSERT_CONFIG)
-# error "Unknown compiler version - please run the configure tests and report the results"
-# else
-// we don't emit warnings here anymore since there are no defect macros defined for
-// gcc post 3.4, so any failures are gcc regressions...
-//# warning "Unknown compiler version - please run the configure tests and report the results"
-# endif
-#endif
-
-
+++ /dev/null
-// (C) Copyright John Maddock 2005.
-// Use, modification and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-// The aim of this header is just to include <utility> but to do
-// so in a way that does not result in recursive inclusion of
-// the Boost TR1 components if boost/tr1/tr1/utility is in the
-// include search path. We have to do this to avoid circular
-// dependencies:
-//
-
-#ifndef BOOST_CONFIG_UTILITY
-# define BOOST_CONFIG_UTILITY
-
-# ifndef BOOST_TR1_NO_RECURSION
-# define BOOST_TR1_NO_RECURSION
-# define BOOST_CONFIG_NO_UTILITY_RECURSION
-# endif
-
-# include <utility>
-
-# ifdef BOOST_CONFIG_NO_UTILITY_RECURSION
-# undef BOOST_TR1_NO_RECURSION
-# undef BOOST_CONFIG_NO_UTILITY_RECURSION
-# endif
-
-#endif
+++ /dev/null
-// (C) Copyright John Maddock 2001 - 2003.
-// (C) Copyright Bill Kempf 2001.
-// (C) Copyright Aleksey Gurtovoy 2003.
-// (C) Copyright Rene Rivera 2005.
-// Use, modification and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org for most recent version.
-
-// Win32 specific config options:
-
-#define BOOST_PLATFORM "Win32"
-
-// Get the information about the MinGW runtime, i.e. __MINGW32_*VERSION.
-#if defined(__MINGW32__)
-# include <_mingw.h>
-#endif
-
-#if defined(__GNUC__) && !defined(BOOST_NO_SWPRINTF)
-# define BOOST_NO_SWPRINTF
-#endif
-
-#if !defined(__GNUC__) && !defined(BOOST_HAS_DECLSPEC)
-# define BOOST_HAS_DECLSPEC
-#endif
-
-#if defined(__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 2) || ((__MINGW32_MAJOR_VERSION == 2) && (__MINGW32_MINOR_VERSION >= 0)))
-# define BOOST_HAS_STDINT_H
-# define __STDC_LIMIT_MACROS
-# define BOOST_HAS_DIRENT_H
-# define BOOST_HAS_UNISTD_H
-#endif
-
-//
-// Win32 will normally be using native Win32 threads,
-// but there is a pthread library avaliable as an option,
-// we used to disable this when BOOST_DISABLE_WIN32 was
-// defined but no longer - this should allow some
-// files to be compiled in strict mode - while maintaining
-// a consistent setting of BOOST_HAS_THREADS across
-// all translation units (needed for shared_ptr etc).
-//
-
-#ifdef _WIN32_WCE
-# define BOOST_NO_ANSI_APIS
-#endif
-
-#ifndef BOOST_HAS_PTHREADS
-# define BOOST_HAS_WINTHREADS
-#endif
-
-#ifndef BOOST_DISABLE_WIN32
-// WEK: Added
-#define BOOST_HAS_FTIME
-#define BOOST_WINDOWS 1
-
-#endif
+++ /dev/null
-// Boost compiler configuration selection header file
-
-// (C) Copyright John Maddock 2001 - 2003.
-// (C) Copyright Martin Wille 2003.
-// (C) Copyright Guillaume Melquiond 2003.
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/ for most recent version.
-
-
-// one identification macro for each of the
-// compilers we support:
-
-# define BOOST_CXX_GCCXML 0
-# define BOOST_CXX_COMO 0
-# define BOOST_CXX_DMC 0
-# define BOOST_CXX_INTEL 0
-# define BOOST_CXX_GNUC 0
-# define BOOST_CXX_KCC 0
-# define BOOST_CXX_SGI 0
-# define BOOST_CXX_TRU64 0
-# define BOOST_CXX_GHS 0
-# define BOOST_CXX_BORLAND 0
-# define BOOST_CXX_CW 0
-# define BOOST_CXX_SUNPRO 0
-# define BOOST_CXX_HPACC 0
-# define BOOST_CXX_MPW 0
-# define BOOST_CXX_IBMCPP 0
-# define BOOST_CXX_MSVC 0
-# define BOOST_CXX_PGI 0
-
-
-// locate which compiler we are using and define
-// BOOST_COMPILER_CONFIG as needed:
-
-#if defined(__GCCXML__)
-// GCC-XML emulates other compilers, it has to appear first here!
-# define BOOST_COMPILER_CONFIG "boost/config/compiler/gcc_xml.hpp"
-
-#elif defined __COMO__
-// Comeau C++
-# define BOOST_COMPILER_CONFIG "boost/config/compiler/comeau.hpp"
-
-#elif defined __DMC__
-// Digital Mars C++
-# define BOOST_COMPILER_CONFIG "boost/config/compiler/digitalmars.hpp"
-
-#elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)
-// Intel
-# define BOOST_COMPILER_CONFIG "boost/config/compiler/intel.hpp"
-
-# elif defined __GNUC__
-// GNU C++:
-# define BOOST_COMPILER_CONFIG "boost/config/compiler/gcc.hpp"
-
-#elif defined __KCC
-// Kai C++
-# define BOOST_COMPILER_CONFIG "boost/config/compiler/kai.hpp"
-
-#elif defined __sgi
-// SGI MIPSpro C++
-# define BOOST_COMPILER_CONFIG "boost/config/compiler/sgi_mipspro.hpp"
-
-#elif defined __DECCXX
-// Compaq Tru64 Unix cxx
-# define BOOST_COMPILER_CONFIG "boost/config/compiler/compaq_cxx.hpp"
-
-#elif defined __ghs
-// Greenhills C++
-# define BOOST_COMPILER_CONFIG "boost/config/compiler/greenhills.hpp"
-
-#elif defined __BORLANDC__
-// Borland
-# define BOOST_COMPILER_CONFIG "boost/config/compiler/borland.hpp"
-
-#elif defined __MWERKS__
-// Metrowerks CodeWarrior
-# define BOOST_COMPILER_CONFIG "boost/config/compiler/metrowerks.hpp"
-
-#elif defined __SUNPRO_CC
-// Sun Workshop Compiler C++
-# define BOOST_COMPILER_CONFIG "boost/config/compiler/sunpro_cc.hpp"
-
-#elif defined __HP_aCC
-// HP aCC
-# define BOOST_COMPILER_CONFIG "boost/config/compiler/hp_acc.hpp"
-
-#elif defined(__MRC__) || defined(__SC__)
-// MPW MrCpp or SCpp
-# define BOOST_COMPILER_CONFIG "boost/config/compiler/mpw.hpp"
-
-#elif defined(__IBMCPP__)
-// IBM Visual Age
-# define BOOST_COMPILER_CONFIG "boost/config/compiler/vacpp.hpp"
-
-#elif defined(__PGI)
-// Portland Group Inc.
-# define BOOST_COMPILER_CONFIG "boost/config/compiler/pgi.hpp"
-
-#elif defined _MSC_VER
-// Microsoft Visual C++
-//
-// Must remain the last #elif since some other vendors (Metrowerks, for
-// example) also #define _MSC_VER
-# define BOOST_COMPILER_CONFIG "boost/config/compiler/visualc.hpp"
-
-#elif defined (BOOST_ASSERT_CONFIG)
-// this must come last - generate an error if we don't
-// recognise the compiler:
-# error "Unknown compiler - please configure (http://www.boost.org/libs/config/config.htm#configuring) and report the results to the main boost mailing list (http://www.boost.org/more/mailing_lists.htm#main)"
-
-#endif
+++ /dev/null
-// Boost compiler configuration selection header file
-
-// (C) Copyright John Maddock 2001 - 2002.
-// (C) Copyright Jens Maurer 2001.
-// Use, modification and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org for most recent version.
-
-// locate which platform we are on and define BOOST_PLATFORM_CONFIG as needed.
-// Note that we define the headers to include using "header_name" not
-// <header_name> in order to prevent macro expansion within the header
-// name (for example "linux" is a macro on linux systems).
-
-#if defined(linux) || defined(__linux) || defined(__linux__)
-// linux:
-# define BOOST_PLATFORM_CONFIG "boost/config/platform/linux.hpp"
-
-#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
-// BSD:
-# define BOOST_PLATFORM_CONFIG "boost/config/platform/bsd.hpp"
-
-#elif defined(sun) || defined(__sun)
-// solaris:
-# define BOOST_PLATFORM_CONFIG "boost/config/platform/solaris.hpp"
-
-#elif defined(__sgi)
-// SGI Irix:
-# define BOOST_PLATFORM_CONFIG "boost/config/platform/irix.hpp"
-
-#elif defined(__hpux)
-// hp unix:
-# define BOOST_PLATFORM_CONFIG "boost/config/platform/hpux.hpp"
-
-#elif defined(__CYGWIN__)
-// cygwin is not win32:
-# define BOOST_PLATFORM_CONFIG "boost/config/platform/cygwin.hpp"
-
-#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
-// win32:
-# define BOOST_PLATFORM_CONFIG "boost/config/platform/win32.hpp"
-
-#elif defined(__BEOS__)
-// BeOS
-# define BOOST_PLATFORM_CONFIG "boost/config/platform/beos.hpp"
-
-#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
-// MacOS
-# define BOOST_PLATFORM_CONFIG "boost/config/platform/macos.hpp"
-
-#elif defined(__IBMCPP__) || defined(_AIX)
-// IBM
-# define BOOST_PLATFORM_CONFIG "boost/config/platform/aix.hpp"
-
-#elif defined(__amigaos__)
-// AmigaOS
-# define BOOST_PLATFORM_CONFIG "boost/config/platform/amigaos.hpp"
-
-#elif defined(__QNXNTO__)
-// QNX:
-# define BOOST_PLATFORM_CONFIG "boost/config/platform/qnxnto.hpp"
-
-#else
-
-# if defined(unix) \
- || defined(__unix) \
- || defined(_XOPEN_SOURCE) \
- || defined(_POSIX_SOURCE)
-
- // generic unix platform:
-
-# ifndef BOOST_HAS_UNISTD_H
-# define BOOST_HAS_UNISTD_H
-# endif
-
-# include <boost/config/posix_features.hpp>
-
-# endif
-
-# if defined (BOOST_ASSERT_CONFIG)
- // this must come last - generate an error if we don't
- // recognise the platform:
-# error "Unknown platform - please configure and report the results to boost.org"
-# endif
-
-#endif
-
-
-
+++ /dev/null
-// Boost compiler configuration selection header file
-
-// (C) Copyright John Maddock 2001 - 2003.
-// (C) Copyright Jens Maurer 2001 - 2002.
-// Use, modification and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-
-// See http://www.boost.org for most recent version.
-
-// locate which std lib we are using and define BOOST_STDLIB_CONFIG as needed:
-
-// we need to include a std lib header here in order to detect which
-// library is in use, use <utility> as it's about the smallest
-// of the std lib headers - do not rely on this header being included -
-// users can short-circuit this header if they know whose std lib
-// they are using.
-
-#include <boost/config/no_tr1/utility.hpp>
-
-#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
-// STLPort library; this _must_ come first, otherwise since
-// STLport typically sits on top of some other library, we
-// can end up detecting that first rather than STLport:
-# define BOOST_STDLIB_CONFIG "boost/config/stdlib/stlport.hpp"
-
-#elif defined(__LIBCOMO__)
-// Comeau STL:
-#define BOOST_STDLIB_CONFIG "boost/config/stdlib/libcomo.hpp"
-
-#elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER)
-// Rogue Wave library:
-# define BOOST_STDLIB_CONFIG "boost/config/stdlib/roguewave.hpp"
-
-#elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
-// GNU libstdc++ 3
-# define BOOST_STDLIB_CONFIG "boost/config/stdlib/libstdcpp3.hpp"
-
-#elif defined(__STL_CONFIG_H)
-// generic SGI STL
-# define BOOST_STDLIB_CONFIG "boost/config/stdlib/sgi.hpp"
-
-#elif defined(__MSL_CPP__)
-// MSL standard lib:
-# define BOOST_STDLIB_CONFIG "boost/config/stdlib/msl.hpp"
-
-#elif defined(__IBMCPP__)
-// take the default VACPP std lib
-# define BOOST_STDLIB_CONFIG "boost/config/stdlib/vacpp.hpp"
-
-#elif defined(MSIPL_COMPILE_H)
-// Modena C++ standard library
-# define BOOST_STDLIB_CONFIG "boost/config/stdlib/modena.hpp"
-
-#elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER)
-// Dinkumware Library (this has to appear after any possible replacement libraries):
-# define BOOST_STDLIB_CONFIG "boost/config/stdlib/dinkumware.hpp"
-
-#elif defined (BOOST_ASSERT_CONFIG)
-// this must come last - generate an error if we don't
-// recognise the library:
-# error "Unknown standard library - please configure and report the results to boost.org"
-
-#endif
-
-
-
+++ /dev/null
-// (C) Copyright John Maddock 2001.
-// (C) Copyright Jens Maurer 2001.
-// Use, modification and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org for most recent version.
-
-// config for libstdc++ v3
-// not much to go in here:
-
-#ifdef __GLIBCXX__
-#define BOOST_STDLIB "GNU libstdc++ version " BOOST_STRINGIZE(__GLIBCXX__)
-#else
-#define BOOST_STDLIB "GNU libstdc++ version " BOOST_STRINGIZE(__GLIBCPP__)
-#endif
-
-#if !defined(_GLIBCPP_USE_WCHAR_T) && !defined(_GLIBCXX_USE_WCHAR_T)
-# define BOOST_NO_CWCHAR
-# define BOOST_NO_CWCTYPE
-# define BOOST_NO_STD_WSTRING
-# define BOOST_NO_STD_WSTREAMBUF
-#endif
-
-#if defined(__osf__) && !defined(_REENTRANT) \
- && ( defined(_GLIBCXX_HAVE_GTHR_DEFAULT) || defined(_GLIBCPP_HAVE_GTHR_DEFAULT) )
-// GCC 3 on Tru64 forces the definition of _REENTRANT when any std lib header
-// file is included, therefore for consistency we define it here as well.
-# define _REENTRANT
-#endif
-
-#ifdef __GLIBCXX__ // gcc 3.4 and greater:
-# if defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
- || defined(_GLIBCXX__PTHREADS)
- //
- // If the std lib has thread support turned on, then turn it on in Boost
- // as well. We do this because some gcc-3.4 std lib headers define _REENTANT
- // while others do not...
- //
-# define BOOST_HAS_THREADS
-# else
-# define BOOST_DISABLE_THREADS
-# endif
-#elif defined(__GLIBCPP__) \
- && !defined(_GLIBCPP_HAVE_GTHR_DEFAULT) \
- && !defined(_GLIBCPP__PTHREADS)
- // disable thread support if the std lib was built single threaded:
-# define BOOST_DISABLE_THREADS
-#endif
-
-#if (defined(linux) || defined(__linux) || defined(__linux__)) && defined(__arm__) && defined(_GLIBCPP_HAVE_GTHR_DEFAULT)
-// linux on arm apparently doesn't define _REENTRANT
-// so just turn on threading support whenever the std lib is thread safe:
-# define BOOST_HAS_THREADS
-#endif
-
-
-#if !defined(_GLIBCPP_USE_LONG_LONG) \
- && !defined(_GLIBCXX_USE_LONG_LONG)\
- && defined(BOOST_HAS_LONG_LONG)
-// May have been set by compiler/*.hpp, but "long long" without library
-// support is useless.
-# undef BOOST_HAS_LONG_LONG
-#endif
-
-#if defined(__GLIBCXX__) || (defined(__GLIBCPP__) && __GLIBCPP__>=20020514) // GCC >= 3.1.0
-# define BOOST_STD_EXTENSION_NAMESPACE __gnu_cxx
-# define BOOST_HAS_SLIST
-# define BOOST_HAS_HASH
-# define BOOST_SLIST_HEADER <ext/slist>
-# define BOOST_HASH_SET_HEADER <ext/hash_set>
-# define BOOST_HASH_MAP_HEADER <ext/hash_map>
-#endif
+++ /dev/null
-// Boost config.hpp configuration header file ------------------------------//
-
-// (C) Copyright John Maddock 2001 - 2003.
-// (C) Copyright Darin Adler 2001.
-// (C) Copyright Peter Dimov 2001.
-// (C) Copyright Bill Kempf 2002.
-// (C) Copyright Jens Maurer 2002.
-// (C) Copyright David Abrahams 2002 - 2003.
-// (C) Copyright Gennaro Prota 2003.
-// (C) Copyright Eric Friedman 2003.
-// Use, modification and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org for most recent version.
-
-// Boost config.hpp policy and rationale documentation has been moved to
-// http://www.boost.org/libs/config
-//
-// This file is intended to be stable, and relatively unchanging.
-// It should contain boilerplate code only - no compiler specific
-// code unless it is unavoidable - no changes unless unavoidable.
-
-#ifndef BOOST_CONFIG_SUFFIX_HPP
-#define BOOST_CONFIG_SUFFIX_HPP
-
-//
-// look for long long by looking for the appropriate macros in <limits.h>.
-// Note that we use limits.h rather than climits for maximal portability,
-// remember that since these just declare a bunch of macros, there should be
-// no namespace issues from this.
-//
-#if !defined(BOOST_HAS_LONG_LONG) \
- && !defined(BOOST_MSVC) && !defined(__BORLANDC__)
-# include <limits.h>
-# if (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX))
-# define BOOST_HAS_LONG_LONG
-# endif
-#endif
-
-// GCC 3.x will clean up all of those nasty macro definitions that
-// BOOST_NO_CTYPE_FUNCTIONS is intended to help work around, so undefine
-// it under GCC 3.x.
-#if defined(__GNUC__) && (__GNUC__ >= 3) && defined(BOOST_NO_CTYPE_FUNCTIONS)
-# undef BOOST_NO_CTYPE_FUNCTIONS
-#endif
-
-//
-// Assume any extensions are in namespace std:: unless stated otherwise:
-//
-# ifndef BOOST_STD_EXTENSION_NAMESPACE
-# define BOOST_STD_EXTENSION_NAMESPACE std
-# endif
-
-//
-// If cv-qualified specializations are not allowed, then neither are cv-void ones:
-//
-# if defined(BOOST_NO_CV_SPECIALIZATIONS) \
- && !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS)
-# define BOOST_NO_CV_VOID_SPECIALIZATIONS
-# endif
-
-//
-// If there is no numeric_limits template, then it can't have any compile time
-// constants either!
-//
-# if defined(BOOST_NO_LIMITS) \
- && !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS)
-# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
-# define BOOST_NO_MS_INT64_NUMERIC_LIMITS
-# define BOOST_NO_LONG_LONG_NUMERIC_LIMITS
-# endif
-
-//
-// if there is no long long then there is no specialisation
-// for numeric_limits<long long> either:
-//
-#if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS)
-# define BOOST_NO_LONG_LONG_NUMERIC_LIMITS
-#endif
-
-//
-// if there is no __int64 then there is no specialisation
-// for numeric_limits<__int64> either:
-//
-#if !defined(BOOST_HAS_MS_INT64) && !defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS)
-# define BOOST_NO_MS_INT64_NUMERIC_LIMITS
-#endif
-
-//
-// if member templates are supported then so is the
-// VC6 subset of member templates:
-//
-# if !defined(BOOST_NO_MEMBER_TEMPLATES) \
- && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
-# define BOOST_MSVC6_MEMBER_TEMPLATES
-# endif
-
-//
-// Without partial specialization, can't test for partial specialisation bugs:
-//
-# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
- && !defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG)
-# define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG
-# endif
-
-//
-// Without partial specialization, we can't have array-type partial specialisations:
-//
-# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
- && !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
-# define BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS
-# endif
-
-//
-// Without partial specialization, std::iterator_traits can't work:
-//
-# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
- && !defined(BOOST_NO_STD_ITERATOR_TRAITS)
-# define BOOST_NO_STD_ITERATOR_TRAITS
-# endif
-
-//
-// Without member template support, we can't have template constructors
-// in the standard library either:
-//
-# if defined(BOOST_NO_MEMBER_TEMPLATES) \
- && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) \
- && !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
-# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
-# endif
-
-//
-// Without member template support, we can't have a conforming
-// std::allocator template either:
-//
-# if defined(BOOST_NO_MEMBER_TEMPLATES) \
- && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) \
- && !defined(BOOST_NO_STD_ALLOCATOR)
-# define BOOST_NO_STD_ALLOCATOR
-# endif
-
-//
-// without ADL support then using declarations will break ADL as well:
-//
-#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) && !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL)
-# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
-#endif
-
-//
-// If we have a standard allocator, then we have a partial one as well:
-//
-#if !defined(BOOST_NO_STD_ALLOCATOR)
-# define BOOST_HAS_PARTIAL_STD_ALLOCATOR
-#endif
-
-//
-// We can't have a working std::use_facet if there is no std::locale:
-//
-# if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_USE_FACET)
-# define BOOST_NO_STD_USE_FACET
-# endif
-
-//
-// We can't have a std::messages facet if there is no std::locale:
-//
-# if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_MESSAGES)
-# define BOOST_NO_STD_MESSAGES
-# endif
-
-//
-// We can't have a working std::wstreambuf if there is no std::locale:
-//
-# if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_WSTREAMBUF)
-# define BOOST_NO_STD_WSTREAMBUF
-# endif
-
-//
-// We can't have a <cwctype> if there is no <cwchar>:
-//
-# if defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_CWCTYPE)
-# define BOOST_NO_CWCTYPE
-# endif
-
-//
-// We can't have a swprintf if there is no <cwchar>:
-//
-# if defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_SWPRINTF)
-# define BOOST_NO_SWPRINTF
-# endif
-
-//
-// If Win32 support is turned off, then we must turn off
-// threading support also, unless there is some other
-// thread API enabled:
-//
-#if defined(BOOST_DISABLE_WIN32) && defined(_WIN32) \
- && !defined(BOOST_DISABLE_THREADS) && !defined(BOOST_HAS_PTHREADS)
-# define BOOST_DISABLE_THREADS
-#endif
-
-//
-// Turn on threading support if the compiler thinks that it's in
-// multithreaded mode. We put this here because there are only a
-// limited number of macros that identify this (if there's any missing
-// from here then add to the appropriate compiler section):
-//
-#if (defined(__MT__) || defined(_MT) || defined(_REENTRANT) \
- || defined(_PTHREADS)) && !defined(BOOST_HAS_THREADS)
-# define BOOST_HAS_THREADS
-#endif
-
-//
-// Turn threading support off if BOOST_DISABLE_THREADS is defined:
-//
-#if defined(BOOST_DISABLE_THREADS) && defined(BOOST_HAS_THREADS)
-# undef BOOST_HAS_THREADS
-#endif
-
-//
-// Turn threading support off if we don't recognise the threading API:
-//
-#if defined(BOOST_HAS_THREADS) && !defined(BOOST_HAS_PTHREADS)\
- && !defined(BOOST_HAS_WINTHREADS) && !defined(BOOST_HAS_BETHREADS)\
- && !defined(BOOST_HAS_MPTASKS)
-# undef BOOST_HAS_THREADS
-#endif
-
-//
-// Turn threading detail macros off if we don't (want to) use threading
-//
-#ifndef BOOST_HAS_THREADS
-# undef BOOST_HAS_PTHREADS
-# undef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
-# undef BOOST_HAS_WINTHREADS
-# undef BOOST_HAS_BETHREADS
-# undef BOOST_HAS_MPTASKS
-#endif
-
-//
-// If the compiler claims to be C99 conformant, then it had better
-// have a <stdint.h>:
-//
-# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
-# define BOOST_HAS_STDINT_H
-# ifndef BOOST_HAS_LOG1P
-# define BOOST_HAS_LOG1P
-# endif
-# ifndef BOOST_HAS_EXPM1
-# define BOOST_HAS_EXPM1
-# endif
-# endif
-
-//
-// Define BOOST_NO_SLIST and BOOST_NO_HASH if required.
-// Note that this is for backwards compatibility only.
-//
-# ifndef BOOST_HAS_SLIST
-# define BOOST_NO_SLIST
-# endif
-
-# ifndef BOOST_HAS_HASH
-# define BOOST_NO_HASH
-# endif
-
-//
-// Set BOOST_SLIST_HEADER if not set already:
-//
-#if defined(BOOST_HAS_SLIST) && !defined(BOOST_SLIST_HEADER)
-# define BOOST_SLIST_HEADER <slist>
-#endif
-
-//
-// Set BOOST_HASH_SET_HEADER if not set already:
-//
-#if defined(BOOST_HAS_HASH) && !defined(BOOST_HASH_SET_HEADER)
-# define BOOST_HASH_SET_HEADER <hash_set>
-#endif
-
-//
-// Set BOOST_HASH_MAP_HEADER if not set already:
-//
-#if defined(BOOST_HAS_HASH) && !defined(BOOST_HASH_MAP_HEADER)
-# define BOOST_HASH_MAP_HEADER <hash_map>
-#endif
-
-// BOOST_HAS_ABI_HEADERS
-// This macro gets set if we have headers that fix the ABI,
-// and prevent ODR violations when linking to external libraries:
-#if defined(BOOST_ABI_PREFIX) && defined(BOOST_ABI_SUFFIX) && !defined(BOOST_HAS_ABI_HEADERS)
-# define BOOST_HAS_ABI_HEADERS
-#endif
-
-#if defined(BOOST_HAS_ABI_HEADERS) && defined(BOOST_DISABLE_ABI_HEADERS)
-# undef BOOST_HAS_ABI_HEADERS
-#endif
-
-// BOOST_NO_STDC_NAMESPACE workaround --------------------------------------//
-// Because std::size_t usage is so common, even in boost headers which do not
-// otherwise use the C library, the <cstddef> workaround is included here so
-// that ugly workaround code need not appear in many other boost headers.
-// NOTE WELL: This is a workaround for non-conforming compilers; <cstddef>
-// must still be #included in the usual places so that <cstddef> inclusion
-// works as expected with standard conforming compilers. The resulting
-// double inclusion of <cstddef> is harmless.
-
-# ifdef BOOST_NO_STDC_NAMESPACE
-# include <cstddef>
- namespace std { using ::ptrdiff_t; using ::size_t; }
-# endif
-
-// Workaround for the unfortunate min/max macros defined by some platform headers
-
-#define BOOST_PREVENT_MACRO_SUBSTITUTION
-
-#ifndef BOOST_USING_STD_MIN
-# define BOOST_USING_STD_MIN() using std::min
-#endif
-
-#ifndef BOOST_USING_STD_MAX
-# define BOOST_USING_STD_MAX() using std::max
-#endif
-
-// BOOST_NO_STD_MIN_MAX workaround -----------------------------------------//
-
-# ifdef BOOST_NO_STD_MIN_MAX
-
-namespace std {
- template <class _Tp>
- inline const _Tp& min BOOST_PREVENT_MACRO_SUBSTITUTION (const _Tp& __a, const _Tp& __b) {
- return __b < __a ? __b : __a;
- }
- template <class _Tp>
- inline const _Tp& max BOOST_PREVENT_MACRO_SUBSTITUTION (const _Tp& __a, const _Tp& __b) {
- return __a < __b ? __b : __a;
- }
-}
-
-# endif
-
-// BOOST_STATIC_CONSTANT workaround --------------------------------------- //
-// On compilers which don't allow in-class initialization of static integral
-// constant members, we must use enums as a workaround if we want the constants
-// to be available at compile-time. This macro gives us a convenient way to
-// declare such constants.
-
-# ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
-# define BOOST_STATIC_CONSTANT(type, assignment) enum { assignment }
-# else
-# define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment
-# endif
-
-// BOOST_USE_FACET / HAS_FACET workaround ----------------------------------//
-// When the standard library does not have a conforming std::use_facet there
-// are various workarounds available, but they differ from library to library.
-// The same problem occurs with has_facet.
-// These macros provide a consistent way to access a locale's facets.
-// Usage:
-// replace
-// std::use_facet<Type>(loc);
-// with
-// BOOST_USE_FACET(Type, loc);
-// Note do not add a std:: prefix to the front of BOOST_USE_FACET!
-// Use for BOOST_HAS_FACET is analagous.
-
-#if defined(BOOST_NO_STD_USE_FACET)
-# ifdef BOOST_HAS_TWO_ARG_USE_FACET
-# define BOOST_USE_FACET(Type, loc) std::use_facet(loc, static_cast<Type*>(0))
-# define BOOST_HAS_FACET(Type, loc) std::has_facet(loc, static_cast<Type*>(0))
-# elif defined(BOOST_HAS_MACRO_USE_FACET)
-# define BOOST_USE_FACET(Type, loc) std::_USE(loc, Type)
-# define BOOST_HAS_FACET(Type, loc) std::_HAS(loc, Type)
-# elif defined(BOOST_HAS_STLP_USE_FACET)
-# define BOOST_USE_FACET(Type, loc) (*std::_Use_facet<Type >(loc))
-# define BOOST_HAS_FACET(Type, loc) std::has_facet< Type >(loc)
-# endif
-#else
-# define BOOST_USE_FACET(Type, loc) std::use_facet< Type >(loc)
-# define BOOST_HAS_FACET(Type, loc) std::has_facet< Type >(loc)
-#endif
-
-// BOOST_NESTED_TEMPLATE workaround ------------------------------------------//
-// Member templates are supported by some compilers even though they can't use
-// the A::template member<U> syntax, as a workaround replace:
-//
-// typedef typename A::template rebind<U> binder;
-//
-// with:
-//
-// typedef typename A::BOOST_NESTED_TEMPLATE rebind<U> binder;
-
-#ifndef BOOST_NO_MEMBER_TEMPLATE_KEYWORD
-# define BOOST_NESTED_TEMPLATE template
-#else
-# define BOOST_NESTED_TEMPLATE
-#endif
-
-// BOOST_UNREACHABLE_RETURN(x) workaround -------------------------------------//
-// Normally evaluates to nothing, unless BOOST_NO_UNREACHABLE_RETURN_DETECTION
-// is defined, in which case it evaluates to return x; Use when you have a return
-// statement that can never be reached.
-
-#ifdef BOOST_NO_UNREACHABLE_RETURN_DETECTION
-# define BOOST_UNREACHABLE_RETURN(x) return x;
-#else
-# define BOOST_UNREACHABLE_RETURN(x)
-#endif
-
-// BOOST_DEDUCED_TYPENAME workaround ------------------------------------------//
-//
-// Some compilers don't support the use of `typename' for dependent
-// types in deduced contexts, e.g.
-//
-// template <class T> void f(T, typename T::type);
-// ^^^^^^^^
-// Replace these declarations with:
-//
-// template <class T> void f(T, BOOST_DEDUCED_TYPENAME T::type);
-
-#ifndef BOOST_NO_DEDUCED_TYPENAME
-# define BOOST_DEDUCED_TYPENAME typename
-#else
-# define BOOST_DEDUCED_TYPENAME
-#endif
-
-// long long workaround ------------------------------------------//
-// On gcc (and maybe other compilers?) long long is alway supported
-// but it's use may generate either warnings (with -ansi), or errors
-// (with -pedantic -ansi) unless it's use is prefixed by __extension__
-//
-#if defined(BOOST_HAS_LONG_LONG)
-namespace boost{
-# ifdef __GNUC__
- __extension__ typedef long long long_long_type;
- __extension__ typedef unsigned long long ulong_long_type;
-# else
- typedef long long long_long_type;
- typedef unsigned long long ulong_long_type;
-# endif
-}
-#endif
-
-// BOOST_[APPEND_]EXPLICIT_TEMPLATE_[NON_]TYPE macros --------------------------//
-//
-// Some compilers have problems with function templates whose
-// template parameters don't appear in the function parameter
-// list (basically they just link one instantiation of the
-// template in the final executable). These macros provide a
-// uniform way to cope with the problem with no effects on the
-// calling syntax.
-
-// Example:
-//
-// #include <iostream>
-// #include <ostream>
-// #include <typeinfo>
-//
-// template <int n>
-// void f() { std::cout << n << ' '; }
-//
-// template <typename T>
-// void g() { std::cout << typeid(T).name() << ' '; }
-//
-// int main() {
-// f<1>();
-// f<2>();
-//
-// g<int>();
-// g<double>();
-// }
-//
-// With VC++ 6.0 the output is:
-//
-// 2 2 double double
-//
-// To fix it, write
-//
-// template <int n>
-// void f(BOOST_EXPLICIT_TEMPLATE_NON_TYPE(int, n)) { ... }
-//
-// template <typename T>
-// void g(BOOST_EXPLICIT_TEMPLATE_TYPE(T)) { ... }
-//
-
-
-#if defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
-
-# include "boost/type.hpp"
-# include "boost/non_type.hpp"
-
-# define BOOST_EXPLICIT_TEMPLATE_TYPE(t) boost::type<t>* = 0
-# define BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) boost::type<t>*
-# define BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) boost::non_type<t, v>* = 0
-# define BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) boost::non_type<t, v>*
-
-# define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t) \
- , BOOST_EXPLICIT_TEMPLATE_TYPE(t)
-# define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) \
- , BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
-# define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) \
- , BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
-# define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) \
- , BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
-
-#else
-
-// no workaround needed: expand to nothing
-
-# define BOOST_EXPLICIT_TEMPLATE_TYPE(t)
-# define BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
-# define BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
-# define BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
-
-# define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t)
-# define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
-# define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
-# define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
-
-
-#endif // defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
-
-
-// ---------------------------------------------------------------------------//
-
-//
-// Helper macro BOOST_STRINGIZE:
-// Converts the parameter X to a string after macro replacement
-// on X has been performed.
-//
-#define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X)
-#define BOOST_DO_STRINGIZE(X) #X
-
-//
-// Helper macro BOOST_JOIN:
-// The following piece of macro magic joins the two
-// arguments together, even when one of the arguments is
-// itself a macro (see 16.3.1 in C++ standard). The key
-// is that macro expansion of macro arguments does not
-// occur in BOOST_DO_JOIN2 but does in BOOST_DO_JOIN.
-//
-#define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y )
-#define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y)
-#define BOOST_DO_JOIN2( X, Y ) X##Y
-
-//
-// Set some default values for compiler/library/platform names.
-// These are for debugging config setup only:
-//
-# ifndef BOOST_COMPILER
-# define BOOST_COMPILER "Unknown ISO C++ Compiler"
-# endif
-# ifndef BOOST_STDLIB
-# define BOOST_STDLIB "Unknown ISO standard library"
-# endif
-# ifndef BOOST_PLATFORM
-# if defined(unix) || defined(__unix) || defined(_XOPEN_SOURCE) \
- || defined(_POSIX_SOURCE)
-# define BOOST_PLATFORM "Generic Unix"
-# else
-# define BOOST_PLATFORM "Unknown"
-# endif
-# endif
-
-#endif
-
-
+++ /dev/null
-// boost/config/user.hpp ---------------------------------------------------//
-
-// (C) Copyright John Maddock 2001.
-// Use, modification and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// Do not check in modified versions of this file,
-// This file may be customized by the end user, but not by boost.
-
-//
-// Use this file to define a site and compiler specific
-// configuration policy:
-//
-
-// define this to locate a compiler config file:
-// #define BOOST_COMPILER_CONFIG <myheader>
-
-// define this to locate a stdlib config file:
-// #define BOOST_STDLIB_CONFIG <myheader>
-
-// define this to locate a platform config file:
-// #define BOOST_PLATFORM_CONFIG <myheader>
-
-// define this to disable compiler config,
-// use if your compiler config has nothing to set:
-// #define BOOST_NO_COMPILER_CONFIG
-
-// define this to disable stdlib config,
-// use if your stdlib config has nothing to set:
-// #define BOOST_NO_STDLIB_CONFIG
-
-// define this to disable platform config,
-// use if your platform config has nothing to set:
-// #define BOOST_NO_PLATFORM_CONFIG
-
-// define this to disable all config options,
-// excluding the user config. Use if your
-// setup is fully ISO compliant, and has no
-// useful extensions, or for autoconf generated
-// setups:
-// #define BOOST_NO_CONFIG
-
-// define this to make the config "optimistic"
-// about unknown compiler versions. Normally
-// unknown compiler versions are assumed to have
-// all the defects of the last known version, however
-// setting this flag, causes the config to assume
-// that unknown compiler versions are fully conformant
-// with the standard:
-// #define BOOST_STRICT_CONFIG
-
-// define this to cause the config to halt compilation
-// with an #error if it encounters anything unknown --
-// either an unknown compiler version or an unknown
-// compiler/platform/library:
-// #define BOOST_ASSERT_CONFIG
-
-
-// define if you want to disable threading support, even
-// when available:
-// #define BOOST_DISABLE_THREADS
-
-// define when you want to disable Win32 specific features
-// even when available:
-// #define BOOST_DISABLE_WIN32
-
-// BOOST_DISABLE_ABI_HEADERS: Stops boost headers from including any
-// prefix/suffix headers that normally control things like struct
-// packing and alignment.
-// #define BOOST_DISABLE_ABI_HEADERS
-
-// BOOST_ABI_PREFIX: A prefix header to include in place of whatever
-// boost.config would normally select, any replacement should set up
-// struct packing and alignment options as required.
-// #define BOOST_ABI_PREFIX my-header-name
-
-// BOOST_ABI_SUFFIX: A suffix header to include in place of whatever
-// boost.config would normally select, any replacement should undo
-// the effects of the prefix header.
-// #define BOOST_ABI_SUFFIX my-header-name
-
-// BOOST_ALL_DYN_LINK: Forces all libraries that have separate source,
-// to be linked as dll's rather than static libraries on Microsoft Windows
-// (this macro is used to turn on __declspec(dllimport) modifiers, so that
-// the compiler knows which symbols to look for in a dll rather than in a
-// static library). Note that there may be some libraries that can only
-// be statically linked (Boost.Test for example) and others which may only
-// be dynamically linked (Boost.Threads for example), in these cases this
-// macro has no effect.
-// #define BOOST_ALL_DYN_LINK
-
-// BOOST_WHATEVER_DYN_LINK: Forces library "whatever" to be linked as a dll
-// rather than a static library on Microsoft Windows: replace the WHATEVER
-// part of the macro name with the name of the library that you want to
-// dynamically link to, for example use BOOST_DATE_TIME_DYN_LINK or
-// BOOST_REGEX_DYN_LINK etc (this macro is used to turn on __declspec(dllimport)
-// modifiers, so that the compiler knows which symbols to look for in a dll
-// rather than in a static library).
-// Note that there may be some libraries that can only be statically linked
-// (Boost.Test for example) and others which may only be dynamically linked
-// (Boost.Threads for example), in these cases this macro is unsupported.
-// #define BOOST_WHATEVER_DYN_LINK
-
-// BOOST_ALL_NO_LIB: Tells the config system not to automatically select
-// which libraries to link against.
-// Normally if a compiler supports #pragma lib, then the correct library
-// build variant will be automatically selected and linked against,
-// simply by the act of including one of that library's headers.
-// This macro turns that feature off.
-// #define BOOST_ALL_NO_LIB
-
-// BOOST_WHATEVER_NO_LIB: Tells the config system not to automatically
-// select which library to link against for library "whatever",
-// replace WHATEVER in the macro name with the name of the library;
-// for example BOOST_DATE_TIME_NO_LIB or BOOST_REGEX_NO_LIB.
-// Normally if a compiler supports #pragma lib, then the correct library
-// build variant will be automatically selected and linked against, simply
-// by the act of including one of that library's headers. This macro turns
-// that feature off.
-// #define BOOST_WHATEVER_NO_LIB
-
-
-
+++ /dev/null
-#ifndef BOOST_BAD_WEAK_PTR_HPP_INCLUDED
-#define BOOST_BAD_WEAK_PTR_HPP_INCLUDED
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-//
-// detail/bad_weak_ptr.hpp
-//
-// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#include <exception>
-
-#ifdef __BORLANDC__
-# pragma warn -8026 // Functions with excep. spec. are not expanded inline
-#endif
-
-namespace boost
-{
-
-// The standard library that comes with Borland C++ 5.5.1, 5.6.4
-// defines std::exception and its members as having C calling
-// convention (-pc). When the definition of bad_weak_ptr
-// is compiled with -ps, the compiler issues an error.
-// Hence, the temporary #pragma option -pc below.
-
-#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564
-# pragma option push -pc
-#endif
-
-class bad_weak_ptr: public std::exception
-{
-public:
-
- virtual char const * what() const throw()
- {
- return "tr1::bad_weak_ptr";
- }
-};
-
-#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564
-# pragma option pop
-#endif
-
-} // namespace boost
-
-#ifdef __BORLANDC__
-# pragma warn .8026 // Functions with excep. spec. are not expanded inline
-#endif
-
-#endif // #ifndef BOOST_BAD_WEAK_PTR_HPP_INCLUDED
+++ /dev/null
-#ifndef BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED
-#define BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-//
-// detail/shared_count.hpp
-//
-// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
-// Copyright 2004-2005 Peter Dimov
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifdef __BORLANDC__
-# pragma warn -8027 // Functions containing try are not expanded inline
-#endif
-
-#include <boost/config.hpp>
-#include <boost/checked_delete.hpp>
-#include <boost/throw_exception.hpp>
-#include <boost/detail/bad_weak_ptr.hpp>
-#include <boost/detail/sp_counted_base.hpp>
-#include <boost/detail/sp_counted_impl.hpp>
-
-#include <memory> // std::auto_ptr
-#include <functional> // std::less
-#include <new> // std::bad_alloc
-
-namespace boost
-{
-
-namespace detail
-{
-
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
-
-int const shared_count_id = 0x2C35F101;
-int const weak_count_id = 0x298C38A4;
-
-#endif
-
-class weak_count;
-
-class shared_count
-{
-private:
-
- sp_counted_base * pi_;
-
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
- int id_;
-#endif
-
- friend class weak_count;
-
-public:
-
- shared_count(): pi_(0) // nothrow
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
- , id_(shared_count_id)
-#endif
- {
- }
-
- template<class Y> explicit shared_count( Y * p ): pi_( 0 )
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
- , id_(shared_count_id)
-#endif
- {
-#ifndef BOOST_NO_EXCEPTIONS
-
- try
- {
- pi_ = new sp_counted_impl_p<Y>( p );
- }
- catch(...)
- {
- boost::checked_delete( p );
- throw;
- }
-
-#else
-
- pi_ = new sp_counted_impl_p<Y>( p );
-
- if( pi_ == 0 )
- {
- boost::checked_delete( p );
- boost::throw_exception( std::bad_alloc() );
- }
-
-#endif
- }
-
- template<class P, class D> shared_count(P p, D d): pi_(0)
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
- , id_(shared_count_id)
-#endif
- {
-#ifndef BOOST_NO_EXCEPTIONS
-
- try
- {
- pi_ = new sp_counted_impl_pd<P, D>(p, d);
- }
- catch(...)
- {
- d(p); // delete p
- throw;
- }
-
-#else
-
- pi_ = new sp_counted_impl_pd<P, D>(p, d);
-
- if(pi_ == 0)
- {
- d(p); // delete p
- boost::throw_exception(std::bad_alloc());
- }
-
-#endif
- }
-
- template<class P, class D, class A> shared_count( P p, D d, A a ): pi_( 0 )
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
- , id_(shared_count_id)
-#endif
- {
- typedef sp_counted_impl_pda<P, D, A> impl_type;
- typedef typename A::template rebind< impl_type >::other A2;
-
- A2 a2( a );
-
-#ifndef BOOST_NO_EXCEPTIONS
-
- try
- {
- pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) );
- new( static_cast< void* >( pi_ ) ) impl_type( p, d, a );
- }
- catch(...)
- {
- d( p );
-
- if( pi_ != 0 )
- {
- a2.deallocate( static_cast< impl_type* >( pi_ ), 1 );
- }
-
- throw;
- }
-
-#else
-
- pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) );
-
- if( pi_ != 0 )
- {
- new( static_cast< void* >( pi_ ) ) impl_type( p, d, a );
- }
- else
- {
- d( p );
- boost::throw_exception( std::bad_alloc() );
- }
-
-#endif
- }
-
-#ifndef BOOST_NO_AUTO_PTR
-
- // auto_ptr<Y> is special cased to provide the strong guarantee
-
- template<class Y>
- explicit shared_count( std::auto_ptr<Y> & r ): pi_( new sp_counted_impl_p<Y>( r.get() ) )
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
- , id_(shared_count_id)
-#endif
- {
-#ifdef BOOST_NO_EXCEPTIONS
-
- if( pi_ == 0 )
- {
- boost::throw_exception(std::bad_alloc());
- }
-
-#endif
-
- r.release();
- }
-
-#endif
-
- ~shared_count() // nothrow
- {
- if( pi_ != 0 ) pi_->release();
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
- id_ = 0;
-#endif
- }
-
- shared_count(shared_count const & r): pi_(r.pi_) // nothrow
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
- , id_(shared_count_id)
-#endif
- {
- if( pi_ != 0 ) pi_->add_ref_copy();
- }
-
- explicit shared_count(weak_count const & r); // throws bad_weak_ptr when r.use_count() == 0
-
- shared_count & operator= (shared_count const & r) // nothrow
- {
- sp_counted_base * tmp = r.pi_;
-
- if( tmp != pi_ )
- {
- if( tmp != 0 ) tmp->add_ref_copy();
- if( pi_ != 0 ) pi_->release();
- pi_ = tmp;
- }
-
- return *this;
- }
-
- void swap(shared_count & r) // nothrow
- {
- sp_counted_base * tmp = r.pi_;
- r.pi_ = pi_;
- pi_ = tmp;
- }
-
- long use_count() const // nothrow
- {
- return pi_ != 0? pi_->use_count(): 0;
- }
-
- bool unique() const // nothrow
- {
- return use_count() == 1;
- }
-
- friend inline bool operator==(shared_count const & a, shared_count const & b)
- {
- return a.pi_ == b.pi_;
- }
-
- friend inline bool operator<(shared_count const & a, shared_count const & b)
- {
- return std::less<sp_counted_base *>()( a.pi_, b.pi_ );
- }
-
- void * get_deleter( sp_typeinfo const & ti ) const
- {
- return pi_? pi_->get_deleter( ti ): 0;
- }
-};
-
-
-class weak_count
-{
-private:
-
- sp_counted_base * pi_;
-
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
- int id_;
-#endif
-
- friend class shared_count;
-
-public:
-
- weak_count(): pi_(0) // nothrow
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
- , id_(weak_count_id)
-#endif
- {
- }
-
- weak_count(shared_count const & r): pi_(r.pi_) // nothrow
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
- , id_(shared_count_id)
-#endif
- {
- if(pi_ != 0) pi_->weak_add_ref();
- }
-
- weak_count(weak_count const & r): pi_(r.pi_) // nothrow
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
- , id_(shared_count_id)
-#endif
- {
- if(pi_ != 0) pi_->weak_add_ref();
- }
-
- ~weak_count() // nothrow
- {
- if(pi_ != 0) pi_->weak_release();
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
- id_ = 0;
-#endif
- }
-
- weak_count & operator= (shared_count const & r) // nothrow
- {
- sp_counted_base * tmp = r.pi_;
- if(tmp != 0) tmp->weak_add_ref();
- if(pi_ != 0) pi_->weak_release();
- pi_ = tmp;
-
- return *this;
- }
-
- weak_count & operator= (weak_count const & r) // nothrow
- {
- sp_counted_base * tmp = r.pi_;
- if(tmp != 0) tmp->weak_add_ref();
- if(pi_ != 0) pi_->weak_release();
- pi_ = tmp;
-
- return *this;
- }
-
- void swap(weak_count & r) // nothrow
- {
- sp_counted_base * tmp = r.pi_;
- r.pi_ = pi_;
- pi_ = tmp;
- }
-
- long use_count() const // nothrow
- {
- return pi_ != 0? pi_->use_count(): 0;
- }
-
- friend inline bool operator==(weak_count const & a, weak_count const & b)
- {
- return a.pi_ == b.pi_;
- }
-
- friend inline bool operator<(weak_count const & a, weak_count const & b)
- {
- return std::less<sp_counted_base *>()(a.pi_, b.pi_);
- }
-};
-
-inline shared_count::shared_count( weak_count const & r ): pi_( r.pi_ )
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
- , id_(shared_count_id)
-#endif
-{
- if( pi_ == 0 || !pi_->add_ref_lock() )
- {
- boost::throw_exception( boost::bad_weak_ptr() );
- }
-}
-
-} // namespace detail
-
-} // namespace boost
-
-#ifdef __BORLANDC__
-# pragma warn .8027 // Functions containing try are not expanded inline
-#endif
-
-#endif // #ifndef BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED
+++ /dev/null
-#ifndef BOOST_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED
-#define BOOST_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-//
-// detail/sp_counted_base.hpp
-//
-// Copyright 2005, 2006 Peter Dimov
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#include <boost/config.hpp>
-
-#if defined( BOOST_SP_DISABLE_THREADS )
-
-# include <boost/detail/sp_counted_base_nt.hpp>
-
-#elif defined( BOOST_SP_USE_PTHREADS )
-
-# include <boost/detail/sp_counted_base_pt.hpp>
-
-#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) )
-
-# include <boost/detail/sp_counted_base_gcc_x86.hpp>
-
-//~ #elif defined( __MWERKS__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) )
-
-//~ # include <boost/detail/sp_counted_base_cw_x86.hpp>
-
-#elif defined( __GNUC__ ) && defined( __ia64__ ) && !defined( __INTEL_COMPILER )
-
-# include <boost/detail/sp_counted_base_gcc_ia64.hpp>
-
-#elif defined(__HP_aCC) && defined(__ia64)
-
-# include <boost/detail/sp_counted_base_acc_ia64.hpp>
-
-#elif defined( __MWERKS__ ) && defined( __POWERPC__ )
-
-# include <boost/detail/sp_counted_base_cw_ppc.hpp>
-
-#elif defined( __GNUC__ ) && ( defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc ) )
-
-# include <boost/detail/sp_counted_base_gcc_ppc.hpp>
-
-#elif defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 )
-
-# include <boost/detail/sp_counted_base_sync.hpp>
-
-#elif defined(__GNUC__) && ( defined( __sparcv8 ) || defined( __sparcv9 ) )
-
-# include <boost/detail/sp_counted_base_gcc_sparc.hpp>
-
-#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ )
-
-# include <boost/detail/sp_counted_base_w32.hpp>
-
-#elif !defined( BOOST_HAS_THREADS )
-
-# include <boost/detail/sp_counted_base_nt.hpp>
-
-#elif defined( BOOST_HAS_PTHREADS )
-
-# include <boost/detail/sp_counted_base_pt.hpp>
-
-#else
-
-// Use #define BOOST_DISABLE_THREADS to avoid the error
-# error Unrecognized threading platform
-
-#endif
-
-#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED
+++ /dev/null
-#ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED
-#define BOOST_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-//
-// detail/sp_counted_base_gcc_x86.hpp - g++ on 486+ or AMD64
-//
-// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
-// Copyright 2004-2005 Peter Dimov
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-//
-// Lock-free algorithm by Alexander Terekhov
-//
-// Thanks to Ben Hitchings for the #weak + (#shared != 0)
-// formulation
-//
-
-#include "sp_typeinfo.hpp"
-
-namespace boost
-{
-
-namespace detail
-{
-
-inline int atomic_exchange_and_add( int * pw, int dv )
-{
- // int r = *pw;
- // *pw += dv;
- // return r;
-
- int r;
-
- __asm__ __volatile__
- (
- "lock\n\t"
- "xadd %1, %0":
- "=m"( *pw ), "=r"( r ): // outputs (%0, %1)
- "m"( *pw ), "1"( dv ): // inputs (%2, %3 == %1)
- "memory", "cc" // clobbers
- );
-
- return r;
-}
-
-inline void atomic_increment( int * pw )
-{
- //atomic_exchange_and_add( pw, 1 );
-
- __asm__
- (
- "lock\n\t"
- "incl %0":
- "=m"( *pw ): // output (%0)
- "m"( *pw ): // input (%1)
- "cc" // clobbers
- );
-}
-
-inline int atomic_conditional_increment( int * pw )
-{
- // int rv = *pw;
- // if( rv != 0 ) ++*pw;
- // return rv;
-
- int rv, tmp;
-
- __asm__
- (
- "movl %0, %%eax\n\t"
- "0:\n\t"
- "test %%eax, %%eax\n\t"
- "je 1f\n\t"
- "movl %%eax, %2\n\t"
- "incl %2\n\t"
- "lock\n\t"
- "cmpxchgl %2, %0\n\t"
- "jne 0b\n\t"
- "1:":
- "=m"( *pw ), "=&a"( rv ), "=&r"( tmp ): // outputs (%0, %1, %2)
- "m"( *pw ): // input (%3)
- "cc" // clobbers
- );
-
- return rv;
-}
-
-class sp_counted_base
-{
-private:
-
- sp_counted_base( sp_counted_base const & );
- sp_counted_base & operator= ( sp_counted_base const & );
-
- int use_count_; // #shared
- int weak_count_; // #weak + (#shared != 0)
-
-public:
-
- sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
- {
- }
-
- virtual ~sp_counted_base() // nothrow
- {
- }
-
- // dispose() is called when use_count_ drops to zero, to release
- // the resources managed by *this.
-
- virtual void dispose() = 0; // nothrow
-
- // destroy() is called when weak_count_ drops to zero.
-
- virtual void destroy() // nothrow
- {
- delete this;
- }
-
- virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
-
- void add_ref_copy()
- {
- atomic_increment( &use_count_ );
- }
-
- bool add_ref_lock() // true on success
- {
- return atomic_conditional_increment( &use_count_ ) != 0;
- }
-
- void release() // nothrow
- {
- if( atomic_exchange_and_add( &use_count_, -1 ) == 1 )
- {
- dispose();
- weak_release();
- }
- }
-
- void weak_add_ref() // nothrow
- {
- atomic_increment( &weak_count_ );
- }
-
- void weak_release() // nothrow
- {
- if( atomic_exchange_and_add( &weak_count_, -1 ) == 1 )
- {
- destroy();
- }
- }
-
- long use_count() const // nothrow
- {
- return static_cast<int const volatile &>( use_count_ );
- }
-};
-
-} // namespace detail
-
-} // namespace boost
-
-#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED
+++ /dev/null
-#ifndef BOOST_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED
-#define BOOST_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-//
-// detail/sp_counted_impl.hpp
-//
-// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
-// Copyright 2004-2005 Peter Dimov
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#include <boost/config.hpp>
-
-#if defined(BOOST_SP_USE_STD_ALLOCATOR) && defined(BOOST_SP_USE_QUICK_ALLOCATOR)
-# error BOOST_SP_USE_STD_ALLOCATOR and BOOST_SP_USE_QUICK_ALLOCATOR are incompatible.
-#endif
-
-#include <boost/checked_delete.hpp>
-#include <boost/detail/sp_counted_base.hpp>
-
-#if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
-#include <boost/detail/quick_allocator.hpp>
-#endif
-
-#if defined(BOOST_SP_USE_STD_ALLOCATOR)
-#include <memory> // std::allocator
-#endif
-
-#include <cstddef> // std::size_t
-
-namespace boost
-{
-
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
-
-void sp_scalar_constructor_hook( void * px, std::size_t size, void * pn );
-void sp_scalar_destructor_hook( void * px, std::size_t size, void * pn );
-
-#endif
-
-namespace detail
-{
-
-template<class X> class sp_counted_impl_p: public sp_counted_base
-{
-private:
-
- X * px_;
-
- sp_counted_impl_p( sp_counted_impl_p const & );
- sp_counted_impl_p & operator= ( sp_counted_impl_p const & );
-
- typedef sp_counted_impl_p<X> this_type;
-
-public:
-
- explicit sp_counted_impl_p( X * px ): px_( px )
- {
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
- boost::sp_scalar_constructor_hook( px, sizeof(X), this );
-#endif
- }
-
- virtual void dispose() // nothrow
- {
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
- boost::sp_scalar_destructor_hook( px_, sizeof(X), this );
-#endif
- boost::checked_delete( px_ );
- }
-
- virtual void * get_deleter( detail::sp_typeinfo const & )
- {
- return 0;
- }
-
-#if defined(BOOST_SP_USE_STD_ALLOCATOR)
-
- void * operator new( std::size_t )
- {
- return std::allocator<this_type>().allocate( 1, static_cast<this_type *>(0) );
- }
-
- void operator delete( void * p )
- {
- std::allocator<this_type>().deallocate( static_cast<this_type *>(p), 1 );
- }
-
-#endif
-
-#if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
-
- void * operator new( std::size_t )
- {
- return quick_allocator<this_type>::alloc();
- }
-
- void operator delete( void * p )
- {
- quick_allocator<this_type>::dealloc( p );
- }
-
-#endif
-};
-
-//
-// Borland's Codeguard trips up over the -Vx- option here:
-//
-#ifdef __CODEGUARD__
-# pragma option push -Vx-
-#endif
-
-template<class P, class D> class sp_counted_impl_pd: public sp_counted_base
-{
-private:
-
- P ptr; // copy constructor must not throw
- D del; // copy constructor must not throw
-
- sp_counted_impl_pd( sp_counted_impl_pd const & );
- sp_counted_impl_pd & operator= ( sp_counted_impl_pd const & );
-
- typedef sp_counted_impl_pd<P, D> this_type;
-
-public:
-
- // pre: d(p) must not throw
-
- sp_counted_impl_pd( P p, D d ): ptr(p), del(d)
- {
- }
-
- virtual void dispose() // nothrow
- {
- del( ptr );
- }
-
- virtual void * get_deleter( detail::sp_typeinfo const & ti )
- {
- return ti == BOOST_SP_TYPEID(D)? &reinterpret_cast<char&>( del ): 0;
- }
-
-#if defined(BOOST_SP_USE_STD_ALLOCATOR)
-
- void * operator new( std::size_t )
- {
- return std::allocator<this_type>().allocate( 1, static_cast<this_type *>(0) );
- }
-
- void operator delete( void * p )
- {
- std::allocator<this_type>().deallocate( static_cast<this_type *>(p), 1 );
- }
-
-#endif
-
-#if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
-
- void * operator new( std::size_t )
- {
- return quick_allocator<this_type>::alloc();
- }
-
- void operator delete( void * p )
- {
- quick_allocator<this_type>::dealloc( p );
- }
-
-#endif
-};
-
-template<class P, class D, class A> class sp_counted_impl_pda: public sp_counted_base
-{
-private:
-
- P p_; // copy constructor must not throw
- D d_; // copy constructor must not throw
- A a_; // copy constructor must not throw
-
- sp_counted_impl_pda( sp_counted_impl_pda const & );
- sp_counted_impl_pda & operator= ( sp_counted_impl_pda const & );
-
- typedef sp_counted_impl_pda<P, D, A> this_type;
-
-public:
-
- // pre: d( p ) must not throw
-
- sp_counted_impl_pda( P p, D d, A a ): p_( p ), d_( d ), a_( a )
- {
- }
-
- virtual void dispose() // nothrow
- {
- d_( p_ );
- }
-
- virtual void destroy() // nothrow
- {
- typedef typename A::template rebind< this_type >::other A2;
-
- A2 a2( a_ );
-
- this->~this_type();
- a2.deallocate( this, 1 );
- }
-
- virtual void * get_deleter( detail::sp_typeinfo const & ti )
- {
- return ti == BOOST_SP_TYPEID( D )? &reinterpret_cast<char&>( d_ ): 0;
- }
-};
-
-#ifdef __CODEGUARD__
-# pragma option pop
-#endif
-
-} // namespace detail
-
-} // namespace boost
-
-#endif // #ifndef BOOST_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED
+++ /dev/null
-#ifndef BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED
-#define BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-// detail/sp_typeinfo.hpp
-//
-// Copyright 2007 Peter Dimov
-//
-// Distributed under the Boost Software License, Version 1.0.
-// See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#include <boost/config.hpp>
-
-#if defined( BOOST_NO_TYPEID )
-
-namespace boost
-{
-
-namespace detail
-{
-
-typedef void* sp_typeinfo;
-
-template<class T> struct sp_typeid_
-{
- static char v_;
-};
-
-template<class T> char sp_typeid_< T >::v_;
-
-template<class T> struct sp_typeid_< T const >: sp_typeid_< T >
-{
-};
-
-template<class T> struct sp_typeid_< T volatile >: sp_typeid_< T >
-{
-};
-
-template<class T> struct sp_typeid_< T const volatile >: sp_typeid_< T >
-{
-};
-
-} // namespace detail
-
-} // namespace boost
-
-#define BOOST_SP_TYPEID(T) (&boost::detail::sp_typeid_<T>::v_)
-
-#else
-
-#include <typeinfo>
-
-namespace boost
-{
-
-namespace detail
-{
-
-#if defined( BOOST_NO_STD_TYPEINFO )
-
-typedef ::type_info sp_typeinfo;
-
-#else
-
-typedef std::type_info sp_typeinfo;
-
-#endif
-
-} // namespace detail
-
-} // namespace boost
-
-#define BOOST_SP_TYPEID(T) typeid(T)
-
-#endif
-
-#endif // #ifndef BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED
+++ /dev/null
-// Copyright David Abrahams 2002.
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-#ifndef WORKAROUND_DWA2002126_HPP
-# define WORKAROUND_DWA2002126_HPP
-
-// Compiler/library version workaround macro
-//
-// Usage:
-//
-// #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
-// // workaround for eVC4 and VC6
-// ... // workaround code here
-// #endif
-//
-// When BOOST_STRICT_CONFIG is defined, expands to 0. Otherwise, the
-// first argument must be undefined or expand to a numeric
-// value. The above expands to:
-//
-// (BOOST_MSVC) != 0 && (BOOST_MSVC) < 1300
-//
-// When used for workarounds that apply to the latest known version
-// and all earlier versions of a compiler, the following convention
-// should be observed:
-//
-// #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1301))
-//
-// The version number in this case corresponds to the last version in
-// which the workaround was known to have been required. When
-// BOOST_DETECT_OUTDATED_WORKAROUNDS is not the defined, the macro
-// BOOST_TESTED_AT(x) expands to "!= 0", which effectively activates
-// the workaround for any version of the compiler. When
-// BOOST_DETECT_OUTDATED_WORKAROUNDS is defined, a compiler warning or
-// error will be issued if the compiler version exceeds the argument
-// to BOOST_TESTED_AT(). This can be used to locate workarounds which
-// may be obsoleted by newer versions.
-
-# ifndef BOOST_STRICT_CONFIG
-
-#include <boost/config.hpp>
-
-#ifndef __BORLANDC__
-#define __BORLANDC___WORKAROUND_GUARD 1
-#else
-#define __BORLANDC___WORKAROUND_GUARD 0
-#endif
-#ifndef __MSC_VER
-#define __MSC_VER_WORKAROUND_GUARD 1
-#else
-#define __MSC_VER_WORKAROUND_GUARD 0
-#endif
-#ifndef _MSC_FULL_VER
-#define _MSC_FULL_VER_WORKAROUND_GUARD 1
-#else
-#define _MSC_FULL_VER_WORKAROUND_GUARD 0
-#endif
-#ifndef BOOST_MSVC
-#define BOOST_MSVC_WORKAROUND_GUARD 1
-#else
-#define BOOST_MSVC_WORKAROUND_GUARD 0
-#endif
-#ifndef __GNUC__
-#define __GNUC___WORKAROUND_GUARD 1
-#else
-#define __GNUC___WORKAROUND_GUARD 0
-#endif
-#ifndef __GNUC_MINOR__
-#define __GNUC_MINOR___WORKAROUND_GUARD 1
-#else
-#define __GNUC_MINOR___WORKAROUND_GUARD 0
-#endif
-#ifndef __GNUC_PATCHLEVEL__
-#define __GNUC_PATCHLEVEL___WORKAROUND_GUARD 1
-#else
-#define __GNUC_PATCHLEVEL___WORKAROUND_GUARD 0
-#endif
-#ifndef __IBMCPP__
-#define __IBMCPP___WORKAROUND_GUARD 1
-#else
-#define __IBMCPP___WORKAROUND_GUARD 0
-#endif
-#ifndef __SUNPRO_CC
-#define __SUNPRO_CC_WORKAROUND_GUARD 1
-#else
-#define __SUNPRO_CC_WORKAROUND_GUARD 0
-#endif
-#ifndef __DECCXX_VER
-#define __DECCXX_VER_WORKAROUND_GUARD 1
-#else
-#define __DECCXX_VER_WORKAROUND_GUARD 0
-#endif
-#ifndef __MWERKS__
-#define __MWERKS___WORKAROUND_GUARD 1
-#else
-#define __MWERKS___WORKAROUND_GUARD 0
-#endif
-#ifndef __EDG_VERSION__
-#define __EDG_VERSION___WORKAROUND_GUARD 1
-#else
-#define __EDG_VERSION___WORKAROUND_GUARD 0
-#endif
-#ifndef __HP_aCC
-#define __HP_aCC_WORKAROUND_GUARD 1
-#else
-#define __HP_aCC_WORKAROUND_GUARD 0
-#endif
-#ifndef _CRAYC
-#define _CRAYC_WORKAROUND_GUARD 1
-#else
-#define _CRAYC_WORKAROUND_GUARD 0
-#endif
-#ifndef __DMC__
-#define __DMC___WORKAROUND_GUARD 1
-#else
-#define __DMC___WORKAROUND_GUARD 0
-#endif
-#ifndef MPW_CPLUS
-#define MPW_CPLUS_WORKAROUND_GUARD 1
-#else
-#define MPW_CPLUS_WORKAROUND_GUARD 0
-#endif
-
-#ifndef _RWSTD_VER
-#define _RWSTD_VER_WORKAROUND_GUARD 1
-#else
-#define _RWSTD_VER_WORKAROUND_GUARD 0
-#endif
-#ifndef _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
-#define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC_WORKAROUND_GUARD 1
-#else
-#define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC_WORKAROUND_GUARD 0
-#endif
-#ifndef __SGI_STL_PORT
-#define __SGI_STL_PORT_WORKAROUND_GUARD 1
-#else
-#define __SGI_STL_PORT_WORKAROUND_GUARD 0
-#endif
-#ifndef _STLPORT_VERSION
-#define _STLPORT_VERSION_WORKAROUND_GUARD 1
-#else
-#define _STLPORT_VERSION_WORKAROUND_GUARD 0
-#endif
-
-#ifndef BOOST_INTEL_CXX_VERSION
-#define BOOST_INTEL_CXX_VERSION_WORKAROUND_GUARD 1
-#else
-#define BOOST_INTEL_CXX_VERSION_WORKAROUND_GUARD 0
-#endif
-#ifndef BOOST_INTEL_WIN
-#define BOOST_INTEL_WIN_WORKAROUND_GUARD 1
-#else
-#define BOOST_INTEL_WIN_WORKAROUND_GUARD 0
-#endif
-#ifndef BOOST_DINKUMWARE_STDLIB
-#define BOOST_DINKUMWARE_STDLIB_WORKAROUND_GUARD 1
-#else
-#define BOOST_DINKUMWARE_STDLIB_WORKAROUND_GUARD 0
-#endif
-#ifndef BOOST_INTEL
-#define BOOST_INTEL_WORKAROUND_GUARD 1
-#else
-#define BOOST_INTEL_WORKAROUND_GUARD 0
-#endif
-// Always define to zero, if it's used it'll be defined my MPL:
-#define BOOST_MPL_CFG_GCC_WORKAROUND_GUARD 0
-
-# define BOOST_WORKAROUND(symbol, test) \
- ((symbol ## _WORKAROUND_GUARD + 0 == 0) && \
- (symbol != 0) && (1 % (( (symbol test) ) + 1)))
-// ^ ^ ^ ^
-// The extra level of parenthesis nesting above, along with the
-// BOOST_OPEN_PAREN indirection below, is required to satisfy the
-// broken preprocessor in MWCW 8.3 and earlier.
-//
-// The basic mechanism works as follows:
-// (symbol test) + 1 => if (symbol test) then 2 else 1
-// 1 % ((symbol test) + 1) => if (symbol test) then 1 else 0
-//
-// The complication with % is for cooperation with BOOST_TESTED_AT().
-// When "test" is BOOST_TESTED_AT(x) and
-// BOOST_DETECT_OUTDATED_WORKAROUNDS is #defined,
-//
-// symbol test => if (symbol <= x) then 1 else -1
-// (symbol test) + 1 => if (symbol <= x) then 2 else 0
-// 1 % ((symbol test) + 1) => if (symbol <= x) then 1 else divide-by-zero
-//
-
-# ifdef BOOST_DETECT_OUTDATED_WORKAROUNDS
-# define BOOST_OPEN_PAREN (
-# define BOOST_TESTED_AT(value) > value) ?(-1): BOOST_OPEN_PAREN 1
-# else
-# define BOOST_TESTED_AT(value) != ((value)-(value))
-# endif
-
-# else
-
-# define BOOST_WORKAROUND(symbol, test) 0
-
-# endif
-
-#endif // WORKAROUND_DWA2002126_HPP
+++ /dev/null
-#ifndef BOOST_SHARED_PTR_HPP_INCLUDED
-#define BOOST_SHARED_PTR_HPP_INCLUDED
-
-//
-// shared_ptr.hpp
-//
-// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
-// Copyright (c) 2001-2007 Peter Dimov
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-// See http://www.boost.org/libs/smart_ptr/shared_ptr.htm for documentation.
-//
-
-#include <boost/config.hpp> // for broken compiler workarounds
-
-#if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
-#include <boost/detail/shared_ptr_nmt.hpp>
-#else
-
-#include <memory> // for std::auto_ptr
-
-#include <boost/assert.hpp>
-#include <boost/checked_delete.hpp>
-#include <boost/throw_exception.hpp>
-#include <boost/detail/shared_count.hpp>
-#include <boost/detail/workaround.hpp>
-
-#include <algorithm> // for std::swap
-#include <functional> // for std::less
-#include <typeinfo> // for std::bad_cast
-#include <iosfwd> // for std::basic_ostream
-
-#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash
-# pragma warning(push)
-# pragma warning(disable:4284) // odd return type for operator->
-#endif
-
-namespace boost
-{
-
-template<class T> class weak_ptr;
-template<class T> class enable_shared_from_this;
-
-namespace detail
-{
-
-struct static_cast_tag {};
-struct const_cast_tag {};
-struct dynamic_cast_tag {};
-struct polymorphic_cast_tag {};
-
-template<class T> struct shared_ptr_traits
-{
- typedef T & reference;
-};
-
-template<> struct shared_ptr_traits<void>
-{
- typedef void reference;
-};
-
-#if !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS)
-
-template<> struct shared_ptr_traits<void const>
-{
- typedef void reference;
-};
-
-template<> struct shared_ptr_traits<void volatile>
-{
- typedef void reference;
-};
-
-template<> struct shared_ptr_traits<void const volatile>
-{
- typedef void reference;
-};
-
-#endif
-
-// enable_shared_from_this support
-
-template<class T, class Y> void sp_enable_shared_from_this( shared_count const & pn, boost::enable_shared_from_this<T> const * pe, Y const * px )
-{
- if(pe != 0) pe->_internal_weak_this._internal_assign(const_cast<Y*>(px), pn);
-}
-
-#ifdef _MANAGED
-
-// Avoid C4793, ... causes native code generation
-
-struct sp_any_pointer
-{
- template<class T> sp_any_pointer( T* ) {}
-};
-
-inline void sp_enable_shared_from_this( shared_count const & /*pn*/, sp_any_pointer, sp_any_pointer )
-{
-}
-
-#else // _MANAGED
-
-#ifdef sgi
-// Turn off: the last argument of the varargs function "sp_enable_shared_from_this" is unnamed
-# pragma set woff 3506
-#endif
-
-inline void sp_enable_shared_from_this( shared_count const & /*pn*/, ... )
-{
-}
-
-#ifdef sgi
-# pragma reset woff 3506
-#endif
-
-#endif // _MANAGED
-
-#if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined( BOOST_NO_AUTO_PTR )
-
-// rvalue auto_ptr support based on a technique by Dave Abrahams
-
-template< class T, class R > struct sp_enable_if_auto_ptr
-{
-};
-
-template< class T, class R > struct sp_enable_if_auto_ptr< std::auto_ptr< T >, R >
-{
- typedef R type;
-};
-
-#endif
-
-} // namespace detail
-
-
-//
-// shared_ptr
-//
-// An enhanced relative of scoped_ptr with reference counted copy semantics.
-// The object pointed to is deleted when the last shared_ptr pointing to it
-// is destroyed or reset.
-//
-
-template<class T> class shared_ptr
-{
-private:
-
- // Borland 5.5.1 specific workaround
- typedef shared_ptr<T> this_type;
-
-public:
-
- typedef T element_type;
- typedef T value_type;
- typedef T * pointer;
- typedef typename boost::detail::shared_ptr_traits<T>::reference reference;
-
- shared_ptr(): px(0), pn() // never throws in 1.30+
- {
- }
-
- template<class Y>
- explicit shared_ptr( Y * p ): px( p ), pn( p ) // Y must be complete
- {
- boost::detail::sp_enable_shared_from_this( pn, p, p );
- }
-
- //
- // Requirements: D's copy constructor must not throw
- //
- // shared_ptr will release p by calling d(p)
- //
-
- template<class Y, class D> shared_ptr(Y * p, D d): px(p), pn(p, d)
- {
- boost::detail::sp_enable_shared_from_this( pn, p, p );
- }
-
- // As above, but with allocator. A's copy constructor shall not throw.
-
- template<class Y, class D, class A> shared_ptr( Y * p, D d, A a ): px( p ), pn( p, d, a )
- {
- boost::detail::sp_enable_shared_from_this( pn, p, p );
- }
-
-// generated copy constructor, assignment, destructor are fine...
-
-// except that Borland C++ has a bug, and g++ with -Wsynth warns
-#if defined(__BORLANDC__) || defined(__GNUC__)
-
- shared_ptr & operator=(shared_ptr const & r) // never throws
- {
- px = r.px;
- pn = r.pn; // shared_count::op= doesn't throw
- return *this;
- }
-
-#endif
-
- template<class Y>
- explicit shared_ptr(weak_ptr<Y> const & r): pn(r.pn) // may throw
- {
- // it is now safe to copy r.px, as pn(r.pn) did not throw
- px = r.px;
- }
-
- template<class Y>
- shared_ptr(shared_ptr<Y> const & r): px(r.px), pn(r.pn) // never throws
- {
- }
-
- // aliasing
- template< class Y >
- shared_ptr( shared_ptr<Y> const & r, T * p ): px( p ), pn( r.pn ) // never throws
- {
- }
-
- template<class Y>
- shared_ptr(shared_ptr<Y> const & r, boost::detail::static_cast_tag): px(static_cast<element_type *>(r.px)), pn(r.pn)
- {
- }
-
- template<class Y>
- shared_ptr(shared_ptr<Y> const & r, boost::detail::const_cast_tag): px(const_cast<element_type *>(r.px)), pn(r.pn)
- {
- }
-
- template<class Y>
- shared_ptr(shared_ptr<Y> const & r, boost::detail::dynamic_cast_tag): px(dynamic_cast<element_type *>(r.px)), pn(r.pn)
- {
- if(px == 0) // need to allocate new counter -- the cast failed
- {
- pn = boost::detail::shared_count();
- }
- }
-
- template<class Y>
- shared_ptr(shared_ptr<Y> const & r, boost::detail::polymorphic_cast_tag): px(dynamic_cast<element_type *>(r.px)), pn(r.pn)
- {
- if(px == 0)
- {
- boost::throw_exception(std::bad_cast());
- }
- }
-
-#ifndef BOOST_NO_AUTO_PTR
-
- template<class Y>
- explicit shared_ptr(std::auto_ptr<Y> & r): px(r.get()), pn()
- {
- Y * tmp = r.get();
- pn = boost::detail::shared_count(r);
- boost::detail::sp_enable_shared_from_this( pn, tmp, tmp );
- }
-
-#if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
-
- template<class Ap>
- shared_ptr( Ap r, typename boost::detail::sp_enable_if_auto_ptr<Ap, int>::type = 0 ): px( r.get() ), pn()
- {
- typename Ap::element_type * tmp = r.get();
- pn = boost::detail::shared_count( r );
- boost::detail::sp_enable_shared_from_this( pn, tmp, tmp );
- }
-
-
-#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-
-#endif // BOOST_NO_AUTO_PTR
-
-#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1300)
-
- template<class Y>
- shared_ptr & operator=(shared_ptr<Y> const & r) // never throws
- {
- px = r.px;
- pn = r.pn; // shared_count::op= doesn't throw
- return *this;
- }
-
-#endif
-
-#ifndef BOOST_NO_AUTO_PTR
-
- template<class Y>
- shared_ptr & operator=( std::auto_ptr<Y> & r )
- {
- this_type(r).swap(*this);
- return *this;
- }
-
-#if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
-
- template<class Ap>
- typename boost::detail::sp_enable_if_auto_ptr< Ap, shared_ptr & >::type operator=( Ap r )
- {
- this_type( r ).swap( *this );
- return *this;
- }
-
-
-#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-
-#endif // BOOST_NO_AUTO_PTR
-
-// Move support
-
-#if defined( BOOST_HAS_RVALUE_REFS )
-
- shared_ptr( shared_ptr && r ): px( r.px ), pn() // never throws
- {
- pn.swap( r.pn );
- r.px = 0;
- }
-
- template<class Y>
- shared_ptr( shared_ptr<Y> && r ): px( r.px ), pn() // never throws
- {
- pn.swap( r.pn );
- r.px = 0;
- }
-
- shared_ptr & operator=( shared_ptr && r ) // never throws
- {
- this_type( static_cast< shared_ptr && >( r ) ).swap( *this );
- return *this;
- }
-
- template<class Y>
- shared_ptr & operator=( shared_ptr<Y> && r ) // never throws
- {
- this_type( static_cast< shared_ptr<Y> && >( r ) ).swap( *this );
- return *this;
- }
-
-#endif
-
- void reset() // never throws in 1.30+
- {
- this_type().swap(*this);
- }
-
- template<class Y> void reset(Y * p) // Y must be complete
- {
- BOOST_ASSERT(p == 0 || p != px); // catch self-reset errors
- this_type(p).swap(*this);
- }
-
- template<class Y, class D> void reset( Y * p, D d )
- {
- this_type( p, d ).swap( *this );
- }
-
- template<class Y, class D, class A> void reset( Y * p, D d, A a )
- {
- this_type( p, d, a ).swap( *this );
- }
-
- template<class Y> void reset( shared_ptr<Y> const & r, T * p )
- {
- this_type( r, p ).swap( *this );
- }
-
- reference operator* () const // never throws
- {
- BOOST_ASSERT(px != 0);
- return *px;
- }
-
- T * operator-> () const // never throws
- {
- BOOST_ASSERT(px != 0);
- return px;
- }
-
- T * get() const // never throws
- {
- return px;
- }
-
- // implicit conversion to "bool"
-
-#if ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__)
-
- operator bool () const
- {
- return px != 0;
- }
-
-#elif defined( _MANAGED )
-
- static void unspecified_bool( this_type*** )
- {
- }
-
- typedef void (*unspecified_bool_type)( this_type*** );
-
- operator unspecified_bool_type() const // never throws
- {
- return px == 0? 0: unspecified_bool;
- }
-
-#elif \
- ( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, < 0x3200) ) || \
- ( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) ) || \
- ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) )
-
- typedef T * (this_type::*unspecified_bool_type)() const;
-
- operator unspecified_bool_type() const // never throws
- {
- return px == 0? 0: &this_type::get;
- }
-
-#else
-
- typedef T * this_type::*unspecified_bool_type;
-
- operator unspecified_bool_type() const // never throws
- {
- return px == 0? 0: &this_type::px;
- }
-
-#endif
-
- // operator! is redundant, but some compilers need it
-
- bool operator! () const // never throws
- {
- return px == 0;
- }
-
- bool unique() const // never throws
- {
- return pn.unique();
- }
-
- long use_count() const // never throws
- {
- return pn.use_count();
- }
-
- void swap(shared_ptr<T> & other) // never throws
- {
- std::swap(px, other.px);
- pn.swap(other.pn);
- }
-
- template<class Y> bool _internal_less(shared_ptr<Y> const & rhs) const
- {
- return pn < rhs.pn;
- }
-
- void * _internal_get_deleter( detail::sp_typeinfo const & ti ) const
- {
- return pn.get_deleter( ti );
- }
-
-// Tasteless as this may seem, making all members public allows member templates
-// to work in the absence of member template friends. (Matthew Langston)
-
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
-
-private:
-
- template<class Y> friend class shared_ptr;
- template<class Y> friend class weak_ptr;
-
-
-#endif
-
- T * px; // contained pointer
- boost::detail::shared_count pn; // reference counter
-
-}; // shared_ptr
-
-template<class T, class U> inline bool operator==(shared_ptr<T> const & a, shared_ptr<U> const & b)
-{
- return a.get() == b.get();
-}
-
-template<class T, class U> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<U> const & b)
-{
- return a.get() != b.get();
-}
-
-#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96
-
-// Resolve the ambiguity between our op!= and the one in rel_ops
-
-template<class T> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<T> const & b)
-{
- return a.get() != b.get();
-}
-
-#endif
-
-template<class T, class U> inline bool operator<(shared_ptr<T> const & a, shared_ptr<U> const & b)
-{
- return a._internal_less(b);
-}
-
-template<class T> inline void swap(shared_ptr<T> & a, shared_ptr<T> & b)
-{
- a.swap(b);
-}
-
-template<class T, class U> shared_ptr<T> static_pointer_cast(shared_ptr<U> const & r)
-{
- return shared_ptr<T>(r, boost::detail::static_cast_tag());
-}
-
-template<class T, class U> shared_ptr<T> const_pointer_cast(shared_ptr<U> const & r)
-{
- return shared_ptr<T>(r, boost::detail::const_cast_tag());
-}
-
-template<class T, class U> shared_ptr<T> dynamic_pointer_cast(shared_ptr<U> const & r)
-{
- return shared_ptr<T>(r, boost::detail::dynamic_cast_tag());
-}
-
-// shared_*_cast names are deprecated. Use *_pointer_cast instead.
-
-template<class T, class U> shared_ptr<T> shared_static_cast(shared_ptr<U> const & r)
-{
- return shared_ptr<T>(r, boost::detail::static_cast_tag());
-}
-
-template<class T, class U> shared_ptr<T> shared_dynamic_cast(shared_ptr<U> const & r)
-{
- return shared_ptr<T>(r, boost::detail::dynamic_cast_tag());
-}
-
-template<class T, class U> shared_ptr<T> shared_polymorphic_cast(shared_ptr<U> const & r)
-{
- return shared_ptr<T>(r, boost::detail::polymorphic_cast_tag());
-}
-
-template<class T, class U> shared_ptr<T> shared_polymorphic_downcast(shared_ptr<U> const & r)
-{
- BOOST_ASSERT(dynamic_cast<T *>(r.get()) == r.get());
- return shared_static_cast<T>(r);
-}
-
-// get_pointer() enables boost::mem_fn to recognize shared_ptr
-
-template<class T> inline T * get_pointer(shared_ptr<T> const & p)
-{
- return p.get();
-}
-
-// operator<<
-
-#if defined(__GNUC__) && (__GNUC__ < 3)
-
-template<class Y> std::ostream & operator<< (std::ostream & os, shared_ptr<Y> const & p)
-{
- os << p.get();
- return os;
-}
-
-#else
-
-// in STLport's no-iostreams mode no iostream symbols can be used
-#ifndef _STLP_NO_IOSTREAMS
-
-# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300 && __SGI_STL_PORT)
-// MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL
-using std::basic_ostream;
-template<class E, class T, class Y> basic_ostream<E, T> & operator<< (basic_ostream<E, T> & os, shared_ptr<Y> const & p)
-# else
-template<class E, class T, class Y> std::basic_ostream<E, T> & operator<< (std::basic_ostream<E, T> & os, shared_ptr<Y> const & p)
-# endif
-{
- os << p.get();
- return os;
-}
-
-#endif // _STLP_NO_IOSTREAMS
-
-#endif // __GNUC__ < 3
-
-// get_deleter
-
-#if ( defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3) ) || \
- ( defined(__EDG_VERSION__) && BOOST_WORKAROUND(__EDG_VERSION__, <= 238) ) || \
- ( defined(__HP_aCC) && BOOST_WORKAROUND(__HP_aCC, <= 33500) )
-
-// g++ 2.9x doesn't allow static_cast<X const *>(void *)
-// apparently EDG 2.38 and HP aCC A.03.35 also don't accept it
-
-template<class D, class T> D * get_deleter(shared_ptr<T> const & p)
-{
- void const * q = p._internal_get_deleter(BOOST_SP_TYPEID(D));
- return const_cast<D *>(static_cast<D const *>(q));
-}
-
-#else
-
-template<class D, class T> D * get_deleter(shared_ptr<T> const & p)
-{
- return static_cast<D *>(p._internal_get_deleter(BOOST_SP_TYPEID(D)));
-}
-
-#endif
-
-} // namespace boost
-
-#ifdef BOOST_MSVC
-# pragma warning(pop)
-#endif
-
-#endif // #if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
-
-#endif // #ifndef BOOST_SHARED_PTR_HPP_INCLUDED
+++ /dev/null
-#ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED
-#define BOOST_THROW_EXCEPTION_HPP_INCLUDED
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-//
-// boost/throw_exception.hpp
-//
-// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-// http://www.boost.org/libs/utility/throw_exception.html
-//
-
-#include <boost/config.hpp>
-
-#ifdef BOOST_NO_EXCEPTIONS
-# include <exception>
-#endif
-
-namespace boost
-{
-
-#ifdef BOOST_NO_EXCEPTIONS
-
-void throw_exception(std::exception const & e); // user defined
-
-#else
-
-template<class E> inline void throw_exception(E const & e)
-{
- throw e;
-}
-
-#endif
-
-} // namespace boost
-
-#endif // #ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED