ReactOS  0.4.13-dev-249-gcba1a2f
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 
19 inline size_t safestrlen ( const tchar *string )
20 {
21  if ( !string )
22  return 0;
23  return _tcslen(string);
24 }
25 
26 inline 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 
36 inline 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 
47 inline tchar* safestrlwr ( tchar* str )
48 {
49  if ( !str )
50  return 0;
51  return _tcslwr(str);
52 }
53 
54 inline tchar* safestrupr ( tchar* str )
55 {
56  if ( !str )
57  return 0;
58  return _tcsupr(str);
59 }
60 
61 #endif//__SAFESTR_H
tchar * safestrlwr(tchar *str)
Definition: safestr.h:47
GLuint GLuint GLsizei count
Definition: gl.h:1545
_TCHAR * _tcsncpy(_TCHAR *dst, const _TCHAR *src, size_t n)
Definition: tcsncpy.h:9
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
const WCHAR * str
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
#define _tcslwr
Definition: tchar.h:1465
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define _tcsupr
Definition: tchar.h:1467
size_t safestrlen(const tchar *string)
Definition: safestr.h:19
#define tchar
Definition: safestr.h:13
tchar * safestrupr(tchar *str)
Definition: safestr.h:54
tchar * safestrcpy(tchar *strDest, const tchar *strSource)
Definition: safestr.h:26
tchar * safestrncpy(tchar *strDest, const tchar *strSource, size_t count)
Definition: safestr.h:36