git: c4e2162100ff - main - databases/mysql-connector-c++: Fix build with protobuf 22+

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Thu, 14 Dec 2023 17:03:22 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c4e2162100ff5ea3c958df03902e2353c929ba85

commit c4e2162100ff5ea3c958df03902e2353c929ba85
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2023-12-14 16:22:24 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2023-12-14 17:03:03 +0000

    databases/mysql-connector-c++: Fix build with protobuf 22+
---
 databases/mysql-connector-c++/files/patch-protobuf | 56 ++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/databases/mysql-connector-c++/files/patch-protobuf b/databases/mysql-connector-c++/files/patch-protobuf
new file mode 100644
index 000000000000..bef66563c69a
--- /dev/null
+++ b/databases/mysql-connector-c++/files/patch-protobuf
@@ -0,0 +1,56 @@
+--- cdk/protocol/mysqlx/protocol.cc.orig	2023-03-23 16:32:48 UTC
++++ cdk/protocol/mysqlx/protocol.cc
+@@ -37,6 +37,7 @@
+ 
+ #include <mysql/cdk/foundation/common.h>
+ #include <google/protobuf/io/zero_copy_stream.h>
++#include <absl/base/log_severity.h>
+ 
+ /*
+   Note: On Windows the INIT_ONCE structure was added only in later
+@@ -117,7 +118,7 @@ namespace mysqlx {
+   Protobuf log handler initialization.
+ */
+ 
+-static void log_handler(LogLevel level, const char* filename, int line, const std::string& message);
++static void log_handler(absl::LogSeverity level, const char* filename, int line, const std::string& message);
+ 
+ #ifdef _WIN32
+ BOOL CALLBACK log_handler_init(PINIT_ONCE, PVOID, PVOID*)
+@@ -128,7 +129,6 @@ BOOL CALLBACK log_handler_init(PINIT_ONCE, PVOID, PVOI
+ #else
+ static void log_handler_init()
+ {
+-  SetLogHandler(log_handler);
+ }
+ #endif
+ 
+@@ -290,14 +290,14 @@ Message* mk_message(Protocol_side side, msg_type_t msg
+ */
+ 
+ static void log_handler(
+-  LogLevel level, const char* /*filename*/, int /*line*/,
++  absl::LogSeverity level, const char* /*filename*/, int /*line*/,
+   const std::string& message
+ )
+ {
+   switch(level)
+   {
+-    case LOGLEVEL_FATAL:
+-    case LOGLEVEL_ERROR:
++    case absl::LogSeverity::kFatal:
++    case absl::LogSeverity::kError:
+       /*
+         With this code the error description is:
+ 
+@@ -311,8 +311,8 @@ static void log_handler(
+       */
+       throw_error(cdkerrc::protobuf_error, message);
+ 
+-    case LOGLEVEL_WARNING:
+-    case LOGLEVEL_INFO:
++    case absl::LogSeverity::kWarning:
++    case absl::LogSeverity::kInfo:
+     default:
+     {
+       // just ignore for now