Skip to content

Commit

Permalink
other way
Browse files Browse the repository at this point in the history
  • Loading branch information
illwieckz committed Jul 14, 2024
1 parent 85b2661 commit d0d6b4e
Showing 1 changed file with 5 additions and 23 deletions.
28 changes: 5 additions & 23 deletions example2/example2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,11 @@

using namespace crnlib;

// Copied from crn_strutils.cpp without asserts.
char* example2_strcpy_safe(char* pDst, size_t dst_len, const char* pSrc) {
if (!dst_len)
return pDst;

char* q = pDst;
char c;

do {
if (dst_len == 1) {
*q++ = '\0';
break;
}

c = *pSrc++;
*q++ = c;

dst_len--;

} while (c);

return pDst;
}
#if defined(_WIN32)
#define example2_strcpy_safe(d, l, s) strcpy_s(d, l, s)
#else
void example2_strcpy_safe(char *d, size_t l, const char* s) {l = strnlen(s, l - 1); memcpy(d, s, l); d[l] = '\0';}
#endif

static int print_usage() {
printf("Description: Transcodes .CRN to .DDS files using crn_decomp.h.\n");
Expand Down

0 comments on commit d0d6b4e

Please sign in to comment.