MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / atoilw

Function atoilw

Libraries/unrar/unicode.cpp:555–574  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

553
554
555int64 atoilw(const wchar *s)
556{
557 bool sign=false;
558 if (*s=='-') // We do use signed integers here, for example, in GUI SFX.
559 {
560 s++;
561 sign=true;
562 }
563 // Use unsigned type here, since long string can overflow the variable
564 // and signed integer overflow is undefined behavior in C++.
565 uint64 n=0;
566 while (*s>='0' && *s<='9')
567 {
568 n=n*10+(*s-'0');
569 s++;
570 }
571 // Check int64(n)>=0 to avoid the signed overflow with undefined behavior
572 // when negating 0x8000000000000000.
573 return sign && int64(n)>=0 ? -int64(n) : int64(n);
574}
575
576
577#ifdef DBCS_SUPPORTED

Callers 2

ProcessSwitchMethod · 0.85
atoiwFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected