Skip to content

Commit

Permalink
use string_veiw
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Jul 23, 2024
1 parent 0f4ec1f commit e371232
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ffilesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ size_t fs_char2char(const char* in, char* out, size_t buffer_size)
}


size_t fs_str2char(std::string in, char* out, size_t buffer_size)
size_t fs_str2char(std::string_view in, char* out, size_t buffer_size)
{
// string to char*, for Fortran interface
if(in.length() >= buffer_size){
Expand Down
2 changes: 1 addition & 1 deletion src/ffilesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
extern "C" {
#endif

size_t fs_str2char(std::string, char*, size_t);
size_t fs_str2char(std::string_view, char*, size_t);
size_t fs_char2char(const char*, char*, size_t);

#ifdef __cplusplus
Expand Down
4 changes: 2 additions & 2 deletions test/case_sensitive/case_sensitive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace fs = std::filesystem;
// Discussion of general issues across operating systems.
// https://github.com/dotnet/runtime/issues/14321

bool is_case_sensitive(std::string drive){
bool is_case_sensitive(std::string_view drive){
// https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getvolumeinformationa

if (drive.empty())
Expand All @@ -25,7 +25,7 @@ bool is_case_sensitive(std::string drive){
DWORD lpFileSystemFlags=0;

if(!GetVolumeInformationA(drive.c_str(), 0, 0, 0, 0, &lpFileSystemFlags, 0, 0))
throw std::runtime_error("GetVolumeInformation: " + drive + " " + std::system_category().message(GetLastError()));
throw std::runtime_error("GetVolumeInformation: " + std::system_category().message(GetLastError()));

return bool(FILE_CASE_SENSITIVE_SEARCH & lpFileSystemFlags);
}
Expand Down
2 changes: 1 addition & 1 deletion test/is_exe/test_is_exe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace fs = std::filesystem;

bool fs_is_exe(std::string path)
bool fs_is_exe(std::string_view path)
{

fs::path p(path);
Expand Down

0 comments on commit e371232

Please sign in to comment.