ReactOS 0.4.16-dev-297-gc569aee
safestr.h
Go to the documentation of this file.
1//
2// safestr.h
3//
4// safe versions of some string manipulation routines
5//
6
7#ifndef __SAFESTR_H
8#define __SAFESTR_H
9
10#include <tchar.h>
11
12#ifndef tchar
13#define tchar TCHAR
14#endif//tchar
15
16#include <string.h>
17#include "assert.h"
18
19inline size_t safestrlen ( const tchar *string )
20{
21 if ( !string )
22 return 0;
23 return _tcslen(string);
24}
25
26inline tchar* safestrcpy ( tchar* strDest, const tchar* strSource )
27{
28 ASSERT(strDest);
29 if ( !strSource )
30 *strDest = 0;
31 else
32 _tcscpy ( strDest, strSource );
33 return strDest;
34}
35
36inline tchar* safestrncpy ( tchar* strDest, const tchar* strSource, size_t count )
37{
38 ASSERT(strDest);
39 if ( !strSource )
40 count = 0;
41 else
42 _tcsncpy ( strDest, strSource, count );
43 strDest[count] = 0;
44 return strDest;
45}
46
48{
49 if ( !str )
50 return 0;
51 return _tcslwr(str);
52}
53
55{
56 if ( !str )
57 return 0;
58 return _tcsupr(str);
59}
60
61#endif//__SAFESTR_H
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define _tcscpy
Definition: tchar.h:623
#define _tcsncpy
Definition: tchar.h:1410
#define _tcslwr
Definition: tchar.h:1465
#define _tcsupr
Definition: tchar.h:1467
#define ASSERT(a)
Definition: mode.c:44
const WCHAR * str
tchar * safestrupr(tchar *str)
Definition: safestr.h:54
#define tchar
Definition: safestr.h:13
tchar * safestrncpy(tchar *strDest, const tchar *strSource, size_t count)
Definition: safestr.h:36
tchar * safestrcpy(tchar *strDest, const tchar *strSource)
Definition: safestr.h:26
size_t safestrlen(const tchar *string)
Definition: safestr.h:19
tchar * safestrlwr(tchar *str)
Definition: safestr.h:47
#define _tcslen
Definition: xmlstorage.h:198