Skip to content

Commit 509b893

Browse files
committed
fix: address narrowing conversions and missing includes in server and transaction manager
1 parent 050d181 commit 509b893

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/network/server.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,13 +360,13 @@ void Server::handle_connection(int client_fd) {
360360
// Row Description (T)
361361
if (!res.rows().empty() && res.schema().column_count() > 0) {
362362
const auto& schema = res.schema();
363-
const uint32_t num_cols = static_cast<uint32_t>(schema.column_count());
363+
const auto num_cols = static_cast<uint32_t>(schema.column_count());
364364

365365
// Calculate T packet length
366366
uint32_t t_len = 4 + 2; // len + num_cols
367367
for (uint32_t i = 0; i < num_cols; ++i) {
368-
t_len +=
369-
schema.get_column(i).name().size() + 1 + 4 + 2 + 4 + 2 + 4 + 2;
368+
t_len += static_cast<uint32_t>(schema.get_column(i).name().size()) +
369+
1 + 4 + 2 + 4 + 2 + 4 + 2;
370370
}
371371

372372
const char t_type = 'T';

src/transaction/transaction_manager.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66
#include "transaction/transaction_manager.hpp"
77

88
#include <algorithm>
9+
#include <cstddef>
910
#include <memory>
1011
#include <mutex>
1112
#include <utility>
1213

1314
#include "catalog/catalog.hpp"
15+
#include "executor/types.hpp"
1416
#include "recovery/log_manager.hpp"
1517
#include "recovery/log_record.hpp"
18+
#include "storage/buffer_pool_manager.hpp"
1619
#include "storage/heap_table.hpp"
1720
#include "transaction/lock_manager.hpp"
1821
#include "transaction/transaction.hpp"
@@ -78,7 +81,7 @@ void TransactionManager::commit(Transaction* txn) {
7881
completed_transactions_.push_back(std::move(active_transactions_[txn->get_id()]));
7982
static_cast<void>(active_transactions_.erase(txn->get_id()));
8083

81-
constexpr size_t MAX_COMPLETED = 100;
84+
constexpr std::size_t MAX_COMPLETED = 100;
8285
if (completed_transactions_.size() > MAX_COMPLETED) {
8386
completed_transactions_.pop_front();
8487
}
@@ -113,7 +116,7 @@ void TransactionManager::abort(Transaction* txn) {
113116
completed_transactions_.push_back(std::move(active_transactions_[txn->get_id()]));
114117
static_cast<void>(active_transactions_.erase(txn->get_id()));
115118

116-
constexpr size_t MAX_COMPLETED = 100;
119+
constexpr std::size_t MAX_COMPLETED = 100;
117120
if (completed_transactions_.size() > MAX_COMPLETED) {
118121
completed_transactions_.pop_front();
119122
}

tests/cloudSQL_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ constexpr double PI_UPPER = 3.15;
4545
constexpr int64_t VAL_1 = 1;
4646
constexpr int64_t VAL_2 = 2;
4747
constexpr int64_t VAL_10 = 10;
48-
48+
constexpr int64_t VAL_20 = 20;
4949
constexpr int64_t VAL_25 = 25;
5050
constexpr uint64_t STATS_100 = 100;
5151
constexpr uint16_t PORT_5432 = 5432;

0 commit comments

Comments
 (0)