From 15b06480412b010c9b72e9c734bc79e60e8f8520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Sun, 18 Apr 2021 11:00:41 +0200 Subject: [PATCH] Fix wxReadlink signature to return ssize_t Introduced in 53bd139, wxReadlink() trivially wraps readlink(), but returned int instead of ssize_t as defined for readlink() by POSIX. Fixes "Implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int'" on platforms with sizeof(ssize_t)>sizeof(int). --- include/wx/filefn.h | 2 +- src/common/filename.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/wx/filefn.h b/include/wx/filefn.h index e975ee0022..fe019f9de0 100644 --- a/include/wx/filefn.h +++ b/include/wx/filefn.h @@ -410,7 +410,7 @@ inline int wxOpen(const wxString& path, int flags, mode_t mode) { return wxCRT_Open(path.fn_str(), flags, mode); } #if defined(wxHAS_NATIVE_READLINK) -inline int wxReadlink(const wxString& path, char* buf, int size) +inline ssize_t wxReadlink(const wxString& path, char* buf, int size) { return wxCRT_Readlink(path.fn_str(), buf, size); } #endif diff --git a/src/common/filename.cpp b/src/common/filename.cpp index d10ae513c2..e5e9ec39ca 100644 --- a/src/common/filename.cpp +++ b/src/common/filename.cpp @@ -1698,7 +1698,7 @@ wxFileName wxFileName::ResolveLink() bufSize = st.st_size + 1; char buf[bufSize]; - int result = wxReadlink(link, buf, bufSize - 1); + ssize_t result = wxReadlink(link, buf, bufSize - 1); if ( result != -1 ) {