Formatted WV utils/src files.

[ Merge of http://go/wvgerrit/80944 ]

Ran `git clang-format` on files in utils/src.

Used the new .clang-format config.

Bug: 134365840
Test: WV unit tests
Change-Id: Idbba01ec65fc019327fc59dc1d95d7cefa4a5aa7
This commit is contained in:
Alex Dale
2019-06-27 13:48:27 -07:00
parent 906dc12c5d
commit fc31b3ef2a
2 changed files with 10 additions and 11 deletions

View File

@@ -6,7 +6,6 @@
//
#include <windows.h>
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
LPVOID lpReserved) {
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) {
return TRUE;
}

View File

@@ -8,6 +8,7 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <vector>
@@ -24,12 +25,11 @@ static const char kBase64Codes[] =
// Gets the given (zero-indexed) bits [a, b) of |in|.
#define GET_BITS(in, a, b) GET_LOW_BITS((in) >> (a), (b) - (a))
// Calculates a/b using round-up division (only works for positive numbers).
#define CEIL_DIVIDE(a, b) ((((a) - 1) / (b)) + 1)
#define CEIL_DIVIDE(a, b) ((((a)-1) / (b)) + 1)
int DecodeBase64Char(char c) {
const char* it = strchr(kBase64Codes, c);
if (it == NULL)
return -1;
if (it == NULL) return -1;
return it - kBase64Codes;
}
@@ -121,8 +121,8 @@ std::string Base64Encode(const std::vector<uint8_t>& bin_input) {
if (i % 3 == 2) {
result[out_index++] = kBase64Codes[GET_BITS(temp, 18, 24)];
result[out_index++] = kBase64Codes[GET_BITS(temp, 12, 18)];
result[out_index++] = kBase64Codes[GET_BITS(temp, 6, 12)];
result[out_index++] = kBase64Codes[GET_BITS(temp, 0, 6)];
result[out_index++] = kBase64Codes[GET_BITS(temp, 6, 12)];
result[out_index++] = kBase64Codes[GET_BITS(temp, 0, 6)];
temp = 0;
}
}
@@ -135,7 +135,7 @@ std::string Base64Encode(const std::vector<uint8_t>& bin_input) {
} else if (bin_input.size() % 3 == 2) {
result[out_index++] = kBase64Codes[GET_BITS(temp, 18, 24)];
result[out_index++] = kBase64Codes[GET_BITS(temp, 12, 18)];
result[out_index++] = kBase64Codes[GET_BITS(temp, 6, 12)];
result[out_index++] = kBase64Codes[GET_BITS(temp, 6, 12)];
result[out_index++] = '=';
}
@@ -208,8 +208,8 @@ std::vector<uint8_t> Base64Decode(const std::string& b64_input) {
if (i % 4 == 3) {
result[out_index++] = GET_BITS(temp, 16, 24);
result[out_index++] = GET_BITS(temp, 8, 16);
result[out_index++] = GET_BITS(temp, 0, 8);
result[out_index++] = GET_BITS(temp, 8, 16);
result[out_index++] = GET_BITS(temp, 0, 8);
temp = 0;
}
}
@@ -223,7 +223,7 @@ std::vector<uint8_t> Base64Decode(const std::string& b64_input) {
break;
case 3:
result[out_index++] = GET_BITS(temp, 16, 24);
result[out_index++] = GET_BITS(temp, 8, 16);
result[out_index++] = GET_BITS(temp, 8, 16);
break;
}
result.resize(out_index);