Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
cottsay committed Jun 4, 2020
1 parent ee6a8dc commit 31f5f67
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
7 changes: 6 additions & 1 deletion rcl_logging_spdlog/test/fixtures.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <rcutils/process.h>
#include <rcutils/types/string_array.h>

#include <limits.h>
#include <string>

#include "gtest/gtest.h"
Expand Down Expand Up @@ -89,7 +90,11 @@ class LoggingTest : public AllocatorTest
throw std::runtime_error("Failed to glob for log files");
}

char raw_line[2048];
#ifdef _WIN32
char raw_line[MAX_PATH];
#else
char raw_line[PATH_MAX];
#endif
char * ret = fgets(raw_line, sizeof(raw_line), fp);
pclose(fp);
if (nullptr == ret) {
Expand Down
13 changes: 6 additions & 7 deletions rcl_logging_spdlog/test/test_logging_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <rcutils/error_handling.h>
#include <rcutils/logging.h>

#include <limits.h>
#include <fstream>
#include <string>

Expand Down Expand Up @@ -64,24 +65,22 @@ class RestoreEnvVar
// TODO(cottsay): Remove when ros2/rcpputils#63 is resolved
static fs::path current_path()
{
char * cwd;
#ifdef _WIN32
#ifdef UNICODE
#error "rcpputils::fs does not support Unicode paths"
#endif
cwd = _getcwd(NULL, 0);
char cwd[MAX_PATH];
if (nullptr == _getcwd(cwd, MAX_PATH)) {
#else
cwd = getcwd(NULL, 0);
char cwd[PATH_MAX];
if (nullptr == getcwd(cwd, PATH_MAX)) {
#endif
if (nullptr == cwd) {
std::error_code ec{errno, std::system_category()};
errno = 0;
throw std::system_error{ec, "cannot get current working directory"};
}

std::string ret(cwd);
free(cwd);
return fs::path(ret);
return fs::path(cwd);
}

TEST_F(LoggingTest, init_invalid)
Expand Down

0 comments on commit 31f5f67

Please sign in to comment.