Skip to content

Commit 003c014

Browse files
committed
Refactor: Use XFILE for test memory I/O dumps
1 parent 1a4f327 commit 003c014

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

tests/api.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4559,12 +4559,12 @@ static WC_INLINE int test_ssl_memio_write_cb(WOLFSSL *ssl, char *data, int sz,
45594559
* "Import from Hex Dump..." option ion and selecting the TCP
45604560
* encapsulation option. */
45614561
char dump_file_name[64];
4562-
WOLFSSL_BIO *dump_file;
4562+
XFILE dump_file;
45634563
sprintf(dump_file_name, "%s/%s.dump", tmpDirName, currentTestName);
4564-
dump_file = wolfSSL_BIO_new_file(dump_file_name, "a");
4565-
if (dump_file != NULL) {
4566-
(void)wolfSSL_BIO_write(dump_file, data, sz);
4567-
wolfSSL_BIO_free(dump_file);
4564+
dump_file = XFOPEN(dump_file_name, "ab");
4565+
if (dump_file != XBADFILE) {
4566+
(void)XFWRITE(data, 1, (size_t)sz, dump_file);
4567+
XFCLOSE(dump_file);
45684568
}
45694569
}
45704570
#endif

tests/utils.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ int test_memio_write_cb(WOLFSSL *ssl, char *data, int sz, void *ctx)
8080
#ifdef WOLFSSL_DUMP_MEMIO_STREAM
8181
{
8282
char dump_file_name[64];
83-
WOLFSSL_BIO *dump_file;
83+
XFILE dump_file;
8484
sprintf(dump_file_name, "%s/%s.dump", tmpDirName, currentTestName);
85-
dump_file = wolfSSL_BIO_new_file(dump_file_name, "a");
86-
if (dump_file != NULL) {
87-
(void)wolfSSL_BIO_write(dump_file, data, sz);
88-
wolfSSL_BIO_free(dump_file);
85+
dump_file = XFOPEN(dump_file_name, "ab");
86+
if (dump_file != XBADFILE) {
87+
(void)XFWRITE(data, 1, (size_t)sz, dump_file);
88+
XFCLOSE(dump_file);
8989
}
9090
}
9191
#endif

0 commit comments

Comments
 (0)