nitrobin / protohx Goto Github PK
View Code? Open in Web Editor NEWProtohx is crossplatform implementation of "Google's Protocol Buffers" for haxe 3.
License: BSD 2-Clause "Simplified" License
Protohx is crossplatform implementation of "Google's Protocol Buffers" for haxe 3.
License: BSD 2-Clause "Simplified" License
When i received a message from java server(long type).I found that the Int64 field is a negative number,like -948372833,the correct value should be 30 Billion or larger.
is that a bug?
0.4.3 isn't compling with haxe 3.1.3 because of lack of Int64.is
which is used in MessageUtils.hx
. Here is conditional compilation workaround:
diff --git a/protohx/MessageUtils.hx b/protohx/MessageUtils.hx
index dcec9eb..68c6a56 100644
--- a/protohx/MessageUtils.hx
+++ b/protohx/MessageUtils.hx
@@ -18,7 +18,7 @@ class MessageUtils {
return value;
} else if (Std.is(value, Bytes)) {
return cast(value, Bytes).toHex();
- } else if (Int64.is(value)) {
+ } else if #if haxe_320 (Int64.is(value)) #else (Std.is(value,Int64)) #end {
return Int64.toStr(cast(value, Int64));
} else if (Std.is(value, protohx.Message)) {
var m:Dynamic = {};
In flash, you get the error:
haxe: Comparison of Int and UInt might lead to unexpected results
when trying to perform the operation
var tag:PT_UInt = protohx.ReadUtils.read__TYPE_UINT32(input);
switch (tag >> 3) {
tag >> 3 is causing the problem
message Test{
required uint32 test=1;
optional string resultPath=2;
required uint32 test2=3;
}
var msg = new ProtocolMessage();
msg.type = ProtocolMessage.MsgType.TEST;
var lrq = new samples.Test();
lrq.test = 0;
lrq.resultPath = "1";
lrq.test2 = 0;
msg.test = lrq;
such like same proto
c#
bytes: 086a4200
haxe:
byts 08707720a080012043139393931863
the size is not same and each language can be decode right by theirself ,what's wrong?
The following proto:
message MMMonster {
optional MMMonsterCard monsterCard = 1;
repeated uint32 modifiersUsed = 2 [packed=true];
repeated uint32 modifiers = 3 [packed=true]; // list of scroll IDs
repeated uint32 equippedGear = 4 [packed=true]; // list of equipped gear ids
}
Generates (cut sample):
if (this.modifiersUsed != null && this.modifiersUsed.length > 0) {
protohx.WriteUtils.writeTag(output, protohx.WireType.LENGTH_DELIMITED, 2);
protohx.WriteUtils.writePackedRepeated(output, protohx.WriteUtils.write__TYPE_UINT32, this.modifiersUsed);
Which is causing:
Warning:(107, 89) haxe: Array<protohx.PT_UInt> should be Array<protohx.PT_Int>
Warning:(107, 89) haxe: Type parameters are invariant
Warning:(107, 89) haxe: UInt should be protohx.PT_Int
Warning:(107, 89) haxe: UInt should be Int
Warning:(107, 89) haxe: For function argument 'value'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.