mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 22:23:01 +00:00
- Tree cleanups proposed on the mailing list. Move all non-Core OS modules to rosapps. Tests were already moved by Fireball to rostests.
svn path=/trunk/; revision=26033
This commit is contained in:
parent
ad07a1e58f
commit
1e3d5d70e9
420 changed files with 78215 additions and 0 deletions
61
rosapps/sysutils/utils/sdkparse/safestr.h
Normal file
61
rosapps/sysutils/utils/sdkparse/safestr.h
Normal file
|
@ -0,0 +1,61 @@
|
|||
//
|
||||
// safestr.h
|
||||
//
|
||||
// safe versions of some string manipulation routines
|
||||
//
|
||||
|
||||
#ifndef __SAFESTR_H
|
||||
#define __SAFESTR_H
|
||||
|
||||
#include <tchar.h>
|
||||
|
||||
#ifndef tchar
|
||||
#define tchar TCHAR
|
||||
#endif//tchar
|
||||
|
||||
#include <string.h>
|
||||
#include "assert.h"
|
||||
|
||||
inline size_t safestrlen ( const tchar *string )
|
||||
{
|
||||
if ( !string )
|
||||
return 0;
|
||||
return _tcslen(string);
|
||||
}
|
||||
|
||||
inline tchar* safestrcpy ( tchar* strDest, const tchar* strSource )
|
||||
{
|
||||
ASSERT(strDest);
|
||||
if ( !strSource )
|
||||
*strDest = 0;
|
||||
else
|
||||
_tcscpy ( strDest, strSource );
|
||||
return strDest;
|
||||
}
|
||||
|
||||
inline tchar* safestrncpy ( tchar* strDest, const tchar* strSource, size_t count )
|
||||
{
|
||||
ASSERT(strDest);
|
||||
if ( !strSource )
|
||||
count = 0;
|
||||
else
|
||||
_tcsncpy ( strDest, strSource, count );
|
||||
strDest[count] = 0;
|
||||
return strDest;
|
||||
}
|
||||
|
||||
inline tchar* safestrlwr ( tchar* str )
|
||||
{
|
||||
if ( !str )
|
||||
return 0;
|
||||
return _tcslwr(str);
|
||||
}
|
||||
|
||||
inline tchar* safestrupr ( tchar* str )
|
||||
{
|
||||
if ( !str )
|
||||
return 0;
|
||||
return _tcsupr(str);
|
||||
}
|
||||
|
||||
#endif//__SAFESTR_H
|
Loading…
Add table
Add a link
Reference in a new issue