PageRenderTime 35ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/handler/gpatcher/rtl.cc

https://github.com/a-palchikov/attic
C++ | 39 lines | 31 code | 7 blank | 1 comment | 9 complexity | 058f439e190b6ba958c89bc98cde3127 MD5 | raw file
  1. #include <tchar.h>
  2. // credits to Andy Polyakov (appro at fy.chalmers.se)
  3. static void _memmove (void *dst, void *src, size_t n)
  4. {
  5. unsigned char *d = (unsigned char*)dst, *s = (unsigned char*)src;
  6. while (n--) *d++ = *s++;
  7. }
  8. static size_t _lstrlenW (TCHAR *str)
  9. {
  10. int len = 0;
  11. while (*str) { str++, len++; }
  12. return len;
  13. }
  14. static TCHAR *_lstrrchrW (TCHAR *str, TCHAR c)
  15. {
  16. TCHAR *p = NULL;
  17. while (*str) { if (*str == c) p = str; str++; }
  18. return p;
  19. }
  20. static TCHAR *_lstrchrW (TCHAR *str,TCHAR c)
  21. {
  22. TCHAR *p = NULL;
  23. while (*str) { if (*str == c) { p = str; break; } str++; }
  24. return p;
  25. }
  26. static TCHAR *_lstrncpyW (TCHAR *dst, TCHAR *src, size_t n)
  27. {
  28. TCHAR *ret=dst;
  29. while(--n && *src) { *dst++ = *src++; }
  30. *dst=_T('\0');
  31. return ret;
  32. }