Skip to content

WriterPrototype use non-exist zero property #508

@dreamershl

Description

@dreamershl

Is it possible to add the string type support as before? Since javascript doesn't support long natively, my app always use the Long.toString(). When encode the message, the previous version will use the Long to parse the string back to Long. But in the new version, this can't be supported anymore.

  1. longbits.js doesn't export this zero

     var zero = new LongBits(0, 0);
    
  2. writer.js directly use it. when the value isn't valid uint64, the exception will be thrown

    WriterPrototype.uint64 = function write_uint64(value) {
       var bits;
       if (typeof value === 'number')
          bits = value ? LongBits.fromNumber(value) : LongBits.zero;
       else if (value.low || value.high)
          bits = new LongBits(value.low >>> 0, value.high >>> 0);
     else
        bits = LongBits.zero;
     return this.push(writeVarint64, bits.length(), bits);
      };
    

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions