# HG changeset patch # User Nomad # Date 1361165208 -7200 # Node ID 83f85ab6079a25339fd2bf35fc03356d6d964f55 # Parent 9a8d37c07e5005e96e21aed8538c070672b9a7d3 sprintfex fix diff -r 9a8d37c07e50 -r 83f85ab6079a mm7_4.cpp --- a/mm7_4.cpp Mon Feb 18 07:13:20 2013 +0200 +++ b/mm7_4.cpp Mon Feb 18 07:26:48 2013 +0200 @@ -4841,7 +4841,7 @@ unsigned __int8 v6; // bl@1 Player *pPlayer; // ebx@3 NPCData *v9; // eax@4 - size_t v10; // eax@6 + //size_t v10; // eax@6 char *v11; // esi@7 int v12; // edx@7 ItemGen *v13; // edi@7 @@ -4916,8 +4916,10 @@ else v9 = GetNPCData(uDialogue_SpeakingActorNPC_ID); v65 = v9; - v10 = 0; + //v10 = 0; v64 = 0; + + int i = 0; if ( (signed int)v60 > 0 ) { v11 = a4; @@ -4926,9 +4928,9 @@ while ( 1 ) { v14 = lpsz[v12]; - if ( v14 == 37 ) + if ( v14 == '%' ) break; - pTmpBuf2[v10++] = v14; + pTmpBuf2[i++] = v14; LABEL_119: ++v12; v64 = v12; @@ -4938,6 +4940,7 @@ v15 = &lpsz[v12 + 1]; v16 = (unsigned __int8)lpsz[v12 + 2]; v17 = v16 + 10 * (unsigned __int8)*v15 - 528; + if ( v17 <= 15 ) { if ( v17 != 15 ) @@ -5063,7 +5066,8 @@ case 0x21E: goto LABEL_93; case 0x214: - goto LABEL_117; + v11 = a1; + goto LABEL_118; default: goto LABEL_108; } @@ -5072,7 +5076,7 @@ v11 = pGlobalTXT_LocalizationStrings[393];// "daughter" LABEL_118: strcat(pTmpBuf2, v11); - v10 = strlen(pTmpBuf2); + i = strlen(pTmpBuf2); v64 += 2; v12 = v64; goto LABEL_119; @@ -5113,7 +5117,6 @@ { v46 = v13->GetDisplayName(); sprintf(a1, format_4E2D80, v59, v46); -LABEL_117: v11 = a1; goto LABEL_118; } @@ -5159,7 +5162,8 @@ strncpy(a1, v15, 2u); v51 = atoi(a1); sprintf(a1, "%lu", v51); - goto LABEL_117; + v11 = a1; + goto LABEL_118; } v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; v27 = *v26; @@ -5203,7 +5207,8 @@ } LABEL_98: sprintf(a1, "%lu", v29); - goto LABEL_117; + v11 = a1; + goto LABEL_118; } v34 = *v26; } @@ -5237,9 +5242,9 @@ v54 = v56.field_18; v53 = v56.field_C + 1; v50 = v56.field_14; -LABEL_116: sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); - goto LABEL_117; + v11 = a1; + goto LABEL_118; } v52 = pPlayers[4]; break; @@ -5253,7 +5258,9 @@ v54 = v57.field_18; v53 = v57.field_C + 1; v50 = v57.field_14; - goto LABEL_116; + sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); + v11 = a1; + goto LABEL_118; } return pTmpBuf2; } diff -r 9a8d37c07e50 -r 83f85ab6079a mm7text_ru.cpp --- a/mm7text_ru.cpp Mon Feb 18 07:13:20 2013 +0200 +++ b/mm7text_ru.cpp Mon Feb 18 07:26:48 2013 +0200 @@ -1085,12 +1085,13 @@ while (left <= right) { match = left + (right - left) / 2; - switch (_mbsncmp(name, (unsigned char *)table[match].name, name_len)) - { - case -1: right = match; break; - case 0: return table[match].gender; - case 1: left = match; break; - } + int rval = _mbsncmp(name, (unsigned char *)table[match].name, name_len); + if (rval < 0) + right = match; + else if (!rval) + return table[match].gender; + else + left = match; } assert(false); return 0;