Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of NSAPITests by
Revision 9:07b22947be75, committed 2016-03-03
- Comitter:
- bridadan
- Date:
- Thu Mar 03 21:04:29 2016 +0000
- Parent:
- 8:5a5c498e1fa0
- Child:
- 10:0d938ec9100c
- Commit message:
- Switching from strstr to memcmp for return data checks. Also fixing a printf
Changed in this revision
| NSAPITests.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/NSAPITests.cpp Thu Mar 03 20:39:45 2016 +0000
+++ b/NSAPITests.cpp Thu Mar 03 21:04:29 2016 +0000
@@ -124,7 +124,7 @@
int32_t bytes_received = socket->recv(received_data, sizeof(received_data));
if (bytes_received >= (int32_t)data_size) {
- if (strstr(received_data, expected_data) != NULL) {
+ if (memcmp(received_data, expected_data, data_size) == 0) {
return 0;
} else {
printf("'recv' returned incorrect data with length %d\r\n", bytes_received);
@@ -193,7 +193,7 @@
bytes_received = socket->recv(received_data, data_size, false);
if (bytes_received >= (int32_t)data_size) {
- if (strstr(received_data, expected_data) != NULL) {
+ if (memcmp(received_data, expected_data, data_size) == 0) {
result = 0;
break;
} else {
@@ -209,7 +209,7 @@
if (result == -1) {
printf("'recv' returned no data\r\n");
} else if (result == -2) {
- printf("'recv' returned incorrect data\r\n");
+ printf("'recv' returned incorrect data with length %d\r\n", bytes_received);
} else if (result == -3) {
printf("'recv' failed with code %d\r\n", bytes_received);
}
