MCPcopy Create free account
hub / github.com/ablab/spades / FMT_NOEXCEPT

Function FMT_NOEXCEPT

ext/src/cppformat/format.cc:137–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135// Buffer should be at least of size 1.
136int safe_strerror(
137 int error_code, char *&buffer, std::size_t buffer_size) FMT_NOEXCEPT(true) {
138 assert(buffer != 0 && buffer_size != 0);
139 int result = 0;
140#ifdef _GNU_SOURCE
141 char *message = strerror_r(error_code, buffer, buffer_size);
142 // If the buffer is full then the message is probably truncated.
143 if (message == buffer && strlen(buffer) == buffer_size - 1)
144 result = ERANGE;
145 buffer = message;
146#elif __MINGW32__
147 errno = 0;
148 (void)buffer_size;
149 buffer = strerror(error_code);
150 result = errno;
151#elif _WIN32
152 result = strerror_s(buffer, buffer_size, error_code);
153 // If the buffer is full then the message is probably truncated.
154 if (result == 0 && std::strlen(buffer) == buffer_size - 1)
155 result = ERANGE;
156#else
157 result = strerror_r(error_code, buffer, buffer_size);
158 if (result == -1)
159 result = errno; // glibc versions before 2.13 return result in errno.
160#endif
161 return result;
162}
163
164void format_error_code(fmt::Writer &out, int error_code,
165 fmt::StringRef message) FMT_NOEXCEPT(true) {

Callers

nothing calls this directly

Calls 10

assertClass · 0.85
count_digitsFunction · 0.85
StringClass · 0.85
clearMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45
resizeMethod · 0.45
ptrMethod · 0.45
convertMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected