compat.hpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MPL-2.0 */
2 
3 #ifndef __ZMQ_COMPAT_HPP_INCLUDED__
4 #define __ZMQ_COMPAT_HPP_INCLUDED__
5 
6 #include "precompiled.hpp"
7 #include <string.h>
8 
9 #ifdef ZMQ_HAVE_WINDOWS
10 #define strcasecmp _stricmp
11 #define strtok_r strtok_s
12 #else
13 #ifndef ZMQ_HAVE_STRLCPY
14 #ifdef ZMQ_HAVE_LIBBSD
15 #include <bsd/string.h>
16 #else
17 static inline size_t
18 strlcpy (char *dest_, const char *src_, const size_t dest_size_)
19 {
20  size_t remain = dest_size_;
21  for (; remain && *src_; --remain, ++src_, ++dest_) {
22  *dest_ = *src_;
23  }
24  return dest_size_ - remain;
25 }
26 #endif
27 #endif
28 template <size_t size>
29 static inline int strcpy_s (char (&dest_)[size], const char *const src_)
30 {
31  const size_t res = strlcpy (dest_, src_, size);
32  return res >= size ? ERANGE : 0;
33 }
34 #endif
35 
36 #ifndef HAVE_STRNLEN
37 static inline size_t strnlen (const char *s, size_t len)
38 {
39  for (size_t i = 0; i < len; i++) {
40  if (s[i] == '\0')
41  return i + 1;
42  }
43 
44  return len;
45 }
46 #endif
47 
48 #endif
strnlen
static size_t strnlen(const char *s, size_t len)
Definition: compat.hpp:37
s
XmlRpcServer s
precompiled.hpp
strlcpy
static size_t strlcpy(char *dest_, const char *src_, const size_t dest_size_)
Definition: compat.hpp:18
strcpy_s
static int strcpy_s(char(&dest_)[size], const char *const src_)
Definition: compat.hpp:29
i
int i
Definition: gmock-matchers_test.cc:764
len
int len
Definition: php/ext/google/protobuf/map.c:206
size
GLsizeiptr size
Definition: glcorearb.h:2943


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:48