- Timestamp:
- 08/13/20 15:11:55 (4 years ago)
- Location:
- cpp/common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/common/util-string.cpp
r1016 r1025 1 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-20 19Maciej Komosinski and Szymon Ulatowski.2 // Copyright (C) 1999-2020 Maciej Komosinski and Szymon Ulatowski. 3 3 // See LICENSE.txt for details. 4 4 … … 15 15 #include <android/log.h> //only needed to print error messages related to a workaround for Android bug 16 16 #endif 17 18 string repr(const char *str) 19 { 20 string out = ""; 21 char hex[4]; 22 while (*str) 23 { 24 if (*str >= 32 && *str < 128) 25 out += *str; 26 else 27 { 28 if (*str == 10) out += "\\n"; else 29 if (*str == 13) out += "\\r"; else 30 { 31 sprintf(hex, "%X", *str); 32 out += "\\x"; 33 out += hex; 34 } 35 } 36 str++; 37 } 38 return out; 39 } 40 17 41 18 42 string ssprintf_va(const char* format, va_list ap) … … 31 55 #endif 32 56 33 while ( 1)57 while (true) 34 58 { 35 59 buf = (char*)malloc(size); -
cpp/common/util-string.h
r1016 r1025 1 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-20 15Maciej Komosinski and Szymon Ulatowski.2 // Copyright (C) 1999-2020 Maciej Komosinski and Szymon Ulatowski. 3 3 // See LICENSE.txt for details. 4 4 … … 8 8 #include "nonstd_stl.h" 9 9 #include <stdarg.h> 10 11 string repr(const char *str); 10 12 11 13 char* strmove(char *a, char *b); //strcpy that works well for overlapping strings ("Source and destination overlap")
Note: See TracChangeset
for help on using the changeset viewer.