Format source code.

This commit is contained in:
Jordan Bancino 2023-04-16 17:51:52 +00:00
parent 4ee66ae3c7
commit 582df63a31
3 changed files with 15 additions and 14 deletions

View file

@ -70,7 +70,7 @@ ROUTE_IMPL(RouteUiaFallback, path, argp)
{ {
HttpResponseStatus(args->context, HTTP_NOT_FOUND); HttpResponseStatus(args->context, HTTP_NOT_FOUND);
StreamPrintf(stream, StreamPrintf(stream,
"<p>Unknown auth type: <code>%s</code></p>", authType); "<p>Unknown auth type: <code>%s</code></p>", authType);
} }
HtmlEnd(stream); HtmlEnd(stream);

View file

@ -689,7 +689,7 @@ UserDeleteTokens(User * user, char *exempt)
} }
int int
UserGetPrivileges(User *user) UserGetPrivileges(User * user)
{ {
if (!user) if (!user)
{ {
@ -700,7 +700,7 @@ UserGetPrivileges(User *user)
} }
int int
UserSetPrivileges(User *user, int privileges) UserSetPrivileges(User * user, int privileges)
{ {
JsonValue *val; JsonValue *val;
@ -726,7 +726,7 @@ UserSetPrivileges(User *user, int privileges)
} }
int int
UserDecodePrivileges(JsonValue *val) UserDecodePrivileges(JsonValue * val)
{ {
int privileges = USER_NONE; int privileges = USER_NONE;
@ -740,17 +740,17 @@ UserDecodePrivileges(JsonValue *val)
if (JsonValueType(val) == JSON_ARRAY) if (JsonValueType(val) == JSON_ARRAY)
{ {
arr = JsonValueAsArray(val); arr = JsonValueAsArray(val);
for (i = 0; i < ArraySize(arr); i++) for (i = 0; i < ArraySize(arr); i++)
{
val = ArrayGet(arr, i);
if (!val || JsonValueType(val) != JSON_STRING)
{ {
val = ArrayGet(arr, i); continue;
if (!val || JsonValueType(val) != JSON_STRING)
{
continue;
}
privileges |= UserDecodePrivilege(JsonValueAsString(val));
} }
privileges |= UserDecodePrivilege(JsonValueAsString(val));
}
} }
finish: finish:
@ -794,6 +794,7 @@ JsonValue *
UserEncodePrivileges(int privileges) UserEncodePrivileges(int privileges)
{ {
Array *arr = ArrayCreate(); Array *arr = ArrayCreate();
if (!arr) if (!arr)
{ {
return NULL; return NULL;

View file

@ -40,7 +40,7 @@ typedef struct RegTokenInfo
unsigned long created; unsigned long created;
unsigned long expires; unsigned long expires;
int grants; /* privileges */ int grants; /* privileges */
} RegTokenInfo; } RegTokenInfo;