Skip to content

Commit 3fbfd62

Browse files
committed
Move variable to function
1 parent eaf191d commit 3fbfd62

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/tools/spake2p/Cmd_GenVerifier.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,8 @@ uint8_t gSalt[BASE64_MAX_DECODED_LEN(BASE64_ENCODED_LEN(kSpake2p_Max_PBKDF_Salt_
159159
uint8_t gSaltDecodedLen = 0;
160160
uint8_t gSaltLen = 0;
161161
const char * gOutFileName = nullptr;
162-
std::ifstream gPinCodeFile;
163162

164-
static uint32_t GetNextPinCode()
163+
static uint32_t GetNextPinCode(std::ifstream & gPinCodeFile)
165164
{
166165
if (!gPinCodeFile.is_open())
167166
{
@@ -207,13 +206,14 @@ bool HandleOption(const char * progName, OptionSet * optSet, int id, const char
207206
break;
208207

209208
case 'f':
209+
std::ifstream gPinCodeFile;
210210
gPinCodeFile.open(arg, std::ios::in);
211211
if (gPinCodeFile.fail())
212212
{
213213
PrintArgError("%s: Failed to open the PIN code file: %s\n", progName, arg);
214214
return false;
215215
}
216-
gPinCode = GetNextPinCode();
216+
gPinCode = GetNextPinCode(gPinCodeFile);
217217
gPinCodeFile.close();
218218
break;
219219

0 commit comments

Comments
 (0)