How to use the flatbuffers.flatbuffers.SIZEOF_INT function in flatbuffers

To help you get started, we’ve selected a few flatbuffers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bjornharrtell / flatgeobuf / src / ts / ol.ts View on Github external
flatbuffers.Builder.prototype.finish = function (root_table: any, opt_file_identifier: any, opt_size_prefix: any) {
    var size_prefix = opt_size_prefix ? true : false;
    if (opt_file_identifier) {
        var file_identifier = opt_file_identifier;
        this.prep(this.minalign, flatbuffers.SIZEOF_INT +
            flatbuffers.FILE_IDENTIFIER_LENGTH + (size_prefix ? flatbuffers.SIZE_PREFIX_LENGTH : 0));
        if (file_identifier.length != flatbuffers.FILE_IDENTIFIER_LENGTH) {
            throw new Error('FlatBuffers: file identifier must be length ' +
                flatbuffers.FILE_IDENTIFIER_LENGTH);
        }
        for (var i = flatbuffers.FILE_IDENTIFIER_LENGTH - 1; i >= 0; i--) {
            this.writeInt8(file_identifier.charCodeAt(i));
        }
    }
    this.prep(this.minalign, flatbuffers.SIZEOF_INT + (size_prefix ? flatbuffers.SIZE_PREFIX_LENGTH : 0));
    this.addOffset(root_table);
    if (size_prefix) {
        this.addInt32(this.bb.capacity() - this.space);
    }
    this.bb.setPosition(this.space);
};
github bjornharrtell / flatgeobuf / src / ts / geojson.ts View on Github external
flatbuffers.Builder.prototype.finish = function (root_table: any, opt_file_identifier: any, opt_size_prefix: any) {
    var size_prefix = opt_size_prefix ? true : false;
    if (opt_file_identifier) {
        var file_identifier = opt_file_identifier;
        this.prep(this.minalign, flatbuffers.SIZEOF_INT +
            flatbuffers.FILE_IDENTIFIER_LENGTH + (size_prefix ? flatbuffers.SIZE_PREFIX_LENGTH : 0));
        if (file_identifier.length != flatbuffers.FILE_IDENTIFIER_LENGTH) {
            throw new Error('FlatBuffers: file identifier must be length ' +
                flatbuffers.FILE_IDENTIFIER_LENGTH);
        }
        for (var i = flatbuffers.FILE_IDENTIFIER_LENGTH - 1; i >= 0; i--) {
            this.writeInt8(file_identifier.charCodeAt(i));
        }
    }
    this.prep(this.minalign, flatbuffers.SIZEOF_INT + (size_prefix ? flatbuffers.SIZE_PREFIX_LENGTH : 0));
    this.addOffset(root_table);
    if (size_prefix) {
        this.addInt32(this.bb.capacity() - this.space);
    }
    this.bb.setPosition(this.space);
};