Skip to content

Commit

Permalink
Move the variables whre they are used
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamdp committed Dec 13, 2024
1 parent b36f923 commit 00e991e
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,31 +126,30 @@ bool TestDACRevocationDelegateImpl::CrossValidateCert(const Json::Value & revoke
bool TestDACRevocationDelegateImpl::IsEntryInRevocationSet(const std::string & akidHexStr, const std::string & issuerNameBase64Str,
const std::string & serialNumberHexStr)
{
Json::CharReaderBuilder readerBuilder;
Json::Value jsonData;
std::string errs;

// Try direct data first, then fall back to file

if (!mRevocationData.empty())
{
std::string errs;
std::istringstream jsonStream(!mRevocationData.empty() ? mRevocationData : "[]");
if (!Json::parseFromStream(readerBuilder, jsonStream, &jsonData, &errs))
if (!Json::parseFromStream(Json::CharReaderBuilder(), jsonStream, &jsonData, &errs))
{
ChipLogError(NotSpecified, "Failed to parse JSON data: %s", errs.c_str());
return false;
}
}
else if (!mDeviceAttestationRevocationSetPath.empty())
{
std::string errs;
std::ifstream file(mDeviceAttestationRevocationSetPath.c_str());
if (!file.is_open())
{
ChipLogError(NotSpecified, "Failed to open file: %s", mDeviceAttestationRevocationSetPath.c_str());
return false;
}

bool parsingSuccessful = Json::parseFromStream(readerBuilder, file, &jsonData, &errs);
bool parsingSuccessful = Json::parseFromStream(Json::CharReaderBuilder(), file, &jsonData, &errs);
file.close();

if (!parsingSuccessful)
Expand All @@ -161,6 +160,7 @@ bool TestDACRevocationDelegateImpl::IsEntryInRevocationSet(const std::string & a
}
else
{
ChipLogDetail(NotSpecified, "No revocation data available");
// No revocation data available
return false;
}
Expand Down

0 comments on commit 00e991e

Please sign in to comment.