qykings / protobuf-actionscript3

Automatically exported from code.google.com/p/protobuf-actionscript3
0 stars 0 forks source link

Unable to encode double or float data types #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create a message containing data type 'double'
2. create an instance of the message, fill the field with floating point data
3. write the message to data output -> error

This is related to a patch made in r12

Error: Tried to write primative field type, but type was not valid
    at
com.google.protobuf::CodedOutputStream/writeField()[lib\com\google\protobuf\Code
dOutputStream.as:248]
    at
com.google.protobuf::Message/writeToCodedStream()[lib\com\google\protobuf\Messag
e.as:80]
    at
com.google.protobuf::Message/writeToDataOutput()[lib\com\google\protobuf\Message
.as:88]

Original issue reported on code.google.com by Matthijs.Mullender on 16 Dec 2009 at 1:49

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I assume that you were writing a "Number" type into the double field, since 
that fits
the trace.

It is true that this should be correctly handled: as3 Number will fit into a
gpb double. However the question remains how to convert Number to a bytearray 
(no
bits operation allowed because of Number limitation)...

Original comment by sorrydevil@gmail.com on 19 Dec 2009 at 10:34

GoogleCodeExporter commented 9 years ago
Hi Matthijs,

I've checked in a tentative fix for this on trunk latest. Do you mind testing 
it?

Original comment by sorrydevil@gmail.com on 20 Dec 2009 at 1:38