MCPcopy Create free account
hub / github.com/cxasm/notepad-- / readBase

Function readBase

src/findwin.cpp:779–809  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

777//const QChar *constData() const
778
779bool readBase(const QChar * str, int * value, int base, int size)
780{
781 int i = 0, temp = 0;
782 *value = 0;
783 QChar max = QChar(QChar('0').digitValue() + base - 1);
784 QChar current;
785 while (i < size)
786 {
787 current = str[i];
788 if (current >= 'A')
789 {
790 current = current.digitValue() & 0xdf;
791 current = current.digitValue() - ('A' - '0' - 10);
792 }
793 else if (current > '9')
794 return false;
795
796 if (current >= '0' && current <= max)
797 {
798 temp *= base;
799 temp += (current.digitValue() - '0');
800 }
801 else
802 {
803 return false;
804 }
805 ++i;
806 }
807 *value = temp;
808 return true;
809}
810
811
812int convertExtendedToString(QString& query, QString &result)

Callers 1

convertExtendedToStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected