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 175f745
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 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)
{
createdir(ERRORSDIR, base);
std::string url = relpath;
Expand All @@ -247,7 +247,7 @@ void write_to_error_directory(const std::string& base, const std::string relpath
std::cerr << "Error opening file " + fullpath + " cause: " + ::strerror(errno) << std::endl;
return ;
}
if (write(fd, content, size) != size) {
if ((size_t) write(fd, content, size) != size) {
close(fd);
std::cerr << "Failed writing: " << fullpath << " - " << ::strerror(errno) << std::endl;
}
Expand All @@ -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) {
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 175f745

Please sign in to comment.