Fix const char

This commit is contained in:
Krzosa Karol
2024-03-16 11:55:44 +01:00
parent da575e8877
commit 18100a87fb
2 changed files with 30 additions and 33 deletions

View File

@@ -108,8 +108,7 @@ IO_API void IO__Printf(int kind, const char *file, int line, const char *msg, ..
if (IO_User_OutputMessage) {
IO_User_OutputMessage(kind, file, line, result, size);
}
else {
} else {
IO_OutputMessage(result, size);
}
@@ -118,9 +117,9 @@ IO_API void IO__Printf(int kind, const char *file, int line, const char *msg, ..
}
}
IO_API bool IO__FatalError(char *msg) {
int len = IO_Strlen(msg);
IO_ErrorResult result = IO_OutputError(msg, len);
IO_API bool IO__FatalError(const char *msg) {
int len = IO_Strlen((char *)msg);
IO_ErrorResult result = IO_OutputError((char *)msg, len);
if (result == IO_ErrorResult_Exit) {
IO_Exit(1);
}
@@ -130,8 +129,7 @@ IO_API bool IO__FatalError(char *msg) {
IO_API void IO_Print(int kind, const char *file, int line, char *msg, int len) {
if (IO_User_OutputMessage) {
IO_User_OutputMessage(kind, file, line, msg, len);
}
else {
} else {
IO_OutputMessage(msg, len);
}
}
@@ -188,8 +186,7 @@ IO_API IO_ErrorResult IO_OutputError(char *str, int len) {
}
result = IO_ErrorResult_Exit;
}
else {
} else {
result = IO_ErrorResult_Break;
}

View File

@@ -55,7 +55,7 @@ extern IO_THREAD_LOCAL void (*IO_User_OutputMessage)(int kind, const char *file,
#define IO__TOSTRING(x) IO__STRINGIFY(x)
#define IO_LINE IO__TOSTRING(__LINE__)
#define IO_Assert(x) !(x) && IO__FatalError((char *)(__FILE__ "(" IO_LINE "): " \
#define IO_Assert(x) !(x) && IO__FatalError((__FILE__ "(" IO_LINE "): " \
"error: " #x "\n")) && \
IO_DebugBreak()
#define IO_FatalErrorf(...) \
@@ -86,14 +86,14 @@ extern IO_THREAD_LOCAL void (*IO_User_OutputMessage)(int kind, const char *file,
}
#define IO_InvalidCodepath() IO_FatalError("This codepath is invalid")
#define IO_InvalidDefaultCase() \
default: { \
default: { \
IO_FatalError("Entered invalid switch statement case"); \
}
}
#define IO_Todo() IO_FatalError("This codepath is not implemented yet")
IO_API bool IO__FatalErrorf(const char *file, int line, const char *msg, ...) IO__PrintfFormat(3, 4);
IO_API void IO__Printf(int kind, const char *file, int line, const char *msg, ...) IO__PrintfFormat(4, 5);
IO_API bool IO__FatalError(char *msg);
IO_API bool IO__FatalError(const char *msg);
IO_API void IO_Print(int kind, const char *file, int line, char *msg, int len);
IO_API void IO_OutputMessage(char *str, int len);
IO_API IO_ErrorResult IO_OutputError(char *str, int len);