From 394859f980cf571f56bc4f76e2434d7eb1812e3b Mon Sep 17 00:00:00 2001 From: Arnau Rossello Date: Fri, 2 Jan 2015 17:21:47 +0000 Subject: [PATCH 1/2] Fixed compile warnings on clang --- src/FileUtils.cpp | 2 +- src/UpdateDialogGtkFactory.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/FileUtils.cpp b/src/FileUtils.cpp index 03f033c..302c759 100644 --- a/src/FileUtils.cpp +++ b/src/FileUtils.cpp @@ -111,7 +111,7 @@ int FileUtils::fileMode(const char* path) throw (IOException) { throw IOException("Error reading file permissions for " + std::string(path)); } - return fileInfo.st_mode; + return *reinterpret_cast(&fileInfo.st_mode); #else // not implemented for Windows return 0; diff --git a/src/UpdateDialogGtkFactory.cpp b/src/UpdateDialogGtkFactory.cpp index c62e129..813509b 100644 --- a/src/UpdateDialogGtkFactory.cpp +++ b/src/UpdateDialogGtkFactory.cpp @@ -35,8 +35,9 @@ UpdateDialogGtk* (*update_dialog_gtk_new)() = 0; bool extractFileFromBinary(int fd, const void* buffer, size_t length) { - size_t count = write(fd,buffer,length); - return count >= length; + ssize_t count = write(fd,buffer,length); + if(count < 0) return false; + return static_cast(count) >= length; } UpdateDialog* UpdateDialogGtkFactory::createDialog() From e97a816574840103aa47c754ccb2d59f592dbd20 Mon Sep 17 00:00:00 2001 From: Arnau Rossello Date: Mon, 5 Jan 2015 10:39:43 +0000 Subject: [PATCH 2/2] Fixed notes from PR --- src/UpdateDialogGtkFactory.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/UpdateDialogGtkFactory.cpp b/src/UpdateDialogGtkFactory.cpp index 813509b..aade193 100644 --- a/src/UpdateDialogGtkFactory.cpp +++ b/src/UpdateDialogGtkFactory.cpp @@ -36,7 +36,10 @@ UpdateDialogGtk* (*update_dialog_gtk_new)() = 0; bool extractFileFromBinary(int fd, const void* buffer, size_t length) { ssize_t count = write(fd,buffer,length); - if(count < 0) return false; + if(count < 0) + { + return false; + } return static_cast(count) >= length; }