From: John Wolfe Date: Wed, 18 May 2022 01:36:21 +0000 (-0700) Subject: Changes to common source files not directly applicable to open-vm-tools. X-Git-Tag: stable-12.1.0~64 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bac24ee80957feea0336f7ac597630aedf13ec86;p=thirdparty%2Fopen-vm-tools.git Changes to common source files not directly applicable to open-vm-tools. --- diff --git a/open-vm-tools/lib/include/sigc++2to3.h b/open-vm-tools/lib/include/sigc++2to3.h new file mode 100644 index 000000000..cdc96a159 --- /dev/null +++ b/open-vm-tools/lib/include/sigc++2to3.h @@ -0,0 +1,138 @@ +/********************************************************* + * Copyright (C) 2022 VMware, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation version 2.1 and no later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + *********************************************************/ + +/* + * sigc++2to3.h -- + * + * A header file that contain definations that will allow some sigc++2 APIs + * to work when builing with sigc++3. + */ + +#pragma once + + +#include +#include +#include + + +#if SIGCXX_MAJOR_VERSION >= 3 + +namespace sigc { + + +// Bridge slot syntax change +template +class slot : public slot { +private: + using _true_slot = slot; +public: + inline slot() = default; + inline slot(const _true_slot& src) : _true_slot(src) {} + template + inline slot(const T_functor& func) : _true_slot(func) {} +}; + +template +using slot0 = slot; +template +using slot1 = slot; +template +using slot2 = slot; +template +using slot3 = slot; +template +using slot4 = slot; +template +using slot5 = slot; +template +using slot6 = slot; +template +using slot7 = slot; + + +// Bridge signal syntax change +template +class signal : public signal { +public: + signal() = default; +}; + +template +using signal0 = signal; +template +using signal1 = signal; +template +using signal2 = signal; +template +using signal3 = signal; +template +using signal4 = signal; +template +using signal5 = signal; +template +using signal6 = signal; +template +using signal7 = signal; + + +//Bridge bound_mem_functor +template +using bound_mem_functor0 = bound_mem_functor; +template +using bound_mem_functor1 = bound_mem_functor; +template +using bound_mem_functor2 = bound_mem_functor; +template +using bound_mem_functor3 = bound_mem_functor; +template +using bound_mem_functor4 = bound_mem_functor; +template +using bound_mem_functor5 = bound_mem_functor; +template +using bound_mem_functor6 = bound_mem_functor; +template +using bound_mem_functor7 = bound_mem_functor; + + +// Add old mem_fun API for pointer +template +inline decltype(auto) +mem_fun(T_obj *obj, T_return (T_obj::*func)(T_arg...)) +{ + return bound_mem_functor(*obj, func); +} + +template +inline decltype(auto) +mem_fun(const T_obj *obj, T_return (T_obj::*func)(T_arg...) const) +{ + return bound_mem_functor(*obj, func); +} + + +// Stub sigc::ref impl +template +inline decltype(auto) ref(T& t) { return std::ref(t); } +template +inline decltype(auto) ref(const T& t) { return std::cref(t); } + + +} //namespace sigc + +#endif // SIGCXX_MAJOR_VERSION >= 3 diff --git a/open-vm-tools/services/plugins/dndcp/dnd/copyPasteRpc.hh b/open-vm-tools/services/plugins/dndcp/dnd/copyPasteRpc.hh index c488dbed2..6fdb6b6ad 100644 --- a/open-vm-tools/services/plugins/dndcp/dnd/copyPasteRpc.hh +++ b/open-vm-tools/services/plugins/dndcp/dnd/copyPasteRpc.hh @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2007-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2007-2017,2022 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -25,7 +25,8 @@ #ifndef COPY_PASTE_RPC_HH #define COPY_PASTE_RPC_HH -#include +#include +#include #include "dndCPLibExport.hh" #include "rpcBase.h" diff --git a/open-vm-tools/services/plugins/dndcp/dnd/dndRpc.hh b/open-vm-tools/services/plugins/dndcp/dnd/dndRpc.hh index 33c72f369..100e621a8 100644 --- a/open-vm-tools/services/plugins/dndcp/dnd/dndRpc.hh +++ b/open-vm-tools/services/plugins/dndcp/dnd/dndRpc.hh @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2007-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2007-2017,2022 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -25,7 +25,8 @@ #ifndef DND_RPC_HH #define DND_RPC_HH -#include +#include +#include #include "dndCPLibExport.hh" #include "rpcBase.h" diff --git a/open-vm-tools/services/plugins/dndcp/dnd/fileTransferRpc.hh b/open-vm-tools/services/plugins/dndcp/dnd/fileTransferRpc.hh index b685735ad..f33d352a8 100644 --- a/open-vm-tools/services/plugins/dndcp/dnd/fileTransferRpc.hh +++ b/open-vm-tools/services/plugins/dndcp/dnd/fileTransferRpc.hh @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2010-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2010-2017,2022 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -25,7 +25,8 @@ #ifndef FILE_TRANSFER_RPC_HH #define FILE_TRANSFER_RPC_HH -#include +#include +#include #include "dndCPLibExport.hh" #include "rpcBase.h" diff --git a/open-vm-tools/services/plugins/dndcp/stringxx/string.hh b/open-vm-tools/services/plugins/dndcp/stringxx/string.hh index 53a50f4c5..ea44000e7 100644 --- a/open-vm-tools/services/plugins/dndcp/stringxx/string.hh +++ b/open-vm-tools/services/plugins/dndcp/stringxx/string.hh @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2008-2019 VMware, Inc. All rights reserved. + * Copyright (C) 2008-2019,2022 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -55,6 +55,7 @@ * need to include here. */ #include +#include // For GIOMM_*_VERSION macros #include #ifdef _WIN32 @@ -101,6 +102,18 @@ public: static const size_type npos; // Normalize mode map to Glib::NormalizeMode +#if GIOMM_MAJOR_VERSION >= 2 && GIOMM_MINOR_VERSION >= 68 + typedef enum { + NORMALIZE_DEFAULT = Glib::NormalizeMode::DEFAULT, + NORMALIZE_NFD = Glib::NormalizeMode::NFD, + NORMALIZE_DEFAULT_COMPOSE = Glib::NormalizeMode::DEFAULT_COMPOSE, + NORMALIZE_NFC = Glib::NormalizeMode::NFC, + NORMALIZE_ALL = Glib::NormalizeMode::ALL, + NORMALIZE_NFKD = Glib::NormalizeMode::NFKD, + NORMALIZE_ALL_COMPOSE = Glib::NormalizeMode::ALL_COMPOSE, + NORMALIZE_NFKC = Glib::NormalizeMode::NFKC + } NormalizeMode; +#else typedef enum { NORMALIZE_DEFAULT = Glib::NORMALIZE_DEFAULT, NORMALIZE_NFD = Glib::NORMALIZE_NFD, @@ -111,6 +124,7 @@ public: NORMALIZE_ALL_COMPOSE = Glib::NORMALIZE_ALL_COMPOSE, NORMALIZE_NFKC = Glib::NORMALIZE_NFKC } NormalizeMode; +#endif string(); string(const char *s); diff --git a/open-vm-tools/services/plugins/dndcp/stringxx/ubstr_t.hh b/open-vm-tools/services/plugins/dndcp/stringxx/ubstr_t.hh index 2d0f7f07f..46e118a84 100644 --- a/open-vm-tools/services/plugins/dndcp/stringxx/ubstr_t.hh +++ b/open-vm-tools/services/plugins/dndcp/stringxx/ubstr_t.hh @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2008-2019,2021 VMware, Inc. All rights reserved. + * Copyright (C) 2008-2019,2021-2022 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -32,6 +32,7 @@ #include #include +#include // For GIOMM_*_VERSION #include #include "autoCPtr.hh" @@ -115,6 +116,9 @@ private: { } +#if GIOMM_MAJOR_VERSION >= 2 && GIOMM_MINOR_VERSION >= 68 + // Glib::RefPtr is now just a std::shared_ptr so no extras are needed +#else // For Glib::RefPtr. void reference() { @@ -129,6 +133,7 @@ private: delete this; } } +#endif // Takes ownership of the input string. void Set(char *utf8String) // IN/OUT: May be NULL. @@ -145,13 +150,18 @@ private: return mUTF8String; } +#if GIOMM_MAJOR_VERSION >= 2 && GIOMM_MINOR_VERSION >= 68 + public: +#else private: // Only destructible via unreference(). +#endif ~UTF8Data() { free(mUTF8String); } + private: char *mUTF8String; unsigned int mRefCount;