New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WriterPrototype use non-exist zero property #508

Closed
dreamershl opened this Issue Dec 1, 2016 · 0 comments

Comments

Projects
None yet
2 participants
@dreamershl

dreamershl commented Dec 1, 2016

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);
      };
    

dreamershl added a commit to dreamershl/protobuf.js that referenced this issue Dec 1, 2016

dreamershl added a commit to dreamershl/protobuf.js that referenced this issue Dec 1, 2016

dreamershl added a commit to dreamershl/protobuf.js that referenced this issue Dec 1, 2016

@dcodeIO dcodeIO closed this in 6e5fdb6 Dec 1, 2016

@dcodeIO dcodeIO added the enhancement label Dec 1, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment