Fix code review issues: safer type conversions and error handling

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-26 03:48:48 +00:00
parent acf04ce8d5
commit e88e32b1e8
2 changed files with 16 additions and 4 deletions

View File

@@ -79,8 +79,9 @@ void MergeController::merge(
Json::Value conflictsArray(Json::arrayValue);
for (const auto &conflict : result.conflicts) {
Json::Value conflictObj;
conflictObj["start_line"] = Json::Value::UInt64(conflict.start_line);
conflictObj["end_line"] = Json::Value::UInt64(conflict.end_line);
// Note: start_line and end_line are size_t (always non-negative)
conflictObj["start_line"] = static_cast<Json::UInt64>(conflict.start_line);
conflictObj["end_line"] = static_cast<Json::UInt64>(conflict.end_line);
Json::Value baseLines(Json::arrayValue);
for (const auto &line : conflict.base_lines) {

View File

@@ -24,8 +24,19 @@ int main(int argc, char* argv[]) {
// Load configuration and start server
app().loadConfigFile(config_file);
std::cout << "Server will listen on port "
<< app().getListeners()[0].toPort << "\n";
// Display listener information if available
auto listeners = app().getListeners();
if (!listeners.empty()) {
try {
std::cout << "Server will listen on port "
<< listeners[0].toPort << "\n";
} catch (...) {
std::cout << "Server listener configured\n";
}
} else {
std::cout << "Server configuration loaded\n";
}
std::cout << "Available endpoints:\n";
std::cout << " POST /api/merge - Three-way merge API\n";
std::cout << "\nPress Ctrl+C to stop the server.\n\n";