GeoDesk for C++
Fast and storage-efficient spatial database engine for OpenStreetMap features
Loading...
Searching...
No Matches
Format.h
Go to the documentation of this file.
1
// Copyright (c) 2024 Clarisma / GeoDesk contributors
2
// SPDX-License-Identifier: LGPL-3.0-only
3
4
#pragma once
5
#include <cstdarg>
6
#include <cstdint>
7
#include <cstdio>
8
9
namespace
clarisma
{
10
11
namespace
Format
12
{
13
inline
int
unsafe(
char
* str,
const
char
* format, ...)
14
{
15
va_list args;
16
va_start(args, format);
17
18
// Disable warnings for GCC and Clang
19
#if defined(__GNUC__) || defined(__clang__)
20
#pragma GCC diagnostic push
21
#pragma GCC diagnostic ignored "-Wformat-security"
22
#endif
23
24
// Disable warnings for MSVC
25
#ifdef _MSC_VER
26
#pragma warning(push)
27
#pragma warning(disable : 4996)
// Disable specific warning for deprecated functions
28
#endif
29
30
int
result = vsprintf(str, format, args);
31
32
// Re-enable warnings for GCC and Clang
33
#if defined(__GNUC__) || defined(__clang__)
34
#pragma GCC diagnostic pop
35
#endif
36
37
// Re-enable warnings for MSVC
38
#ifdef _MSC_VER
39
#pragma warning(pop)
40
#endif
41
42
va_end(args);
43
return
result;
44
}
45
}
46
}
// namespace clarisma
clarisma
Definition
Arena.h:17
include
clarisma
util
Format.h
Generated by
1.12.0