aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/compression
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2017-10-06 18:47:09 -0700
committerGravatar Muxi Yan <mxyan@google.com>2017-10-06 18:47:09 -0700
commit03fc857a6f3ad1ee0a6f46cd19b5c96e56c6fd3b (patch)
tree38e03428954c3abdf2c88cafa9ffbd205789976b /src/core/lib/compression
parent63602748415fb836afd7a9685fbe5e85bf5ebfed (diff)
parent03bd5daf5cd36373152cb6b06a5f259db1331e87 (diff)
Merge remote-tracking branch 'upstream/master' into fix-stream-compression-config-interface
Diffstat (limited to 'src/core/lib/compression')
-rw-r--r--src/core/lib/compression/algorithm_metadata.h10
-rw-r--r--src/core/lib/compression/compression.cc (renamed from src/core/lib/compression/compression.c)4
-rw-r--r--src/core/lib/compression/compression_internal.cc (renamed from src/core/lib/compression/compression_internal.c)0
-rw-r--r--src/core/lib/compression/compression_internal.h8
-rw-r--r--src/core/lib/compression/message_compress.cc (renamed from src/core/lib/compression/message_compress.c)0
-rw-r--r--src/core/lib/compression/message_compress.h8
-rw-r--r--src/core/lib/compression/stream_compression.cc (renamed from src/core/lib/compression/stream_compression.c)2
-rw-r--r--src/core/lib/compression/stream_compression.h8
-rw-r--r--src/core/lib/compression/stream_compression_gzip.cc (renamed from src/core/lib/compression/stream_compression_gzip.c)7
-rw-r--r--src/core/lib/compression/stream_compression_gzip.h8
-rw-r--r--src/core/lib/compression/stream_compression_identity.cc (renamed from src/core/lib/compression/stream_compression_identity.c)9
-rw-r--r--src/core/lib/compression/stream_compression_identity.h8
12 files changed, 59 insertions, 13 deletions
diff --git a/src/core/lib/compression/algorithm_metadata.h b/src/core/lib/compression/algorithm_metadata.h
index 7db771ea74..23333ac0c4 100644
--- a/src/core/lib/compression/algorithm_metadata.h
+++ b/src/core/lib/compression/algorithm_metadata.h
@@ -23,6 +23,10 @@
#include "src/core/lib/compression/compression_internal.h"
#include "src/core/lib/transport/metadata.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/** Return compression algorithm based metadata value */
grpc_slice grpc_compression_algorithm_slice(
grpc_compression_algorithm algorithm);
@@ -56,4 +60,8 @@ grpc_message_compression_algorithm_from_slice(grpc_slice str);
grpc_stream_compression_algorithm grpc_stream_compression_algorithm_from_slice(
grpc_slice str);
-#endif /* GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H */ \ No newline at end of file
diff --git a/src/core/lib/compression/compression.c b/src/core/lib/compression/compression.cc
index af2391ba10..31349a58cd 100644
--- a/src/core/lib/compression/compression.c
+++ b/src/core/lib/compression/compression.cc
@@ -94,12 +94,12 @@ grpc_compression_algorithm grpc_compression_algorithm_for_level(
grpc_message_compression_algorithm_for_level(
grpc_compression_level_to_message_compression_level(level),
grpc_compression_bitset_to_message_bitset(accepted_encodings)),
- 0));
+ (grpc_stream_compression_algorithm)0));
return algo;
} else if (level <= GRPC_COMPRESS_LEVEL_STREAM_HIGH) {
GPR_ASSERT(
grpc_compression_algorithm_from_message_stream_compression_algorithm(
- &algo, 0,
+ &algo, (grpc_message_compression_algorithm)0,
grpc_stream_compression_algorithm_for_level(
grpc_compression_level_to_stream_compression_level(level),
grpc_compression_bitset_to_stream_bitset(accepted_encodings))));
diff --git a/src/core/lib/compression/compression_internal.c b/src/core/lib/compression/compression_internal.cc
index e31eb830f1..e31eb830f1 100644
--- a/src/core/lib/compression/compression_internal.c
+++ b/src/core/lib/compression/compression_internal.cc
diff --git a/src/core/lib/compression/compression_internal.h b/src/core/lib/compression/compression_internal.h
index dcd49c8c11..aab5324b67 100644
--- a/src/core/lib/compression/compression_internal.h
+++ b/src/core/lib/compression/compression_internal.h
@@ -21,6 +21,10 @@
#include <grpc/impl/codegen/compression_types.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef enum {
GRPC_MESSAGE_COMPRESS_NONE = 0,
GRPC_MESSAGE_COMPRESS_DEFLATE,
@@ -107,4 +111,8 @@ grpc_stream_compression_algorithm grpc_stream_compression_algorithm_for_level(
int grpc_stream_compression_algorithm_parse(
grpc_slice value, grpc_stream_compression_algorithm *algorithm);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* GRPC_CORE_LIB_COMPRESSION_COMPRESSION_INTERNAL_H */
diff --git a/src/core/lib/compression/message_compress.c b/src/core/lib/compression/message_compress.cc
index d174992355..d174992355 100644
--- a/src/core/lib/compression/message_compress.c
+++ b/src/core/lib/compression/message_compress.cc
diff --git a/src/core/lib/compression/message_compress.h b/src/core/lib/compression/message_compress.h
index 2882bf7075..7c2eb99443 100644
--- a/src/core/lib/compression/message_compress.h
+++ b/src/core/lib/compression/message_compress.h
@@ -23,6 +23,10 @@
#include "src/core/lib/compression/compression_internal.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* compress 'input' to 'output' using 'algorithm'.
On success, appends compressed slices to output and returns 1.
On failure, appends uncompressed slices to output and returns 0. */
@@ -37,4 +41,8 @@ int grpc_msg_decompress(grpc_exec_ctx* exec_ctx,
grpc_message_compression_algorithm algorithm,
grpc_slice_buffer* input, grpc_slice_buffer* output);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H */
diff --git a/src/core/lib/compression/stream_compression.c b/src/core/lib/compression/stream_compression.cc
index 411489f029..7faeb0d34f 100644
--- a/src/core/lib/compression/stream_compression.c
+++ b/src/core/lib/compression/stream_compression.cc
@@ -21,7 +21,7 @@
#include "src/core/lib/compression/stream_compression.h"
#include "src/core/lib/compression/stream_compression_gzip.h"
-extern const grpc_stream_compression_vtable
+extern "C" const grpc_stream_compression_vtable
grpc_stream_compression_identity_vtable;
bool grpc_stream_compress(grpc_stream_compression_context *ctx,
diff --git a/src/core/lib/compression/stream_compression.h b/src/core/lib/compression/stream_compression.h
index 6d073280fa..6ee3ac1966 100644
--- a/src/core/lib/compression/stream_compression.h
+++ b/src/core/lib/compression/stream_compression.h
@@ -26,6 +26,10 @@
#include "src/core/lib/transport/static_metadata.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct grpc_stream_compression_vtable grpc_stream_compression_vtable;
/* Stream compression/decompression context */
@@ -111,4 +115,8 @@ void grpc_stream_compression_context_destroy(
int grpc_stream_compression_method_parse(
grpc_slice value, bool is_compress, grpc_stream_compression_method *method);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/src/core/lib/compression/stream_compression_gzip.c b/src/core/lib/compression/stream_compression_gzip.cc
index abcbdb3a91..087b018be5 100644
--- a/src/core/lib/compression/stream_compression_gzip.c
+++ b/src/core/lib/compression/stream_compression_gzip.cc
@@ -222,7 +222,6 @@ static void grpc_stream_compression_context_destroy_gzip(
}
const grpc_stream_compression_vtable grpc_stream_compression_gzip_vtable = {
- .compress = grpc_stream_compress_gzip,
- .decompress = grpc_stream_decompress_gzip,
- .context_create = grpc_stream_compression_context_create_gzip,
- .context_destroy = grpc_stream_compression_context_destroy_gzip};
+ grpc_stream_compress_gzip, grpc_stream_decompress_gzip,
+ grpc_stream_compression_context_create_gzip,
+ grpc_stream_compression_context_destroy_gzip};
diff --git a/src/core/lib/compression/stream_compression_gzip.h b/src/core/lib/compression/stream_compression_gzip.h
index 7cf49a0de9..a3f1b0406f 100644
--- a/src/core/lib/compression/stream_compression_gzip.h
+++ b/src/core/lib/compression/stream_compression_gzip.h
@@ -21,6 +21,14 @@
#include "src/core/lib/compression/stream_compression.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern const grpc_stream_compression_vtable grpc_stream_compression_gzip_vtable;
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/src/core/lib/compression/stream_compression_identity.c b/src/core/lib/compression/stream_compression_identity.cc
index 3dfcf53b85..9b2e6062e1 100644
--- a/src/core/lib/compression/stream_compression_identity.c
+++ b/src/core/lib/compression/stream_compression_identity.cc
@@ -27,7 +27,7 @@
/* Singleton context used for all identity streams. */
static grpc_stream_compression_context identity_ctx = {
- .vtable = &grpc_stream_compression_identity_vtable};
+ &grpc_stream_compression_identity_vtable};
static void grpc_stream_compression_pass_through(grpc_slice_buffer *in,
grpc_slice_buffer *out,
@@ -88,7 +88,6 @@ static void grpc_stream_compression_context_destroy_identity(
}
const grpc_stream_compression_vtable grpc_stream_compression_identity_vtable = {
- .compress = grpc_stream_compress_identity,
- .decompress = grpc_stream_decompress_identity,
- .context_create = grpc_stream_compression_context_create_identity,
- .context_destroy = grpc_stream_compression_context_destroy_identity};
+ grpc_stream_compress_identity, grpc_stream_decompress_identity,
+ grpc_stream_compression_context_create_identity,
+ grpc_stream_compression_context_destroy_identity};
diff --git a/src/core/lib/compression/stream_compression_identity.h b/src/core/lib/compression/stream_compression_identity.h
index 41926e949e..3a729fafad 100644
--- a/src/core/lib/compression/stream_compression_identity.h
+++ b/src/core/lib/compression/stream_compression_identity.h
@@ -21,7 +21,15 @@
#include "src/core/lib/compression/stream_compression.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern const grpc_stream_compression_vtable
grpc_stream_compression_identity_vtable;
+#ifdef __cplusplus
+}
+#endif
+
#endif