Skip to content

Commit 54de017

Browse files
Hansel Ipclaude
andcommitted
Remove unnecessary inner scope block
Remove the leftover scope braces from the try/catch removal and fix indentation for cleaner code structure. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent f88a641 commit 54de017

File tree

1 file changed

+41
-43
lines changed

1 file changed

+41
-43
lines changed

lib/http/HttpResponseDecoder.cpp

Lines changed: 41 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -189,64 +189,62 @@ namespace MAT_NS_BEGIN {
189189
return;
190190
}
191191

192+
int accepted = 0;
193+
auto acc = responseBody.find("acc");
194+
if (responseBody.end() != acc)
192195
{
193-
int accepted = 0;
194-
auto acc = responseBody.find("acc");
195-
if (responseBody.end() != acc)
196+
if (acc.value().is_number())
196197
{
197-
if (acc.value().is_number())
198-
{
199-
accepted = acc.value().get<int>();
200-
}
198+
accepted = acc.value().get<int>();
201199
}
200+
}
202201

203-
int rejected = 0;
204-
auto rej = responseBody.find("rej");
205-
if (responseBody.end() != rej)
202+
int rejected = 0;
203+
auto rej = responseBody.find("rej");
204+
if (responseBody.end() != rej)
205+
{
206+
if (rej.value().is_number())
206207
{
207-
if (rej.value().is_number())
208-
{
209-
rejected = rej.value().get<int>();
210-
}
208+
rejected = rej.value().get<int>();
211209
}
210+
}
212211

213-
auto efi = responseBody.find("efi");
214-
if (responseBody.end() != efi)
212+
auto efi = responseBody.find("efi");
213+
if (responseBody.end() != efi)
214+
{
215+
for (auto it = responseBody["efi"].begin(); it != responseBody["efi"].end(); ++it)
215216
{
216-
for (auto it = responseBody["efi"].begin(); it != responseBody["efi"].end(); ++it)
217+
std::string efiKey(it.key());
218+
nlohmann::json val = it.value();
219+
if (val.is_array())
217220
{
218-
std::string efiKey(it.key());
219-
nlohmann::json val = it.value();
220-
if (val.is_array())
221-
{
222-
//std::vector<int> failureVector = val.get<std::vector<int>>();
223-
// eventsRejected(ctx); with only the ids in the vector above
224-
}
225-
if (val.is_string())
221+
//std::vector<int> failureVector = val.get<std::vector<int>>();
222+
// eventsRejected(ctx); with only the ids in the vector above
223+
}
224+
if (val.is_string())
225+
{
226+
if ("all" == val.get<std::string>())
226227
{
227-
if ("all" == val.get<std::string>())
228-
{
229-
result = Rejected;
230-
}
228+
result = Rejected;
231229
}
232230
}
233231
}
232+
}
234233

235-
auto ticket = responseBody.find("TokenCrackingFailure");
236-
if (responseBody.end() != ticket)
237-
{
238-
DebugEvent evt;
239-
evt.type = DebugEventType::EVT_TICKET_EXPIRED;
240-
DispatchEvent(evt);
241-
}
234+
auto ticket = responseBody.find("TokenCrackingFailure");
235+
if (responseBody.end() != ticket)
236+
{
237+
DebugEvent evt;
238+
evt.type = DebugEventType::EVT_TICKET_EXPIRED;
239+
DispatchEvent(evt);
240+
}
242241

243-
if (result != Rejected)
244-
{
245-
LOG_TRACE("HTTP response: accepted=%d rejected=%d", accepted, rejected);
246-
} else
247-
{
248-
LOG_TRACE("HTTP response: all rejected");
249-
}
242+
if (result != Rejected)
243+
{
244+
LOG_TRACE("HTTP response: accepted=%d rejected=%d", accepted, rejected);
245+
} else
246+
{
247+
LOG_TRACE("HTTP response: all rejected");
250248
}
251249
#else
252250
UNREFERENCED_PARAMETER(response);

0 commit comments

Comments
 (0)