@gfean/react-native-bundle-drop 0.3.9 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BundleDrop.podspec +9 -2
- package/README.md +19 -0
- package/android/build.gradle +43 -4
- package/android/src/main/cpp/CMakeLists.txt +45 -0
- package/android/src/main/cpp/bundle_drop_xdelta_jni.c +55 -0
- package/android/src/main/java/com/bundledrop/BundleDropBundleVerifier.kt +73 -0
- package/android/src/main/java/com/bundledrop/BundleDropFileOps.kt +193 -8
- package/android/src/main/java/com/bundledrop/BundleDropModule.kt +60 -7
- package/android/src/main/java/com/bundledrop/BundleDropOtaPrefs.kt +2 -12
- package/android/src/main/java/com/bundledrop/BundleDropOtaResolver.kt +208 -3
- package/android/src/main/java/com/bundledrop/BundleDropXdeltaNative.kt +57 -0
- package/ios/BundleDropBridge.m +27 -0
- package/ios/BundleDropBundleVerifier.swift +106 -0
- package/ios/BundleDropFileOps.swift +149 -0
- package/ios/BundleDropModule.swift +100 -11
- package/ios/BundleDropOtaResolver.swift +149 -3
- package/ios/BundleDropZipExtractor.m +75 -3
- package/lib/CLI/cli.js +1 -8
- package/lib/CLI/scripts/upload-cli.d.ts +0 -1
- package/lib/CLI/scripts/upload-cli.js +98 -36
- package/lib/api/client.d.ts +11 -1
- package/lib/api/client.js +84 -17
- package/lib/api/clientApi.d.ts +2 -1
- package/lib/api/clientApi.js +9 -0
- package/lib/api/types.d.ts +65 -13
- package/lib/bundleInfo.d.ts +2 -0
- package/lib/fs/bundlePointer.d.ts +2 -1
- package/lib/fs/bundlePointer.js +34 -6
- package/lib/fs/fsUtils.js +4 -1
- package/lib/injectImageResolver.js +82 -75
- package/lib/install/bundleInstallShared.d.ts +8 -0
- package/lib/install/bundleInstallShared.js +97 -0
- package/lib/install/bundleVerification.d.ts +5 -0
- package/lib/install/bundleVerification.js +34 -0
- package/lib/install/installFromZip.d.ts +2 -5
- package/lib/install/installFromZip.js +33 -68
- package/lib/loadConfig.js +12 -1
- package/lib/manager/downloadAndInstall.d.ts +9 -0
- package/lib/manager/downloadAndInstall.js +84 -24
- package/lib/manager/reporting.js +26 -2
- package/lib/manager/rollbackState.js +21 -12
- package/lib/manager/updateCheck.js +89 -11
- package/lib/manager/updateState.js +3 -9
- package/lib/manifest/bundleManifest.d.ts +33 -0
- package/lib/manifest/bundleManifest.js +298 -0
- package/lib/native/bundleDropNative.js +1 -2
- package/lib/native/fs.d.ts +14 -0
- package/lib/native/fs.js +35 -0
- package/lib/patch-engine/installFromPatchSet.d.ts +16 -0
- package/lib/patch-engine/installFromPatchSet.js +143 -0
- package/lib/patch-engine/patchOperations.d.ts +33 -0
- package/lib/patch-engine/patchOperations.js +77 -0
- package/lib/patch-engine/patchTransport.d.ts +18 -0
- package/lib/patch-engine/patchTransport.js +81 -0
- package/lib/patchAlgorithms.d.ts +4 -0
- package/lib/patchAlgorithms.js +9 -0
- package/lib/runtime/service.js +43 -9
- package/lib/scripts/bundle.d.ts +3 -0
- package/lib/scripts/bundle.js +197 -43
- package/lib/scripts/download-bundle.js +18 -7
- package/package.json +44 -6
- package/third_party/xdelta/NOTICE +7 -0
- package/third_party/xdelta/PROVENANCE.md +10 -0
- package/third_party/xdelta/bundle_drop_xdelta.c +252 -0
- package/third_party/xdelta/bundle_drop_xdelta.h +26 -0
- package/third_party/xdelta/xdelta3/LICENSE +176 -0
- package/third_party/xdelta/xdelta3/config.h +34 -0
- package/third_party/xdelta/xdelta3/xdelta3-cfgs.h +171 -0
- package/third_party/xdelta/xdelta3/xdelta3-decode.h +1219 -0
- package/third_party/xdelta/xdelta3/xdelta3-hash.h +159 -0
- package/third_party/xdelta/xdelta3/xdelta3-internal.h +385 -0
- package/third_party/xdelta/xdelta3/xdelta3-list.h +127 -0
- package/third_party/xdelta/xdelta3/xdelta3.c +4819 -0
- package/third_party/xdelta/xdelta3/xdelta3.h +1476 -0
- package/lib/CLI/scripts/init-native-config.d.ts +0 -18
- package/lib/CLI/scripts/init-native-config.js +0 -539
- package/lib/assetExtensions.d.ts +0 -4
- package/lib/assetExtensions.js +0 -35
- package/lib/scripts/upload-bundle.d.ts +0 -9
- package/lib/scripts/upload-bundle.js +0 -320
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Xdelta Provenance
|
|
2
|
+
|
|
3
|
+
- Upstream: https://github.com/jmacd/xdelta
|
|
4
|
+
- Branch: release3_1_apl
|
|
5
|
+
- Commit: 7508fd2a823443b1f0173ca361620f21d62a7d37
|
|
6
|
+
- License: Apache License 2.0
|
|
7
|
+
- Imported: 2026-05-21
|
|
8
|
+
|
|
9
|
+
This SDK vendors the Apache-licensed xdelta source for native mobile
|
|
10
|
+
VCDIFF decode/apply only. Do not replace it with `jmacd/xdelta-gpl`.
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
#include "bundle_drop_xdelta.h"
|
|
2
|
+
|
|
3
|
+
#include <errno.h>
|
|
4
|
+
#include <stdint.h>
|
|
5
|
+
#include <stdio.h>
|
|
6
|
+
#include <string.h>
|
|
7
|
+
#include <sys/stat.h>
|
|
8
|
+
|
|
9
|
+
#include "xdelta3/xdelta3.h"
|
|
10
|
+
|
|
11
|
+
#define BD_XDELTA_INPUT_BUFFER_SIZE (64U * 1024U)
|
|
12
|
+
#define BD_XDELTA_SOURCE_BLOCK_SIZE (64U * 1024U)
|
|
13
|
+
#define BD_XDELTA_MAX_OUTPUT_BYTES (512ULL * 1024ULL * 1024ULL)
|
|
14
|
+
|
|
15
|
+
typedef struct {
|
|
16
|
+
FILE *source_file;
|
|
17
|
+
uint8_t source_buffer[BD_XDELTA_SOURCE_BLOCK_SIZE];
|
|
18
|
+
} bd_xdelta_source_context;
|
|
19
|
+
|
|
20
|
+
static void bd_xdelta_set_error(char *buffer, size_t len, const char *message) {
|
|
21
|
+
if (buffer == NULL || len == 0) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (message == NULL) {
|
|
25
|
+
message = "xdelta error";
|
|
26
|
+
}
|
|
27
|
+
snprintf(buffer, len, "%s", message);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static const char *bd_xdelta_error_message(xd3_stream *stream, int ret) {
|
|
31
|
+
if (stream != NULL && stream->msg != NULL) {
|
|
32
|
+
return stream->msg;
|
|
33
|
+
}
|
|
34
|
+
const char *message = xd3_strerror(ret);
|
|
35
|
+
return message != NULL ? message : "xdelta decode failed";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static int bd_xdelta_source_size(const char *path, xoff_t *size_out) {
|
|
39
|
+
struct stat st;
|
|
40
|
+
if (stat(path, &st) != 0) {
|
|
41
|
+
return errno != 0 ? errno : EIO;
|
|
42
|
+
}
|
|
43
|
+
if (st.st_size < 0) {
|
|
44
|
+
return EINVAL;
|
|
45
|
+
}
|
|
46
|
+
*size_out = (xoff_t)st.st_size;
|
|
47
|
+
return 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static int bd_xdelta_getblk(xd3_stream *stream, xd3_source *source, xoff_t blkno) {
|
|
51
|
+
(void)stream;
|
|
52
|
+
bd_xdelta_source_context *context = (bd_xdelta_source_context *)source->ioh;
|
|
53
|
+
if (context == NULL || context->source_file == NULL) {
|
|
54
|
+
return EINVAL;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
xoff_t offset = blkno * (xoff_t)source->blksize;
|
|
58
|
+
if (fseeko(context->source_file, (off_t)offset, SEEK_SET) != 0) {
|
|
59
|
+
return errno != 0 ? errno : EIO;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
size_t bytes_read = fread(context->source_buffer, 1, source->blksize, context->source_file);
|
|
63
|
+
if (ferror(context->source_file)) {
|
|
64
|
+
return errno != 0 ? errno : EIO;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
source->curblkno = blkno;
|
|
68
|
+
source->onblk = (usize_t)bytes_read;
|
|
69
|
+
source->curblk = context->source_buffer;
|
|
70
|
+
return 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
int bd_xdelta_apply(
|
|
74
|
+
const char *base_path,
|
|
75
|
+
const char *patch_path,
|
|
76
|
+
const char *output_path,
|
|
77
|
+
char *error_buffer,
|
|
78
|
+
size_t error_buffer_len
|
|
79
|
+
) {
|
|
80
|
+
if (base_path == NULL || patch_path == NULL || output_path == NULL) {
|
|
81
|
+
bd_xdelta_set_error(error_buffer, error_buffer_len, "xdelta paths must not be null");
|
|
82
|
+
return -1;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
FILE *base_file = NULL;
|
|
86
|
+
FILE *patch_file = NULL;
|
|
87
|
+
FILE *output_file = NULL;
|
|
88
|
+
xd3_stream stream;
|
|
89
|
+
xd3_config config;
|
|
90
|
+
xd3_source source;
|
|
91
|
+
bd_xdelta_source_context source_context;
|
|
92
|
+
uint8_t input_buffer[BD_XDELTA_INPUT_BUFFER_SIZE];
|
|
93
|
+
uint64_t total_output = 0;
|
|
94
|
+
xoff_t source_size = 0;
|
|
95
|
+
int result = -1;
|
|
96
|
+
|
|
97
|
+
memset(&stream, 0, sizeof(stream));
|
|
98
|
+
memset(&config, 0, sizeof(config));
|
|
99
|
+
memset(&source, 0, sizeof(source));
|
|
100
|
+
memset(&source_context, 0, sizeof(source_context));
|
|
101
|
+
|
|
102
|
+
int stat_error = bd_xdelta_source_size(base_path, &source_size);
|
|
103
|
+
if (stat_error != 0) {
|
|
104
|
+
bd_xdelta_set_error(error_buffer, error_buffer_len, "failed to stat xdelta base file");
|
|
105
|
+
goto cleanup;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
base_file = fopen(base_path, "rb");
|
|
109
|
+
if (base_file == NULL) {
|
|
110
|
+
bd_xdelta_set_error(error_buffer, error_buffer_len, "failed to open xdelta base file");
|
|
111
|
+
goto cleanup;
|
|
112
|
+
}
|
|
113
|
+
patch_file = fopen(patch_path, "rb");
|
|
114
|
+
if (patch_file == NULL) {
|
|
115
|
+
bd_xdelta_set_error(error_buffer, error_buffer_len, "failed to open xdelta patch file");
|
|
116
|
+
goto cleanup;
|
|
117
|
+
}
|
|
118
|
+
output_file = fopen(output_path, "wb");
|
|
119
|
+
if (output_file == NULL) {
|
|
120
|
+
bd_xdelta_set_error(error_buffer, error_buffer_len, "failed to open xdelta output file");
|
|
121
|
+
goto cleanup;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
source_context.source_file = base_file;
|
|
125
|
+
source.blksize = BD_XDELTA_SOURCE_BLOCK_SIZE;
|
|
126
|
+
source.name = base_path;
|
|
127
|
+
source.ioh = &source_context;
|
|
128
|
+
source.max_winsize = XD3_DEFAULT_SRCWINSZ;
|
|
129
|
+
|
|
130
|
+
xd3_init_config(&config, XD3_ADLER32_NOVER);
|
|
131
|
+
config.winsize = XD3_DEFAULT_WINSIZE;
|
|
132
|
+
config.getblk = bd_xdelta_getblk;
|
|
133
|
+
|
|
134
|
+
int ret = xd3_config_stream(&stream, &config);
|
|
135
|
+
if (ret != 0) {
|
|
136
|
+
bd_xdelta_set_error(error_buffer, error_buffer_len, bd_xdelta_error_message(&stream, ret));
|
|
137
|
+
goto cleanup;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
ret = xd3_set_source_and_size(&stream, &source, source_size);
|
|
141
|
+
if (ret != 0) {
|
|
142
|
+
bd_xdelta_set_error(error_buffer, error_buffer_len, bd_xdelta_error_message(&stream, ret));
|
|
143
|
+
goto cleanup;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
size_t bytes_read;
|
|
147
|
+
do {
|
|
148
|
+
bytes_read = fread(input_buffer, 1, sizeof(input_buffer), patch_file);
|
|
149
|
+
if (ferror(patch_file)) {
|
|
150
|
+
bd_xdelta_set_error(error_buffer, error_buffer_len, "failed to read xdelta patch file");
|
|
151
|
+
goto cleanup;
|
|
152
|
+
}
|
|
153
|
+
if (bytes_read < sizeof(input_buffer)) {
|
|
154
|
+
stream.flags |= XD3_FLUSH;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
xd3_avail_input(&stream, input_buffer, (usize_t)bytes_read);
|
|
158
|
+
|
|
159
|
+
for (;;) {
|
|
160
|
+
ret = xd3_decode_input(&stream);
|
|
161
|
+
if (ret == XD3_INPUT) {
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
if (ret == XD3_GOTHEADER || ret == XD3_WINSTART || ret == XD3_WINFINISH) {
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
if (ret == XD3_OUTPUT) {
|
|
168
|
+
if (total_output + stream.avail_out > BD_XDELTA_MAX_OUTPUT_BYTES) {
|
|
169
|
+
bd_xdelta_set_error(error_buffer, error_buffer_len, "xdelta output exceeds safety limit");
|
|
170
|
+
goto cleanup;
|
|
171
|
+
}
|
|
172
|
+
if (fwrite(stream.next_out, 1, stream.avail_out, output_file) != stream.avail_out) {
|
|
173
|
+
bd_xdelta_set_error(error_buffer, error_buffer_len, "failed to write xdelta output file");
|
|
174
|
+
goto cleanup;
|
|
175
|
+
}
|
|
176
|
+
total_output += stream.avail_out;
|
|
177
|
+
xd3_consume_output(&stream);
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
bd_xdelta_set_error(error_buffer, error_buffer_len, bd_xdelta_error_message(&stream, ret));
|
|
182
|
+
goto cleanup;
|
|
183
|
+
}
|
|
184
|
+
} while (bytes_read == sizeof(input_buffer));
|
|
185
|
+
|
|
186
|
+
ret = xd3_close_stream(&stream);
|
|
187
|
+
if (ret != 0) {
|
|
188
|
+
bd_xdelta_set_error(error_buffer, error_buffer_len, bd_xdelta_error_message(&stream, ret));
|
|
189
|
+
goto cleanup;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (fflush(output_file) != 0) {
|
|
193
|
+
bd_xdelta_set_error(error_buffer, error_buffer_len, "failed to flush xdelta output file");
|
|
194
|
+
goto cleanup;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
result = 0;
|
|
198
|
+
|
|
199
|
+
cleanup:
|
|
200
|
+
if (result != 0) {
|
|
201
|
+
xd3_abort_stream(&stream);
|
|
202
|
+
}
|
|
203
|
+
xd3_free_stream(&stream);
|
|
204
|
+
if (output_file != NULL) {
|
|
205
|
+
fclose(output_file);
|
|
206
|
+
}
|
|
207
|
+
if (patch_file != NULL) {
|
|
208
|
+
fclose(patch_file);
|
|
209
|
+
}
|
|
210
|
+
if (base_file != NULL) {
|
|
211
|
+
fclose(base_file);
|
|
212
|
+
}
|
|
213
|
+
if (result != 0) {
|
|
214
|
+
remove(output_path);
|
|
215
|
+
}
|
|
216
|
+
return result;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
int bd_xdelta_self_test(void) {
|
|
220
|
+
static const uint8_t base[] = "Bundle Drop xdelta base fixture\nline one\n";
|
|
221
|
+
static const uint8_t expected[] = "Bundle Drop xdelta target fixture\nline two\n";
|
|
222
|
+
static const uint8_t patch[] = {
|
|
223
|
+
0xd6, 0xc3, 0xc4, 0x00, 0x04, 0x15, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74,
|
|
224
|
+
0x2e, 0x74, 0x78, 0x74, 0x2f, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x74,
|
|
225
|
+
0x78, 0x74, 0x2f, 0x05, 0x25, 0x00, 0x1a, 0x2b, 0x00, 0x0a, 0x05, 0x02,
|
|
226
|
+
0x5d, 0x5e, 0x0f, 0xb6, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x74, 0x77,
|
|
227
|
+
0x6f, 0x0a, 0x13, 0x13, 0x07, 0x1e, 0x05, 0x00, 0x17
|
|
228
|
+
};
|
|
229
|
+
uint8_t output[sizeof(expected)];
|
|
230
|
+
usize_t output_size = sizeof(output);
|
|
231
|
+
int ret = xd3_decode_memory(
|
|
232
|
+
patch,
|
|
233
|
+
(usize_t)sizeof(patch),
|
|
234
|
+
base,
|
|
235
|
+
(usize_t)(sizeof(base) - 1),
|
|
236
|
+
output,
|
|
237
|
+
&output_size,
|
|
238
|
+
(usize_t)sizeof(output),
|
|
239
|
+
XD3_ADLER32_NOVER
|
|
240
|
+
);
|
|
241
|
+
if (ret != 0) {
|
|
242
|
+
return 0;
|
|
243
|
+
}
|
|
244
|
+
if (output_size != sizeof(expected) - 1) {
|
|
245
|
+
return 0;
|
|
246
|
+
}
|
|
247
|
+
return memcmp(output, expected, sizeof(expected) - 1) == 0 ? 1 : 0;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const char *bd_xdelta_version(void) {
|
|
251
|
+
return "xdelta 3.1.1-apl release3_1_apl 7508fd2a823443b1f0173ca361620f21d62a7d37";
|
|
252
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#ifndef BUNDLE_DROP_XDELTA_H
|
|
2
|
+
#define BUNDLE_DROP_XDELTA_H
|
|
3
|
+
|
|
4
|
+
#include <stddef.h>
|
|
5
|
+
|
|
6
|
+
#ifdef __cplusplus
|
|
7
|
+
extern "C" {
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
int bd_xdelta_apply(
|
|
11
|
+
const char *base_path,
|
|
12
|
+
const char *patch_path,
|
|
13
|
+
const char *output_path,
|
|
14
|
+
char *error_buffer,
|
|
15
|
+
size_t error_buffer_len
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
int bd_xdelta_self_test(void);
|
|
19
|
+
|
|
20
|
+
const char *bd_xdelta_version(void);
|
|
21
|
+
|
|
22
|
+
#ifdef __cplusplus
|
|
23
|
+
}
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
#endif
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#ifndef BUNDLE_DROP_XDELTA_CONFIG_H
|
|
2
|
+
#define BUNDLE_DROP_XDELTA_CONFIG_H
|
|
3
|
+
|
|
4
|
+
#if !defined(__cplusplus) && !defined(static_assert)
|
|
5
|
+
#define static_assert _Static_assert
|
|
6
|
+
#endif
|
|
7
|
+
|
|
8
|
+
#define SIZEOF_UNSIGNED_INT 4
|
|
9
|
+
#define SIZEOF_UNSIGNED_LONG_LONG 8
|
|
10
|
+
|
|
11
|
+
#if defined(__LP64__) || defined(_WIN64)
|
|
12
|
+
#define SIZEOF_SIZE_T 8
|
|
13
|
+
#define SIZEOF_UNSIGNED_LONG 8
|
|
14
|
+
#else
|
|
15
|
+
#define SIZEOF_SIZE_T 4
|
|
16
|
+
#define SIZEOF_UNSIGNED_LONG 4
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
#define XD3_MAIN 0
|
|
20
|
+
#define XD3_ENCODER 0
|
|
21
|
+
#define REGRESSION_TEST 0
|
|
22
|
+
#define NOT_MAIN 0
|
|
23
|
+
#define PYTHON_MODULE 0
|
|
24
|
+
#define SWIG_MODULE 0
|
|
25
|
+
#define SECONDARY_DJW 0
|
|
26
|
+
#define SECONDARY_FGK 0
|
|
27
|
+
#define SECONDARY_LZMA 0
|
|
28
|
+
|
|
29
|
+
#define XD3_HARDMAXWINSIZE (1U << 26)
|
|
30
|
+
#define XD3_DEFAULT_WINSIZE (1U << 20)
|
|
31
|
+
#define XD3_DEFAULT_SRCWINSZ (1U << 26)
|
|
32
|
+
#define XD3_DEFAULT_IOPT_SIZE (1U << 15)
|
|
33
|
+
|
|
34
|
+
#endif
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/* xdelta3 - delta compression tools and library
|
|
2
|
+
Copyright 2016 Joshua MacDonald
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/******************************************************************
|
|
18
|
+
SOFT string matcher
|
|
19
|
+
******************************************************************/
|
|
20
|
+
|
|
21
|
+
#if XD3_BUILD_SOFT
|
|
22
|
+
|
|
23
|
+
#define TEMPLATE soft
|
|
24
|
+
#define LLOOK stream->smatcher.large_look
|
|
25
|
+
#define LSTEP stream->smatcher.large_step
|
|
26
|
+
#define SLOOK stream->smatcher.small_look
|
|
27
|
+
#define SCHAIN stream->smatcher.small_chain
|
|
28
|
+
#define SLCHAIN stream->smatcher.small_lchain
|
|
29
|
+
#define MAXLAZY stream->smatcher.max_lazy
|
|
30
|
+
#define LONGENOUGH stream->smatcher.long_enough
|
|
31
|
+
|
|
32
|
+
#define SOFTCFG 1
|
|
33
|
+
#include "xdelta3.c"
|
|
34
|
+
#undef SOFTCFG
|
|
35
|
+
|
|
36
|
+
#undef TEMPLATE
|
|
37
|
+
#undef LLOOK
|
|
38
|
+
#undef SLOOK
|
|
39
|
+
#undef LSTEP
|
|
40
|
+
#undef SCHAIN
|
|
41
|
+
#undef SLCHAIN
|
|
42
|
+
#undef MAXLAZY
|
|
43
|
+
#undef LONGENOUGH
|
|
44
|
+
#endif
|
|
45
|
+
|
|
46
|
+
#define SOFTCFG 0
|
|
47
|
+
|
|
48
|
+
/************************************************************
|
|
49
|
+
FASTEST string matcher
|
|
50
|
+
**********************************************************/
|
|
51
|
+
#if XD3_BUILD_FASTEST
|
|
52
|
+
#define TEMPLATE fastest
|
|
53
|
+
#define LLOOK 9
|
|
54
|
+
#define LSTEP 26
|
|
55
|
+
#define SLOOK 4U
|
|
56
|
+
#define SCHAIN 1
|
|
57
|
+
#define SLCHAIN 1
|
|
58
|
+
#define MAXLAZY 6
|
|
59
|
+
#define LONGENOUGH 6
|
|
60
|
+
|
|
61
|
+
#include "xdelta3.c"
|
|
62
|
+
|
|
63
|
+
#undef TEMPLATE
|
|
64
|
+
#undef LLOOK
|
|
65
|
+
#undef SLOOK
|
|
66
|
+
#undef LSTEP
|
|
67
|
+
#undef SCHAIN
|
|
68
|
+
#undef SLCHAIN
|
|
69
|
+
#undef MAXLAZY
|
|
70
|
+
#undef LONGENOUGH
|
|
71
|
+
#endif
|
|
72
|
+
|
|
73
|
+
/************************************************************
|
|
74
|
+
FASTER string matcher
|
|
75
|
+
**********************************************************/
|
|
76
|
+
#if XD3_BUILD_FASTER
|
|
77
|
+
#define TEMPLATE faster
|
|
78
|
+
#define LLOOK 9
|
|
79
|
+
#define LSTEP 15
|
|
80
|
+
#define SLOOK 4U
|
|
81
|
+
#define SCHAIN 1
|
|
82
|
+
#define SLCHAIN 1
|
|
83
|
+
#define MAXLAZY 18
|
|
84
|
+
#define LONGENOUGH 18
|
|
85
|
+
|
|
86
|
+
#include "xdelta3.c"
|
|
87
|
+
|
|
88
|
+
#undef TEMPLATE
|
|
89
|
+
#undef LLOOK
|
|
90
|
+
#undef SLOOK
|
|
91
|
+
#undef LSTEP
|
|
92
|
+
#undef SCHAIN
|
|
93
|
+
#undef SLCHAIN
|
|
94
|
+
#undef MAXLAZY
|
|
95
|
+
#undef LONGENOUGH
|
|
96
|
+
#endif
|
|
97
|
+
|
|
98
|
+
/******************************************************
|
|
99
|
+
FAST string matcher
|
|
100
|
+
********************************************************/
|
|
101
|
+
#if XD3_BUILD_FAST
|
|
102
|
+
#define TEMPLATE fast
|
|
103
|
+
#define LLOOK 9
|
|
104
|
+
#define LSTEP 8
|
|
105
|
+
#define SLOOK 4U
|
|
106
|
+
#define SCHAIN 4
|
|
107
|
+
#define SLCHAIN 1
|
|
108
|
+
#define MAXLAZY 18
|
|
109
|
+
#define LONGENOUGH 35
|
|
110
|
+
|
|
111
|
+
#include "xdelta3.c"
|
|
112
|
+
|
|
113
|
+
#undef TEMPLATE
|
|
114
|
+
#undef LLOOK
|
|
115
|
+
#undef SLOOK
|
|
116
|
+
#undef LSTEP
|
|
117
|
+
#undef SCHAIN
|
|
118
|
+
#undef SLCHAIN
|
|
119
|
+
#undef MAXLAZY
|
|
120
|
+
#undef LONGENOUGH
|
|
121
|
+
#endif
|
|
122
|
+
|
|
123
|
+
/**************************************************
|
|
124
|
+
SLOW string matcher
|
|
125
|
+
**************************************************************/
|
|
126
|
+
#if XD3_BUILD_SLOW
|
|
127
|
+
#define TEMPLATE slow
|
|
128
|
+
#define LLOOK 9
|
|
129
|
+
#define LSTEP 2
|
|
130
|
+
#define SLOOK 4U
|
|
131
|
+
#define SCHAIN 44
|
|
132
|
+
#define SLCHAIN 13
|
|
133
|
+
#define MAXLAZY 90
|
|
134
|
+
#define LONGENOUGH 70
|
|
135
|
+
|
|
136
|
+
#include "xdelta3.c"
|
|
137
|
+
|
|
138
|
+
#undef TEMPLATE
|
|
139
|
+
#undef LLOOK
|
|
140
|
+
#undef SLOOK
|
|
141
|
+
#undef LSTEP
|
|
142
|
+
#undef SCHAIN
|
|
143
|
+
#undef SLCHAIN
|
|
144
|
+
#undef MAXLAZY
|
|
145
|
+
#undef LONGENOUGH
|
|
146
|
+
#endif
|
|
147
|
+
|
|
148
|
+
/********************************************************
|
|
149
|
+
DEFAULT string matcher
|
|
150
|
+
************************************************************/
|
|
151
|
+
#if XD3_BUILD_DEFAULT
|
|
152
|
+
#define TEMPLATE default
|
|
153
|
+
#define LLOOK 9
|
|
154
|
+
#define LSTEP 3
|
|
155
|
+
#define SLOOK 4U
|
|
156
|
+
#define SCHAIN 8
|
|
157
|
+
#define SLCHAIN 2
|
|
158
|
+
#define MAXLAZY 36
|
|
159
|
+
#define LONGENOUGH 70
|
|
160
|
+
|
|
161
|
+
#include "xdelta3.c"
|
|
162
|
+
|
|
163
|
+
#undef TEMPLATE
|
|
164
|
+
#undef LLOOK
|
|
165
|
+
#undef SLOOK
|
|
166
|
+
#undef LSTEP
|
|
167
|
+
#undef SCHAIN
|
|
168
|
+
#undef SLCHAIN
|
|
169
|
+
#undef MAXLAZY
|
|
170
|
+
#undef LONGENOUGH
|
|
171
|
+
#endif
|