mediapipe/third_party/com_google_protobuf_fixes.diff

101 lines
3.0 KiB
Diff

diff --git a/BUILD b/BUILD
index 112432160..ab5e80ce2 100644
--- a/BUILD
+++ b/BUILD
@@ -50,7 +50,7 @@ GTEST_MAIN = select({
# ZLIB configuration
################################################################################
-ZLIB_DEPS = ["@zlib//:zlib"]
+ZLIB_DEPS = ["@zlib"]
################################################################################
# Protobuf Runtime Library
@@ -200,6 +200,7 @@ cc_library(
includes = ["src/"],
linkopts = LINK_OPTS,
visibility = ["//visibility:public"],
+ alwayslink = 1,
)
PROTOBUF_DEPS = select({
@@ -273,6 +274,7 @@ cc_library(
linkopts = LINK_OPTS,
visibility = ["//visibility:public"],
deps = [":protobuf_lite"] + PROTOBUF_DEPS,
+ alwayslink = 1,
)
# This provides just the header files for use in projects that need to build
@@ -867,7 +869,6 @@ py_proto_library(
protoc = ":protoc",
py_libs = [
":python_srcs",
- "@six//:six",
],
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
diff --git a/src/google/protobuf/io/gzip_stream.h b/src/google/protobuf/io/gzip_stream.h
index b1ce1d36c..69ed1b996 100644
--- a/src/google/protobuf/io/gzip_stream.h
+++ b/src/google/protobuf/io/gzip_stream.h
@@ -47,10 +47,13 @@
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/io/zero_copy_stream.h>
#include <google/protobuf/port.h>
-#include <zlib.h>
#include <google/protobuf/port_def.inc>
+#if HAVE_ZLIB
+#include <zlib.h>
+#endif // HAVE_ZLIB
+
namespace google {
namespace protobuf {
namespace io {
@@ -76,8 +79,10 @@ class PROTOBUF_EXPORT GzipInputStream : public ZeroCopyInputStream {
virtual ~GzipInputStream();
// Return last error message or NULL if no error.
+#if HAVE_ZLIB
inline const char* ZlibErrorMessage() const { return zcontext_.msg; }
inline int ZlibErrorCode() const { return zerror_; }
+#endif // HAVE_ZLIB
// implements ZeroCopyInputStream ----------------------------------
bool Next(const void** data, int* size);
@@ -90,8 +95,10 @@ class PROTOBUF_EXPORT GzipInputStream : public ZeroCopyInputStream {
ZeroCopyInputStream* sub_stream_;
+#if HAVE_ZLIB
z_stream zcontext_;
int zerror_;
+#endif // HAVE_ZLIB
void* output_buffer_;
void* output_position_;
@@ -143,8 +150,10 @@ class PROTOBUF_EXPORT GzipOutputStream : public ZeroCopyOutputStream {
virtual ~GzipOutputStream();
// Return last error message or NULL if no error.
+#if HAVE_ZLIB
inline const char* ZlibErrorMessage() const { return zcontext_.msg; }
inline int ZlibErrorCode() const { return zerror_; }
+#endif // HAVE_ZLIB
// Flushes data written so far to zipped data in the underlying stream.
// It is the caller's responsibility to flush the underlying stream if
@@ -177,8 +186,10 @@ class PROTOBUF_EXPORT GzipOutputStream : public ZeroCopyOutputStream {
void* sub_data_;
int sub_data_size_;
+#if HAVE_ZLIB
z_stream zcontext_;
int zerror_;
+#endif //HAVE_ZLIB
void* input_buffer_;
size_t input_buffer_length_;