Skip to content

Commit

Permalink
Fix mixed variable declaration.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarske committed Jan 9, 2024
1 parent 067bd43 commit 6a32ed4
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions examples/tpm_test_keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@
int writeBin(const char* filename, const byte *buf, word32 bufSz)
{
int rc = TPM_RC_FAILURE;
#if !defined(NO_FILESYSTEM) && !defined(NO_WRITE_TEMP_FILES)
XFILE fp = NULL;
size_t fileSz = 0;
#endif

if (filename == NULL || buf == NULL)
return BAD_FUNC_ARG;

#if !defined(NO_FILESYSTEM) && !defined(NO_WRITE_TEMP_FILES)
XFILE fp = NULL;
size_t fileSz = 0;

fp = XFOPEN(filename, "wb");
if (fp != XBADFILE) {
fileSz = XFWRITE(buf, 1, bufSz, fp);
Expand All @@ -73,15 +74,16 @@ int writeBin(const char* filename, const byte *buf, word32 bufSz)
int readBin(const char* filename, byte *buf, word32* bufSz)
{
int rc = TPM_RC_FAILURE;

if (filename == NULL || buf == NULL)
return BAD_FUNC_ARG;

#if !defined(NO_FILESYSTEM) && !defined(NO_WRITE_TEMP_FILES)
XFILE fp = NULL;
size_t fileSz = 0;
size_t bytes_read = 0;
#endif

if (filename == NULL || buf == NULL)
return BAD_FUNC_ARG;

#if !defined(NO_FILESYSTEM) && !defined(NO_WRITE_TEMP_FILES)
fp = XFOPEN(filename, "rb");
if (fp != XBADFILE) {
XFSEEK(fp, 0, XSEEK_END);
Expand Down

0 comments on commit 6a32ed4

Please sign in to comment.