Rev 440 | Rev 460 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 440 | Rev 444 | ||
---|---|---|---|
Line 18... | Line 18... | ||
18 | */ |
18 | */ |
19 | 19 | ||
20 | #include <string.h> |
20 | #include <string.h> |
21 | #include <stdlib.h> |
21 | #include <stdlib.h> |
22 | 22 | ||
- | 23 | #ifdef WIN_ENV |
|
- | 24 | #include <windows.h> |
|
- | 25 | #endif |
|
- | 26 | ||
23 | #include "str.h" |
27 | #include "str.h" |
24 | #include "sprintf_tiny.h" |
28 | #include "sprintf_tiny.h" |
25 | 29 | ||
- | 30 | #ifdef UNICODE |
|
- | 31 | size_t xstrlen(wchar_t* s) { |
|
- | 32 | return lstrlen(s); |
|
- | 33 | } |
|
- | 34 | wchar_t* xstrcpy(wchar_t* dst, wchar_t* src) { |
|
- | 35 | return lstrcpy(dst, src); |
|
- | 36 | } |
|
- | 37 | wchar_t* xstrcat(wchar_t* dst, const wchar_t* src) { |
|
- | 38 | return lstrcat(dst, src); |
|
- | 39 | } |
|
- | 40 | wchar_t* xstrrchr(wchar_t* const _Str, const int _Ch) { |
|
- | 41 | return wcsrchr(_Str, _Ch); |
|
- | 42 | } |
|
- | 43 | int xstrcasecmp(const wchar_t* a, const wchar_t* b) { |
|
- | 44 | return _wcsicmp(a, b); |
|
- | 45 | } |
|
- | 46 | #else |
|
- | 47 | size_t xstrlen(char* s) { |
|
- | 48 | return strlen(s); |
|
- | 49 | } |
|
- | 50 | char* xstrcpy(char* dst, char* src) { |
|
- | 51 | return strcpy(dst, src); |
|
- | 52 | } |
|
- | 53 | char* xstrcat(char* dst, const char* src) { |
|
- | 54 | return strcat(dst, src); |
|
- | 55 | } |
|
- | 56 | char* xstrrchr(char* const _Str, const int _Ch) { |
|
- | 57 | return strrchr(_Str, _Ch); |
|
- | 58 | } |
|
- | 59 | int xstrcasecmp(const char* a, const char* b) { |
|
- | 60 | //return strcasecmp(a, b); |
|
- | 61 | return _stricmp(a, b); |
|
- | 62 | } |
|
- | 63 | #endif |
|
- | 64 | ||
26 | // convert C (null-terminated) to Pascal (length byte) string |
65 | // convert C (null-terminated) to Pascal (length byte) string |
27 | // no bounds checking |
66 | // no bounds checking |
28 | unsigned char *myc2pstr(char *s){ |
67 | unsigned char *myc2pstr(char *s){ |
29 | size_t n = strlen(s); |
68 | size_t n = strlen(s); |
30 | memmove(s+1,s,n); |
69 | memmove(s+1,s,n); |