Skip to content

Commit

Permalink
ssize_t is not defined on Windows.
Browse files Browse the repository at this point in the history
And anyway the argument is storing the output `std::string::size` which is a `size_t`
  • Loading branch information
mgautierfr committed Aug 26, 2024
1 parent 048af29 commit 876705c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/zimdump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ int ZimDumper::listEntriesByNamespace(const std::string ns, bool details)
return ret;
}

void write_to_error_directory(const std::string& base, const std::string relpath, const char *content, ssize_t size)
void write_to_error_directory(const std::string& base, const std::string relpath, const char *content, size_t size)

Check warning on line 232 in src/zimdump.cpp

View check run for this annotation

Codecov / codecov/patch

src/zimdump.cpp#L232

Added line #L232 was not covered by tests
{
createdir(ERRORSDIR, base);
std::string url = relpath;
Expand Down Expand Up @@ -266,7 +266,7 @@ void write_to_error_directory(const std::string& base, const std::string relpath
#endif
}

inline void write_to_file(const std::string &base, const std::string& path, const char* data, ssize_t size) {
inline void write_to_file(const std::string &base, const std::string& path, const char* data, size_t size) {

Check warning on line 269 in src/zimdump.cpp

View check run for this annotation

Codecov / codecov/patch

src/zimdump.cpp#L269

Added line #L269 was not covered by tests
std::string fullpath = base + path;
#ifdef _WIN32
std::wstring wpath = utf8ToUtf16(fullpath);
Expand All @@ -279,7 +279,7 @@ inline void write_to_file(const std::string &base, const std::string& path, cons
write_to_error_directory(base, path, data, size);
return ;
}
if (write(fd, data, size) != size) {
if ((size_t) write(fd, data, size) != size) {
write_to_error_directory(base, path, data, size);
}
close(fd);
Expand Down

0 comments on commit 876705c

Please sign in to comment.