Go to the documentation of this file.
42 #define WIN32_LEAN_AND_MEAN // We only need minimal includes
44 #define snprintf _snprintf // see comment in strutil.cc
45 #elif defined(HAVE_PTHREAD)
48 #error "No suitable threading library available."
50 #if defined(__ANDROID__)
51 #include <android/log.h>
63 #include <google/protobuf/port_def.inc>
71 int minLibraryVersion,
72 const char* filename) {
76 <<
"This program requires version " <<
VersionString(minLibraryVersion)
77 <<
" of the Protocol Buffer runtime library, but the installed version "
79 "your library. If you compiled the program yourself, make sure that "
80 "your headers are from the same version of Protocol Buffers as your "
81 "link-time library. (Version verification failed in \""
82 << filename <<
"\".)";
87 <<
"This program was compiled against version "
88 <<
VersionString(headerVersion) <<
" of the Protocol Buffer runtime "
89 "library, which is not compatible with the installed version ("
91 "author for an update. If you compiled the program yourself, make "
92 "sure that your headers are from the same version of Protocol Buffers "
93 "as your link-time library. (Version verification failed in \""
94 << filename <<
"\".)";
121 #ifndef GOOGLE_PROTOBUF_MIN_LOG_LEVEL
122 #define GOOGLE_PROTOBUF_MIN_LOG_LEVEL LOGLEVEL_INFO
127 #if defined(__ANDROID__)
133 static const char* level_names[] = {
"INFO",
"WARNING",
"ERROR",
"FATAL"};
135 static const int android_log_levels[] = {
143 const int android_log_level = android_log_levels[
level];
144 ::std::ostringstream ostr;
145 ostr <<
"[libprotobuf " << level_names[
level] <<
" " << filename <<
":"
146 << line <<
"] " <<
message.c_str();
149 __android_log_write(android_log_level,
"libprotobuf-native",
152 fprintf(stderr,
"%s", ostr.str().c_str());
156 if (android_log_level == ANDROID_LOG_FATAL) {
157 __android_log_write(ANDROID_LOG_FATAL,
"libprotobuf-native",
168 static const char* level_names[] = {
"INFO",
"WARNING",
"ERROR",
"FATAL" };
172 fprintf(stderr,
"[libprotobuf %s %s:%d] %s\n",
179 int ,
const string& ) {
207 std::ostringstream
str;
216 #undef DECLARE_STREAM_OPERATOR
217 #define DECLARE_STREAM_OPERATOR(TYPE, FORMAT) \
218 LogMessage& LogMessage::operator<<(TYPE value) { \
223 snprintf(buffer, sizeof(buffer), FORMAT, value); \
225 buffer[sizeof(buffer)-1] = '\0'; \
226 message_ += buffer; \
239 #undef DECLARE_STREAM_OPERATOR
242 : level_(
level), filename_(filename),
line_(line) {}
246 bool suppress =
false;
257 #if PROTOBUF_USE_EXCEPTIONS
276 if (new_func ==
nullptr) {
310 uint8 result_array[4];
312 result_array[0] =
static_cast<uint8>(
x >> 24);
313 result_array[1] =
static_cast<uint8>((
x >> 16) & 0xFF);
314 result_array[2] =
static_cast<uint8>((
x >> 8) & 0xFF);
315 result_array[3] =
static_cast<uint8>(
x & 0xFF);
327 for (
auto pair :
functions) pair.first(pair.second);
340 void (*
func)() =
reinterpret_cast<void (*)()
>(
const_cast<void*
>(arg));
351 shutdown_data->functions.push_back(std::make_pair(
f, arg));
358 static bool is_shutdown =
false;
365 #if PROTOBUF_USE_EXCEPTIONS
366 FatalException::~FatalException() throw() {}
368 const char* FatalException::what()
const throw() {
369 return message_.c_str();
static ShutdownData * get()
static void RunZeroArgFunc(const void *arg)
const Descriptor::ReservedRange value
void operator=(LogMessage &other)
LogMessage & operator<<(const std::string &value)
void VerifyVersion(int headerVersion, int minLibraryVersion, const char *filename)
void NullLogHandler(LogLevel, const char *, int, const string &)
void OnShutdown(void(*func)())
#define DECLARE_STREAM_OPERATOR(TYPE, FORMAT)
void OnShutdownRun(void(*f)(const void *), const void *arg)
int snprintf(char *str, size_t size, const char *format,...)
#define GOOGLE_PROTOBUF_MIN_LOG_LEVEL
static const int kMinHeaderVersionForLibrary
#define GOOGLE_LOG(LEVEL)
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
void PROTOBUF_EXPORT DoNothing()
std::vector< std::pair< void(*)(const void *), const void * > > functions
string VersionString(int version)
LogHandler * SetLogHandler(LogHandler *new_func)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
LogMessage(LogLevel level, const char *filename, int line)
#define GOOGLE_PROTOBUF_VERSION
GLsizei const GLfloat * value
static std::atomic< int > log_silencer_count_
void ShutdownProtobufLibrary()
void LogHandler(LogLevel level, const char *filename, int line, const std::string &message)
static LogHandler * log_handler_
GLenum GLuint GLenum GLsizei const GLchar * message
void DefaultLogHandler(LogLevel level, const char *filename, int line, const string &message)
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:48