diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-01-19 21:54:33 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-01-19 21:54:33 +0000 |
commit | 3f1356f667375268ba34d1217d8eff19379749e5 (patch) | |
tree | 138c858bc820c42b7136ea27d45a969fe972c9b1 /src/base | |
parent | e2de312e82083e1ac62006d3552f05a8ab88253b (diff) | |
download | usdx-3f1356f667375268ba34d1217d8eff19379749e5.tar.gz usdx-3f1356f667375268ba34d1217d8eff19379749e5.tar.xz usdx-3f1356f667375268ba34d1217d8eff19379749e5.zip |
Mic settings saved again (broken in revision 912)
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1572 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/UIni.pas | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/base/UIni.pas b/src/base/UIni.pas index 3a4d6129..7f25a813 100644 --- a/src/base/UIni.pas +++ b/src/base/UIni.pas @@ -283,17 +283,22 @@ function TIni.ExtractKeyIndex(const Key, Prefix, Suffix: string): integer; var Value: string; Start: integer; + PrefixPos, SuffixPos: integer; begin Result := -1; - if Pos(Prefix, Key) > -1 then - begin - Start := Pos(Prefix, Key) + Length(Prefix); + PrefixPos := Pos(Prefix, Key); + if (PrefixPos <= 0) then + Exit; + SuffixPos := Pos(Suffix, Key); + if (SuffixPos <= 0) then + Exit; - // copy all between prefix and suffix - Value := Copy(Key, Start, Pos(Suffix, Key)-1 - Start); - Result := StrToIntDef(Value, -1); - end; + Start := PrefixPos + Length(Prefix); + + // copy all between prefix and suffix + Value := Copy(Key, Start, SuffixPos - Start); + Result := StrToIntDef(Value, -1); end; (** |