From ceb0da146370b9f2fe9390ba68cb28ed23d6f7e9 Mon Sep 17 00:00:00 2001 From: Sven Robertz <sven@cs.lth.se> Date: Thu, 21 Feb 2013 14:35:36 +0100 Subject: [PATCH] now the csharp lib compiles. Still not tested, though --- lib/csharp/se/lth/control/labcomm/LabCommDecoderChannel.cs | 2 +- lib/csharp/se/lth/control/labcomm/LabCommEncoder.cs | 1 + lib/csharp/se/lth/control/labcomm/LabCommEncoderChannel.cs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/csharp/se/lth/control/labcomm/LabCommDecoderChannel.cs b/lib/csharp/se/lth/control/labcomm/LabCommDecoderChannel.cs index c6b149d..ca4d6bc 100644 --- a/lib/csharp/se/lth/control/labcomm/LabCommDecoderChannel.cs +++ b/lib/csharp/se/lth/control/labcomm/LabCommDecoderChannel.cs @@ -169,7 +169,7 @@ namespace se.lth.control.labcomm { do { byte c = decodeByte(); - res |= (c & 0x7f) << 7*i; + res |= (uint) ((c & 0x7f) << 7*i); cont = (c & 0x80) != 0; i++; } while(cont); diff --git a/lib/csharp/se/lth/control/labcomm/LabCommEncoder.cs b/lib/csharp/se/lth/control/labcomm/LabCommEncoder.cs index 87008c8..1ddadd2 100644 --- a/lib/csharp/se/lth/control/labcomm/LabCommEncoder.cs +++ b/lib/csharp/se/lth/control/labcomm/LabCommEncoder.cs @@ -15,6 +15,7 @@ namespace se.lth.control.labcomm { void encodeFloat(float value); void encodeDouble(double value); void encodeString(String value); + void encodePacked32(Int64 value); } diff --git a/lib/csharp/se/lth/control/labcomm/LabCommEncoderChannel.cs b/lib/csharp/se/lth/control/labcomm/LabCommEncoderChannel.cs index 25f27c8..73ee904 100644 --- a/lib/csharp/se/lth/control/labcomm/LabCommEncoderChannel.cs +++ b/lib/csharp/se/lth/control/labcomm/LabCommEncoderChannel.cs @@ -84,7 +84,7 @@ namespace se.lth.control.labcomm { public void encodeString(String value) { byte[] buf = Encoding.UTF8.GetBytes(value); - EncodePacked32(buf.Length, 4); + encodePacked32(buf.Length); bytes.Write(buf, 0, buf.Length); } -- GitLab