refactor(developer): fixup remaining functions in kmcmplib to always report errors directly and return FALSE rather than return error to caller
- Dominant language
- Pascal
- Stars
- 534
- Forks
- 143
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 113
Description
15 lines where results from other functions are reported later:
```
15 results - 3 files
developer\src\kmcmplib\src\CompileKeyboardBuffer.cpp:
114 if (msg != STATUS_EndOfFile) {
115: ReportCompilerMessage(msg);
116 return FALSE;
134 if (msg != STATUS_EndOfFile) {
135: ReportCompilerMessage(msg);
136 return FALSE;
developer\src\kmcmplib\src\Compiler.cpp:
297 if ((msg = GetRHS(fk, p, tstr, 80, (int)(p - pp), FALSE)) != STATUS_Success) {
298: ReportCompilerMessage(msg);
299 return FALSE;
544 if ((msg = ProcessKeyLine(fk, p, IsUnicode)) != STATUS_Success) {
545: ReportCompilerMessage(msg);
546 return FALSE;
559 delete[] buf;
560: ReportCompilerMessage(msg);
561 return FALSE;
565 delete[] buf;
566: ReportCompilerMessage(msg);
567 return FALSE;
600 delete[] buf;
601: ReportCompilerMessage(msg);
602 return FALSE;
606 delete[] buf;
607: ReportCompilerMessage(msg);
608 return FALSE;
744 if ((msg = ExpandCapsRulesForGroup(fk, gp)) != STATUS_Success) {
745: ReportCompilerMessage(msg);
746 return FALSE;
802 delete[] temp;
803: ReportCompilerMessage(msg);
804 return FALSE;
951 if ((msg = ImportBitmapFile(fk, sp->dpString, &fk->dwBitmapSize, &fk->lpBitmap)) != STATUS_Success) {
952: ReportCompilerMessage(msg);
953 return FALSE;
991 if ((msg = ProcessEthnologueStore(sp->dpString)) != STATUS_Success) {
992: ReportCompilerMessage(msg);
993 return FALSE; // I2646
998 if ((msg = ProcessHotKey(sp->dpString, &fk->dwHotKey)) != STATUS_Success) {
999: ReportCompilerMessage(msg);
1000 return FALSE;
1295 if ((msg = VerifyCasedKeys(sp)) != STATUS_Success) {
1296: ReportCompilerMessage(msg);
1297 return FALSE;
developer\src\kmcmplib\src\CompilerInterfaces.cpp:
98 if(msg != STATUS_Success) {
99: ReportCompilerMessage(msg);
100 return FALSE;
```
193 places where functions are returning status or error codes:
```
193 results - 2 files
developer\src\kmcmplib\src\CasedKeys.cpp:
26 // mnemonic layouts in 14.0
27: return KmnCompilerMessages::ERROR_CasedKeysNotSupportedWithMnemonicLayout;
28 }
39 if (!kmcmp::MapUSCharToVK(*p, &key, &shift)) {
40: return KmnCompilerMessages::ERROR_CasedKeysMustContainOnlyVirtualKeys;
41 }
42 if (shift & K_SHIFTFLAG) {
43: return KmnCompilerMessages::ERROR_CasedKeysMustNotIncludeShiftStates;
44 }
47 if (*(p + 1) != CODE_EXTENDED) {
48: return KmnCompilerMessages::ERROR_CasedKeysMustContainOnlyVirtualKeys;
49 }
52 if (shift != ISVIRTUALKEY) {
53: return KmnCompilerMessages::ERROR_CasedKeysMustNotIncludeShiftStates;
54 }
68
69: return STATUS_Success;
70 }
78 // mnemonic layouts in 14.0
79: return STATUS_Success;
80 }
85 // process the key
86: return STATUS_Success;
87 }
98 }
99: return STATUS_Success;
100 }
108 if (!kmcmp::MapUSCharToVK(kpp->Key, &key, &shift)) {
109: return STATUS_Success;
110 }
114 // Don't attempt expansion if either Caps Lock flag is specified in the key rule
115: return STATUS_Success;
116 }
127 // This key is not modified by Caps Lock
128: return STATUS_Success;
129 }
133 if(!resizeKeyArray(gp)) {
134: return KmnCompilerMessages::FATAL_CannotAllocateMemory;
135 }
151
152: return STATUS_Success;
153 }
developer\src\kmcmplib\src\Compiler.cpp:
341 case CODE_INDEX:
342: return KmnCompilerMessages::ERROR_ContextAndIndexInvalidInMatchNomatch;
343 }
346 }
347: return STATUS_Success;
348 }
913 if(!resizeStoreArray(fk)) {
914: return KmnCompilerMessages::FATAL_CannotAllocateMemory;
915 }
930
931: return STATUS_Success;
932 }
1437 // no key in the rule, so offset is past end of context
1438: return KmnCompilerMessages::ERROR_IndexDoesNotPointToAny;
1439 if (i < contextOffset) // I4914
1440 // offset is beyond the key
1441: return KmnCompilerMessages::ERROR_IndexDoesNotPointToAny;
1442 q = key;
1446 if (*q != UC_SENTINEL || *(q + 1) != CODE_ANY)
1447: return KmnCompilerMessages::ERROR_IndexDoesNotPointToAny;
1448
1461 if (contextOffset > xstrlen(context))
1462: return KmnCompilerMessages::ERROR_ContextExHasInvalidOffset;
1463
1469 if(!VerifyKeyboardVersion(fk, VERSION_140)) {
1470: return KmnCompilerMessages::ERROR_140FeatureOnlyContextAndNotAnyWeb;
1471 }
1476 }
1477: return STATUS_Success;
1478 }
1529 }
1530: return STATUS_Success;
1531 }
1545 }
1546: return STATUS_Success;
1547 }
1554 if (u16len(pklOut) > GLOBAL_BUFSIZE - 3) {
1555: return KmnCompilerMessages::FATAL_CannotAllocateMemory;
1556 }
1560 }
1561: return STATUS_Success;
1562 }
1571 if (*p != UC_SENTINEL) {
1572: return KmnCompilerMessages::ERROR_OutputInReadonlyGroup;
1573 }
1584 if (!targetGroup->fReadOnly) {
1585: return KmnCompilerMessages::ERROR_CannotUseReadWriteGroupFromReadonlyGroup;
1586 }
1603 }
1604: return KmnCompilerMessages::ERROR_OutputInReadonlyGroup;
1605 default:
1608 // given CODE_CONTEXT does what we need anyway
1609: return KmnCompilerMessages::ERROR_StatementNotPermittedInReadonlyGroup;
1610 }
1611 }
1612: return STATUS_Success;
1613 }
1624 if (!pklIn || !pklKey || !pklOut)
1625: return KmnCompilerMessages::FATAL_CannotAllocateMemory; // forget about the little leak if pklKey or pklOut fail...
1626
1651
1652: if (pklKey[0] == 0) return KmnCompilerMessages::ERROR_ZeroLengthString;
1653
1655 // #11643: non-BMP characters do not makes sense for key codes
1656: return KmnCompilerMessages::ERROR_NonBMPCharactersNotSupportedInKeySection;
1657 }
1663 if ((msg = GetXString(fk, str, u">", pklIn, GLOBAL_BUFSIZE - 1, (int)(str - pp), &p, TRUE, IsUnicode)) != STATUS_Success) return msg;
1664: if (pklIn[0] == 0) return KmnCompilerMessages::ERROR_ZeroLengthString;
1665 }
1669
1670: if (pklOut[0] == 0) return KmnCompilerMessages::ERROR_ZeroLengthString;
1671
1701 if(!resizeKeyArray(gp)) {
1702: return KmnCompilerMessages::FATAL_CannotAllocateMemory;
1703 }
1723 kp->ShiftFlags = 0;
1724: return STATUS_Success;
1725 }
1728
1729: if (*pklKey == 0) return KmnCompilerMessages::ERROR_ZeroLengthString;
1730
1744 default:
1745: return KmnCompilerMessages::ERROR_InvalidCodeInKeyPartOfRule;
1746 }
1752
1753: return STATUS_Success;
1754 }
1787
1788: return STATUS_Success;
1789 }
1816 if (!resizeKeyArray(gp, nchrs)) {
1817: return KmnCompilerMessages::FATAL_CannotAllocateMemory;
1818 }
1839 default:
1840: return KmnCompilerMessages::ERROR_CodeInvalidInKeyStore;
1841 }
1843 // #11643: non-BMP characters do not makes sense for key codes
1844: return KmnCompilerMessages::ERROR_NonBMPCharactersNotSupportedInKeySection;
1845 } else {
1856
1857: return STATUS_Success;
1858 }
2048 // to crash if we reach this
2049: return KmnCompilerMessages::FATAL_BufferOverflow;
2050 }
2098 // TODO: report an error about the missing token details --> "token: %c",(int)*p);
2099: return KmnCompilerMessages::ERROR_InvalidToken;
2100 case 0:
2105 q = GetDelimitedString(&p, u"()", GDS_CUTLEAD | GDS_CUTFOLL);
2106: if (!q || !*q) return KmnCompilerMessages::ERROR_InvalidDeadkey;
2107
2109 tstr[mx++] = CODE_DEADKEY;
2110: if (!StrValidChrs(q, DeadKeyChars)) return KmnCompilerMessages::ERROR_InvalidDeadkey;
2111 tstr[mx++] = GetDeadKey(fk, q); //atoiW(q); 7-5-01: named deadkeys
2116 n = xatoi(&p);
2117: if (*p != '\0' && !iswspace(*p)) return KmnCompilerMessages::ERROR_InvalidValue;
2118 if ((err = kmcmp::UTF32ToUTF16(n, &n1, &n2)) != STATUS_Success) return err;
2126 q = (PKMX_WCHAR) u16chr(p + 1, '\"');
2127: if (!q) return KmnCompilerMessages::ERROR_UnterminatedString;
2128: if ((int)(q - p) - 1 + mx > max) return KmnCompilerMessages::ERROR_ExtendedStringTooLong;
2129: if (sFlag) return KmnCompilerMessages::ERROR_StringInVirtualKeySection;
2130 u16ncat(tstr, p + 1, (int)(q - p) - 1); // I3481
2136 q = (PKMX_WCHAR) u16chr(p + 1, '\'');
2137: if (!q) return KmnCompilerMessages::ERROR_UnterminatedString;
2138: if ((int)(q - p) - 1 + mx > max) return KmnCompilerMessages::ERROR_ExtendedStringTooLong;
2139: if (sFlag) return KmnCompilerMessages::ERROR_StringInVirtualKeySection;
2140 u16ncat(tstr, p + 1, (int)(q - p) - 1); // I3481
2145 case 3:
2146: if (u16nicmp(p, u"any", 3) != 0) return KmnCompilerMessages::ERROR_InvalidToken;
2147: if (sFlag) return KmnCompilerMessages::ERROR_AnyInVirtualKeySection;
2148 p += 3;
2149 q = GetDelimitedString(&p, u"()", GDS_CUTLEAD | GDS_CUTFOLL);
2150: if (!q || !*q) return KmnCompilerMessages::ERROR_InvalidAny;
2151
2155 }
2156: if (i == fk->cxStoreArray) return KmnCompilerMessages::ERROR_StoreDoesNotExist;
2157
2158: if (!*fk->dpStoreArray[i].dpString) return KmnCompilerMessages::ERROR_ZeroLengthString;
2159 kmcmp::CheckStoreUsage(fk, i, TRUE, FALSE, FALSE);
2168 {
2169: if (sFlag) return KmnCompilerMessages::ERROR_BeepInVirtualKeySection;
2170 p += 4;
2177 if(!VerifyKeyboardVersion(fk, VERSION_90)) {
2178: return KmnCompilerMessages::ERROR_90FeatureOnly_IfSystemStores;
2179 }
2180: if (sFlag) return KmnCompilerMessages::ERROR_InvalidInVirtualKeySection;
2181 p += 10;
2182 q = GetDelimitedString(&p, u"()", GDS_CUTLEAD | GDS_CUTFOLL);
2183: if (!q || !*q) return KmnCompilerMessages::ERROR_InvalidToken;
2184 err = process_baselayout(fk, q, tstr, &mx);
2187 else
2188: return KmnCompilerMessages::ERROR_InvalidToken;
2189
2194 if(!VerifyKeyboardVersion(fk, VERSION_80)) {
2195: return KmnCompilerMessages::ERROR_80FeatureOnly;
2196 }
2197: if (sFlag) return KmnCompilerMessages::ERROR_InvalidInVirtualKeySection;
2198 p += 2;
2199 q = GetDelimitedString(&p, u"()", GDS_CUTLEAD | GDS_CUTFOLL);
2200: if (!q || !*q) return KmnCompilerMessages::ERROR_InvalidIf;
2201
2206 {
2207: if (u16nicmp(p, u"index", 5) != 0) return KmnCompilerMessages::ERROR_InvalidToken;
2208: if (sFlag) return KmnCompilerMessages::ERROR_IndexInVirtualKeySection;
2209 p += 5;
2211
2212: if (!q || !*q) return KmnCompilerMessages::ERROR_InvalidIndex;
2213
2218 r = u16tok(q, p_sep_com, &context); // I3481
2219: if (!r) return KmnCompilerMessages::ERROR_InvalidIndex;
2220
2224 }
2225: if (i == fk->cxStoreArray) return KmnCompilerMessages::ERROR_StoreDoesNotExist;
2226
2229 r = u16tok(NULL, p_sep_com, &context); // I3481
2230: if (!r || !*r || !isIntegerWstring(r) || atoiW(r) < 1) return KmnCompilerMessages::ERROR_InvalidIndex;
2231 }
2240 case 6:
2241: if (u16nicmp(p, u"outs", 4) != 0) return KmnCompilerMessages::ERROR_InvalidToken;
2242: if (sFlag) return KmnCompilerMessages::ERROR_OutsInVirtualKeySection;
2243 p += 4;
2244 q = GetDelimitedString(&p, u"()", GDS_CUTLEAD | GDS_CUTFOLL);
2245: if (!q || !*q) return KmnCompilerMessages::ERROR_InvalidOuts;
2246
2250 }
2251: if (i == fk->cxStoreArray) return KmnCompilerMessages::ERROR_StoreDoesNotExist;
2252
2258 if (mx >= max - 1) {
2259: return KmnCompilerMessages::ERROR_OutsTooLong;
2260 }
2267 {
2268: if (sFlag) return KmnCompilerMessages::ERROR_ContextInVirtualKeySection;
2269 p += 7;
2274 if(!VerifyKeyboardVersion(fk, VERSION_60)) {
2275: return KmnCompilerMessages::ERROR_60FeatureOnly_Contextn;
2276 }
2278 n1b = atoiW(q);
2279: if (n1b < 1 || n1b >= 0xF000) return KmnCompilerMessages::ERROR_InvalidToken;
2280 tstr[mx++] = UC_SENTINEL;
2301 if(!VerifyKeyboardVersion(fk, VERSION_501)) {
2302: return KmnCompilerMessages::ERROR_501FeatureOnly_Call;
2303 }
2304: if (sFlag) return KmnCompilerMessages::ERROR_CallInVirtualKeySection;
2305 p += 4;
2306 q = GetDelimitedString(&p, u"()", GDS_CUTLEAD | GDS_CUTFOLL);
2307: if (!q || !*q) return KmnCompilerMessages::ERROR_InvalidCall;
2308
2313
2314: if (!kmcmp::IsValidCallStore(&fk->dpStoreArray[i])) return KmnCompilerMessages::ERROR_InvalidCall;
2315 kmcmp::CheckStoreUsage(fk, i, FALSE, FALSE, TRUE);
2316
2317: if (i == fk->cxStoreArray) return KmnCompilerMessages::ERROR_StoreDoesNotExist;
2318 tstr[mx++] = UC_SENTINEL;
2325 else
2326: return KmnCompilerMessages::ERROR_InvalidToken;
2327 continue;
2331 if(!VerifyKeyboardVersion(fk, VERSION_70)) {
2332: return KmnCompilerMessages::ERROR_70FeatureOnly;
2333 }
2334: if (sFlag) return KmnCompilerMessages::ERROR_AnyInVirtualKeySection;
2335 p += 6;
2336 q = GetDelimitedString(&p, u"()", GDS_CUTLEAD | GDS_CUTFOLL);
2337: if (!q || !*q) return KmnCompilerMessages::ERROR_InvalidAny;
2338
2342 }
2343: if (i == fk->cxStoreArray) return KmnCompilerMessages::ERROR_StoreDoesNotExist;
2344 kmcmp::CheckStoreUsage(fk, i, TRUE, FALSE, FALSE);
2350 }
2351: if (u16nicmp(p, u"nul", 3) != 0) return KmnCompilerMessages::ERROR_InvalidToken;
2352
2363 n = xatoi(&p);
2364: if (*p != '\0' && !iswspace(*p)) return KmnCompilerMessages::ERROR_InvalidValue;
2365 if ((err = kmcmp::UTF32ToUTF16(n, &n1, &n2)) != STATUS_Success) return err;
2373 }
2374: return KmnCompilerMessages::ERROR_InvalidToken;
2375 }
2378 q = GetDelimitedString(&p, u"()", GDS_CUTLEAD | GDS_CUTFOLL);
2379: if (!q || !*q) return KmnCompilerMessages::ERROR_InvalidUse;
2380 tstr[mx++] = UC_SENTINEL;
2382 tstr[mx] = GetGroupNum(fk, q);
2383: if (tstr[mx] == 0) return KmnCompilerMessages::ERROR_GroupDoesNotExist;
2384 tstr[++mx] = 0;
2389 if(!VerifyKeyboardVersion(fk, VERSION_80)) {
2390: return KmnCompilerMessages::ERROR_80FeatureOnly;
2391 }
2392: if (sFlag) return KmnCompilerMessages::ERROR_InvalidInVirtualKeySection;
2393 p += 5;
2394 q = GetDelimitedString(&p, u"()", GDS_CUTLEAD | GDS_CUTFOLL);
2395: if (!q || !*q) return KmnCompilerMessages::ERROR_InvalidReset;
2396
2401 {
2402: if (u16nicmp(p, u"return", 6) != 0) return KmnCompilerMessages::ERROR_InvalidToken;
2403
2481 if(!VerifyKeyboardVersion(fk, VERSION_100)) {
2482: return STATUS_Success;
2483 }
2496 {
2497: return KmnCompilerMessages::ERROR_InvalidToken; // I3137 - key portion of VK is missing e.g. "[CTRL ALT]", this generates invalid kmx file that can crash Keyman or compiler later on // I3511
2498 }
2504 if(!VerifyKeyboardVersion(fk, VERSION_60)) {
2505: return KmnCompilerMessages::ERROR_60FeatureOnly_VirtualCharKey;
2506 }
2510 KMX_WCHAR chQuote = *q;
2511: q++; if (*q == chQuote || *q == '\n' || *q == 0) return KmnCompilerMessages::ERROR_InvalidToken;
2512 tstr[mx - 1] |= VIRTUALCHARKEY;
2513 tstr[mx++] = *q;
2514: q++; if (*q != chQuote) return KmnCompilerMessages::ERROR_InvalidToken;
2515 q++;
2516 while (iswspace(*q)) q++;
2517: if (*q != ']') return KmnCompilerMessages::ERROR_InvalidToken;
2518 break; /* out of while loop */
2522
2523: if (*q == 0) return KmnCompilerMessages::ERROR_InvalidToken;
2524
2526
2527: if (j >= SZMAX_VKDICTIONARYNAME) return KmnCompilerMessages::ERROR_InvalidToken;
2528
2545 if(!VerifyKeyboardVersion(fk, VERSION_90)) {
2546: return KmnCompilerMessages::ERROR_InvalidToken;
2547 }
2550 if (i == 0)
2551: return KmnCompilerMessages::ERROR_InvalidToken;
2552 }
2576 if(!VerifyKeyboardVersion(fk, VERSION_80)) {
2577: return KmnCompilerMessages::ERROR_80FeatureOnly;
2578 }
2580 q = GetDelimitedString(&p, u"()", GDS_CUTLEAD | GDS_CUTFOLL);
2581: if (!q || !*q) return KmnCompilerMessages::ERROR_InvalidSet;
2582
2588 if(!VerifyKeyboardVersion(fk, VERSION_80)) {
2589: return KmnCompilerMessages::ERROR_80FeatureOnly;
2590 }
2592 q = GetDelimitedString(&p, u"()", GDS_CUTLEAD | GDS_CUTFOLL);
2593: if (!q || !*q) return KmnCompilerMessages::ERROR_InvalidSave;
2594
2599 {
2600: if (u16nicmp(p, u"switch", 6) != 0) return KmnCompilerMessages::ERROR_InvalidToken;
2601 p += 6;
2602 q = GetDelimitedString(&p, u"()", GDS_CUTLEAD | GDS_CUTFOLL);
2603: if (!q || !*q) return KmnCompilerMessages::ERROR_InvalidSwitch;
2604 tstr[mx++] = UC_SENTINEL;
2618 else
2619: return KmnCompilerMessages::ERROR_InvalidToken;
2620 continue;
2622 if(!VerifyKeyboardVersion(fk, VERSION_60)) {
2623: return KmnCompilerMessages::ERROR_60FeatureOnly_NamedCodes;
2624 }
2629 *q = c;
2630: if (n == 0) return KmnCompilerMessages::ERROR_InvalidNamedCode;
2631 if (i < 0xFFFFFFFFL) kmcmp::CheckStoreUsage(fk, i, TRUE, FALSE, FALSE); // I2993
2642 case 17:
2643: if (u16nicmp(p, u"platform", 8) != 0) return KmnCompilerMessages::ERROR_InvalidToken; // I3430
2644 if(!VerifyKeyboardVersion(fk, VERSION_90)) {
2645: return KmnCompilerMessages::ERROR_90FeatureOnly_IfSystemStores;
2646 }
2647: if (sFlag) return KmnCompilerMessages::ERROR_InvalidInVirtualKeySection;
2648 p += 8;
2649 q = GetDelimitedString(&p, u"()", GDS_CUTLEAD | GDS_CUTFOLL);
2650: if (!q || !*q) return KmnCompilerMessages::ERROR_InvalidToken;
2651 err = process_platform(fk, q, tstr, &mx);
2654 case 18: // I3437
2655: if (u16nicmp(p, u"layer", 5) != 0) return KmnCompilerMessages::ERROR_InvalidToken;
2656 if(!VerifyKeyboardVersion(fk, VERSION_90)) {
2657: return KmnCompilerMessages::ERROR_90FeatureOnly_SetSystemStores;
2658 }
2659: if (sFlag) return KmnCompilerMessages::ERROR_InvalidInVirtualKeySection;
2660 p += 5;
2661 q = GetDelimitedString(&p, u"()", GDS_CUTLEAD | GDS_CUTFOLL);
2662: if (!q || !*q) return KmnCompilerMessages::ERROR_InvalidToken;
2663 err = process_set_synonym(TSS_LAYER, fk, q, tstr, &mx);
2666 case 19: // #2241
2667: if (*(p + 1) != '.') return KmnCompilerMessages::ERROR_InvalidToken;
2668: if (sFlag) return KmnCompilerMessages::ERROR_InvalidInVirtualKeySection;
2669 p += 2;
2673 default:
2674: return KmnCompilerMessages::ERROR_InvalidToken;
2675 }
2681 ErrChr = 0;
2682: return STATUS_Success;
2683 }
2691 ErrChr = 0;
2692: return STATUS_Success;
2693 }
2694
2695: return KmnCompilerMessages::ERROR_NoTokensFound;
2696 }
2730 // TODO: redundant error
2731: return KmnCompilerMessages::ERROR_InvalidIf;
2732 }
2742
2743: return STATUS_Success;
2744 }
2760
2761: if (*s != '=') return KmnCompilerMessages::ERROR_InvalidIf;
2762 s++;
2769 if(!VerifyKeyboardVersion( fk, VERSION_90)) {
2770: return KmnCompilerMessages::ERROR_90FeatureOnly_IfSystemStores;
2771 }
2775 }
2776: if (!StoreTokens[i]) return KmnCompilerMessages::ERROR_IfSystemStore_NotFound;
2777 code = CODE_IFSYSTEMSTORE;
2786 }
2787: if (i == fk->cxStoreArray) return KmnCompilerMessages::ERROR_StoreDoesNotExist;
2788 kmcmp::CheckStoreUsage(fk, i, FALSE, TRUE, FALSE);
2805 // TODO: redundant error
2806: return KmnCompilerMessages::ERROR_InvalidIf;
2807 }
2817
2818: return STATUS_Success;
2819 }
2828 }
2829: if (i == fk->cxStoreArray) return KmnCompilerMessages::ERROR_StoreDoesNotExist;
2830 kmcmp::CheckStoreUsage(fk, i, FALSE, TRUE, FALSE);
2836
2837: return STATUS_Success;
2838 }
2846 if (*mx == 0) {
2847: return KmnCompilerMessages::ERROR_ExpansionMustFollowCharacterOrVKey;
2848 }
2852 if (*(p + 1) != CODE_EXTENDED) {
2853: return KmnCompilerMessages::ERROR_ExpansionMustFollowCharacterOrVKey;
2854 }
2882 if(!isVKey) {
2883: return KmnCompilerMessages::ERROR_CharacterExpansionMustBeFollowedByCharacter;
2884 }
2885 if (temp[1] != CODE_EXTENDED) {
2886: return KmnCompilerMessages::ERROR_VKeyExpansionMustBeFollowedByVKey;
2887 }
2889 if (HighShiftFlags != BaseShiftFlags) {
2890: return KmnCompilerMessages::ERROR_VKeyExpansionMustUseConsistentShift;
2891 }
2892 if (HighKey <= BaseKey) {
2893: return KmnCompilerMessages::ERROR_ExpansionMustBePositive;
2894 }
2896 if (*mx + (HighKey - BaseKey) * 5 + 1 >= max) {
2897: return KmnCompilerMessages::ERROR_VirtualKeyExpansionTooLong;
2898 }
2912 if (isVKey) {
2913: return KmnCompilerMessages::ERROR_VKeyExpansionMustBeFollowedByVKey;
2914 }
2917 if (HighChar <= BaseChar) {
2918: return KmnCompilerMessages::ERROR_ExpansionMustBePositive;
2919 }
2925 if (*mx + 3 >= max) {
2926: return KmnCompilerMessages::ERROR_CharacterRangeTooLong;
2927 }
2932 if (*mx + 2 >= max) {
2933: return KmnCompilerMessages::ERROR_CharacterRangeTooLong;
2934 }
2940
2941: return STATUS_Success;
2942 }
2960 // TODO: redundant error
2961: return KmnCompilerMessages::ERROR_InvalidSet;
2962 }
2970 tstr[(*mx)] = 0;
2971: return STATUS_Success;
2972 }
2980 while (*s == u' ') s++;
2981: if (*s != '=') return KmnCompilerMessages::ERROR_InvalidSet;
2982 s++;
2991 if(!VerifyKeyboardVersion(fk, VERSION_90)) {
2992: return KmnCompilerMessages::ERROR_90FeatureOnly_SetSystemStores; // I3437
2993 }
2997 }
2998: if (!StoreTokens[i]) return KmnCompilerMessages::ERROR_SetSystemStore_NotFound;
2999 code = CODE_SETSYSTEMSTORE;
3010 }
3011: if (i == fk->cxStoreArray) return KmnCompilerMessages::ERROR_StoreDoesNotExist;
3012 kmcmp::CheckStoreUsage(fk, i, FALSE, TRUE, FALSE);
3032 // TODO: redundant error
3033: return KmnCompilerMessages::ERROR_InvalidSet;
3034 }
3042 tstr[(*mx)] = 0;
3043: return STATUS_Success;
3044 }
3053 }
3054: if (i == fk->cxStoreArray) return KmnCompilerMessages::ERROR_StoreDoesNotExist;
3055 kmcmp::CheckStoreUsage(fk, i, FALSE, TRUE, FALSE);
3060 tstr[(*mx)] = 0;
3061: return STATUS_Success;
3062 }
3119 }
3120: if (q == p) return KmnCompilerMessages::ERROR_InvalidEthnologueCode;
3121 if (*p)
3124 {
3125: if (!iswalpha(*p)) return KmnCompilerMessages::ERROR_InvalidEthnologueCode;
3126 p++;
3159
3160: return STATUS_Success;
3161 }
3175 else if (u16nicmp(q, u"SHIFT", 5) == 0) sFlag |= HK_SHIFT, q += 5;
3176: else if (towupper(*q) != 'K') return KmnCompilerMessages::ERROR_InvalidToken;
3177 } while (towupper(*q) != 'K');
3185 }
3186: else return KmnCompilerMessages::ERROR_NoTokensFound;
3187
3192
3193: if (i == VK__MAX + 1) return KmnCompilerMessages::ERROR_InvalidToken; // I3438
3194
3196
3197: return STATUS_Success;
3198 }
3207 *hk |= *q;
3208: return STATUS_Success;
3209 }
3210
3211: return KmnCompilerMessages::ERROR_CodeInvalidInThisSection;
3212 }
3291 buf = new KMX_BYTE[size];
3292: if (!buf) return KmnCompilerMessages::FATAL_CannotAllocateMemory;
3293 memset(buf, 0, size);
3407 delete[] buf;
3408: return KmnCompilerMessages::FATAL_SomewhereIGotItWrong;
3409 }
3415
3416: return STATUS_Success;
3417 }
3428 if(offset >= sz) {
3429: return STATUS_EndOfFile;
3430 }
3444 if (len == 0) {
3445: return STATUS_EndOfFile;
3446 }
3536
3537: return STATUS_Success;
3538 }
3544
3545: if (!p) return KmnCompilerMessages::ERROR_NoTokensFound;
3546
3585 if(endsWith(szNameUtf8, ".bmp")) {
3586: return KmnCompilerMessages::ERROR_CannotReadBitmapFile;
3587 }
3594 // about the prolog at this point so we don't overrun our buffer
3595: return KmnCompilerMessages::ERROR_CannotReadBitmapFile;
3596 }
3604 if(!VerifyKeyboardVersion(fk, VERSION_70)) {
3605: return KmnCompilerMessages::ERROR_70FeatureOnly;
3606 }
3608
3609: return STATUS_Success;
3610 }
3648
3649: if (n == 0) return KmnCompilerMessages::ERROR_ReservedCharacter;
3650 for (int i = 0; res[i] > 0; i++)
3655 }
3656: return STATUS_Success;
3657 }
3674 if (n < 0 || n > 0x10FFFF) {
3675: return KmnCompilerMessages::ERROR_InvalidCharacter;
3676 }
```
It may be best to break this into chunks of work around a function or family of functions, if possible.
Contributor guide
Assessment
This issue has not been assessed yet.