Skip to content

Commit

Permalink
- Eliminating some compiler warnings in distribution runtime.
Browse files Browse the repository at this point in the history
-  Addresses #121.
  • Loading branch information
bandurvp committed Oct 10, 2017
1 parent ec28ff2 commit baf6778
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 4 additions & 2 deletions c/vdmclibdist/src/main/asn1vdm.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* The Send_Bus and HandleRecieved calls */

#ifndef SERIALISE_H_
#define SERIALISE_H_
#ifndef ASN1VDM_H_
#define ASN1VDM_H_

#include "basicTypes.h"
#include "Vdm.h"
Expand All @@ -24,4 +24,6 @@ void fromBool2VdmBool(VdmInteger *s, TVP *d);
void fromVdmReal2Real(TVP *s, VdmInteger *d);
void fromReal2VdmReal(VdmInteger *s, TVP *d);

void fromVdmQuote2Quote(TVP *s, VdmInteger *d);

#endif
12 changes: 5 additions & 7 deletions c/vdmclibdist/src/main/serialise.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "serialise.h"
#include "asn1crt.h"
#include "asn1vdm.h"

/** Serialisation functions **/
void serialise(byte* encBuff, int size, va_list args){
Expand Down Expand Up @@ -59,7 +60,7 @@ void deserialise(byte* decBuff, int size, TVP args[]){
if(type==VDM_REAL){
size_t offset = VdmReal_REQUIRED_BYTES_FOR_ENCODING + 1;
deserialiseReal(decBuff, &args[i], b);
printf("Deserialised real value is %d \n", args[i]->value.doubleVal);
printf("Deserialised real value is %f \n", args[i]->value.doubleVal);
b = b + offset;
}
if(type==VDM_BOOL){
Expand Down Expand Up @@ -183,11 +184,10 @@ void serialiseRes(byte* encBuff, TVP t){
fromVdmInt2Int(&t, &val);
int pErrCode;
BitStream bitStrm;
char intBuff[VdmInteger_REQUIRED_BYTES_FOR_ENCODING + 1];
byte intBuff[VdmInteger_REQUIRED_BYTES_FOR_ENCODING + 1];
BitStream_Init(&bitStrm, intBuff, VdmInteger_REQUIRED_BYTES_FOR_ENCODING);
VdmInteger_Encode(&val, &bitStrm, &pErrCode, TRUE);
printf("Serialised Integer is: %d \n", t->value.intVal);
int n;
memcpy(encBuff+1, intBuff, VdmInteger_REQUIRED_BYTES_FOR_ENCODING + 1);
}

Expand All @@ -197,7 +197,7 @@ void serialiseRes(byte* encBuff, TVP t){
fromVdmQuote2Quote(&t, &val);
int pErrCode;
BitStream bitStrm;
char intBuff[VdmInteger_REQUIRED_BYTES_FOR_ENCODING + 1];
byte intBuff[VdmInteger_REQUIRED_BYTES_FOR_ENCODING + 1];
BitStream_Init(&bitStrm, intBuff, VdmInteger_REQUIRED_BYTES_FOR_ENCODING);
VdmInteger_Encode(&val, &bitStrm, &pErrCode, TRUE);
printf("Serialised Quote is: %d \n", t->value.quoteVal);
Expand All @@ -210,11 +210,10 @@ void serialiseRes(byte* encBuff, TVP t){
fromVdmReal2Real(&t, &val);
int pErrCode;
BitStream bitStrm;
char intBuff[VdmReal_REQUIRED_BYTES_FOR_ENCODING + 1];
byte intBuff[VdmReal_REQUIRED_BYTES_FOR_ENCODING + 1];
BitStream_Init(&bitStrm, intBuff, VdmReal_REQUIRED_BYTES_FOR_ENCODING);
VdmReal_Encode(&val, &bitStrm, &pErrCode, TRUE);
printf("Serialised Real is: %f \n", t->value.doubleVal);
int n;
memcpy(encBuff+1, intBuff, VdmReal_REQUIRED_BYTES_FOR_ENCODING + 1);
}

Expand Down Expand Up @@ -251,7 +250,6 @@ TVP deserialiseRes(byte* decFullBuff){
}

if(decFullBuff[0]==VDM_BOOL){
int errCode;
TVP res = newBool(decFullBuff[1]);
printf("Deserialising Boolean result: %d", res->value.boolVal);
return res;
Expand Down

0 comments on commit baf6778

Please sign in to comment.