-
Notifications
You must be signed in to change notification settings - Fork 537
Expand file tree
/
Copy pathstr_wrapper.cpp
More file actions
45 lines (37 loc) · 1.02 KB
/
str_wrapper.cpp
File metadata and controls
45 lines (37 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2026 Advanced Micro Devices, Inc. All rights reserved.
#include "core/common/str_wrapper.h"
#include <cstdio>
#include <cstring>
#include <cstdarg>
namespace xrt_core { namespace str_wrapper {
// Pointer case - use std:: functions (cross-platform)
char* strcpy(char* dest, const char* src)
{
return std::strcpy(dest, src);
}
char* strncpy(char* dest, const char* src, size_t n)
{
return std::strncpy(dest, src, n);
}
char* strcat(char* dest, const char* src)
{
return std::strcat(dest, src);
}
char* strncat(char* dest, const char* src, size_t n)
{
return std::strncat(dest, src, n);
}
int sprintf(char* buf, const char* format, ...)
{
va_list args;
va_start(args, format);
int result = std::vsprintf(buf, format, args);
va_end(args);
return result;
}
int vsnprintf(char* buf, size_t size, const char* format, va_list args)
{
return std::vsnprintf(buf, size, format, args);
}
}} // str_wrapper, xrt_core