Skip to content

Commit de49e33

Browse files
committed
clang 9 compilation fixes
Signed-off-by: Rosen Penev <[email protected]>
1 parent 513b1b0 commit de49e33

File tree

5 files changed

+22
-24
lines changed

5 files changed

+22
-24
lines changed

src/http.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,6 @@ static Exiv2::Dictionary stringToDict(const std::string& s) {
112112
return result;
113113
}
114114

115-
static int makeNonBlocking(auto sockfd) {
116-
#if defined(_WIN32)
117-
ULONG ioctl_opt = 1;
118-
return ioctlsocket(sockfd, FIONBIO, &ioctl_opt);
119-
#else
120-
int result = fcntl(sockfd, F_SETFL, O_NONBLOCK);
121-
return result >= 0 ? result : SOCKET_ERROR;
122-
#endif
123-
}
124-
125115
int Exiv2::http(Exiv2::Dictionary& request, Exiv2::Dictionary& response, std::string& errors) {
126116
request.try_emplace("verb", "GET");
127117
request.try_emplace("header");
@@ -212,7 +202,15 @@ int Exiv2::http(Exiv2::Dictionary& request, Exiv2::Dictionary& response, std::st
212202
freeaddrinfo(r);
213203
}
214204

215-
makeNonBlocking(sockfd);
205+
[](auto sockfd) {
206+
#if defined(_WIN32)
207+
ULONG ioctl_opt = 1;
208+
return ioctlsocket(sockfd, FIONBIO, &ioctl_opt);
209+
#else
210+
int result = fcntl(sockfd, F_SETFL, O_NONBLOCK);
211+
return result >= 0 ? result : SOCKET_ERROR;
212+
#endif
213+
}(sockfd);
216214

217215
////////////////////////////////////
218216
// and connect

src/tiffcomposite_int.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "basicio.hpp"
88
#include "enforce.hpp"
99
#include "error.hpp"
10+
#include "image_int.hpp"
1011
#include "makernote_int.hpp"
1112
#include "safe_op.hpp"
1213
#include "sonymn_int.hpp"
@@ -737,9 +738,9 @@ size_t TiffMnEntry::doCount() const {
737738
// Count of IFD makernote in tag Exif.Photo.MakerNote is the size of the
738739
// Makernote in bytes
739740
if (tiffType() != ttUndefined && tiffType() != ttUnsignedByte && tiffType() != ttSignedByte) {
740-
EXV_ERROR << "Makernote entry 0x" << std::setw(4) << std::setfill('0') << std::hex << tag()
741-
<< " has incorrect Exif (TIFF) type " << std::dec << tiffType()
742-
<< ". (Expected signed or unsigned byte.)\n";
741+
EXV_ERROR << stringFormat(
742+
"Makernote entry 0x{:04x} has incorrect Exif (TIFF) type {}. (Expected signed or unsigned byte.)\n", tag(),
743+
static_cast<uint16_t>(tiffType()));
743744
}
744745
#endif
745746
return mn_->size();
@@ -760,8 +761,8 @@ size_t TiffBinaryArray::doCount() const {
760761
size_t typeSize = TypeInfo::typeSize(typeId);
761762
if (0 == typeSize) {
762763
#ifndef SUPPRESS_WARNINGS
763-
EXV_WARNING << "Directory " << groupName(group()) << ", entry 0x" << std::setw(4) << std::setfill('0') << std::hex
764-
<< tag() << " has unknown Exif (TIFF) type " << std::dec << tiffType() << "; setting type size 1.\n";
764+
EXV_WARNING << stringFormat("Directory {}, entry 0x{:04x} has unknown Exif (TIFF) type {}; setting type size 1.\n",
765+
groupName(group()), tag(), static_cast<uint16_t>(tiffType()));
765766
#endif
766767
typeSize = 1;
767768
}

src/tiffimage_int.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2195,7 +2195,7 @@ DataBuf TiffHeaderBase::write() const {
21952195
return buf;
21962196
}
21972197

2198-
void TiffHeaderBase::print(std::ostream& os, std::string_view prefix) const {
2198+
void TiffHeaderBase::print(std::ostream& os, const char* prefix) const {
21992199
os << stringFormat("{}{} = 0x{:08x}", prefix, _("TIFF header, offset"), offset_);
22002200

22012201
switch (byteOrder_) {

src/tiffimage_int.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class TiffHeaderBase {
7575
@param os Output stream to write to.
7676
@param prefix Prefix to be written before each line of output.
7777
*/
78-
virtual void print(std::ostream& os, std::string_view prefix = "") const;
78+
virtual void print(std::ostream& os, const char* prefix = "") const;
7979
//! Return the byte order (little or big endian).
8080
[[nodiscard]] virtual ByteOrder byteOrder() const;
8181
//! Return the offset to the start of the root directory.

src/tiffvisitor_int.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,19 +1241,18 @@ void TiffReader::readTiffEntry(TiffEntryBase* object) {
12411241
size_t typeSize = TypeInfo::typeSize(typeId);
12421242
if (0 == typeSize) {
12431243
#ifndef SUPPRESS_WARNINGS
1244-
EXV_WARNING << "Directory " << groupName(object->group()) << ", entry 0x" << std::setw(4) << std::setfill('0')
1245-
<< std::hex << object->tag() << " has unknown Exif (TIFF) type " << std::dec << tiffType
1246-
<< "; setting type size 1.\n";
1244+
EXV_WARNING << stringFormat(
1245+
"Directory {}, entry 0x{:04x} has unknown Exif (TIFF) type {}; setting type size 1.\n",
1246+
groupName(object->group()), object->tag(), static_cast<uint16_t>(tiffType));
12471247
#endif
12481248
typeSize = 1;
12491249
}
12501250
p += 2;
12511251
uint32_t count = getULong(p, byteOrder());
12521252
if (count >= 0x10000000) {
12531253
#ifndef SUPPRESS_WARNINGS
1254-
EXV_ERROR << "Directory " << groupName(object->group()) << ", entry 0x" << std::setw(4) << std::setfill('0')
1255-
<< std::hex << object->tag() << " has invalid size " << std::dec << count << "*" << typeSize
1256-
<< "; skipping entry.\n";
1254+
EXV_ERROR << stringFormat("Directory {}, entry 0x{:04x} has invalid size {}*{}; skipping entry.\n",
1255+
groupName(object->group()), object->tag(), count, typeSize);
12571256
#endif
12581257
return;
12591258
}

0 commit comments

Comments
 (0)