Skip to content

Commit

Permalink
Remove build warnings (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
pablogs9 committed May 30, 2022
1 parent 44a8d59 commit 5f23b9c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/filesystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ bool
rcutils_get_cwd(char * buffer, size_t max_length)
{
#ifdef RCUTILS_NO_FILESYSTEM
(void) buffer;
(void) max_length;
RCUTILS_SET_ERROR_MSG("not available filesystem");
return false;
#else
Expand All @@ -83,6 +85,7 @@ bool
rcutils_is_directory(const char * abs_path)
{
#ifdef RCUTILS_NO_FILESYSTEM
(void) abs_path;
RCUTILS_SET_ERROR_MSG("not available filesystem");
return false;
#else
Expand All @@ -102,6 +105,7 @@ bool
rcutils_is_file(const char * abs_path)
{
#ifdef RCUTILS_NO_FILESYSTEM
(void) abs_path;
RCUTILS_SET_ERROR_MSG("not available filesystem");
return false;
#else
Expand All @@ -121,6 +125,7 @@ bool
rcutils_exists(const char * abs_path)
{
#ifdef RCUTILS_NO_FILESYSTEM
(void) abs_path;
RCUTILS_SET_ERROR_MSG("not available filesystem");
return false;
#else
Expand All @@ -136,6 +141,7 @@ bool
rcutils_is_readable(const char * abs_path)
{
#ifdef RCUTILS_NO_FILESYSTEM
(void) abs_path;
RCUTILS_SET_ERROR_MSG("not available filesystem");
return false;
#else
Expand All @@ -158,6 +164,7 @@ bool
rcutils_is_writable(const char * abs_path)
{
#ifdef RCUTILS_NO_FILESYSTEM
(void) abs_path;
RCUTILS_SET_ERROR_MSG("not available filesystem");
return false;
#else
Expand All @@ -180,6 +187,7 @@ bool
rcutils_is_readable_and_writable(const char * abs_path)
{
#ifdef RCUTILS_NO_FILESYSTEM
(void) abs_path;
RCUTILS_SET_ERROR_MSG("not available filesystem");
return false;
#else
Expand All @@ -206,6 +214,13 @@ rcutils_join_path(
const char * right_hand_path,
rcutils_allocator_t allocator)
{
#ifdef RCUTILS_NO_FILESYSTEM
(void) left_hand_path;
(void) right_hand_path;
(void) allocator;
RCUTILS_SET_ERROR_MSG("not available filesystem");
return NULL;
#else
if (NULL == left_hand_path) {
return NULL;
}
Expand All @@ -217,23 +232,36 @@ rcutils_join_path(
allocator,
"%s%s%s",
left_hand_path, RCUTILS_PATH_DELIMITER, right_hand_path);
#endif // _RCUTILS_NO_FILESYSTEM
}

char *
rcutils_to_native_path(
const char * path,
rcutils_allocator_t allocator)
{
#ifdef RCUTILS_NO_FILESYSTEM
(void) path;
(void) allocator;
RCUTILS_SET_ERROR_MSG("not available filesystem");
return NULL;
#else
if (NULL == path) {
return NULL;
}

return rcutils_repl_str(path, "/", RCUTILS_PATH_DELIMITER, &allocator);
#endif // _RCUTILS_NO_FILESYSTEM
}

bool
rcutils_mkdir(const char * abs_path)
{
#ifdef RCUTILS_NO_FILESYSTEM
(void) abs_path;
RCUTILS_SET_ERROR_MSG("not available filesystem");
return false;
#else
if (NULL == abs_path) {
return false;
}
Expand Down Expand Up @@ -261,13 +289,16 @@ rcutils_mkdir(const char * abs_path)
}

return success;
#endif // _RCUTILS_NO_FILESYSTEM
}

size_t
rcutils_calculate_directory_size(const char * directory_path, rcutils_allocator_t allocator)
{

#ifdef RCUTILS_NO_FILESYSTEM
(void) directory_path;
(void) allocator;
RCUTILS_SET_ERROR_MSG("not available filesystem");
return 0;
#else
Expand Down Expand Up @@ -326,6 +357,7 @@ rcutils_get_file_size(const char * file_path)
{

#ifdef RCUTILS_NO_FILESYSTEM
(void) file_path;
RCUTILS_SET_ERROR_MSG("not available filesystem");
return 0;
#else
Expand Down
3 changes: 3 additions & 0 deletions src/shared_library.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ rcutils_load_shared_library(
return RCUTILS_RET_OK;

#else
(void) lib;
(void) library_path;
(void) allocator;
return RCUTILS_RET_ERROR;
#endif //RCUTILS_NO_FILESYSTEM

Expand Down

0 comments on commit 5f23b9c

Please sign in to comment.