ReactOS
0.4.16-dev-527-gdad3a09
__throw_out_of_range_fmt.cpp
Go to the documentation of this file.
1
/*
2
* PROJECT: GCC c++ support library
3
* LICENSE: MIT (https://spdx.org/licenses/MIT)
4
* PURPOSE: __throw_out_of_range_fmt implementation
5
* COPYRIGHT: Copyright 2024 Timo Kreuzer <timo.kreuzer@reactos.org>
6
*/
7
8
#include <stdexcept>
9
#include <cstdarg>
10
#include <cstring>
11
#include <malloc.h>
12
13
namespace
std
{
14
15
class
out_of_range_error
:
public
exception
16
{
17
char
*
m_msg
;
18
public
:
19
explicit
out_of_range_error
(
const
char
*
msg
)
noexcept
20
{
21
size_t
len
=
strlen
(
msg
) + 1;
22
m_msg
= (
char
*)
malloc
(
len
);
23
strcpy
(
m_msg
,
msg
);
24
}
25
virtual
~out_of_range_error
() {
free
(
m_msg
); };
26
virtual
const
char
*
what
()
const
noexcept {
return
m_msg
; }
27
};
28
29
void
__throw_out_of_range_fmt
(
const
char
*
format
, ...)
30
{
31
char
buffer
[1024];
32
va_list
argptr;
33
34
va_start
(argptr,
format
);
35
_vsnprintf
(
buffer
,
sizeof
(
buffer
),
format
, argptr);
36
buffer
[
sizeof
(
buffer
) - 1] = 0;
37
va_end
(argptr);
38
39
throw
out_of_range_error
(
buffer
);
40
}
41
42
}
// namespace std
strlen
ACPI_SIZE strlen(const char *String)
Definition:
utclib.c:269
va_list
char * va_list
Definition:
acmsvcex.h:78
va_end
#define va_end(ap)
Definition:
acmsvcex.h:90
va_start
#define va_start(ap, A)
Definition:
acmsvcex.h:91
msg
#define msg(x)
Definition:
auth_time.c:54
std::out_of_range_error
Definition:
__throw_out_of_range_fmt.cpp:16
std::out_of_range_error::out_of_range_error
out_of_range_error(const char *msg) noexcept
Definition:
__throw_out_of_range_fmt.cpp:19
std::out_of_range_error::~out_of_range_error
virtual ~out_of_range_error()
Definition:
__throw_out_of_range_fmt.cpp:25
std::out_of_range_error::m_msg
char * m_msg
Definition:
__throw_out_of_range_fmt.cpp:17
std::out_of_range_error::what
virtual const char * what() const noexcept
Definition:
__throw_out_of_range_fmt.cpp:26
free
#define free
Definition:
debug_ros.c:5
malloc
#define malloc
Definition:
debug_ros.c:4
buffer
GLuint buffer
Definition:
glext.h:5915
len
GLenum GLsizei len
Definition:
glext.h:6722
std
Definition:
features.h:417
std::__throw_out_of_range_fmt
void __throw_out_of_range_fmt(const char *format,...)
Definition:
__throw_out_of_range_fmt.cpp:29
strcpy
strcpy
Definition:
string.h:131
__exception
Definition:
cpp.c:26
format
Definition:
format.c:58
_vsnprintf
#define _vsnprintf
Definition:
xmlstorage.h:202
const
#define const
Definition:
zconf.h:233
sdk
lib
gcc-compat
__throw_out_of_range_fmt.cpp
Generated on Sat Jan 18 2025 06:14:29 for ReactOS by
1.9.6