in src/main/cpp/launcher/windows/src/ExtractUtils.c [165:212]
void readNumber(LauncherProperties * props, DWORD * result) {
if(isOK(props)) {
SizedString * numberString = createSizedString();
DWORD i =0;
DWORD number = 0;
readString(props, numberString, 0);
if(!isOK(props)) {
freeSizedString(&numberString);
writeMessageA(props, OUTPUT_LEVEL_DEBUG, 1,
"Error!! Can`t read number string. Most probably integrity error.", 1);
return;
}
if(numberString->bytes==NULL) {
freeSizedString(&numberString);
writeMessageA(props, OUTPUT_LEVEL_DEBUG, 1,
"Error!! Can`t read number string (it can`t be NULL). Most probably integrity error.", 1);
props->status = ERROR_INTEGRITY;
return;
}
for(;i<numberString->length;i++) {
char c = numberString->bytes[i];
if(c>='0' && c<='9') {
number = number * 10 + (c - '0');
} else if(c==0) {
// we have reached the end of number section
writeMessageA(props, OUTPUT_LEVEL_DEBUG, 1,
"Can`t read number from string (it contains zero character):", 1);
writeMessageA(props, OUTPUT_LEVEL_DEBUG, 1, numberString->bytes, 1);
props->status = ERROR_INTEGRITY;
break;
} else {
// unexpected...
writeMessageA(props, OUTPUT_LEVEL_DEBUG, 1,
"Can`t read number from string (unexpected error):", 1);
writeMessageA(props, OUTPUT_LEVEL_DEBUG, 1, numberString->bytes, 1);
props->status = ERROR_INTEGRITY;
break;
}
}
freeSizedString(&numberString);
*result = number;
}
}