Fixed incorrect error checking in readDATA

- Resolves #97
This commit is contained in:
Jason Watkins
2016-07-09 17:54:41 -07:00
parent f9ca716f44
commit 5d23d482f7

View File

@@ -336,7 +336,7 @@ int readDATA(XPCSocket sock, float data[][9], int rows)
// Read data // Read data
char buffer[4829] = { 0 }; char buffer[4829] = { 0 };
int result = readUDP(sock, buffer, 5120); int result = readUDP(sock, buffer, 4829);
if (result <= 0) if (result <= 0)
{ {
printError("readDATA", "Failed to read from socket."); printError("readDATA", "Failed to read from socket.");
@@ -347,7 +347,11 @@ int readDATA(XPCSocket sock, float data[][9], int rows)
if (readRows > rows) if (readRows > rows)
{ {
printError("readDATA", "Read more rows than will fit in dataRef."); printError("readDATA", "Read more rows than will fit in dataRef.");
// Copy as much data as we can anyway }
else if (readRows < rows)
{
printError("readDATA", "Read fewer rows than expected.");
// Copy as much data as we read anyway
rows = readRows; rows = readRows;
} }