Added C test for WYPT command and fixed bugs in parseWYPT and sendWYPT.

This commit is contained in:
Jason Watkins
2015-04-09 10:24:30 -07:00
parent 1a83517bee
commit 6417822a75
3 changed files with 46 additions and 9 deletions

View File

@@ -453,7 +453,7 @@ short sendWYPT(struct xpcSocket sendfd, WYPT_OP op, float points[], int numPoint
{
buf[5] = op;
buf[6] = numPoints;
size_t len = sizeof(float) * numPoints;
size_t len = sizeof(float) * 3 * numPoints;
memcpy(buf + 7, points, len);
sendUDP(sendfd, buf, len + 7);
return 0;
@@ -721,7 +721,7 @@ xpcWypt parseWYPT(const char data[])
{
result.op = data[5];
result.numPoints = data[6];
char* ptr = data[7];
char* ptr = data + 7;
for (size_t i = 0; i < result.numPoints; ++i)
{
result.points[i].latitude = *((float*)ptr);