only 3 octal chars allowed
| 938 | |
| 939 | // only 3 octal chars allowed |
| 940 | int util_ConvertOctal(const char* psz, int* const pnCharsRead) |
| 941 | { |
| 942 | ASSERT(util_AsciiCharsActLikeTheyShould()); |
| 943 | ASSERT(psz && pnCharsRead); |
| 944 | ASSERT(util_IsOctal(*psz)); // at least one oct char |
| 945 | |
| 946 | int iValue; |
| 947 | for (iValue = 0, *pnCharsRead = 0; *psz && util_IsOctal(*psz) && *pnCharsRead < 3; // limit of 3 octal chars |
| 948 | psz++, (*pnCharsRead)++) |
| 949 | { |
| 950 | iValue *= 010; |
| 951 | iValue += (*psz - '0'); |
| 952 | } |
| 953 | |
| 954 | return (iValue); |
| 955 | } |
| 956 | |
| 957 | bool util_IsOctal(const char ch) |
| 958 | { |
no test coverage detected