@@ -115,7 +115,11 @@ void dbg_assert_imp(const char *filename, int line, int test, const char *msg)
115
115
116
116
void dbg_break ()
117
117
{
118
- * ((volatile unsigned * )0 ) = 0x0 ;
118
+ #ifdef __GNUC__
119
+ __builtin_trap ();
120
+ #else
121
+ abort ();
122
+ #endif
119
123
}
120
124
121
125
void dbg_msg (const char * sys , const char * fmt , ...)
@@ -148,20 +152,20 @@ void dbg_msg(const char *sys, const char *fmt, ...)
148
152
#if defined(CONF_FAMILY_WINDOWS )
149
153
static void logger_win_console (const char * line , void * user )
150
154
{
151
- #define _MAX_LENGTH 1024
152
- #define _MAX_LENGTH_ERROR (_MAX_LENGTH +32)
155
+ #define MAX_LENGTH 1024
156
+ #define MAX_LENGTH_ERROR (MAX_LENGTH +32)
153
157
154
158
static const int UNICODE_REPLACEMENT_CHAR = 0xfffd ;
155
159
156
160
static const char * STR_TOO_LONG = "(str too long)" ;
157
161
static const char * INVALID_UTF8 = "(invalid utf8)" ;
158
162
159
- wchar_t wline [_MAX_LENGTH_ERROR ];
163
+ wchar_t wline [MAX_LENGTH_ERROR ];
160
164
size_t len = 0 ;
161
165
162
166
const char * read = line ;
163
167
const char * error = STR_TOO_LONG ;
164
- while (len < _MAX_LENGTH )
168
+ while (len < MAX_LENGTH )
165
169
{
166
170
// Read a character. This also advances the read pointer
167
171
int glyph = str_utf8_decode (& read );
@@ -213,23 +217,23 @@ static void logger_win_console(const char *line, void *user)
213
217
if (character == 0 )
214
218
break ;
215
219
216
- dbg_assert (len < _MAX_LENGTH_ERROR , "str too short for error" );
217
- wline [len ++ ] = character ;
220
+ dbg_assert (len < MAX_LENGTH_ERROR , "str too short for error" );
221
+ wline [len ++ ] = ( unsigned char ) character ;
218
222
read ++ ;
219
223
}
220
224
}
221
225
222
226
// Terminate the line
223
- dbg_assert (len < _MAX_LENGTH_ERROR , "str too short for \\r" );
227
+ dbg_assert (len < MAX_LENGTH_ERROR , "str too short for \\r" );
224
228
wline [len ++ ] = '\r' ;
225
- dbg_assert (len < _MAX_LENGTH_ERROR , "str too short for \\n" );
229
+ dbg_assert (len < MAX_LENGTH_ERROR , "str too short for \\n" );
226
230
wline [len ++ ] = '\n' ;
227
231
228
232
// Ignore any error that might occur
229
233
WriteConsoleW (GetStdHandle (STD_OUTPUT_HANDLE ), wline , len , 0 , 0 );
230
234
231
- #undef _MAX_LENGTH
232
- #undef _MAX_LENGTH_ERROR
235
+ #undef MAX_LENGTH
236
+ #undef MAX_LENGTH_ERROR
233
237
}
234
238
#endif
235
239
@@ -2638,7 +2642,7 @@ char* str_sanitize_filename(char* aName)
2638
2642
{
2639
2643
// replace forbidden characters with a whispace
2640
2644
if (* str == '/' || * str == '<' || * str == '>' || * str == ':' || * str == '"'
2641
- || * str == '/' || * str == ' \\' || * str == '|' || * str == '?' || * str == '*' )
2645
+ || * str == '\\' || * str == '|' || * str == '?' || * str == '*' )
2642
2646
* str = ' ' ;
2643
2647
str ++ ;
2644
2648
}
@@ -3136,7 +3140,7 @@ int str_utf8_decode(const char **ptr)
3136
3140
{
3137
3141
if ((* buf & 0x80 ) == 0x0 ) /* 0xxxxxxx */
3138
3142
{
3139
- ch = * buf ;
3143
+ ch = ( unsigned char ) * buf ;
3140
3144
buf ++ ;
3141
3145
}
3142
3146
else if ((* buf & 0xE0 ) == 0xC0 ) /* 110xxxxx */
0 commit comments