Skip to content

Commit

Permalink
Clang format, again
Browse files Browse the repository at this point in the history
  • Loading branch information
jdelapla committed Dec 5, 2023
1 parent fd9e19f commit eebe8a7
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/source/Common/AwsV4Signer.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ STATUS signAwsRequestInfo(PRequestInfo pRequestInfo)

// Get the host header
CHK_STATUS(getRequestHost(pRequestInfo->url, &pHostStart, &pHostEnd));
len = (UINT32)(pHostEnd - pHostStart);
len = (UINT32) (pHostEnd - pHostStart);

CHK_STATUS(setRequestHeader(pRequestInfo, AWS_SIG_V4_HEADER_HOST, 0, pHostStart, len));
CHK_STATUS(setRequestHeader(pRequestInfo, AWS_SIG_V4_HEADER_AMZ_DATE, 0, dateTimeStr, 0));
Expand Down Expand Up @@ -185,7 +185,7 @@ STATUS signAwsRequestInfoQueryParam(PRequestInfo pRequestInfo)

// Need to add host header
CHK_STATUS(getRequestHost(pRequestInfo->url, &pHostStart, &pHostEnd));
len = (UINT32)(pHostEnd - pHostStart);
len = (UINT32) (pHostEnd - pHostStart);
CHK_STATUS(setRequestHeader(pRequestInfo, AWS_SIG_V4_HEADER_HOST, 0, pHostStart, len));

// Encode the credentials scope
Expand All @@ -205,7 +205,7 @@ STATUS signAwsRequestInfoQueryParam(PRequestInfo pRequestInfo)

// Calculate the expiration in seconds
expirationInSeconds = MIN(MAX_AWS_SIGV4_CREDENTIALS_EXPIRATION_IN_SECONDS,
(UINT32)((pRequestInfo->pAwsCredentials->expiration - pRequestInfo->currentTime) / HUNDREDS_OF_NANOS_IN_A_SECOND));
(UINT32) ((pRequestInfo->pAwsCredentials->expiration - pRequestInfo->currentTime) / HUNDREDS_OF_NANOS_IN_A_SECOND));
expirationInSeconds = MAX(MIN_AWS_SIGV4_CREDENTIALS_EXPIRATION_IN_SECONDS, expirationInSeconds);

// Add the params
Expand Down Expand Up @@ -291,7 +291,7 @@ STATUS getCanonicalQueryParams(PCHAR pUrl, UINT32 urlLen, BOOL uriEncode, PCHAR*
CHK_STATUS(singleListCreate(&pSingleList));

while (iterate) {
pQueryParamEnd = STRNCHR(pQueryParamStart, (UINT32)(pEndPtr - pQueryParamStart), '&');
pQueryParamEnd = STRNCHR(pQueryParamStart, (UINT32) (pEndPtr - pQueryParamStart), '&');
if (pQueryParamEnd == NULL) {
// break the loop
iterate = FALSE;
Expand All @@ -300,12 +300,12 @@ STATUS getCanonicalQueryParams(PCHAR pUrl, UINT32 urlLen, BOOL uriEncode, PCHAR*
}

// Process the resulting param name and value
CHK(NULL != (pParamValue = STRNCHR(pQueryParamStart, (UINT32)(pQueryParamEnd - pQueryParamStart), '=')), STATUS_INVALID_ARG);
nameLen = (UINT32)(pParamValue - pQueryParamStart);
CHK(NULL != (pParamValue = STRNCHR(pQueryParamStart, (UINT32) (pQueryParamEnd - pQueryParamStart), '=')), STATUS_INVALID_ARG);
nameLen = (UINT32) (pParamValue - pQueryParamStart);

// Advance param start past '='
pParamValue++;
valueLen = (UINT32)(pQueryParamEnd - pParamValue);
valueLen = (UINT32) (pQueryParamEnd - pParamValue);

// Max len is 3 times the size of the allocation to account for max bloat for encoding
maxLen = MIN(MAX_URI_CHAR_LEN, nameLen + 1 + valueLen * 3 + 1);
Expand Down Expand Up @@ -394,7 +394,7 @@ STATUS getCanonicalQueryParams(PCHAR pUrl, UINT32 urlLen, BOOL uriEncode, PCHAR*
}

*pCurPtr = '\0';
queryLen = (UINT32)(pCurPtr - pQuery);
queryLen = (UINT32) (pCurPtr - pQuery);

CleanUp:

Expand Down Expand Up @@ -470,7 +470,7 @@ STATUS generateCanonicalRequestString(PRequestInfo pRequestInfo, PCHAR pRequestS

// Get the canonical URI
CHK_STATUS(getCanonicalUri(pRequestInfo->url, urlLen, &pUriStart, &pUriEnd, &defaultPath));
len = defaultPath ? 1 : (UINT32)(pUriEnd - pUriStart);
len = defaultPath ? 1 : (UINT32) (pUriEnd - pUriStart);

CHK(curLen + len + 1 <= requestLen, STATUS_BUFFER_TOO_SMALL);
MEMCPY(pCurPtr, pUriStart, len * SIZEOF(CHAR));
Expand All @@ -485,7 +485,7 @@ STATUS generateCanonicalRequestString(PRequestInfo pRequestInfo, PCHAR pRequestS
// The start of the query params is either end of the URI or ? so we skip one in that case
pQueryStart = (pUriEnd == pQueryEnd) ? pUriEnd : pUriEnd + 1;

len = (UINT32)(pQueryEnd - pQueryStart);
len = (UINT32) (pQueryEnd - pQueryStart);
CHK(curLen + len + 1 <= requestLen, STATUS_BUFFER_TOO_SMALL);
MEMCPY(pCurPtr, pQueryStart, len * SIZEOF(CHAR));
pCurPtr += len;
Expand Down Expand Up @@ -515,7 +515,7 @@ STATUS generateCanonicalRequestString(PRequestInfo pRequestInfo, PCHAR pRequestS
// Streaming treats this portion as if the body were empty
CHK_STATUS(hexEncodedSha256((PBYTE) EMPTY_STRING, 0, pCurPtr));
} else {
len = (UINT32)(ARRAY_SIZE(PREDEFINED_UNSIGNED_PAYLOAD) - 1);
len = (UINT32) (ARRAY_SIZE(PREDEFINED_UNSIGNED_PAYLOAD) - 1);
MEMCPY(pCurPtr, PREDEFINED_UNSIGNED_PAYLOAD, SIZEOF(CHAR) * len);
}
} else {
Expand Down Expand Up @@ -564,7 +564,7 @@ STATUS generateCanonicalHeaders(PRequestInfo pRequestInfo, PCHAR pCanonicalHeade
// Process only if we have a canonical header name
if (IS_CANONICAL_HEADER_NAME(pRequestHeader->pName)) {
CHK_STATUS(TRIMSTRALL(pRequestHeader->pValue, pRequestHeader->valueLen, &pStart, &pEnd));
valueLen = (UINT32)(pEnd - pStart);
valueLen = (UINT32) (pEnd - pStart);

// Increase the overall length as we use the lower-case header, colon, trimmed lower-case value and new line
overallLen += pRequestHeader->nameLen + 1 + valueLen + 1;
Expand Down Expand Up @@ -676,7 +676,7 @@ STATUS generateSignatureDateTime(UINT64 currentTime, PCHAR pDateTimeStr)
CHK(pDateTimeStr != NULL, STATUS_NULL_ARG);

// Convert to time_t
timeT = (time_t)(currentTime / HUNDREDS_OF_NANOS_IN_A_SECOND);
timeT = (time_t) (currentTime / HUNDREDS_OF_NANOS_IN_A_SECOND);
retSize = STRFTIME(pDateTimeStr, SIGNATURE_DATE_TIME_STRING_LEN, DATE_TIME_STRING_FORMAT, GMTIME(&timeT));
CHK(retSize > 0, STATUS_BUFFER_TOO_SMALL);
pDateTimeStr[retSize] = '\0';
Expand Down Expand Up @@ -834,7 +834,7 @@ STATUS getCanonicalUri(PCHAR pUrl, UINT32 len, PCHAR* ppStart, PCHAR* ppEnd, PBO
} else if (*pCur == '/') {
// This is the case of the path which we find
pStart = pCur;
pEnd = STRNCHR(pCur, urlLen - (UINT32)(pCur - pUrl), '?');
pEnd = STRNCHR(pCur, urlLen - (UINT32) (pCur - pUrl), '?');
iterate = FALSE;
}

Expand Down Expand Up @@ -878,7 +878,7 @@ STATUS uriEncodeString(PCHAR pSrc, UINT32 srcLen, PCHAR pDst, PUINT32 pDstLen)

CHK(pSrc != NULL && pDstLen != NULL, STATUS_NULL_ARG);

while (((UINT32)(pCurPtr - pSrc) < strLen) && ((ch = *pCurPtr++) != '\0')) {
while (((UINT32) (pCurPtr - pSrc) < strLen) && ((ch = *pCurPtr++) != '\0')) {
if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9') || ch == '_' || ch == '-' || ch == '~' || ch == '.') {
encodedLen++;

Expand Down Expand Up @@ -942,9 +942,9 @@ STATUS uriDecodeString(PCHAR pSrc, UINT32 srcLen, PCHAR pDst, PUINT32 pDstLen)

CHK(pSrc != NULL && pDstLen != NULL, STATUS_NULL_ARG);

while (((UINT32)(pCurPtr - pSrc) < strLen) && ((ch = *pCurPtr) != '\0')) {
while (((UINT32) (pCurPtr - pSrc) < strLen) && ((ch = *pCurPtr) != '\0')) {
if (ch == '%') {
CHK((UINT32)(pCurPtr - pSrc) + decLen <= strLen && *(pCurPtr + 1) != '\0' && *(pCurPtr + 2) != '\0', STATUS_INVALID_ARG);
CHK((UINT32) (pCurPtr - pSrc) + decLen <= strLen && *(pCurPtr + 1) != '\0' && *(pCurPtr + 2) != '\0', STATUS_INVALID_ARG);
if (pDec != NULL) {
size = remaining;
CHK_STATUS(hexDecode(pCurPtr + 1, 2, (PBYTE) pDec, &size));
Expand Down

0 comments on commit eebe8a7

Please sign in to comment.