Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
12881b42
Commit
12881b42
authored
Aug 03, 2010
by
dewyatt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added SDL_wcslcpy and SDL_wcslcat.
parent
cae6f137
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
0 deletions
+40
-0
SDL_stdinc.h
include/SDL_stdinc.h
+13
-0
SDL_string.c
src/stdlib/SDL_string.c
+27
-0
No files found.
include/SDL_stdinc.h
View file @
12881b42
...
@@ -470,6 +470,19 @@ extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string);
...
@@ -470,6 +470,19 @@ extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string);
extern
DECLSPEC
size_t
SDLCALL
SDL_wcslen
(
const
wchar_t
*
string
);
extern
DECLSPEC
size_t
SDLCALL
SDL_wcslen
(
const
wchar_t
*
string
);
#endif
#endif
#ifdef HAVE_WCSLCPY
#define SDL_wcslcpy wcslcpy
#else
extern
DECLSPEC
size_t
SDLCALL
SDL_wcslcpy
(
wchar_t
*
dst
,
const
wchar_t
*
src
,
size_t
maxlen
);
#endif
#ifdef HAVE_WCSLCAT
#define SDL_wcslcat wcslcat
#else
extern
DECLSPEC
size_t
SDLCALL
SDL_wcslcat
(
wchar_t
*
dst
,
const
wchar_t
*
src
,
size_t
maxlen
);
#endif
#ifdef HAVE_STRLCPY
#ifdef HAVE_STRLCPY
#define SDL_strlcpy strlcpy
#define SDL_strlcpy strlcpy
#else
#else
...
...
src/stdlib/SDL_string.c
View file @
12881b42
...
@@ -363,6 +363,33 @@ SDL_wcslen(const wchar_t * string)
...
@@ -363,6 +363,33 @@ SDL_wcslen(const wchar_t * string)
}
}
#endif
#endif
#ifndef HAVE_WCSLCPY
size_t
SDL_wcslcpy
(
wchar_t
*
dst
,
const
wchar_t
*
src
,
size_t
maxlen
)
{
size_t
srclen
=
SDL_wcslen
(
src
);
if
(
maxlen
>
0
)
{
size_t
len
=
SDL_min
(
srclen
,
maxlen
-
1
);
SDL_memcpy
(
dst
,
src
,
len
*
sizeof
(
wchar_t
));
dst
[
len
]
=
'\0'
;
}
return
srclen
;
}
#endif
#ifndef HAVE_WCSLCAT
size_t
SDL_wcslcat
(
wchar_t
*
dst
,
const
wchar_t
*
src
,
size_t
maxlen
)
{
size_t
dstlen
=
SDL_wcslen
(
dst
);
size_t
srclen
=
SDL_wcslen
(
src
);
if
(
dstlen
<
maxlen
)
{
SDL_wcslcpy
(
dst
+
dstlen
,
src
,
maxlen
-
dstlen
);
}
return
dstlen
+
srclen
;
}
#endif
#ifndef HAVE_STRLCPY
#ifndef HAVE_STRLCPY
size_t
size_t
SDL_strlcpy
(
char
*
dst
,
const
char
*
src
,
size_t
maxlen
)
SDL_strlcpy
(
char
*
dst
,
const
char
*
src
,
size_t
maxlen
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment