Skip to content

Commit

Permalink
Run clang-format -i on all modified src/ files
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Franceski <[email protected]>
  • Loading branch information
mfrandev authored and Franceski committed Oct 25, 2023
1 parent 2dd2198 commit 7eb7002
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 15 deletions.
3 changes: 2 additions & 1 deletion src/groups/mqb/mqbc/mqbc_storageutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2721,7 +2721,8 @@ int StorageUtil::processCommand(mqbcmd::StorageResult* result,
else if (command.isPartitionValue()) {
const int partitionId = command.partition().partitionId();

if (partitionId < 0 || partitionId >= static_cast<int>(fileStores->size())) {
if (partitionId < 0 ||
partitionId >= static_cast<int>(fileStores->size())) {
bdlma::LocalSequentialAllocator<256> localAllocator(allocator);
mwcu::MemOutStream os(&localAllocator);
os << "Invalid partitionId value: '" << partitionId << "'";
Expand Down
3 changes: 2 additions & 1 deletion src/groups/mwc/mwcst/mwcst_basictableinfoprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@ BasicTableInfoProvider::addColumn(const bslstl::StringRef& tableColumnName,
ColumnFormat& column = d_columns.back();

if (!d_columnGroups.empty()) {
column.d_columnGroupIndex = static_cast<int>(d_columnGroups.size()) - 1;
column.d_columnGroupIndex = static_cast<int>(d_columnGroups.size()) -
1;
}

return column;
Expand Down
11 changes: 6 additions & 5 deletions src/groups/mwc/mwcst/mwcst_printutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,10 @@ const char* memoryHelper(bsls::Types::Int64* num,

bsls::Types::Int64 div = (((bsls::Types::Int64)1) << shift);
*num = bytes >> shift;
*remainder = static_cast<int>(bsl::floor(
((static_cast<double>(bytes - (*num << shift)) / static_cast<double>(div)) *
bsl::pow(10.0, precision))));
*remainder = static_cast<int>(
bsl::floor(((static_cast<double>(bytes - (*num << shift)) /
static_cast<double>(div)) *
bsl::pow(10.0, precision))));

if (negative) {
*num = -*num;
Expand Down Expand Up @@ -257,8 +258,8 @@ bsl::ostream& PrintUtil::printValueWithSeparator(bsl::ostream& stream,

if (precision > 0) {
double absValue = bsl::abs(value);
int remainder = static_cast<int>(bsl::floor((absValue - bsl::floor(absValue)) *
bsl::pow(10.0, precision)));
int remainder = static_cast<int>(bsl::floor(
(absValue - bsl::floor(absValue)) * bsl::pow(10.0, precision)));

snprintf(pos - precision - 2,
precision + 2,
Expand Down
4 changes: 3 additions & 1 deletion src/groups/mwc/mwcst/mwcst_printutil.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,9 @@ int main(int argc, char* argv[])
PrintUtil::printedMemoryLength(data.d_arg, data.d_precision);

LOOP_ASSERT_EQUALS(LINE, ss.str(), data.d_expected_p);
LOOP_ASSERT_EQUALS(LINE, static_cast<int>(ss.str().length()), expectedLength);
LOOP_ASSERT_EQUALS(LINE,
static_cast<int>(ss.str().length()),
expectedLength);
}

#undef TO_I64
Expand Down
23 changes: 16 additions & 7 deletions src/groups/mwc/mwcst/mwcst_tableutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ int TableUtil::printTable(bsl::ostream& stream, const TableInfoProvider& info)
columnWidths[0][i] = info.getHeaderSize(0, static_cast<int>(i));

for (int row = 0; row < numRows; ++row) {
columnWidths[0][i] = bsl::max(columnWidths[0][i],
info.getValueSize(row, static_cast<int>(i)));
columnWidths[0][i] = bsl::max(
columnWidths[0][i],
info.getValueSize(row, static_cast<int>(i)));
}
}

Expand All @@ -76,7 +77,8 @@ int TableUtil::printTable(bsl::ostream& stream, const TableInfoProvider& info)
int lastUpdatedHeader = -1;
int numSubHeaders = 0;
for (size_t col = 0; col < lastLevelHeaders.size(); ++col) {
int headerIdx = info.getParentHeader(level - 1, static_cast<int>(col));
int headerIdx = info.getParentHeader(level - 1,
static_cast<int>(col));
levelHeaders[headerIdx] += lastLevelHeaders[col];

if (lastUpdatedHeader == headerIdx) {
Expand All @@ -94,11 +96,14 @@ int TableUtil::printTable(bsl::ostream& stream, const TableInfoProvider& info)
int mod = excess % numSubHeaders;

levelHeaders[lastUpdatedHeader] = headerSize;
for (size_t hIdx = 0; static_cast<int>(hIdx) < numSubHeaders; ++hIdx) {
for (size_t hIdx = 0;
static_cast<int>(hIdx) < numSubHeaders;
++hIdx) {
// Add 'excessPerSubHeader' to each subHeader, and an
// extra '1' to 'mod' of them
lastLevelHeaders[col - hIdx - 1] +=
excessPerSubHeader + (static_cast<int>(hIdx) < mod ? 1 : 0);
excessPerSubHeader +
(static_cast<int>(hIdx) < mod ? 1 : 0);
}
}

Expand Down Expand Up @@ -131,7 +136,8 @@ int TableUtil::printTable(bsl::ostream& stream, const TableInfoProvider& info)
stream << bsl::setfill(' ');

// Print the header rows
for (int level = static_cast<int>(columnWidths.size()) - 1; level >= 0; --level) {
for (int level = static_cast<int>(columnWidths.size()) - 1; level >= 0;
--level) {
stream << bsl::endl;

for (size_t i = 0; i < columnWidths[level].size(); ++i) {
Expand Down Expand Up @@ -169,7 +175,10 @@ int TableUtil::printTable(bsl::ostream& stream, const TableInfoProvider& info)
}

stream << bsl::setw(columnWidths[0][col]);
info.printValue(stream, row, static_cast<int>(col), columnWidths[0][col]);
info.printValue(stream,
row,
static_cast<int>(col),
columnWidths[0][col]);
}
stream << bsl::endl;
}
Expand Down

0 comments on commit 7eb7002

Please sign in to comment.