mirror of
https://github.com/johndoe6345789/WizardMerge.git
synced 2026-04-24 13:44:55 +00:00
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:
@@ -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) {
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user