MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / verify

Method verify

projects/JavaScript/proto/enums.js:3975–3999  ·  view source on GitHub ↗

* Check if the struct value is valid * @this {!FieldModelEnums} * @param {!boolean} fbeVerifyType Verify model type flag, defaults is true * @returns {!boolean} Field model valid state

(fbeVerifyType = true)

Source from the content-addressed store, hash-verified

3973 * @returns {!boolean} Field model valid state
3974 */
3975 verify (fbeVerifyType = true) {
3976 if ((this._buffer.offset + this.fbeOffset + this.fbeSize) > this._buffer.size) {
3977 return true
3978 }
3979
3980 let fbeStructOffset = this.readUInt32(this.fbeOffset)
3981 if ((fbeStructOffset === 0) || ((this._buffer.offset + fbeStructOffset + 4 + 4) > this._buffer.size)) {
3982 return false
3983 }
3984
3985 let fbeStructSize = this.readUInt32(fbeStructOffset)
3986 if (fbeStructSize < (4 + 4)) {
3987 return false
3988 }
3989
3990 let fbeStructType = this.readUInt32(fbeStructOffset + 4)
3991 if (fbeVerifyType && (fbeStructType !== this.fbeType)) {
3992 return false
3993 }
3994
3995 this._buffer.shift(fbeStructOffset)
3996 let fbeResult = this.verifyFields(fbeStructSize)
3997 this._buffer.unshift(fbeStructOffset)
3998 return fbeResult
3999 }
4000
4001 /**
4002 * Check if the struct fields are valid

Callers

nothing calls this directly

Calls 4

verifyFieldsMethod · 0.95
readUInt32Method · 0.45
shiftMethod · 0.45
unshiftMethod · 0.45

Tested by

no test coverage detected