-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
200 changed files
with
64,400 additions
and
49,471 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
--- | ||
IndentWidth: 4 | ||
ColumnLimit: 0 | ||
|
||
--- | ||
Language: Cpp | ||
|
||
AccessModifierOffset: -4 | ||
|
||
AlignAfterOpenBracket: DontAlign | ||
AlignConsecutiveAssignments: false | ||
AlignConsecutiveDeclarations: false | ||
AlignEscapedNewlines: DontAlign | ||
AlignOperands: false | ||
AlignTrailingComments: false | ||
|
||
AllowShortBlocksOnASingleLine: false | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: None | ||
AllowShortIfStatementsOnASingleLine : false | ||
AllowShortLoopsOnASingleLine: false | ||
|
||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: false | ||
AlwaysBreakTemplateDeclarations: true | ||
|
||
BinPackArguments: true | ||
BinPackParameters: true | ||
|
||
BreakBeforeBraces: Custom | ||
BraceWrapping: | ||
AfterCaseLabel: true | ||
AfterClass: true | ||
AfterControlStatement: true | ||
AfterEnum: true | ||
AfterFunction: true | ||
AfterNamespace: true | ||
AfterStruct: true | ||
AfterUnion: true | ||
AfterExternBlock: true | ||
BeforeCatch: true | ||
BeforeElse: true | ||
IndentBraces: false | ||
SplitEmptyFunction: true | ||
SplitEmptyRecord: true | ||
SplitEmptyNamespace: true | ||
|
||
BreakBeforeInheritanceComma: false | ||
BreakBeforeTernaryOperators: true | ||
|
||
CompactNamespaces: false | ||
FixNamespaceComments: false | ||
NamespaceIndentation: All | ||
|
||
BreakConstructorInitializers: AfterColon | ||
ConstructorInitializerIndentWidth: 4 | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
Cpp11BracedListStyle: false | ||
|
||
IncludeBlocks: Preserve | ||
|
||
IndentCaseLabels: true | ||
IndentWrappedFunctionNames: true | ||
|
||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
MaxEmptyLinesToKeep: 1 | ||
|
||
PointerAlignment: Left | ||
|
||
ReflowComments: true | ||
|
||
SortIncludes: false | ||
SortUsingDeclarations: true | ||
|
||
SpaceAfterTemplateKeyword: false | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 1 | ||
SpacesInAngles: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
# SpaceBeforeInheritanceColon: false | ||
# SpaceBeforeCtorInitializerColon: false | ||
# SpaceBeforeRangeBasedForLoopColon: true | ||
|
||
IndentCaseBlocks: false | ||
IndentCaseLabels: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Checks: '-*,readability-braces-around-statements' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ insert_final_newline = true | |
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace=true | ||
guidelines = 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
/out | ||
CMakeSettings.json | ||
test_package/build/ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
/* 7zBuf.c -- Byte Buffer | ||
2008-03-28 | ||
Igor Pavlov | ||
Public domain */ | ||
|
||
#include "7zBuf.h" | ||
|
||
namespace crnlib { | ||
|
||
void Buf_Init(CBuf* p) { | ||
p->data = 0; | ||
p->size = 0; | ||
} | ||
|
||
int Buf_Create(CBuf* p, size_t size, ISzAlloc* alloc) { | ||
p->size = 0; | ||
if (size == 0) { | ||
p->data = 0; | ||
return 1; | ||
} | ||
p->data = (Byte*)alloc->Alloc(alloc, size); | ||
if (p->data != 0) { | ||
p->size = size; | ||
return 1; | ||
} | ||
return 0; | ||
} | ||
|
||
void Buf_Free(CBuf* p, ISzAlloc* alloc) { | ||
alloc->Free(alloc, p->data); | ||
p->data = 0; | ||
p->size = 0; | ||
} | ||
/* 7zBuf.c -- Byte Buffer | ||
2008-03-28 | ||
Igor Pavlov | ||
Public domain */ | ||
|
||
#include "7zBuf.h" | ||
|
||
namespace crnlib { | ||
|
||
void Buf_Init(CBuf* p) { | ||
p->data = 0; | ||
p->size = 0; | ||
} | ||
|
||
int Buf_Create(CBuf* p, size_t size, ISzAlloc* alloc) { | ||
p->size = 0; | ||
if (size == 0) { | ||
p->data = 0; | ||
return 1; | ||
} | ||
p->data = (Byte*)alloc->Alloc(alloc, size); | ||
if (p->data != 0) { | ||
p->size = size; | ||
return 1; | ||
} | ||
return 0; | ||
} | ||
|
||
void Buf_Free(CBuf* p, ISzAlloc* alloc) { | ||
alloc->Free(alloc, p->data); | ||
p->data = 0; | ||
p->size = 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
/* 7zBuf.h -- Byte Buffer | ||
2008-10-04 : Igor Pavlov : Public domain */ | ||
|
||
#ifndef __7Z_BUF_H | ||
#define __7Z_BUF_H | ||
|
||
#include "LzmaTypes.h" | ||
|
||
namespace crnlib { | ||
|
||
typedef struct | ||
{ | ||
Byte* data; | ||
size_t size; | ||
} CBuf; | ||
|
||
void Buf_Init(CBuf* p); | ||
int Buf_Create(CBuf* p, size_t size, ISzAlloc* alloc); | ||
void Buf_Free(CBuf* p, ISzAlloc* alloc); | ||
|
||
typedef struct | ||
{ | ||
Byte* data; | ||
size_t size; | ||
size_t pos; | ||
} CDynBuf; | ||
|
||
void DynBuf_Construct(CDynBuf* p); | ||
void DynBuf_SeekToBeg(CDynBuf* p); | ||
int DynBuf_Write(CDynBuf* p, const Byte* buf, size_t size, ISzAlloc* alloc); | ||
void DynBuf_Free(CDynBuf* p, ISzAlloc* alloc); | ||
} | ||
|
||
#endif | ||
/* 7zBuf.h -- Byte Buffer | ||
2008-10-04 : Igor Pavlov : Public domain */ | ||
|
||
#ifndef __7Z_BUF_H | ||
#define __7Z_BUF_H | ||
|
||
#include "LzmaTypes.h" | ||
|
||
namespace crnlib { | ||
|
||
typedef struct | ||
{ | ||
Byte* data; | ||
size_t size; | ||
} CBuf; | ||
|
||
void Buf_Init(CBuf* p); | ||
int Buf_Create(CBuf* p, size_t size, ISzAlloc* alloc); | ||
void Buf_Free(CBuf* p, ISzAlloc* alloc); | ||
|
||
typedef struct | ||
{ | ||
Byte* data; | ||
size_t size; | ||
size_t pos; | ||
} CDynBuf; | ||
|
||
void DynBuf_Construct(CDynBuf* p); | ||
void DynBuf_SeekToBeg(CDynBuf* p); | ||
int DynBuf_Write(CDynBuf* p, const Byte* buf, size_t size, ISzAlloc* alloc); | ||
void DynBuf_Free(CDynBuf* p, ISzAlloc* alloc); | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
/* 7zBuf2.c -- Byte Buffer | ||
2008-10-04 : Igor Pavlov : Public domain */ | ||
|
||
/* 7zBuf2.c -- Byte Buffer | ||
2008-10-04 : Igor Pavlov : Public domain */ | ||
|
||
#include <string.h> | ||
|
||
#include "7zBuf.h" | ||
|
||
namespace crnlib { | ||
|
||
void DynBuf_Construct(CDynBuf* p) { | ||
p->data = 0; | ||
p->size = 0; | ||
p->pos = 0; | ||
} | ||
|
||
void DynBuf_SeekToBeg(CDynBuf* p) { | ||
p->pos = 0; | ||
} | ||
|
||
int DynBuf_Write(CDynBuf* p, const Byte* buf, size_t size, ISzAlloc* alloc) { | ||
if (size > p->size - p->pos) { | ||
size_t newSize = p->pos + size; | ||
Byte* data; | ||
newSize += newSize / 4; | ||
data = (Byte*)alloc->Alloc(alloc, newSize); | ||
if (data == 0) | ||
return 0; | ||
p->size = newSize; | ||
memcpy(data, p->data, p->pos); | ||
alloc->Free(alloc, p->data); | ||
p->data = data; | ||
} | ||
memcpy(p->data + p->pos, buf, size); | ||
p->pos += size; | ||
return 1; | ||
} | ||
|
||
void DynBuf_Free(CDynBuf* p, ISzAlloc* alloc) { | ||
alloc->Free(alloc, p->data); | ||
p->data = 0; | ||
p->size = 0; | ||
p->pos = 0; | ||
} | ||
} | ||
|
||
#include "7zBuf.h" | ||
|
||
namespace crnlib { | ||
|
||
void DynBuf_Construct(CDynBuf* p) { | ||
p->data = 0; | ||
p->size = 0; | ||
p->pos = 0; | ||
} | ||
|
||
void DynBuf_SeekToBeg(CDynBuf* p) { | ||
p->pos = 0; | ||
} | ||
|
||
int DynBuf_Write(CDynBuf* p, const Byte* buf, size_t size, ISzAlloc* alloc) { | ||
if (size > p->size - p->pos) { | ||
size_t newSize = p->pos + size; | ||
Byte* data; | ||
newSize += newSize / 4; | ||
data = (Byte*)alloc->Alloc(alloc, newSize); | ||
if (data == 0) | ||
return 0; | ||
p->size = newSize; | ||
memcpy(data, p->data, p->pos); | ||
alloc->Free(alloc, p->data); | ||
p->data = data; | ||
} | ||
memcpy(p->data + p->pos, buf, size); | ||
p->pos += size; | ||
return 1; | ||
} | ||
|
||
void DynBuf_Free(CDynBuf* p, ISzAlloc* alloc) { | ||
alloc->Free(alloc, p->data); | ||
p->data = 0; | ||
p->size = 0; | ||
p->pos = 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
/* 7zCrc.c -- CRC32 calculation | ||
2008-08-05 | ||
Igor Pavlov | ||
/* 7zCrc.c -- CRC32 calculation | ||
2008-08-05 | ||
Igor Pavlov | ||
Public domain */ | ||
|
||
#include "7zCrc.h" | ||
|
||
namespace crnlib { | ||
|
||
#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; | ||
} | ||
} | ||
|
||
#include "7zCrc.h" | ||
|
||
namespace crnlib { | ||
|
||
#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; | ||
} | ||
} |
Oops, something went wrong.