MCPcopy Create free account
hub / github.com/changeofpace/VivienneVMM / ParseScaleFactorToken

Function ParseScaleFactorToken

VivienneCL/token_parser.cpp:529–571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

527
528
529_Use_decl_annotations_
530BOOL
531ParseScaleFactorToken(
532 const std::string& Token,
533 PSCALE_FACTOR pScaleFactor
534)
535{
536 ULONG Value = 0;
537 SCALE_FACTOR ScaleFactor = {};
538 BOOL status = TRUE;
539
540 //
541 // Zero out parameters.
542 //
543 *pScaleFactor = {};
544
545 status = StrUnsignedLongFromString(Token, FALSE, &Value);
546 if (!status)
547 {
548 ERR_PRINT("Invalid scale factor: %s", Token.c_str());
549 goto exit;
550 }
551
552 switch (Value)
553 {
554 case SCALE_BYTE: ScaleFactor = SCALE_BYTE; break;
555 case SCALE_WORD: ScaleFactor = SCALE_WORD; break;
556 case SCALE_DWORD: ScaleFactor = SCALE_DWORD; break;
557 case SCALE_QWORD: ScaleFactor = SCALE_QWORD; break;
558 default:
559 ERR_PRINT("Invalid scale factor value: %u", Value);
560 status = FALSE;
561 goto exit;
562 }
563
564 //
565 // Set out parameters.
566 //
567 *pScaleFactor = ScaleFactor;
568
569exit:
570 return status;
571}
572
573
574//

Callers 1

Calls 1

Tested by

no test coverage detected