diff --git a/Os/Posix/test/ut/PosixFileTests.cpp b/Os/Posix/test/ut/PosixFileTests.cpp index d75c5bc40f..55cc7dfc11 100644 --- a/Os/Posix/test/ut/PosixFileTests.cpp +++ b/Os/Posix/test/ut/PosixFileTests.cpp @@ -33,8 +33,8 @@ bool check_permissions(const char* path, int permission) { //! std::shared_ptr get_test_filename(bool random) { const char* filename = TEST_FILE; - char full_buffer[PATH_MAX]; - char buffer[PATH_MAX - sizeof(BASE_PATH)]; + char full_buffer[_POSIX_PATH_MAX]; + char buffer[_POSIX_PATH_MAX - sizeof(BASE_PATH)]; // When random, select random characters if (random) { filename = buffer; @@ -47,7 +47,7 @@ std::shared_ptr get_test_filename(bool random) { } buffer[i] = 0; // Terminate random string } - (void) snprintf(full_buffer, PATH_MAX, "%s/%s", BASE_PATH, filename); + (void) snprintf(full_buffer, _POSIX_PATH_MAX, "%s/%s", BASE_PATH, filename); // Create a shared pointer wrapping our filename buffer std::shared_ptr pointer(new std::string(full_buffer), std::default_delete()); return pointer; diff --git a/Os/test/ut/file/FileRules.cpp b/Os/test/ut/file/FileRules.cpp index e708ec9569..39b0399b61 100644 --- a/Os/test/ut/file/FileRules.cpp +++ b/Os/test/ut/file/FileRules.cpp @@ -231,7 +231,7 @@ void Os::Test::File::Tester::assert_file_seek(const FwSignedSizeType original_po ASSERT_EQ(this->m_shadow.position(shadow_position), Os::File::Status::OP_OK); const FwSignedSizeType expected_offset = (absolute) ? seek_desired : (original_position + seek_desired); - if (expected_offset > 0) { + if (expected_offset >= 0) { ASSERT_EQ(new_position, expected_offset); } else { ASSERT_EQ(new_position, original_position); @@ -497,7 +497,7 @@ void Os::Test::File::Tester::Preallocate::action( state.assert_file_consistent(); FileState original_file_state = state.current_file_state(); FwSignedSizeType offset = static_cast(STest::Pick::lowerUpper(0, FILE_DATA_MAXIMUM)); - FwSignedSizeType length = static_cast(STest::Pick::lowerUpper(0, FILE_DATA_MAXIMUM)); + FwSignedSizeType length = static_cast(STest::Pick::lowerUpper(1, FILE_DATA_MAXIMUM)); Os::File::Status status = state.m_file.preallocate(offset, length); ASSERT_EQ(Os::File::Status::OP_OK, status); state.shadow_preallocate(offset, length); diff --git a/Os/test/ut/file/SyntheticFileSystem.cpp b/Os/test/ut/file/SyntheticFileSystem.cpp index b81f7c6eae..5bcb59cbf4 100644 --- a/Os/test/ut/file/SyntheticFileSystem.cpp +++ b/Os/test/ut/file/SyntheticFileSystem.cpp @@ -191,7 +191,7 @@ Os::File::Status SyntheticFile::seek(const FwSignedSizeType offset, const SeekTy status = Os::File::Status::NOT_OPENED; } else { FwSignedSizeType new_offset = (absolute) ? offset : (offset + this->m_data->m_pointer); - if (new_offset > 0) { + if (new_offset >= 0) { this->m_data->m_pointer = new_offset; } else { status = Os::File::Status::INVALID_ARGUMENT;