mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 17:12:25 -05:00
Drop UniString
The only thing I intended to use it for was exe path with setcurrentdirectory, but that doesn't matter anymore
This commit is contained in:
parent
bad7f79b7a
commit
482df54808
5 changed files with 1 additions and 62 deletions
|
@ -1188,7 +1188,7 @@ void Gfx_DeleteVb(GfxResourceID* vb) {
|
|||
}
|
||||
|
||||
void Gfx_DeleteIb(GfxResourceID* ib) {
|
||||
if (!ib || *ib == GFX_NULL) return;
|
||||
if (*ib == GFX_NULL) return;
|
||||
GLuint id = (GLuint)(*ib);
|
||||
_glDeleteBuffers(1, &id);
|
||||
*ib = GFX_NULL;
|
||||
|
|
|
@ -1843,16 +1843,6 @@ int Platform_ConvertString(void* data, const String* src) {
|
|||
return src->length * 2;
|
||||
}
|
||||
|
||||
int Platform_ConvertUniString(void* data, const UniString* src) {
|
||||
TCHAR* dst = (TCHAR*)data;
|
||||
int i;
|
||||
if (src->length > FILENAME_SIZE) Logger_Abort("String too long to expand");
|
||||
|
||||
for (i = 0; i < src->length; i++) { *dst++ = src->buffer[i]; }
|
||||
*dst = '\0';
|
||||
return src->length * 2;
|
||||
}
|
||||
|
||||
static void Platform_InitStopwatch(void) {
|
||||
LARGE_INTEGER freq;
|
||||
sw_highRes = QueryPerformanceFrequency(&freq);
|
||||
|
@ -1994,21 +1984,6 @@ int Platform_ConvertString(void* data, const String* src) {
|
|||
return len;
|
||||
}
|
||||
|
||||
int Platform_ConvertUniString(void* data, const UniString* src) {
|
||||
uint8_t* dst = (uint8_t*)data;
|
||||
uint8_t* cur;
|
||||
|
||||
int i, len = 0;
|
||||
if (src->length > FILENAME_SIZE) Logger_Abort("String too long to expand");
|
||||
|
||||
for (i = 0; i < src->length; i++) {
|
||||
cur = dst + len;
|
||||
len += Convert_UnicodeToUtf8(src->buffer[i], cur);
|
||||
}
|
||||
dst[len] = '\0';
|
||||
return len;
|
||||
}
|
||||
|
||||
static void Platform_InitPosix(void) {
|
||||
signal(SIGCHLD, SIG_IGN);
|
||||
/* So writing to closed socket doesn't raise SIGPIPE */
|
||||
|
|
|
@ -36,10 +36,6 @@ extern const ReturnCode ReturnCode_SocketWouldBlock;
|
|||
/* NOTE: Only useful for platform specific function calls - do NOT try to interpret the data. */
|
||||
/* Returns the number of bytes written, excluding trailing NULL terminator. */
|
||||
CC_API int Platform_ConvertString(void* data, const String* src);
|
||||
/* Encodes a unicode string in platform specific format. (e.g. unicode on windows, UTF8 on linux) */
|
||||
/* NOTE: Only useful for platform specific function calls - do NOT try to interpret the data. */
|
||||
/* Returns the number of bytes written, excluding trailing NULL terminator. */
|
||||
CC_API int Platform_ConvertUniString(void* data, const UniString* src);
|
||||
|
||||
/* Initalises the platform specific state. */
|
||||
void Platform_Init(void);
|
||||
|
|
19
src/String.c
19
src/String.c
|
@ -278,25 +278,6 @@ void String_AppendColorless(String* str, const String* src) {
|
|||
}
|
||||
|
||||
|
||||
void UniString_Append(UniString* str, Codepoint c) {
|
||||
if (str->length == str->capacity) return;
|
||||
str->buffer[str->length++] = c;
|
||||
}
|
||||
|
||||
void UniString_AppendConst(UniString* str, const char* src) {
|
||||
for (; *src; src++) {
|
||||
UniString_Append(str, Convert_CP437ToUnicode(*src));
|
||||
}
|
||||
}
|
||||
|
||||
void UniString_AppendString(UniString* str, const String* src) {
|
||||
int i;
|
||||
for (i = 0; i < src->length; i++) {
|
||||
UniString_Append(str, Convert_CP437ToUnicode(src->buffer[i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int String_IndexOfAt(const String* str, int offset, char c) {
|
||||
int i;
|
||||
for (i = offset; i < str->length; i++) {
|
||||
|
|
13
src/String.h
13
src/String.h
|
@ -21,11 +21,6 @@ typedef struct String_ {
|
|||
uint16_t capacity; /* Max number of characters */
|
||||
} String;
|
||||
|
||||
typedef struct UniString_ {
|
||||
Codepoint* buffer;
|
||||
uint16_t length, capacity;
|
||||
} UniString;
|
||||
|
||||
/* Constant string that points to NULL and has 0 length. */
|
||||
/* NOTE: Do NOT modify the contents of this string! */
|
||||
extern const String String_Empty;
|
||||
|
@ -117,14 +112,6 @@ CC_API void String_AppendColorless(String* str, const String* src);
|
|||
/* Attempts to append the two hex digits of a byte. */
|
||||
CC_API void String_AppendHex(String* str, uint8_t value);
|
||||
|
||||
/* Attempts to append a character. */
|
||||
/* Does nothing if str->length == str->capcity. */
|
||||
CC_API void UniString_Append(UniString* str, Codepoint c);
|
||||
/* Attempts to append characters. src MUST be null-terminated. */
|
||||
CC_API void UniString_AppendConst(UniString* str, const char* src);
|
||||
/* Attempts to append characters of a string. */
|
||||
CC_API void UniString_AppendString(UniString* str, const String* src);
|
||||
|
||||
/* Returns first index of the given character in the given string, -1 if not found. */
|
||||
#define String_IndexOf(str, c) String_IndexOfAt(str, 0, c)
|
||||
/* Returns first index of the given character in the given string, -1 if not found. */
|
||||
|
|
Loading…
Reference in a new issue