Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick McCarty <[email protected]>
  • Loading branch information
phmccarty committed Feb 16, 2016
0 parents commit 285133f
Show file tree
Hide file tree
Showing 46 changed files with 25,445 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: true
AlignConsecutiveAssignments: false
AlignEscapedNewlinesLeft: false
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Linux
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IndentCaseLabels: false
IndentWidth: 8
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Always
...

27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
*.o
.libs/
*.lo
*.pc
config.*
.deps/
aclocal.m4
autom4te.cache/
Makefile
Makefile.in
bsdiff
bsdump
bspatch
compile
configure
depcomp
install-sh
libbsdiff.la
libtool
ltmain.sh
m4/
missing
src/.dirstamp
stamp-h1
bsdiff-*.tar.xz
test/*.diff
test/*.out
23 changes: 23 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Copyright 2003-2005 Colin Percival
All rights reserved

Redistribution and use in source and binary forms, with or without
modification, are permitted providing that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
111 changes: 111 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
ACLOCAL_AMFLAGS = -I m4

AM_CFLAGS = \
-fno-common \
-fstack-protector \
-std=gnu99 \
-Wall \
-Wformat \
-Wformat-security \
-Wimplicit-function-declaration \
-Wno-conversion \
-Wstrict-prototypes \
-Wundef \
-Wunreachable-code \
-Wunused-variable

AM_CPPFLAGS = \
$(AM_CFLAGS) \
-D_FORTIFY_SOURCE=2 \
-I$(top_srcdir)/include

EXTRA_DIST = \
COPYING \
findstatic.pl \
README.chromium \
src/bsdiff.sym

AUTOMAKE_OPTIONS = color-tests parallel-tests

if COVERAGE
coverage:
mkdir -p coverage
lcov --compat-libtool --directory . --capture --output-file coverage/report
genhtml -o coverage/ coverage/report
AM_CFLAGS += --coverage
endif

bin_PROGRAMS = \
bsdiff \
bsdump \
bspatch

bsdump_SOURCES = \
src/dump_main.c

bsdump_LDADD = \
libbsdiff.la

bsdiff_SOURCES = \
src/diff_main.c

bsdiff_LDADD = \
libbsdiff.la

bspatch_SOURCES = \
src/patch_main.c

bspatch_LDADD = \
libbsdiff.la

lib_LTLIBRARIES = \
libbsdiff.la

libbsdiff_la_SOURCES = \
src/diff.c \
src/patch.c

libbsdiff_la_LIBADD = \
$(zlib_LIBS)

if ENABLE_LZMA
libbsdiff_la_LIBADD += \
$(lzma_LIBS)
endif

pkgconfiglibdir=$(libdir)/pkgconfig
pkgconfiglib_DATA = \
data/bsdiff.pc

include_HEADERS = \
include/bsdiff.h

noinst_HEADERS = \
src/bsheader.h

# Library version changes according to the libtool convention:
# http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
LIBBSDIFF_CURRENT=1
LIBBSDIFF_REVISION=0
LIBBSDIFF_AGE=0
libbsdiff_la_LDFLAGS = \
-version-info $(LIBBSDIFF_CURRENT):$(LIBBSDIFF_REVISION):$(LIBBSDIFF_AGE) \
-Wl,--version-script=$(top_srcdir)/src/bsdiff.sym

distclean-local:
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

install-exec-hook:
perl findstatic.pl */*.o | grep -v Checking ||:

check_PROGRAMS =

release:
@git rev-parse v$(PACKAGE_VERSION) &> /dev/null; \
if [ "$$?" -eq 0 ]; then \
echo "Error: Release $(PACKAGE_VERSION) already exists."; \
echo "Bump version in configure.ac before releasing."; \
exit 1; \
fi
@git tag -a -m "$(PACKAGE_NAME) release $(PACKAGE_VERSION)" v$(PACKAGE_VERSION)
@printf "\nNew release $(PACKAGE_VERSION) tagged!\n\n"
11 changes: 11 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
This project is a forked version of BSDiff, as taken from the Chromium project
at SVN Revision 122769. See README.chromium for background on its origins.

Significant changes after the fork include:

- Changing the BSDiff file format to support file owner, group, and permission
information.
- Adding more robust error handling.
- Adding a new program, bsdump, that outputs BSDiff header information.
- Converting the core functionality into a library, libbsdiff, with public API
functions make_bsdiff_delta() and apply_bsdiff_delta().
61 changes: 61 additions & 0 deletions README.chromium
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
The README below was taken from a snapshot of the Chromium project at:
svn - Revision 122769: /trunk/src/chrome/installer/mac/third_party/bsdiff

For information specific to the fork as implemented in this project, see the
main README file.

---

Name: BSDiff
URL: http://www.daemonology.net/bsdiff/
Source URL: http://www.daemonology.net/bsdiff/bsdiff-4.3.tar.gz
Version: 4.3
License: BSD
License File: LICENSE

Description:
Binary diff/patch utility. There are other copies of BSDiff in the Chromium
repository, but they're all different. The other copies are based on Mozilla's
fork of BSDiff, which serves a different set of needs. Relative to upstream
BSDiff, Mozilla's version removes all compression, adds a CRC-32 check of the
original file, replaces the custom off_t encoding with signed 32-bit
big-endian integers, and contains a total reorganization of the code. The
version in this directory contains no Mozilla code and builds directly on the
upstream version. It retains and enhances the compression, uses SHA1 to check
both the original file and the patched file, uses a different off_t encoding
more compatible with the original, and involves minimal changes to the
original code.

Theoretically, a hash of the original file should be enough to guarantee data
integrity, but in the event of algorithmic or programming bugs or other
unexpected conditions, a hash of the patched file provides a better guarantee.
This implementation now checks the integrity of both the original and the
patched files. SHA1, rather than CRC-32, is used to minimize the likelihood
that an original file that has been intentionally tampered with will produce
an altered patched file without being detected.

Local Modifications:
- Added LICENSE file by copying the license block from bsdiff.c and
bspatch.c.
- The following modifications are relative to the original unpatched version,
checked in to the Chromium repository at r49280.
- Created goobsdiff.gyp for GYP build system integration.
- Renamed bsdiff.c to goobsdiff.c and bspatch.c to goobspatch.c.
- Added sha1_adapter.cc, sha1_adapter.h, and empty.cc to facilitate hashing.
- Added #include <sys/types.h> to goobspatch.c so that it compiles. (Oops!)
- Changed the magic number in the header from BSDIFF40 to BSDIFF4G.
- Expanded the header to include SHA1 hashes of the original and new files,
and added hash checks to the patcher.
- Expanded the header to include the lengths of the control, diff, and extra
blocks in the patch file, and added patch file length validation to the
patcher.
- Replaced custom off_t encoding with signed 64-bit little-endian integers.
- The control, diff, and extra blocks can be compressed with bzip2, gzip, or
xz/lzma2, or left uncompressed, independently of one another, depending on
which is smallest. This often results in a net reduction in patch size of
about 3%-5%.
- Error messages in the patcher are slightly more descriptive.
- The patcher treats a few more unexpected read cases as errors than it did
previously. This will theoretically cause it to exit with an error instead
of sitting in a busy loop or crashing when certain malformatted patch files
are provided.
13 changes: 13 additions & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

set -e

autoreconf --force --install --symlink --warnings=all

args="\
--prefix=/usr"

if test -z "${NOCONFIGURE}"; then
./configure $args "$@"
make clean
fi
Loading

0 comments on commit 285133f

Please sign in to comment.