From eebe8a7b9d4caa955a9aee205237fea6e738a673 Mon Sep 17 00:00:00 2001 From: James Delaplane Date: Tue, 5 Dec 2023 15:42:22 -0800 Subject: [PATCH] Clang format, again --- src/source/Common/AwsV4Signer.c | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/source/Common/AwsV4Signer.c b/src/source/Common/AwsV4Signer.c index 1e4e44b76..4c58739bf 100644 --- a/src/source/Common/AwsV4Signer.c +++ b/src/source/Common/AwsV4Signer.c @@ -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)); @@ -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 @@ -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 @@ -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; @@ -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); @@ -394,7 +394,7 @@ STATUS getCanonicalQueryParams(PCHAR pUrl, UINT32 urlLen, BOOL uriEncode, PCHAR* } *pCurPtr = '\0'; - queryLen = (UINT32)(pCurPtr - pQuery); + queryLen = (UINT32) (pCurPtr - pQuery); CleanUp: @@ -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)); @@ -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; @@ -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 { @@ -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; @@ -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'; @@ -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; } @@ -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++; @@ -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));