Closed GoogleCodeExporter closed 9 years ago
[deleted comment]
Could you post your .proto and .as codes? I don't understand about your problem.
Original comment by pop.atry@gmail.com
on 11 Nov 2011 at 8:17
I sent the float and int32 data from as3 to c in windows operating system
required int32 num =1;
required float flo =2;
It is not working for numbers .It is working well for the string & bool data
types. If I send numbers or float vaules , it is sending some garbage values .
But flex to flex and C to C , it is working perfectly.
Don't know why this is not working from as3 to c .
Can somebody pls help me in this issue.
subhani.gitam@gmail.com
Original comment by subhani....@gmail.com
on 5 Dec 2011 at 10:12
package {
import com.netease.protobuf.*;
import com.netease.protobuf.fieldDescriptors.*;
import flash.utils.Endian;
import flash.utils.IDataInput;
import flash.utils.IDataOutput;
import flash.utils.IExternalizable;
import flash.errors.IOError;
// @@protoc_insertion_point(imports)
// @@protoc_insertion_point(class_metadata)
public dynamic final class Info extends com.netease.protobuf.Message {
public static const COMMAND:FieldDescriptor$TYPE_STRING = new FieldDescriptor$TYPE_STRING("Info.command", "command", (1 << 3) | com.netease.protobuf.WireType.LENGTH_DELIMITED);
public var command:String;
public static const JUNK:FieldDescriptor$TYPE_BOOL = new FieldDescriptor$TYPE_BOOL("Info.JUNK", "jUNK", (2 << 3) | com.netease.protobuf.WireType.VARINT);
public var jUNK:Boolean;
public static const NUM:FieldDescriptor$TYPE_INT32 = new FieldDescriptor$TYPE_INT32("Info.num", "num", (3 << 3) | com.netease.protobuf.WireType.VARINT);
public var num:int;
public static const FLO:FieldDescriptor$TYPE_FLOAT = new FieldDescriptor$TYPE_FLOAT("Info.flo", "flo", (4 << 3) | com.netease.protobuf.WireType.FIXED_32_BIT);
public var flo:Number;
/**
* @private
*/
override public final function writeToBuffer(output:com.netease.protobuf.WritingBuffer):void {
com.netease.protobuf.WriteUtils.writeTag(output, com.netease.protobuf.WireType.LENGTH_DELIMITED, 1);
com.netease.protobuf.WriteUtils.write$TYPE_STRING(output, this.command);
com.netease.protobuf.WriteUtils.writeTag(output, com.netease.protobuf.WireType.VARINT, 2);
com.netease.protobuf.WriteUtils.write$TYPE_BOOL(output, this.jUNK);
com.netease.protobuf.WriteUtils.writeTag(output, com.netease.protobuf.WireType.VARINT, 3);
com.netease.protobuf.WriteUtils.write$TYPE_INT32(output, this.num);
com.netease.protobuf.WriteUtils.writeTag(output, com.netease.protobuf.WireType.FIXED_32_BIT, 4);
com.netease.protobuf.WriteUtils.write$TYPE_FLOAT(output, this.flo);
for (var fieldKey:* in this) {
super.writeUnknown(output, fieldKey);
}
}
/**
* @private
*/
override public final function readFromSlice(input:flash.utils.IDataInput, bytesAfterSlice:uint):void {
var command$count:uint = 0;
var JUNK$count:uint = 0;
var num$count:uint = 0;
var flo$count:uint = 0;
while (input.bytesAvailable > bytesAfterSlice) {
var tag:uint = com.netease.protobuf.ReadUtils.read$TYPE_UINT32(input);
switch (tag >> 3) {
case 1:
if (command$count != 0) {
throw new flash.errors.IOError('Bad data format: Info.command cannot be set twice.');
}
++command$count;
this.command = com.netease.protobuf.ReadUtils.read$TYPE_STRING(input);
break;
case 2:
if (JUNK$count != 0) {
throw new flash.errors.IOError('Bad data format: Info.jUNK cannot be set twice.');
}
++JUNK$count;
this.jUNK = com.netease.protobuf.ReadUtils.read$TYPE_BOOL(input);
break;
case 3:
if (num$count != 0) {
throw new flash.errors.IOError('Bad data format: Info.num cannot be set twice.');
}
++num$count;
this.num = com.netease.protobuf.ReadUtils.read$TYPE_INT32(input);
break;
case 4:
if (flo$count != 0) {
throw new flash.errors.IOError('Bad data format: Info.flo cannot be set twice.');
}
++flo$count;
this.flo = com.netease.protobuf.ReadUtils.read$TYPE_FLOAT(input);
break;
default:
super.readUnknown(input, tag);
break;
}
}
}
}
}
Original comment by subhani....@gmail.com
on 5 Dec 2011 at 10:16
This is the proto file I am using
option java_package="com.netease.protocGenAs3";
message Info {
required string command = 1;
required bool JUNK = 2;
required int32 num= 3;
required float flo = 4;
}
Original comment by subhani....@gmail.com
on 5 Dec 2011 at 10:16
The proto file is OK. That's all I know.
Original comment by pop.atry@gmail.com
on 5 Dec 2011 at 11:02
okay . Just want to know ,will it supports num32 or float from as3 to C ??..
Because we have tried all the possibilities for all kinds of data types.
It supported only string and bool type. Pls letme knw if you knw furthur info
Original comment by subhani....@gmail.com
on 5 Dec 2011 at 11:08
Yes, it does support float in Protocol Buffers's format. But I don't know about
any other protobuf implementation.
Why not just look at
https://code.google.com/apis/protocolbuffers/docs/encoding.html and ensure the
serialized bytes by your brain.
Original comment by pop.atry@gmail.com
on 5 Dec 2011 at 12:28
Original comment by pop.atry@gmail.com
on 22 Dec 2011 at 2:44
Original issue reported on code.google.com by
q2design...@gmail.com
on 11 Nov 2011 at 2:09