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

Method verify

projects/JavaScript/proto/fbe.js:3023–3053  ·  view source on GitHub ↗

* Check if the map is valid * @this {!FieldModelMap} * @returns {!boolean} Field model valid state

()

Source from the content-addressed store, hash-verified

3021 * @returns {!boolean} Field model valid state
3022 */
3023 verify () {
3024 if ((this._buffer.offset + this.fbeOffset + this.fbeSize) > this._buffer.size) {
3025 return true
3026 }
3027
3028 let fbeMapOffset = this.readUInt32(this.fbeOffset)
3029 if (fbeMapOffset === 0) {
3030 return true
3031 }
3032
3033 if ((this._buffer.offset + fbeMapOffset + 4) > this._buffer.size) {
3034 return false
3035 }
3036
3037 let fbeMapSize = this.readUInt32(fbeMapOffset)
3038
3039 this._modelKey.fbeOffset = fbeMapOffset + 4
3040 this._modelValue.fbeOffset = fbeMapOffset + 4 + this._modelKey.fbeSize
3041 for (let i = 0; i < fbeMapSize; i++) {
3042 if (!this._modelKey.verify()) {
3043 return false
3044 }
3045 this._modelKey.fbeShift(this._modelKey.fbeSize + this._modelValue.fbeSize)
3046 if (!this._modelValue.verify()) {
3047 return false
3048 }
3049 this._modelValue.fbeShift(this._modelKey.fbeSize + this._modelValue.fbeSize)
3050 }
3051
3052 return true
3053 }
3054
3055 /**
3056 * Get the map

Callers

nothing calls this directly

Calls 3

readUInt32Method · 0.45
verifyMethod · 0.45
fbeShiftMethod · 0.45

Tested by

no test coverage detected