--- xdr-string-empty.c 2001/08/01 15:25:50 1.3
+++ xdr-string-empty.c 2001/08/02 11:52:12 1.4
@@ -37,7 +37,6 @@
char msg[] = "";
char* new_msg;
- size_t new_msg_size;
/* Encode the string as octet stream. Then erase the buffer and
decode the string back, verifying that it hasn't changed. */
@@ -48,12 +47,12 @@
printf("Failed to initialize XDS context.\n");
return 1;
}
- if (xds_register(xds, "os", &xdr_encode_string, NULL) != XDS_OK)
+ if (xds_register(xds, "string", &xdr_encode_string, NULL) != XDS_OK)
{
printf("Failed to register my encoding engines.\n");
return 1;
}
- if (xds_encode(xds, "os", msg, 0) != XDS_OK)
+ if (xds_encode(xds, "string", msg, 0) != XDS_OK)
{
printf("xds_encode() failed.\n");
return 1;
@@ -76,7 +75,7 @@
printf("Failed to initialize XDS context.\n");
return 1;
}
- if (xds_register(xds, "os", &xdr_decode_string, NULL) != XDS_OK)
+ if (xds_register(xds, "string", &xdr_decode_string, NULL) != XDS_OK)
{
printf("Failed to register my decoding engines.\n");
return 1;
@@ -86,21 +85,16 @@
printf("xds_setbuffer() failed.\n");
return 1;
}
- if (xds_decode(xds, "os", &new_msg, &new_msg_size) != XDS_OK)
+ if (xds_decode(xds, "string", &new_msg) != XDS_OK)
{
printf("xds_decode() failed.\n");
return 1;
}
- if (new_msg_size != 0)
+ if (strlen(new_msg) != 0)
{
printf("The size of the decoded message is wrong.\n");
return 1;
}
- if (memcmp(msg, new_msg, new_msg_size) != 0)
- {
- printf("The decoded string is not correct.\n");
- return 1;
- }
xds_destroy(xds);
free(new_msg);
|