Skip to content

Commit 285133f

Browse files
committed
Initial commit
Signed-off-by: Patrick McCarty <[email protected]>
0 parents  commit 285133f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+25445
-0
lines changed

.clang-format

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: LLVM
4+
AccessModifierOffset: -2
5+
AlignAfterOpenBracket: true
6+
AlignConsecutiveAssignments: false
7+
AlignEscapedNewlinesLeft: false
8+
AlignOperands: true
9+
AlignTrailingComments: true
10+
AllowAllParametersOfDeclarationOnNextLine: true
11+
AllowShortBlocksOnASingleLine: false
12+
AllowShortCaseLabelsOnASingleLine: false
13+
AllowShortFunctionsOnASingleLine: All
14+
AllowShortIfStatementsOnASingleLine: false
15+
AllowShortLoopsOnASingleLine: false
16+
AlwaysBreakAfterDefinitionReturnType: None
17+
AlwaysBreakBeforeMultilineStrings: false
18+
AlwaysBreakTemplateDeclarations: false
19+
BinPackArguments: true
20+
BinPackParameters: true
21+
BreakBeforeBinaryOperators: None
22+
BreakBeforeBraces: Linux
23+
BreakBeforeTernaryOperators: true
24+
BreakConstructorInitializersBeforeComma: false
25+
ColumnLimit: 0
26+
CommentPragmas: '^ IWYU pragma:'
27+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
28+
ConstructorInitializerIndentWidth: 4
29+
ContinuationIndentWidth: 4
30+
Cpp11BracedListStyle: true
31+
DerivePointerAlignment: false
32+
DisableFormat: false
33+
ExperimentalAutoDetectBinPacking: false
34+
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
35+
IndentCaseLabels: false
36+
IndentWidth: 8
37+
IndentWrappedFunctionNames: false
38+
KeepEmptyLinesAtTheStartOfBlocks: true
39+
MacroBlockBegin: ''
40+
MacroBlockEnd: ''
41+
MaxEmptyLinesToKeep: 1
42+
NamespaceIndentation: None
43+
ObjCBlockIndentWidth: 2
44+
ObjCSpaceAfterProperty: false
45+
ObjCSpaceBeforeProtocolList: true
46+
PenaltyBreakBeforeFirstCallParameter: 19
47+
PenaltyBreakComment: 300
48+
PenaltyBreakFirstLessLess: 120
49+
PenaltyBreakString: 1000
50+
PenaltyExcessCharacter: 1000000
51+
PenaltyReturnTypeOnItsOwnLine: 60
52+
PointerAlignment: Right
53+
SpaceAfterCStyleCast: false
54+
SpaceBeforeAssignmentOperators: true
55+
SpaceBeforeParens: ControlStatements
56+
SpaceInEmptyParentheses: false
57+
SpacesBeforeTrailingComments: 1
58+
SpacesInAngles: false
59+
SpacesInContainerLiterals: true
60+
SpacesInCStyleCastParentheses: false
61+
SpacesInParentheses: false
62+
SpacesInSquareBrackets: false
63+
Standard: Cpp11
64+
TabWidth: 8
65+
UseTab: Always
66+
...
67+

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
*.o
2+
.libs/
3+
*.lo
4+
*.pc
5+
config.*
6+
.deps/
7+
aclocal.m4
8+
autom4te.cache/
9+
Makefile
10+
Makefile.in
11+
bsdiff
12+
bsdump
13+
bspatch
14+
compile
15+
configure
16+
depcomp
17+
install-sh
18+
libbsdiff.la
19+
libtool
20+
ltmain.sh
21+
m4/
22+
missing
23+
src/.dirstamp
24+
stamp-h1
25+
bsdiff-*.tar.xz
26+
test/*.diff
27+
test/*.out

COPYING

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Copyright 2003-2005 Colin Percival
2+
All rights reserved
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted providing that the following conditions
6+
are met:
7+
1. Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
2. Redistributions in binary form must reproduce the above copyright
10+
notice, this list of conditions and the following disclaimer in the
11+
documentation and/or other materials provided with the distribution.
12+
13+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
17+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
21+
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22+
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23+
POSSIBILITY OF SUCH DAMAGE.

Makefile.am

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
ACLOCAL_AMFLAGS = -I m4
2+
3+
AM_CFLAGS = \
4+
-fno-common \
5+
-fstack-protector \
6+
-std=gnu99 \
7+
-Wall \
8+
-Wformat \
9+
-Wformat-security \
10+
-Wimplicit-function-declaration \
11+
-Wno-conversion \
12+
-Wstrict-prototypes \
13+
-Wundef \
14+
-Wunreachable-code \
15+
-Wunused-variable
16+
17+
AM_CPPFLAGS = \
18+
$(AM_CFLAGS) \
19+
-D_FORTIFY_SOURCE=2 \
20+
-I$(top_srcdir)/include
21+
22+
EXTRA_DIST = \
23+
COPYING \
24+
findstatic.pl \
25+
README.chromium \
26+
src/bsdiff.sym
27+
28+
AUTOMAKE_OPTIONS = color-tests parallel-tests
29+
30+
if COVERAGE
31+
coverage:
32+
mkdir -p coverage
33+
lcov --compat-libtool --directory . --capture --output-file coverage/report
34+
genhtml -o coverage/ coverage/report
35+
AM_CFLAGS += --coverage
36+
endif
37+
38+
bin_PROGRAMS = \
39+
bsdiff \
40+
bsdump \
41+
bspatch
42+
43+
bsdump_SOURCES = \
44+
src/dump_main.c
45+
46+
bsdump_LDADD = \
47+
libbsdiff.la
48+
49+
bsdiff_SOURCES = \
50+
src/diff_main.c
51+
52+
bsdiff_LDADD = \
53+
libbsdiff.la
54+
55+
bspatch_SOURCES = \
56+
src/patch_main.c
57+
58+
bspatch_LDADD = \
59+
libbsdiff.la
60+
61+
lib_LTLIBRARIES = \
62+
libbsdiff.la
63+
64+
libbsdiff_la_SOURCES = \
65+
src/diff.c \
66+
src/patch.c
67+
68+
libbsdiff_la_LIBADD = \
69+
$(zlib_LIBS)
70+
71+
if ENABLE_LZMA
72+
libbsdiff_la_LIBADD += \
73+
$(lzma_LIBS)
74+
endif
75+
76+
pkgconfiglibdir=$(libdir)/pkgconfig
77+
pkgconfiglib_DATA = \
78+
data/bsdiff.pc
79+
80+
include_HEADERS = \
81+
include/bsdiff.h
82+
83+
noinst_HEADERS = \
84+
src/bsheader.h
85+
86+
# Library version changes according to the libtool convention:
87+
# http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
88+
LIBBSDIFF_CURRENT=1
89+
LIBBSDIFF_REVISION=0
90+
LIBBSDIFF_AGE=0
91+
libbsdiff_la_LDFLAGS = \
92+
-version-info $(LIBBSDIFF_CURRENT):$(LIBBSDIFF_REVISION):$(LIBBSDIFF_AGE) \
93+
-Wl,--version-script=$(top_srcdir)/src/bsdiff.sym
94+
95+
distclean-local:
96+
rm -rf aclocal.m4 ar-lib autom4te.cache config.guess config.h.in config.h.in~ config.sub configure depcomp install-sh ltmain.sh m4 Makefile.in missing compile
97+
98+
install-exec-hook:
99+
perl findstatic.pl */*.o | grep -v Checking ||:
100+
101+
check_PROGRAMS =
102+
103+
release:
104+
@git rev-parse v$(PACKAGE_VERSION) &> /dev/null; \
105+
if [ "$$?" -eq 0 ]; then \
106+
echo "Error: Release $(PACKAGE_VERSION) already exists."; \
107+
echo "Bump version in configure.ac before releasing."; \
108+
exit 1; \
109+
fi
110+
@git tag -a -m "$(PACKAGE_NAME) release $(PACKAGE_VERSION)" v$(PACKAGE_VERSION)
111+
@printf "\nNew release $(PACKAGE_VERSION) tagged!\n\n"

README

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
This project is a forked version of BSDiff, as taken from the Chromium project
2+
at SVN Revision 122769. See README.chromium for background on its origins.
3+
4+
Significant changes after the fork include:
5+
6+
- Changing the BSDiff file format to support file owner, group, and permission
7+
information.
8+
- Adding more robust error handling.
9+
- Adding a new program, bsdump, that outputs BSDiff header information.
10+
- Converting the core functionality into a library, libbsdiff, with public API
11+
functions make_bsdiff_delta() and apply_bsdiff_delta().

README.chromium

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
The README below was taken from a snapshot of the Chromium project at:
2+
svn - Revision 122769: /trunk/src/chrome/installer/mac/third_party/bsdiff
3+
4+
For information specific to the fork as implemented in this project, see the
5+
main README file.
6+
7+
---
8+
9+
Name: BSDiff
10+
URL: http://www.daemonology.net/bsdiff/
11+
Source URL: http://www.daemonology.net/bsdiff/bsdiff-4.3.tar.gz
12+
Version: 4.3
13+
License: BSD
14+
License File: LICENSE
15+
16+
Description:
17+
Binary diff/patch utility. There are other copies of BSDiff in the Chromium
18+
repository, but they're all different. The other copies are based on Mozilla's
19+
fork of BSDiff, which serves a different set of needs. Relative to upstream
20+
BSDiff, Mozilla's version removes all compression, adds a CRC-32 check of the
21+
original file, replaces the custom off_t encoding with signed 32-bit
22+
big-endian integers, and contains a total reorganization of the code. The
23+
version in this directory contains no Mozilla code and builds directly on the
24+
upstream version. It retains and enhances the compression, uses SHA1 to check
25+
both the original file and the patched file, uses a different off_t encoding
26+
more compatible with the original, and involves minimal changes to the
27+
original code.
28+
29+
Theoretically, a hash of the original file should be enough to guarantee data
30+
integrity, but in the event of algorithmic or programming bugs or other
31+
unexpected conditions, a hash of the patched file provides a better guarantee.
32+
This implementation now checks the integrity of both the original and the
33+
patched files. SHA1, rather than CRC-32, is used to minimize the likelihood
34+
that an original file that has been intentionally tampered with will produce
35+
an altered patched file without being detected.
36+
37+
Local Modifications:
38+
- Added LICENSE file by copying the license block from bsdiff.c and
39+
bspatch.c.
40+
- The following modifications are relative to the original unpatched version,
41+
checked in to the Chromium repository at r49280.
42+
- Created goobsdiff.gyp for GYP build system integration.
43+
- Renamed bsdiff.c to goobsdiff.c and bspatch.c to goobspatch.c.
44+
- Added sha1_adapter.cc, sha1_adapter.h, and empty.cc to facilitate hashing.
45+
- Added #include <sys/types.h> to goobspatch.c so that it compiles. (Oops!)
46+
- Changed the magic number in the header from BSDIFF40 to BSDIFF4G.
47+
- Expanded the header to include SHA1 hashes of the original and new files,
48+
and added hash checks to the patcher.
49+
- Expanded the header to include the lengths of the control, diff, and extra
50+
blocks in the patch file, and added patch file length validation to the
51+
patcher.
52+
- Replaced custom off_t encoding with signed 64-bit little-endian integers.
53+
- The control, diff, and extra blocks can be compressed with bzip2, gzip, or
54+
xz/lzma2, or left uncompressed, independently of one another, depending on
55+
which is smallest. This often results in a net reduction in patch size of
56+
about 3%-5%.
57+
- Error messages in the patcher are slightly more descriptive.
58+
- The patcher treats a few more unexpected read cases as errors than it did
59+
previously. This will theoretically cause it to exit with an error instead
60+
of sitting in a busy loop or crashing when certain malformatted patch files
61+
are provided.

autogen.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
autoreconf --force --install --symlink --warnings=all
6+
7+
args="\
8+
--prefix=/usr"
9+
10+
if test -z "${NOCONFIGURE}"; then
11+
./configure $args "$@"
12+
make clean
13+
fi

0 commit comments

Comments
 (0)