Remove CORE_UTIL_EXPORT

[ Merge of http://go/wvgerrit/155070 ]

These functions are internal utilities and should not be exported from
our library.  IIRC, this was added to aid in Windows tests, but this is
no longer needed.

Bug: 236317198
Test: build_and_run_all_unit_tests.sh
Change-Id: I19beb35a15f0f87dc8f968e1dd5302aed9463e54
This commit is contained in:
Alex Dale
2022-08-01 15:40:54 -07:00
parent e3697c6595
commit 6bc69d5005
7 changed files with 29 additions and 56 deletions

View File

@@ -338,7 +338,6 @@ cc_library_static {
], ],
cflags: [ cflags: [
"-DCORE_UTIL_IMPLEMENTATION",
"-DIS_HIDL", "-DIS_HIDL",
], ],
@@ -371,8 +370,6 @@ cc_library_static {
"liblog", "liblog",
], ],
cflags: ["-DCORE_UTIL_IMPLEMENTATION"],
srcs: cdm_util_src_files, srcs: cdm_util_src_files,
} }

View File

@@ -28,7 +28,7 @@ static const std::string kOemCertificateFileName = "oemcert.bin";
static const std::string kOemCertificateFileNamePrefix = "oemcert_"; static const std::string kOemCertificateFileNamePrefix = "oemcert_";
// File class. The implementation is platform dependent. // File class. The implementation is platform dependent.
class CORE_UTIL_EXPORT File { class File {
public: public:
File() {} File() {}
virtual ~File() {} virtual ~File() {}
@@ -39,7 +39,7 @@ class CORE_UTIL_EXPORT File {
CORE_DISALLOW_COPY_AND_ASSIGN(File); CORE_DISALLOW_COPY_AND_ASSIGN(File);
}; };
class CORE_UTIL_EXPORT FileSystem { class FileSystem {
public: public:
FileSystem(); FileSystem();
FileSystem(const std::string& origin, void* extra_data); FileSystem(const std::string& origin, void* extra_data);

View File

@@ -77,18 +77,13 @@ struct LoggingUidSetter {
// This function is supplied for cases where the system layer does not // This function is supplied for cases where the system layer does not
// initialize logging. This is also needed to initialize logging in // initialize logging. This is also needed to initialize logging in
// unit tests. // unit tests.
CORE_UTIL_EXPORT void InitLogging(); void InitLogging();
#ifdef __GNUC__ #ifdef __GNUC__
[[gnu::format(printf, 5, 6)]] CORE_UTIL_EXPORT void Log(const char* file, [[gnu::format(printf, 5, 6)]]
const char* function,
int line,
LogPriority level,
const char* fmt, ...);
#else
CORE_UTIL_EXPORT void Log(const char* file, const char* function, int line,
LogPriority level, const char* fmt, ...);
#endif #endif
void Log(const char* file, const char* function, int line,
LogPriority level, const char* fmt, ...);
// Log APIs // Log APIs
#ifdef CDM_DISABLE_LOGGING #ifdef CDM_DISABLE_LOGGING

View File

@@ -21,7 +21,7 @@
using ssize_t = SSIZE_T; using ssize_t = SSIZE_T;
inline void sleep(int seconds) { Sleep(seconds * 1000); } inline void sleep(int seconds) { Sleep(seconds * 1000); }
CORE_UTIL_EXPORT int setenv(const char* key, const char* value, int overwrite); int setenv(const char* key, const char* value, int overwrite);
#else #else
# include <arpa/inet.h> # include <arpa/inet.h>
# include <sys/types.h> # include <sys/types.h>

View File

@@ -16,7 +16,7 @@
namespace wvutil { namespace wvutil {
// A simple reader-writer mutex implementation that mimics the one from C++17 // A simple reader-writer mutex implementation that mimics the one from C++17
class CORE_UTIL_EXPORT shared_mutex { class shared_mutex {
public: public:
shared_mutex() : reader_count_(0), has_writer_(false) {} shared_mutex() : reader_count_(0), has_writer_(false) {}
~shared_mutex(); ~shared_mutex();

View File

@@ -15,53 +15,46 @@
namespace wvutil { namespace wvutil {
// ASCII hex to Binary conversion. // ASCII hex to Binary conversion.
CORE_UTIL_EXPORT std::vector<uint8_t> a2b_hex(const std::string& b); std::vector<uint8_t> a2b_hex(const std::string& b);
CORE_UTIL_EXPORT std::vector<uint8_t> a2b_hex(const std::string& label, std::vector<uint8_t> a2b_hex(const std::string& label,
const std::string& b); const std::string& b);
CORE_UTIL_EXPORT std::string a2bs_hex(const std::string& b); std::string a2bs_hex(const std::string& b);
// Binary to ASCII hex conversion. The default versions limit output to 2k to // Binary to ASCII hex conversion. The default versions limit output to 2k to
// protect us from log spam. The unlimited version has no length limit. // protect us from log spam. The unlimited version has no length limit.
CORE_UTIL_EXPORT std::string b2a_hex(const std::vector<uint8_t>& b); std::string b2a_hex(const std::vector<uint8_t>& b);
CORE_UTIL_EXPORT std::string unlimited_b2a_hex(const std::vector<uint8_t>& b); std::string unlimited_b2a_hex(const std::vector<uint8_t>& b);
CORE_UTIL_EXPORT std::string b2a_hex(const std::string& b); std::string b2a_hex(const std::string& b);
CORE_UTIL_EXPORT std::string unlimited_b2a_hex(const std::string& b); std::string unlimited_b2a_hex(const std::string& b);
CORE_UTIL_EXPORT std::string HexEncode(const uint8_t* bytes, size_t size); std::string HexEncode(const uint8_t* bytes, size_t size);
CORE_UTIL_EXPORT std::string UnlimitedHexEncode(const uint8_t* bytes, std::string UnlimitedHexEncode(const uint8_t* bytes, size_t size);
size_t size);
// Base64 encoding/decoding. // Base64 encoding/decoding.
// Converts binary data into the ASCII Base64 character set and vice // Converts binary data into the ASCII Base64 character set and vice
// versa using the encoding rules defined in RFC4648 section 4. // versa using the encoding rules defined in RFC4648 section 4.
CORE_UTIL_EXPORT std::string Base64Encode( std::string Base64Encode(const std::vector<uint8_t>& bin_input);
const std::vector<uint8_t>& bin_input); std::string Base64Encode(const std::string& bin_input);
CORE_UTIL_EXPORT std::string Base64Encode(const std::string& bin_input); std::vector<uint8_t> Base64Decode(const std::string& bin_input);
CORE_UTIL_EXPORT std::vector<uint8_t> Base64Decode(
const std::string& bin_input);
// URL-Safe Base64 encoding/decoding. // URL-Safe Base64 encoding/decoding.
// Converts binary data into the URL/Filename safe ASCII Base64 // Converts binary data into the URL/Filename safe ASCII Base64
// character set and vice versa using the encoding rules defined in // character set and vice versa using the encoding rules defined in
// RFC4648 section 5. // RFC4648 section 5.
CORE_UTIL_EXPORT std::string Base64SafeEncode( std::string Base64SafeEncode(const std::vector<uint8_t>& bin_input);
const std::vector<uint8_t>& bin_input); std::string Base64SafeEncode(const std::string& bin_input);
CORE_UTIL_EXPORT std::string Base64SafeEncode(const std::string& bin_input); std::vector<uint8_t> Base64SafeDecode(const std::string& bin_input);
CORE_UTIL_EXPORT std::vector<uint8_t> Base64SafeDecode(
const std::string& bin_input);
// URL-Safe Base64 encoding without padding. // URL-Safe Base64 encoding without padding.
// Similar to Base64SafeEncode(), without any padding character '=' // Similar to Base64SafeEncode(), without any padding character '='
// at the end. // at the end.
CORE_UTIL_EXPORT std::string Base64SafeEncodeNoPad( std::string Base64SafeEncodeNoPad(const std::vector<uint8_t>& bin_input);
const std::vector<uint8_t>& bin_input); std::string Base64SafeEncodeNoPad(const std::string& bin_input);
CORE_UTIL_EXPORT std::string Base64SafeEncodeNoPad(
const std::string& bin_input);
// Host to Network/Network to Host conversion. // Host to Network/Network to Host conversion.
CORE_UTIL_EXPORT int64_t htonll64(int64_t x); int64_t htonll64(int64_t x);
CORE_UTIL_EXPORT inline int64_t ntohll64(int64_t x) { return htonll64(x); } inline int64_t ntohll64(int64_t x) { return htonll64(x); }
// Encode unsigned integer into a big endian formatted string. // Encode unsigned integer into a big endian formatted string.
CORE_UTIL_EXPORT std::string EncodeUint32(uint32_t u); std::string EncodeUint32(uint32_t u);
} // namespace wvutil } // namespace wvutil

View File

@@ -9,23 +9,11 @@
#ifdef _WIN32 #ifdef _WIN32
# ifdef CORE_UTIL_IMPLEMENTATION
# define CORE_UTIL_EXPORT __declspec(dllexport)
# else
# define CORE_UTIL_EXPORT __declspec(dllimport)
# endif
# define CORE_UTIL_IGNORE_DEPRECATED # define CORE_UTIL_IGNORE_DEPRECATED
# define CORE_UTIL_RESTORE_WARNINGS # define CORE_UTIL_RESTORE_WARNINGS
#else #else
# ifdef CORE_UTIL_IMPLEMENTATION
# define CORE_UTIL_EXPORT __attribute__((visibility("default")))
# else
# define CORE_UTIL_EXPORT
# endif
# ifdef __GNUC__ # ifdef __GNUC__
# define CORE_UTIL_IGNORE_DEPRECATED \ # define CORE_UTIL_IGNORE_DEPRECATED \
_Pragma("GCC diagnostic push") \ _Pragma("GCC diagnostic push") \