Skip to content

Commit

Permalink
clang-format adjustments for version 18
Browse files Browse the repository at this point in the history
This is preparation to add compatibility with previous versions.

Signed-off-by: Rosen Penev <[email protected]>
  • Loading branch information
neheb committed Aug 13, 2024
1 parent 85518e3 commit 872336c
Show file tree
Hide file tree
Showing 27 changed files with 88 additions and 123 deletions.
3 changes: 1 addition & 2 deletions app/actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1688,8 +1688,7 @@ std::string temporaryPath() {

int metacopy(const std::string& source, const std::string& tgt, Exiv2::ImageType targetType, bool preserve) {
#ifdef EXIV2_DEBUG_MESSAGES
std::cerr << "actions.cpp::metacopy"
<< " source = " << source << " target = " << tgt << '\n';
std::cerr << "actions.cpp::metacopy source = " << source << " target = " << tgt << '\n';
#endif

// read the source metadata
Expand Down
2 changes: 1 addition & 1 deletion include/exiv2/datasets.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct EXIV2API DataSet {
TypeId type_; //!< Exiv2 default type
uint16_t recordId_; //!< Record id
const char* photoshop_; //!< Photoshop string
}; // struct DataSet
};

//! IPTC dataset reference, implemented as a static class.
class EXIV2API IptcDataSets {
Expand Down
5 changes: 2 additions & 3 deletions include/exiv2/matroskavideo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@ struct MatroskaTag {
return _process == Composite;
}
void dump(std::ostream& os) const {
os << " MatroskaTag "
<< " id: [0x" << std::hex << _id << "] label:[" << _label << "] type:[" << _type << "] process :[" << _process
<< "]\n";
os << " MatroskaTag id: [0x" << std::hex << _id << "] label:[" << _label << "] type:[" << _type << "] process :["
<< _process << "]\n";
}
};
} // namespace Internal
Expand Down
2 changes: 1 addition & 1 deletion include/exiv2/tags.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ struct EXIV2API TagInfo {
TypeId typeId_; //!< Type id
int16_t count_; //!< The number of values (not bytes!), 0=any, -1=count not known.
PrintFct printFct_; //!< Pointer to tag print function
}; // struct TagInfo
};

//! Access to Exif group and tag lists and misc. tag reference methods, implemented as a static class.
class EXIV2API ExifTags {
Expand Down
2 changes: 1 addition & 1 deletion include/exiv2/value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ class EXIV2API CommentValue : public StringValueBase {
CharsetId charsetId_; //!< Charset id
const char* name_; //!< Name of the charset
const char* code_; //!< Code of the charset
}; // struct CharsetTable
};

//! Charset information lookup functions. Implemented as a static class.
class EXIV2API CharsetInfo {
Expand Down
3 changes: 1 addition & 2 deletions samples/easyaccess-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ static void printFct(EasyAccessFct fct, Exiv2::ExifData ed, const char* label) {
if (pos != ed.end()) {
std::cout << " (" << std::setw(35) << pos->key() << ") : " << pos->print(&ed) << "\n";
} else {
std::cout << " (" << std::setw(35) << " "
<< ") : \n";
std::cout << " (" << std::setw(35) << " ) : \n";
}
}

Expand Down
10 changes: 5 additions & 5 deletions samples/exifdata-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ void print(const std::string& file) {
Exiv2::ExifData& ed = image->exifData();
auto end = ed.end();
for (auto i = ed.begin(); i != end; ++i) {
std::cout << std::setw(45) << std::setfill(' ') << std::left << i->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right << std::hex << i->tag() << " " << std::setw(12)
<< std::setfill(' ') << std::left << i->ifdName() << " " << std::setw(9) << std::setfill(' ') << std::left
<< i->typeName() << " " << std::dec << std::setw(3) << std::setfill(' ') << std::right << i->count()
<< " " << std::dec << i->toString() << "\n";
std::cout << std::setw(45) << std::setfill(' ') << std::left << i->key() << " 0x" << std::setw(4)
<< std::setfill('0') << std::right << std::hex << i->tag() << " " << std::setw(12) << std::setfill(' ')
<< std::left << i->ifdName() << " " << std::setw(9) << std::setfill(' ') << std::left << i->typeName()
<< " " << std::dec << std::setw(3) << std::setfill(' ') << std::right << i->count() << " " << std::dec
<< i->toString() << "\n";
}
}
14 changes: 6 additions & 8 deletions samples/exifprint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,10 @@ int main(int argc, char* const argv[]) {
for (auto i = exifData.begin(); i != end; ++i) {
if (!bLint) {
const char* tn = i->typeName();
std::cout << std::setw(44) << std::setfill(' ') << std::left << i->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right << std::hex << i->tag() << " "
<< std::setw(9) << std::setfill(' ') << std::left << (tn ? tn : "Unknown") << " " << std::dec
<< std::setw(3) << std::setfill(' ') << std::right << i->count() << " " << std::dec << i->toString()
<< "\n";
std::cout << std::setw(45) << std::setfill(' ') << std::left << i->key() << " 0x" << std::setw(4)
<< std::setfill('0') << std::right << std::hex << i->tag() << " " << std::setw(9) << std::setfill(' ')
<< std::left << (tn ? tn : "Unknown") << " " << std::dec << std::setw(3) << std::setfill(' ')
<< std::right << i->count() << " " << std::dec << i->toString() << "\n";
} else {
const Exiv2::TagInfo* tagInfo = findTag(Exiv2::ExifTags::tagList(i->groupName()), i->tag());
if (tagInfo) {
Expand All @@ -95,9 +94,8 @@ int main(int argc, char* const argv[]) {
&& (shortLong.find(i->key()) == shortLong.end() ||
(type != Exiv2::unsignedShort && type != Exiv2::unsignedLong)) // can be short or long!
) {
std::cerr << i->key() << " type " << i->typeName() << " (" << type << ")"
<< " expected " << Exiv2::TypeInfo::typeName(tagInfo->typeId_) << " (" << tagInfo->typeId_ << ")"
<< '\n';
std::cerr << i->key() << " type " << i->typeName() << " (" << type << ") expected "
<< Exiv2::TypeInfo::typeName(tagInfo->typeId_) << " (" << tagInfo->typeId_ << ")" << '\n';
rc = 2;
}
}
Expand Down
9 changes: 3 additions & 6 deletions samples/getopt-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,19 @@ class Params : public Util::Getopt {
*/
int getopt(int argc, char** const argv) {
int rc = Util::Getopt::getopt(argc, argv, ::optstring);
std::cout << "Params::getopt()"
<< " rc = " << rc << '\n';
std::cout << "Params::getopt() rc = " << rc << '\n';
return rc;
}

//! Handle options and their arguments.
int option(int opt, const std::string& optarg, int optopt) override {
std::cout << "Params::option()"
<< " opt = " << opt << " optarg = " << optarg << " optopt = " << optopt << '\n';
std::cout << "Params::option() opt = " << opt << " optarg = " << optarg << " optopt = " << optopt << '\n';
return 0;
}

//! Handle non-option parameters.
int nonoption(const std::string& argv) override {
std::cout << "Params::nonoption()"
<< " " << argv << '\n';
std::cout << "Params::nonoption() " << argv << '\n';
return 0;
}
}; // class Params
Expand Down
3 changes: 1 addition & 2 deletions samples/ini-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ int main() {
std::cerr << "Can't load '" << ini << "'" << '\n';
return EXIT_FAILURE;
}
std::cout << "Config loaded from : '" << ini << "' "
<< "version=" << reader.GetInteger("protocol", "version", -1)
std::cout << "Config loaded from : '" << ini << "' version=" << reader.GetInteger("protocol", "version", -1)
<< ", name=" << reader.Get("user", "name", "UNKNOWN")
<< ", email=" << reader.Get("user", "email", "UNKNOWN") << ", pi=" << reader.GetReal("user", "pi", -1)
<< ", active=" << reader.GetBoolean("user", "active", true) << '\n';
Expand Down
8 changes: 4 additions & 4 deletions samples/iptcprint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ int main(int argc, char* const argv[]) try {

auto end = iptcData.end();
for (auto md = iptcData.begin(); md != end; ++md) {
std::cout << std::setw(44) << std::setfill(' ') << std::left << md->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right << std::hex << md->tag() << " " << std::setw(9)
<< std::setfill(' ') << std::left << md->typeName() << " " << std::dec << std::setw(3)
<< std::setfill(' ') << std::right << md->count() << " " << std::dec << md->value() << '\n';
std::cout << std::setw(44) << std::setfill(' ') << std::left << md->key() << " 0x" << std::setw(4)
<< std::setfill('0') << std::right << std::hex << md->tag() << " " << std::setw(9) << std::setfill(' ')
<< std::left << md->typeName() << " " << std::dec << std::setw(3) << std::setfill(' ') << std::right
<< md->count() << " " << std::dec << md->value() << '\n';
}

return EXIT_SUCCESS;
Expand Down
3 changes: 1 addition & 2 deletions samples/prevtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ int main(int argc, char* const argv[]) try {
Exiv2::PreviewPropertiesList list = loader.getPreviewProperties();
for (auto&& pos : list) {
std::cout << pos.mimeType_ << " preview, type " << pos.id_ << ", " << pos.size_ << " bytes, " << pos.width_ << 'x'
<< pos.height_ << " pixels"
<< "\n";
<< pos.height_ << " pixels\n";

Exiv2::PreviewImage preview = loader.getPreviewImage(pos);
auto s = preview.writeFile(filename + "_" + std::to_string(pos.width_) + "x" + std::to_string(pos.height_));
Expand Down
9 changes: 4 additions & 5 deletions samples/remotetest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@ int main(int argc, char* const argv[]) {
auto end = exifReadData.end();
for (auto i = exifReadData.begin(); i != end; ++i) {
const char* tn = i->typeName();
std::cout << std::setw(44) << std::setfill(' ') << std::left << i->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right << std::hex << i->tag() << " "
<< std::setw(9) << std::setfill(' ') << std::left << (tn ? tn : "Unknown") << " " << std::dec
<< std::setw(3) << std::setfill(' ') << std::right << i->count() << " " << std::dec << i->value()
<< "\n";
std::cout << std::setw(44) << std::setfill(' ') << std::left << i->key() << " 0x" << std::setw(4)
<< std::setfill('0') << std::right << std::hex << i->tag() << " " << std::setw(9) << std::setfill(' ')
<< std::left << (tn ? tn : "Unknown") << " " << std::dec << std::setw(3) << std::setfill(' ')
<< std::right << i->count() << " " << std::dec << i->value() << "\n";
}

// del, reset the metadata
Expand Down
8 changes: 4 additions & 4 deletions samples/tiff-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ void print(const ExifData& exifData) {
}
auto end = exifData.end();
for (auto i = exifData.begin(); i != end; ++i) {
std::cout << std::setw(44) << std::setfill(' ') << std::left << i->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right << std::hex << i->tag() << " " << std::setw(9)
<< std::setfill(' ') << std::left << i->typeName() << " " << std::dec << std::setw(3) << std::setfill(' ')
<< std::right << i->count() << " " << std::dec << i->value() << "\n";
std::cout << std::setw(44) << std::setfill(' ') << std::left << i->key() << " 0x" << std::setw(4)
<< std::setfill('0') << std::right << std::hex << i->tag() << " " << std::setw(9) << std::setfill(' ')
<< std::left << i->typeName() << " " << std::dec << std::setw(3) << std::setfill(' ') << std::right
<< i->count() << " " << std::dec << i->value() << "\n";
}
}
8 changes: 4 additions & 4 deletions samples/write-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ void testCase(const std::string& file1, const std::string& file2, const std::str
void exifPrint(const ExifData& exifData) {
auto i = exifData.begin();
for (; i != exifData.end(); ++i) {
std::cout << std::setw(44) << std::setfill(' ') << std::left << i->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right << std::hex << i->tag() << " " << std::setw(9)
<< std::setfill(' ') << std::left << i->typeName() << " " << std::dec << std::setw(3) << std::setfill(' ')
<< std::right << i->count() << " " << std::dec << i->value() << "\n";
std::cout << std::setw(44) << std::setfill(' ') << std::left << i->key() << " 0x" << std::setw(4)
<< std::setfill('0') << std::right << std::hex << i->tag() << " " << std::setw(9) << std::setfill(' ')
<< std::left << i->typeName() << " " << std::dec << std::setw(3) << std::setfill(' ') << std::right
<< i->count() << " " << std::dec << i->value() << "\n";
}
}
10 changes: 2 additions & 8 deletions src/basicio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1482,10 +1482,7 @@ void HttpIo::HttpImpl::writeRemote(const byte* data, size_t size, size_t from, s
const std::string urlencodeData = urlencode(encodeData.data());

std::stringstream ss;
ss << "path=" << hostInfo_.Path << "&"
<< "from=" << from << "&"
<< "to=" << to << "&"
<< "data=" << urlencodeData;
ss << "path=" << hostInfo_.Path << "&from=" << from << "&to=" << to << "&data=" << urlencodeData;
std::string postData = ss.str();

// create the header
Expand Down Expand Up @@ -1664,10 +1661,7 @@ void CurlIo::CurlImpl::writeRemote(const byte* data, size_t size, size_t from, s
// url encode
const std::string urlencodeData = urlencode(encodeData.data());
std::stringstream ss;
ss << "path=" << hostInfo.Path << "&"
<< "from=" << from << "&"
<< "to=" << to << "&"
<< "data=" << urlencodeData;
ss << "path=" << hostInfo.Path << "&from=" << from << "&to=" << to << "&data=" << urlencodeData;
std::string postData = ss.str();

curl_easy_setopt(curl_, CURLOPT_POSTFIELDS, postData.c_str());
Expand Down
4 changes: 2 additions & 2 deletions src/bmffimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ std::string BmffImage::toAscii(uint32_t n) {
// show 0 as _
std::replace(result.begin(), result.end(), '\0', '_');
// show non 7-bit printable ascii as .
std::replace_if(
result.begin(), result.end(), [](char c) { return c < 32 || c > 126; }, '.');
auto f = [](char c) { return c < 32 || c > 126; };
std::replace_if(result.begin(), result.end(), f, '.');
return result;
}

Expand Down
15 changes: 5 additions & 10 deletions src/convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1051,8 +1051,7 @@ void Converter::cnvXmpFlash(const char* from, const char* to) {
value |= fired & 1;
#ifndef SUPPRESS_WARNINGS
else
EXV_WARNING << "Failed to convert " << std::string(from) + "/exif:Fired"
<< " to " << to << "\n";
EXV_WARNING << "Failed to convert " << std::string(from) + "/exif:Fired to " << to << "\n";
#endif
}
pos = xmpData_->findKey(XmpKey(std::string(from) + "/exif:Return"));
Expand All @@ -1062,8 +1061,7 @@ void Converter::cnvXmpFlash(const char* from, const char* to) {
value |= (ret & 3) << 1;
#ifndef SUPPRESS_WARNINGS
else
EXV_WARNING << "Failed to convert " << std::string(from) + "/exif:Return"
<< " to " << to << "\n";
EXV_WARNING << "Failed to convert " << std::string(from) + "/exif:Return to " << to << "\n";
#endif
}
pos = xmpData_->findKey(XmpKey(std::string(from) + "/exif:Mode"));
Expand All @@ -1073,8 +1071,7 @@ void Converter::cnvXmpFlash(const char* from, const char* to) {
value |= (mode & 3) << 3;
#ifndef SUPPRESS_WARNINGS
else
EXV_WARNING << "Failed to convert " << std::string(from) + "/exif:Mode"
<< " to " << to << "\n";
EXV_WARNING << "Failed to convert " << std::string(from) + "/exif:Mode to " << to << "\n";
#endif
}
pos = xmpData_->findKey(XmpKey(std::string(from) + "/exif:Function"));
Expand All @@ -1084,8 +1081,7 @@ void Converter::cnvXmpFlash(const char* from, const char* to) {
value |= (function & 1) << 5;
#ifndef SUPPRESS_WARNINGS
else
EXV_WARNING << "Failed to convert " << std::string(from) + "/exif:Function"
<< " to " << to << "\n";
EXV_WARNING << "Failed to convert " << std::string(from) + "/exif:Function to " << to << "\n";
#endif
}
pos = xmpData_->findKey(XmpKey(std::string(from) + "/exif:RedEyeMode"));
Expand All @@ -1096,8 +1092,7 @@ void Converter::cnvXmpFlash(const char* from, const char* to) {
value |= (red & 1) << 6;
#ifndef SUPPRESS_WARNINGS
else
EXV_WARNING << "Failed to convert " << std::string(from) + "/exif:RedEyeMode"
<< " to " << to << "\n";
EXV_WARNING << "Failed to convert " << std::string(from) + "/exif:RedEyeMode to " << to << "\n";
#endif
}
if (erase_)
Expand Down
11 changes: 5 additions & 6 deletions src/datasets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,12 +590,11 @@ void IptcKey::makeKey() {
std::ostream& operator<<(std::ostream& os, const DataSet& dataSet) {
std::ios::fmtflags f(os.flags());
IptcKey iptcKey(dataSet.number_, dataSet.recordId_);
os << dataSet.name_ << ", " << std::dec << dataSet.number_ << ", "
<< "0x" << std::setw(4) << std::setfill('0') << std::right << std::hex << dataSet.number_ << ", "
<< IptcDataSets::recordName(dataSet.recordId_) << ", " << std::boolalpha << dataSet.mandatory_ << ", "
<< dataSet.repeatable_ << ", " << std::dec << dataSet.minbytes_ << ", " << dataSet.maxbytes_ << ", "
<< iptcKey.key() << ", " << TypeInfo::typeName(IptcDataSets::dataSetType(dataSet.number_, dataSet.recordId_))
<< ", ";
os << dataSet.name_ << ", " << std::dec << dataSet.number_ << ", 0x" << std::setw(4) << std::setfill('0')
<< std::right << std::hex << dataSet.number_ << ", " << IptcDataSets::recordName(dataSet.recordId_) << ", "
<< std::boolalpha << dataSet.mandatory_ << ", " << dataSet.repeatable_ << ", " << std::dec << dataSet.minbytes_
<< ", " << dataSet.maxbytes_ << ", " << iptcKey.key() << ", "
<< TypeInfo::typeName(IptcDataSets::dataSetType(dataSet.number_, dataSet.recordId_)) << ", ";
// CSV encoded I am \"dead\" beat" => "I am ""dead"" beat"
char Q = '"';
os << Q;
Expand Down
14 changes: 10 additions & 4 deletions src/fff.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ be considered as real pixels */
unsigned char stripeFields; //!< Number of striped fields this image consists of
unsigned char reserved; //!< For future use - should be set to 0
unsigned short reserved1; //!< For future use - should be set to 0
} GEOMETRIC_INFO_T; //!< sizeof struct == 32 bytes

} GEOMETRIC_INFO_T; //!< sizeof struct == 32 bytes

struct IMAGEINFO_T {
unsigned long imageTime; //!< Time in seconds since 1970-01-01 00:00 (UTC)
Expand Down Expand Up @@ -233,13 +234,15 @@ struct DISTR_DATA_T {

short reserved; //!< For future use
long reserved2[3];

}; //!< sizeof struct == 64 bytes

typedef struct _pres_par_t {
signed long level; /* Level as normalized pixel value (apix), Level is defined as middle of
span (in pixel units) */
signed long span; /* Span as normalized pixel value (apix) */
BYTE reserved[40];

} PRES_PAR_T; /* sizeof struct == 48 bytes */

/**
Expand Down Expand Up @@ -282,7 +285,8 @@ struct OBJECT_PAR_T {

float relHum; //!< relative humidity
long reserved[4]; //!< For future use - should be set to 0
}; //!< sizeof struct == 48 bytes

}; //!< sizeof struct == 48 bytes

struct TEMP_CALIB_T {
long Reserved1[2];
Expand Down Expand Up @@ -344,7 +348,8 @@ struct TEMPSENSOR_DATA_T {
char pzTSName[SYSIMG_NAMELEN + 1];
ULONG captureTime; //!< TS updated; time in seconds since 1970-01-01 00:00
ULONG captureMilliTime; //!< TS updated; Milliseconds since last second
}; //!< sizeof struct == 28 bytes

}; //!< sizeof struct == 28 bytes

/** Detector parameter struct */
struct DETECTOR_PARAM_T {
Expand All @@ -360,7 +365,8 @@ struct EXTENDED_IMAGEINFO_T {
DETECTOR_PARAM_T detectorPars[20]; //!< Currently used detector parameters like
//! used bias, offsets. Usage is camera
//! dependent
}; //!< sizeof struct == 960 bytes

}; //!< sizeof struct == 960 bytes

struct _bidata_t {
GEOMETRIC_INFO_T GeometricInfo; // 32 bytes
Expand Down
Loading

0 comments on commit 872336c

Please sign in to comment.