Skip to content

Commit cbb85fb

Browse files
authored
Merge pull request #127 from icon-bobk/fix-method-parsing
Fix method parsing inconsistency
2 parents ea47769 + 10ea3fe commit cbb85fb

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/ads-client.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4819,6 +4819,7 @@ async function _parseDataType(data) {
48194819

48204820
//Get method length
48214821
let len = data.readUInt32LE(pos)
4822+
const methodFinalPos = pos + len;
48224823
pos += 4
48234824

48244825
//4..7 Version
@@ -4841,33 +4842,33 @@ async function _parseDataType(data) {
48414842
method.reserved = data.readUInt32LE(pos)
48424843
pos += 4
48434844

4844-
//24..27 Return type GUID
4845+
//24..39 Return type GUID
48454846
method.returnTypeGuid = data.slice(pos, pos + 16).toString('hex')
48464847
pos += 16
48474848

4848-
//28..31 Return data type
4849+
//40..43 Return data type
48494850
method.retunAdsDataType = data.readUInt32LE(pos)
48504851
method.retunAdsDataTypeStr = ADS.ADS_DATA_TYPES.toString(method.retunAdsDataType)
48514852
pos += 4
48524853

4853-
//27..30 Flags (AdsDataTypeFlags)
4854-
method.flags = data.readUInt16LE(pos)
4854+
//44..47 Flags
4855+
method.flags = data.readUInt32LE(pos)
48554856
method.flagsStr = ADS.ADS_DATA_TYPE_FLAGS.toStringArray(method.flags)
48564857
pos += 4
48574858

4858-
//31..32 Name length
4859+
//48..49 Name length
48594860
method.nameLength = data.readUInt16LE(pos)
48604861
pos += 2
48614862

4862-
//33..34 Return type length
4863+
//50..51 Return type length
48634864
method.returnTypeLength = data.readUInt16LE(pos)
48644865
pos += 2
48654866

4866-
//35..36 Comment length
4867+
//52..53 Comment length
48674868
method.commentLength = data.readUInt16LE(pos)
48684869
pos += 2
48694870

4870-
//37..38 Parameter count
4871+
//54..55 Parameter count
48714872
method.parameterCount = data.readUInt16LE(pos)
48724873
pos += 2
48734874

@@ -4955,6 +4956,7 @@ async function _parseDataType(data) {
49554956
method.parameters.push(param)
49564957
}
49574958

4959+
pos = methodFinalPos;
49584960
dataType.rpcMethods.push(method)
49594961
}
49604962
}

0 commit comments

Comments
 (0)