Mercurial > mm7
diff mm7text_ru.cpp @ 1545:c4ab816fcc5e
assert, Abortf, AbortWithError -> Assert, Error
refactors here and there
author | Nomad |
---|---|
date | Sat, 07 Sep 2013 20:05:20 +0200 |
parents | 934074e7fcc1 |
children | d28d3c006077 |
line wrap: on
line diff
--- a/mm7text_ru.cpp Sat Sep 07 15:20:57 2013 +0200 +++ b/mm7text_ru.cpp Sat Sep 07 20:05:20 2013 +0200 @@ -5,9 +5,9 @@ #include <string.h> #include <stdlib.h> #include <stdio.h> -#include <assert.h> #include "Log.h" +#include "ErrorHandling.h" struct GenderTableEntry @@ -1161,14 +1161,14 @@ return nullptr; } -int sprintfex_internal(char *str) +int sprintfex_internal(char *str) { auto p = strstr(str, "^"); if (!p) return strlen(str); char buf[8192]; - assert(strlen(str) < sizeof(buf)); + Assert(strlen(str) < sizeof(buf)); int next_integer_token = 0; bool integer_tokens_defined[10] = {false, false, false, false, false, false, false, false, false, false}; @@ -1190,7 +1190,7 @@ goto _invalid_token; src += 3; // ^I[ - assert(next_integer_token < 10); + Assert(next_integer_token < 10); if (sscanf(src, "%d", &integer_tokens[next_integer_token])) integer_tokens_defined[next_integer_token++] = true; @@ -1217,7 +1217,7 @@ else if (src[2] != '[') goto _invalid_token; - assert(integer_tokens_defined[integer_token_idx]); + Assert(integer_tokens_defined[integer_token_idx]); src += 3; // ^L[ auto ending1 = src; @@ -1256,7 +1256,7 @@ { if (src[2] != '[') goto _invalid_token; - assert(gender_token_defined); + Assert(gender_token_defined); src += 3; // ^R[ @@ -1285,7 +1285,7 @@ actual_ending = ending3; actual_ending_len = src - ending3 - 1; } - else assert(false); + else Error("Invalid gender token"); strncpy(dst, actual_ending, actual_ending_len); dst += actual_ending_len; @@ -1367,8 +1367,7 @@ strncpy(token, token_begin, token_len); token[token_len] = 0; - Log::Warning(L"Invalid format token: %S", token); - assert(false); + Error("Invalid format token: %s", token); } break; }