Skip to content

Commit daed7bc

Browse files
committed
Rename exported Brotli APIs so they do not conflict with system ones.
1 parent 6a56a3e commit daed7bc

File tree

18 files changed

+123
-123
lines changed

18 files changed

+123
-123
lines changed

external/corefx-bugfix/src/Common/src/Microsoft/Win32/SafeHandles/SafeBrotliHandle.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public SafeBrotliEncoderHandle() : base(IntPtr.Zero, true) { }
1313

1414
protected override bool ReleaseHandle()
1515
{
16-
Interop.Brotli.BrotliEncoderDestroyInstance(handle);
16+
Interop.Brotli.MonoBrotliEncoderDestroyInstance(handle);
1717
return true;
1818
}
1919

@@ -26,7 +26,7 @@ public SafeBrotliDecoderHandle() : base(IntPtr.Zero, true) { }
2626

2727
protected override bool ReleaseHandle()
2828
{
29-
Interop.Brotli.BrotliDecoderDestroyInstance(handle);
29+
Interop.Brotli.MonoBrotliDecoderDestroyInstance(handle);
3030
return true;
3131
}
3232

external/corefx-bugfix/src/Native/AnyOS/brotli/dec/decode.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ BROTLI_BOOL BrotliDecoderSetParameter(
7474
}
7575
}
7676

77-
DLLEXPORT BrotliDecoderState* BrotliDecoderCreateInstance(
77+
DLLEXPORT BrotliDecoderState* MonoBrotliDecoderCreateInstance(
7878
brotli_alloc_func alloc_func, brotli_free_func free_func, void* opaque) {
7979
BrotliDecoderState* state = 0;
8080
if (!alloc_func && !free_func) {
@@ -99,7 +99,7 @@ DLLEXPORT BrotliDecoderState* BrotliDecoderCreateInstance(
9999
}
100100

101101
/* Deinitializes and frees BrotliDecoderState instance. */
102-
DLLEXPORT void BrotliDecoderDestroyInstance(BrotliDecoderState* state) {
102+
DLLEXPORT void MonoBrotliDecoderDestroyInstance(BrotliDecoderState* state) {
103103
if (!state) {
104104
return;
105105
} else {
@@ -2032,7 +2032,7 @@ static BROTLI_NOINLINE BrotliDecoderErrorCode SafeProcessCommands(
20322032
return ProcessCommandsInternal(1, s);
20332033
}
20342034

2035-
DLLEXPORT BrotliDecoderResult BrotliDecoderDecompress(
2035+
DLLEXPORT BrotliDecoderResult MonoBrotliDecoderDecompress(
20362036
size_t encoded_size, const uint8_t* encoded_buffer, size_t* decoded_size,
20372037
uint8_t* decoded_buffer) {
20382038
BrotliDecoderState s;
@@ -2045,7 +2045,7 @@ DLLEXPORT BrotliDecoderResult BrotliDecoderDecompress(
20452045
if (!BrotliDecoderStateInit(&s, 0, 0, 0)) {
20462046
return BROTLI_DECODER_RESULT_ERROR;
20472047
}
2048-
result = BrotliDecoderDecompressStream(
2048+
result = MonoBrotliDecoderDecompressStream(
20492049
&s, &available_in, &next_in, &available_out, &next_out, &total_out);
20502050
*decoded_size = total_out;
20512051
BrotliDecoderStateCleanup(&s);
@@ -2066,7 +2066,7 @@ DLLEXPORT BrotliDecoderResult BrotliDecoderDecompress(
20662066
buffer ahead of time
20672067
- when result is "success" decoder MUST return all unused data back to input
20682068
buffer; this is possible because the invariant is held on enter */
2069-
DLLEXPORT BrotliDecoderResult BrotliDecoderDecompressStream(
2069+
DLLEXPORT BrotliDecoderResult MonoBrotliDecoderDecompressStream(
20702070
BrotliDecoderState* s, size_t* available_in, const uint8_t** next_in,
20712071
size_t* available_out, uint8_t** next_out, size_t* total_out) {
20722072
BrotliDecoderErrorCode result = BROTLI_DECODER_SUCCESS;
@@ -2565,7 +2565,7 @@ const uint8_t* BrotliDecoderTakeOutput(BrotliDecoderState* s, size_t* size) {
25652565
*size = requested_out - available_out;
25662566
} else {
25672567
/* ... or stream is broken. Normally this should be caught by
2568-
BrotliDecoderDecompressStream, this is just a safeguard. */
2568+
MonoBrotliDecoderDecompressStream, this is just a safeguard. */
25692569
if ((int)status < 0) SaveErrorCode(s, status);
25702570
*size = 0;
25712571
result = 0;
@@ -2578,7 +2578,7 @@ BROTLI_BOOL BrotliDecoderIsUsed(const BrotliDecoderState* s) {
25782578
BrotliGetAvailableBits(&s->br) != 0);
25792579
}
25802580

2581-
DLLEXPORT BROTLI_BOOL BrotliDecoderIsFinished(const BrotliDecoderState* s) {
2581+
DLLEXPORT BROTLI_BOOL MonoBrotliDecoderIsFinished(const BrotliDecoderState* s) {
25822582
return TO_BROTLI_BOOL(s->state == BROTLI_STATE_DONE) &&
25832583
!BrotliDecoderHasMoreOutput(s);
25842584
}

external/corefx-bugfix/src/Native/AnyOS/brotli/enc/encode.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ static size_t RemainingInputBlockSize(BrotliEncoderState* s) {
143143
return block_size - (size_t)delta;
144144
}
145145

146-
DLLEXPORT BROTLI_BOOL BrotliEncoderSetParameter(
146+
DLLEXPORT BROTLI_BOOL MonoBrotliEncoderSetParameter(
147147
BrotliEncoderState* state, BrotliEncoderParameter p, uint32_t value) {
148148
/* Changing parameters on the fly is not implemented yet. */
149149
if (state->is_initialized_) return BROTLI_FALSE;
@@ -794,7 +794,7 @@ static void BrotliEncoderInitState(BrotliEncoderState* s) {
794794
memcpy(s->saved_dist_cache_, s->dist_cache_, sizeof(s->saved_dist_cache_));
795795
}
796796

797-
DLLEXPORT BrotliEncoderState* BrotliEncoderCreateInstance(
797+
DLLEXPORT BrotliEncoderState* MonoBrotliEncoderCreateInstance(
798798
brotli_alloc_func alloc_func, brotli_free_func free_func, void* opaque) {
799799
BrotliEncoderState* state = 0;
800800
if (!alloc_func && !free_func) {
@@ -828,7 +828,7 @@ static void BrotliEncoderCleanupState(BrotliEncoderState* s) {
828828
}
829829

830830
/* Deinitializes and frees BrotliEncoderState instance. */
831-
DLLEXPORT void BrotliEncoderDestroyInstance(BrotliEncoderState* state) {
831+
DLLEXPORT void MonoBrotliEncoderDestroyInstance(BrotliEncoderState* state) {
832832
if (!state) {
833833
return;
834834
} else {
@@ -1468,7 +1468,7 @@ static size_t MakeUncompressedStream(
14681468
return result;
14691469
}
14701470

1471-
DLLEXPORT BROTLI_BOOL BrotliEncoderCompress(
1471+
DLLEXPORT BROTLI_BOOL MonoBrotliEncoderCompress(
14721472
int quality, int lgwin, BrotliEncoderMode mode, size_t input_size,
14731473
const uint8_t* input_buffer, size_t* encoded_size,
14741474
uint8_t* encoded_buffer) {
@@ -1499,7 +1499,7 @@ DLLEXPORT BROTLI_BOOL BrotliEncoderCompress(
14991499
return BROTLI_TRUE;
15001500
}
15011501

1502-
s = BrotliEncoderCreateInstance(0, 0, 0);
1502+
s = MonoBrotliEncoderCreateInstance(0, 0, 0);
15031503
if (!s) {
15041504
return BROTLI_FALSE;
15051505
} else {
@@ -1509,18 +1509,18 @@ DLLEXPORT BROTLI_BOOL BrotliEncoderCompress(
15091509
uint8_t* next_out = encoded_buffer;
15101510
size_t total_out = 0;
15111511
BROTLI_BOOL result = BROTLI_FALSE;
1512-
BrotliEncoderSetParameter(s, BROTLI_PARAM_QUALITY, (uint32_t)quality);
1513-
BrotliEncoderSetParameter(s, BROTLI_PARAM_LGWIN, (uint32_t)lgwin);
1514-
BrotliEncoderSetParameter(s, BROTLI_PARAM_MODE, (uint32_t)mode);
1515-
BrotliEncoderSetParameter(s, BROTLI_PARAM_SIZE_HINT, (uint32_t)input_size);
1512+
MonoBrotliEncoderSetParameter(s, BROTLI_PARAM_QUALITY, (uint32_t)quality);
1513+
MonoBrotliEncoderSetParameter(s, BROTLI_PARAM_LGWIN, (uint32_t)lgwin);
1514+
MonoBrotliEncoderSetParameter(s, BROTLI_PARAM_MODE, (uint32_t)mode);
1515+
MonoBrotliEncoderSetParameter(s, BROTLI_PARAM_SIZE_HINT, (uint32_t)input_size);
15161516
if (lgwin > BROTLI_MAX_WINDOW_BITS) {
1517-
BrotliEncoderSetParameter(s, BROTLI_PARAM_LARGE_WINDOW, BROTLI_TRUE);
1517+
MonoBrotliEncoderSetParameter(s, BROTLI_PARAM_LARGE_WINDOW, BROTLI_TRUE);
15181518
}
1519-
result = BrotliEncoderCompressStream(s, BROTLI_OPERATION_FINISH,
1519+
result = MonoBrotliEncoderCompressStream(s, BROTLI_OPERATION_FINISH,
15201520
&available_in, &next_in, &available_out, &next_out, &total_out);
15211521
if (!BrotliEncoderIsFinished(s)) result = 0;
15221522
*encoded_size = total_out;
1523-
BrotliEncoderDestroyInstance(s);
1523+
MonoBrotliEncoderDestroyInstance(s);
15241524
if (!result || (max_out_size && *encoded_size > max_out_size)) {
15251525
goto fallback;
15261526
}
@@ -1801,7 +1801,7 @@ static void UpdateSizeHint(BrotliEncoderState* s, size_t available_in) {
18011801
}
18021802
}
18031803

1804-
DLLEXPORT BROTLI_BOOL BrotliEncoderCompressStream(
1804+
DLLEXPORT BROTLI_BOOL MonoBrotliEncoderCompressStream(
18051805
BrotliEncoderState* s, BrotliEncoderOperation op, size_t* available_in,
18061806
const uint8_t** next_in, size_t* available_out,uint8_t** next_out,
18071807
size_t* total_out) {
@@ -1892,10 +1892,10 @@ DLLEXPORT BROTLI_BOOL BrotliEncoderCompressStream(
18921892

18931893
BROTLI_BOOL BrotliEncoderIsFinished(BrotliEncoderState* s) {
18941894
return TO_BROTLI_BOOL(s->stream_state_ == BROTLI_STREAM_FINISHED &&
1895-
!BrotliEncoderHasMoreOutput(s));
1895+
!MonoBrotliEncoderHasMoreOutput(s));
18961896
}
18971897

1898-
DLLEXPORT BROTLI_BOOL BrotliEncoderHasMoreOutput(BrotliEncoderState* s) {
1898+
DLLEXPORT BROTLI_BOOL MonoBrotliEncoderHasMoreOutput(BrotliEncoderState* s) {
18991899
return TO_BROTLI_BOOL(s->available_out_ != 0);
19001900
}
19011901

external/corefx-bugfix/src/Native/AnyOS/brotli/include/brotli/decode.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ extern "C" {
2222
/**
2323
* Opaque structure that holds decoder state.
2424
*
25-
* Allocated and initialized with ::BrotliDecoderCreateInstance.
26-
* Cleaned up and deallocated with ::BrotliDecoderDestroyInstance.
25+
* Allocated and initialized with ::MonoBrotliDecoderCreateInstance.
26+
* Cleaned up and deallocated with ::MonoBrotliDecoderDestroyInstance.
2727
*/
2828
typedef struct BrotliDecoderStateStruct BrotliDecoderState;
2929

3030
/**
31-
* Result type for ::BrotliDecoderDecompress and
32-
* ::BrotliDecoderDecompressStream functions.
31+
* Result type for ::MonoBrotliDecoderDecompress and
32+
* ::MonoBrotliDecoderDecompressStream functions.
3333
*/
3434
typedef enum {
3535
/** Decoding error, e.g. corrupted input or memory allocation problem. */
@@ -158,7 +158,7 @@ BROTLI_DEC_API BROTLI_BOOL BrotliDecoderSetParameter(
158158
* Creates an instance of ::BrotliDecoderState and initializes it.
159159
*
160160
* The instance can be used once for decoding and should then be destroyed with
161-
* ::BrotliDecoderDestroyInstance, it cannot be reused for a new decoding
161+
* ::MonoBrotliDecoderDestroyInstance, it cannot be reused for a new decoding
162162
* session.
163163
*
164164
* @p alloc_func and @p free_func @b MUST be both zero or both non-zero. In the
@@ -172,15 +172,15 @@ BROTLI_DEC_API BROTLI_BOOL BrotliDecoderSetParameter(
172172
* @returns @c 0 if instance can not be allocated or initialized
173173
* @returns pointer to initialized ::BrotliDecoderState otherwise
174174
*/
175-
BROTLI_DEC_API BrotliDecoderState* BrotliDecoderCreateInstance(
175+
BROTLI_DEC_API BrotliDecoderState* MonoBrotliDecoderCreateInstance(
176176
brotli_alloc_func alloc_func, brotli_free_func free_func, void* opaque);
177177

178178
/**
179179
* Deinitializes and frees ::BrotliDecoderState instance.
180180
*
181181
* @param state decoder instance to be cleaned up and deallocated
182182
*/
183-
BROTLI_DEC_API void BrotliDecoderDestroyInstance(BrotliDecoderState* state);
183+
BROTLI_DEC_API void MonoBrotliDecoderDestroyInstance(BrotliDecoderState* state);
184184

185185
/**
186186
* Performs one-shot memory-to-memory decompression.
@@ -199,7 +199,7 @@ BROTLI_DEC_API void BrotliDecoderDestroyInstance(BrotliDecoderState* state);
199199
* allocation failed, or @p decoded_buffer is not large enough;
200200
* @returns ::BROTLI_DECODER_RESULT_SUCCESS otherwise
201201
*/
202-
BROTLI_DEC_API BrotliDecoderResult BrotliDecoderDecompress(
202+
BROTLI_DEC_API BrotliDecoderResult MonoBrotliDecoderDecompress(
203203
size_t encoded_size,
204204
const uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)],
205205
size_t* decoded_size,
@@ -243,7 +243,7 @@ BROTLI_DEC_API BrotliDecoderResult BrotliDecoderDecompress(
243243
* @returns ::BROTLI_DECODER_RESULT_SUCCESS decoding is finished, no more
244244
* input might be consumed and no more output will be produced
245245
*/
246-
BROTLI_DEC_API BrotliDecoderResult BrotliDecoderDecompressStream(
246+
BROTLI_DEC_API BrotliDecoderResult MonoBrotliDecoderDecompressStream(
247247
BrotliDecoderState* state, size_t* available_in, const uint8_t** next_in,
248248
size_t* available_out, uint8_t** next_out, size_t* total_out);
249249

@@ -261,7 +261,7 @@ BROTLI_DEC_API BROTLI_BOOL BrotliDecoderHasMoreOutput(
261261
* Acquires pointer to internal output buffer.
262262
*
263263
* This method is used to make language bindings easier and more efficient:
264-
* -# push data to ::BrotliDecoderDecompressStream,
264+
* -# push data to ::MonoBrotliDecoderDecompressStream,
265265
* until ::BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT is reported
266266
* -# use ::BrotliDecoderTakeOutput to peek bytes and copy to language-specific
267267
* entity
@@ -308,13 +308,13 @@ BROTLI_DEC_API BROTLI_BOOL BrotliDecoderIsUsed(const BrotliDecoderState* state);
308308
* the input and produced all of the output
309309
* @returns ::BROTLI_FALSE otherwise
310310
*/
311-
BROTLI_DEC_API BROTLI_BOOL BrotliDecoderIsFinished(
311+
BROTLI_DEC_API BROTLI_BOOL MonoBrotliDecoderIsFinished(
312312
const BrotliDecoderState* state);
313313

314314
/**
315315
* Acquires a detailed error code.
316316
*
317-
* Should be used only after ::BrotliDecoderDecompressStream returns
317+
* Should be used only after ::MonoBrotliDecoderDecompressStream returns
318318
* ::BROTLI_DECODER_RESULT_ERROR.
319319
*
320320
* See also ::BrotliDecoderErrorString

0 commit comments

Comments
 (0)