#include <cstring>
Include dependency graph for OW_SafeCString.hpp:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Namespaces | |
namespace | OW_NAMESPACE |
namespace | OW_NAMESPACE::SafeCString |
namespace | OW_NAMESPACE::SafeCString::Impl |
Defines | |
#define | OW_INTSTR_AUX(x) # x |
#define | OW_INTSTR(x) OW_INTSTR_AUX(x) |
Functions | |
char * | OW_NAMESPACE::SafeCString::str_dup (char const *s) |
Like std::strdup, except that new is used to allocate memory. | |
char * | OW_NAMESPACE::SafeCString::str_dup_nothrow (char const *s) |
Like std::strdup, except that no-throw new is used to allocate memory and NULL is returned on allocation failure. | |
char const * | OW_NAMESPACE::SafeCString::nonull (char const *s) |
RETURNS: s if s is nonnull, otherwise returns empty string. | |
char * | OW_NAMESPACE::SafeCString::strcpy_trunc (char *dst, std::size_t dstsize, char const *src) |
PROMISE: copies the first n = min(strlen(src), dstsize - 1) characters of C-string src to dst, null-terminating the result. | |
char * | OW_NAMESPACE::SafeCString::strcpy_trunc (char *dst, std::size_t dstsize, char const *src, std::size_t srclen) |
PROMISE: copies the first n = min(strlen(src), srclen, dstsize - 1) characters of C-string src to dst, null-terminating the result. | |
template<std::size_t N> | |
char * | OW_NAMESPACE::SafeCString::strcpy_trunc (char(&dst)[N], char const *src) |
A variant of strcpy_trunc that infers the destination buffer size. | |
template<std::size_t N> | |
char * | OW_NAMESPACE::SafeCString::strcpy_trunc (char(&dst)[N], char const *src, std::size_t srclen) |
A variant of strcpy_trunc that infers the destination buffer size. | |
template<std::size_t N> | |
std::size_t | OW_NAMESPACE::SafeCString::strcpy_to_pos_trunc (char(&dst)[N], std::size_t pos, char const *src) |
Like strcpy_trunc, but the destination is the subarray dst[pos. | |
template<std::size_t N> | |
std::size_t | OW_NAMESPACE::SafeCString::strcpy_to_pos_trunc (char(&dst)[N], std::size_t pos, char const *src, std::size_t srclen) |
Like strcpy_trunc, but the destination is the subarray dst[pos. | |
OW_NAMESPACE::SafeCString::OW_DECLARE_EXCEPTION (Overflow) | |
char * | OW_NAMESPACE::SafeCString::strcpy_check (char *dst, std::size_t dstsize, char const *src) |
PROMISE: copies the first n = min(strlen(src), dstsize - 1) chars of the C-string src to dst and appends a terminating ''. | |
char * | OW_NAMESPACE::SafeCString::strcpy_check (char *dst, std::size_t dstsize, char const *src, std::size_t srclen) |
PROMISE: copies the first min(n, dstsize - 1) chars of the C-string src to dst, where n = min(strlen(src), srclen), and appends a terminating ''. | |
template<std::size_t N> | |
char * | OW_NAMESPACE::SafeCString::strcpy_check (char(&dst)[N], char const *src) |
A variant of strcpy_check that infers the destination buffer size. | |
template<std::size_t N> | |
char * | OW_NAMESPACE::SafeCString::strcpy_check (char(&dst)[N], char const *src, std::size_t srclen) |
A variant of strcpy_check that infers the destination buffer size. | |
template<std::size_t N> | |
std::size_t | OW_NAMESPACE::SafeCString::strcpy_to_pos_check (char(&dst)[N], std::size_t pos, char const *src) |
Like strcpy_check, but the destination is the subarray dst[pos. | |
template<std::size_t N> | |
std::size_t | OW_NAMESPACE::SafeCString::strcpy_to_pos_check (char(&dst)[N], std::size_t pos, char const *src, std::size_t srclen) |
Like strcpy_check, but the destination is the subarray dst[pos. | |
char * | OW_NAMESPACE::SafeCString::strcat_trunc (char *dst, std::size_t dstsize, char const *src) |
PROMISE: If dst[0. | |
char * | OW_NAMESPACE::SafeCString::strcat_trunc (char *dst, std::size_t dstsize, char const *src, std::size_t srclen) |
PROMISE: If dst[0. | |
template<std::size_t N> | |
char * | OW_NAMESPACE::SafeCString::strcat_trunc (char(&dst)[N], char const *src) |
A variant of strcat_trunc that infers the destination buffer size. | |
template<std::size_t N> | |
char * | OW_NAMESPACE::SafeCString::strcat_trunc (char(&dst)[N], char const *src, std::size_t srclen) |
A variant of strcat_trunc that infers the destination buffer size. | |
char * | OW_NAMESPACE::SafeCString::strcat_check (char *dst, std::size_t dstsize, char const *src) |
PROMISE: If dst[0. | |
char * | OW_NAMESPACE::SafeCString::strcat_check (char *dst, std::size_t dstsize, char const *src, std::size_t srclen) |
PROMISE: If dst[0. | |
template<std::size_t N> | |
char * | OW_NAMESPACE::SafeCString::strcat_check (char(&dst)[N], char const *src) |
A variant of strcat_check that infers the destination buffer size. | |
template<std::size_t N> | |
char * | OW_NAMESPACE::SafeCString::strcat_check (char(&dst)[N], char const *src, std::size_t srclen) |
A variant of strcat_check that infers the destination buffer size. | |
std::size_t | OW_NAMESPACE::SafeCString::Impl::nchars_output (int retval, std::size_t dstsize) |
std::size_t | OW_NAMESPACE::SafeCString::Impl::nchars_check (int retval, std::size_t dstsize) |
template<typename T1> | |
std::size_t | OW_NAMESPACE::SafeCString::sprintf_trunc (char *dst, std::size_t dstsize, char const *fmt, T1 const &x1) |
PROMISE: Behaves like sprintf(dst, fmt, . | |
template<typename T1, typename T2> | |
std::size_t | OW_NAMESPACE::SafeCString::sprintf_trunc (char *dst, std::size_t dstsize, char const *fmt, T1 const &x1, T2 const &x2) |
PROMISE: Behaves like sprintf(dst, fmt, . | |
template<typename T1, typename T2, typename T3> | |
std::size_t | OW_NAMESPACE::SafeCString::sprintf_trunc (char *dst, std::size_t dstsize, char const *fmt, T1 const &x1, T2 const &x2, T3 const &x3) |
PROMISE: Behaves like sprintf(dst, fmt, . | |
template<typename T1, typename T2, typename T3, typename T4> | |
std::size_t | OW_NAMESPACE::SafeCString::sprintf_trunc (char *dst, std::size_t dstsize, char const *fmt, T1 const &x1, T2 const &x2, T3 const &x3, T4 const &x4) |
PROMISE: Behaves like sprintf(dst, fmt, . | |
template<typename T1, typename T2, typename T3, typename T4, typename T5> | |
std::size_t | OW_NAMESPACE::SafeCString::sprintf_trunc (char *dst, std::size_t dstsize, char const *fmt, T1 const &x1, T2 const &x2, T3 const &x3, T4 const &x4, T5 const &x5) |
PROMISE: Behaves like sprintf(dst, fmt, . | |
template<std::size_t N, typename T1> | |
std::size_t | OW_NAMESPACE::SafeCString::sprintf_trunc (char(&dst)[N], char const *fmt, T1 const &x1) |
A variant of sprintf_trunc that infers the destination buffer size. | |
template<std::size_t N, typename T1, typename T2> | |
std::size_t | OW_NAMESPACE::SafeCString::sprintf_trunc (char(&dst)[N], char const *fmt, T1 const &x1, T2 const &x2) |
A variant of sprintf_trunc that infers the destination buffer size. | |
template<std::size_t N, typename T1, typename T2, typename T3> | |
std::size_t | OW_NAMESPACE::SafeCString::sprintf_trunc (char(&dst)[N], char const *fmt, T1 const &x1, T2 const &x2, T3 const &x3) |
A variant of sprintf_trunc that infers the destination buffer size. | |
template<std::size_t N, typename T1, typename T2, typename T3, typename T4> | |
std::size_t | OW_NAMESPACE::SafeCString::sprintf_trunc (char(&dst)[N], char const *fmt, T1 const &x1, T2 const &x2, T3 const &x3, T4 const &x4) |
A variant of sprintf_trunc that infers the destination buffer size. | |
template<std::size_t N, typename T1, typename T2, typename T3, typename T4, typename T5> | |
std::size_t | OW_NAMESPACE::SafeCString::sprintf_trunc (char(&dst)[N], char const *fmt, T1 const &x1, T2 const &x2, T3 const &x3, T4 const &x4, T5 const &x5) |
A variant of sprintf_trunc that infers the destination buffer size. | |
template<typename T1> | |
std::size_t | OW_NAMESPACE::SafeCString::sprintf_check (char *dst, std::size_t dstsize, char const *fmt, T1 const &x1) |
PROMISE: Behaves like sprintf(dst, fmt, . | |
template<typename T1, typename T2> | |
std::size_t | OW_NAMESPACE::SafeCString::sprintf_check (char *dst, std::size_t dstsize, char const *fmt, T1 const &x1, T2 const &x2) |
PROMISE: Behaves like sprintf(dst, fmt, . | |
template<typename T1, typename T2, typename T3> | |
std::size_t | OW_NAMESPACE::SafeCString::sprintf_check (char *dst, std::size_t dstsize, char const *fmt, T1 const &x1, T2 const &x2, T3 const &x3) |
PROMISE: Behaves like sprintf(dst, fmt, . | |
template<typename T1, typename T2, typename T3, typename T4> | |
std::size_t | OW_NAMESPACE::SafeCString::sprintf_check (char *dst, std::size_t dstsize, char const *fmt, T1 const &x1, T2 const &x2, T3 const &x3, T4 const &x4) |
PROMISE: Behaves like sprintf(dst, fmt, . | |
template<typename T1, typename T2, typename T3, typename T4, typename T5> | |
std::size_t | OW_NAMESPACE::SafeCString::sprintf_check (char *dst, std::size_t dstsize, char const *fmt, T1 const &x1, T2 const &x2, T3 const &x3, T4 const &x4, T5 const &x5) |
PROMISE: Behaves like sprintf(dst, fmt, . | |
template<std::size_t N, typename T1> | |
std::size_t | OW_NAMESPACE::SafeCString::sprintf_check (char(&dst)[N], char const *fmt, T1 const &x1) |
A variant of sprintf_check that infers the destination buffer size. | |
template<std::size_t N, typename T1, typename T2> | |
std::size_t | OW_NAMESPACE::SafeCString::sprintf_check (char(&dst)[N], char const *fmt, T1 const &x1, T2 const &x2) |
A variant of sprintf_check that infers the destination buffer size. | |
template<std::size_t N, typename T1, typename T2, typename T3> | |
std::size_t | OW_NAMESPACE::SafeCString::sprintf_check (char(&dst)[N], char const *fmt, T1 const &x1, T2 const &x2, T3 const &x3) |
A variant of sprintf_check that infers the destination buffer size. | |
template<std::size_t N, typename T1, typename T2, typename T3, typename T4> | |
std::size_t | OW_NAMESPACE::SafeCString::sprintf_check (char(&dst)[N], char const *fmt, T1 const &x1, T2 const &x2, T3 const &x3, T4 const &x4) |
A variant of sprintf_check that infers the destination buffer size. | |
template<std::size_t N, typename T1, typename T2, typename T3, typename T4, typename T5> | |
std::size_t | OW_NAMESPACE::SafeCString::sprintf_check (char(&dst)[N], char const *fmt, T1 const &x1, T2 const &x2, T3 const &x3, T4 const &x4, T5 const &x5) |
A variant of sprintf_check that infers the destination buffer size. | |
template<typename T1> | |
std::size_t | OW_NAMESPACE::SafeCString::vprintf_trunc (char *dst, std::size_t dstsize, char const *fmt, va_list ap) |
PROMISE: Behaves like vprintf(dst, fmt, ap) except that output stops at dstsize - 1 characters. | |
template<std::size_t N> | |
std::size_t | OW_NAMESPACE::SafeCString::vprintf_trunc (char(&dst)[N], char const *fmt, va_list ap) |
A variant of vprintf_trunc that infers the destination buffer size. | |
std::size_t | OW_NAMESPACE::SafeCString::vprintf_check (char *dst, std::size_t dstsize, char const *fmt, va_list ap) |
PROMISE: Behaves like vprintf(dst, fmt, ap) except that output stops at dstsize - 1 characters. | |
template<std::size_t N> | |
std::size_t | OW_NAMESPACE::SafeCString::vprintf_check (char(&dst)[N], char const *fmt, va_list ap) |
A variant of vprintf_check that infers the destination buffer size. | |
char * | OW_NAMESPACE::SafeCString::fgets_trunc (char *dst, std::size_t dstsize, FILE *fp) |
PROMISE: Equivalent to std::fgets, except that I/O errors are reported by throwing an exception. | |
template<std::size_t N> | |
char * | OW_NAMESPACE::SafeCString::fgets_trunc (char(&dst)[N], FILE *fp) |
A variant of fgets_trunc that infers the destination buffer size. | |
char * | OW_NAMESPACE::SafeCString::fgets_check (char *dst, std::size_t dstsize, FILE *fp) |
PROMISE: Equivalent to std::fgets, except that I/O errors and truncated lines are reported by throwing an exception. | |
template<std::size_t N> | |
char * | OW_NAMESPACE::SafeCString::fgets_check (char(&dst)[N], FILE *fp) |
A variant of fgets_check that infers the destination buffer size. | |
String | OW_NAMESPACE::SafeCString::fget_string (FILE *fp, std::size_t const max_chars) |
RETURNS: A String created by reading from fp until either EOF or a newline is encountered. | |
Variables | |
int const | OW_NAMESPACE::SafeCString::RESULT_TRUNCATED = 0 |
Error codes for use with OverflowException class. | |
int const | OW_NAMESPACE::SafeCString::DEST_UNTERMINATED = 1 |
|
Definition at line 798 of file OW_SafeCString.hpp. |
|
Definition at line 788 of file OW_SafeCString.hpp. |