clang-tidy: don't use else after return

Found with llvm-else-after-return

Signed-off-by: Rosen Penev <rosenp@gmail.com>
main
Rosen Penev 4 years ago committed by Luis Díaz Más
parent f956a398ad
commit fdf9d3799c

@ -62,7 +62,8 @@ try {
exv_grep_keys_t keys; exv_grep_keys_t keys;
Exiv2::dumpLibraryInfo(std::cout,keys); Exiv2::dumpLibraryInfo(std::cout,keys);
return 0; return 0;
} else if ( _tstrcmp(file,_t("--version-test")) == 0 ) { }
if (_tstrcmp(file, _t("--version-test")) == 0) {
// verifies/test macro EXIV2_TEST_VERSION // verifies/test macro EXIV2_TEST_VERSION
// described in include/exiv2/version.hpp // described in include/exiv2/version.hpp
std::cout << "EXV_PACKAGE_VERSION " << EXV_PACKAGE_VERSION << std::endl std::cout << "EXV_PACKAGE_VERSION " << EXV_PACKAGE_VERSION << std::endl

@ -104,7 +104,8 @@ Jzon::Node& addToTree(Jzon::Node& r1,Token token)
Jzon::Object& o1 = r1.AsObject(); Jzon::Object& o1 = r1.AsObject();
if ( !o1.Has(key) ) o1.Add(key,empty); if ( !o1.Has(key) ) o1.Add(key,empty);
return o1.Get(key); return o1.Get(key);
} else if ( r1.IsArray() ) { }
if (r1.IsArray()) {
Jzon::Array& a1 = r1.AsArray(); Jzon::Array& a1 = r1.AsArray();
while ( a1.GetCount() <= index ) a1.Add(empty); while ( a1.GetCount() <= index ) a1.Add(empty);
return a1.Get(index); return a1.Get(index);

@ -2315,12 +2315,11 @@ namespace Exiv2 {
if(res != CURLE_OK) { if(res != CURLE_OK) {
throw Error(kerErrorMessage, curl_easy_strerror(res)); throw Error(kerErrorMessage, curl_easy_strerror(res));
} else { }
int serverCode; int serverCode;
curl_easy_getinfo (curl_, CURLINFO_RESPONSE_CODE, &serverCode); // get code curl_easy_getinfo(curl_, CURLINFO_RESPONSE_CODE, &serverCode); // get code
if (serverCode >= 400 || serverCode < 0) { if (serverCode >= 400 || serverCode < 0) {
throw Error(kerFileOpenFailed, "http",Exiv2::Internal::stringFormat("%d",serverCode),path_); throw Error(kerFileOpenFailed, "http", Exiv2::Internal::stringFormat("%d", serverCode), path_);
}
} }
} }
@ -2367,12 +2366,11 @@ namespace Exiv2 {
if(res != CURLE_OK) { if(res != CURLE_OK) {
throw Error(kerErrorMessage, curl_easy_strerror(res)); throw Error(kerErrorMessage, curl_easy_strerror(res));
} else { }
int serverCode; int serverCode;
curl_easy_getinfo (curl_, CURLINFO_RESPONSE_CODE, &serverCode); curl_easy_getinfo(curl_, CURLINFO_RESPONSE_CODE, &serverCode);
if (serverCode >= 400 || serverCode < 0) { if (serverCode >= 400 || serverCode < 0) {
throw Error(kerFileOpenFailed, "http",Exiv2::Internal::stringFormat("%d",serverCode),path_); throw Error(kerFileOpenFailed, "http", Exiv2::Internal::stringFormat("%d", serverCode), path_);
}
} }
} }
@ -2384,18 +2382,16 @@ namespace Exiv2 {
{ {
if (p_->protocol_ == pHttp || p_->protocol_ == pHttps) { if (p_->protocol_ == pHttp || p_->protocol_ == pHttps) {
return RemoteIo::write(data, wcount); return RemoteIo::write(data, wcount);
} else {
throw Error(kerErrorMessage, "doesnt support write for this protocol.");
} }
throw Error(kerErrorMessage, "doesnt support write for this protocol.");
} }
long CurlIo::write(BasicIo& src) long CurlIo::write(BasicIo& src)
{ {
if (p_->protocol_ == pHttp || p_->protocol_ == pHttps) { if (p_->protocol_ == pHttp || p_->protocol_ == pHttps) {
return RemoteIo::write(src); return RemoteIo::write(src);
} else {
throw Error(kerErrorMessage, "doesnt support write for this protocol.");
} }
throw Error(kerErrorMessage, "doesnt support write for this protocol.");
} }
CurlIo::CurlIo(const std::string& url, size_t blockSize) CurlIo::CurlIo(const std::string& url, size_t blockSize)

@ -1230,7 +1230,6 @@ namespace Exiv2 {
writeExifDigest(); writeExifDigest();
return; return;
} }
else {
// We have both digests and the values do not match // We have both digests and the values do not match
// Exif was modified after XMP, we should update XMP // Exif was modified after XMP, we should update XMP
setOverwrite(true); setOverwrite(true);
@ -1240,8 +1239,6 @@ namespace Exiv2 {
writeExifDigest(); writeExifDigest();
return; return;
} }
}
else {
// We don't have both digests, it is probably the first conversion to XMP // We don't have both digests, it is probably the first conversion to XMP
setOverwrite(false); // to be safe setOverwrite(false); // to be safe
setErase(false); setErase(false);
@ -1250,7 +1247,6 @@ namespace Exiv2 {
writeExifDigest(); writeExifDigest();
return; return;
} }
}
std::string Converter::computeIptcDigest() std::string Converter::computeIptcDigest()
{ {

@ -401,7 +401,8 @@ namespace {
EXV_WARNING << "Nested document at invalid position: " << startPos << "\n"; EXV_WARNING << "Nested document at invalid position: " << startPos << "\n";
#endif #endif
throw Error(write ? kerImageWriteFailed : kerFailedToReadImageData); throw Error(write ? kerImageWriteFailed : kerFailedToReadImageData);
} else if (startsWith(line, "%%BeginDocument:")) { }
if (startsWith(line, "%%BeginDocument:")) {
if (depth == maxDepth) { if (depth == maxDepth) {
#ifndef SUPPRESS_WARNINGS #ifndef SUPPRESS_WARNINGS
EXV_WARNING << "Document too deeply nested at position: " << startPos << "\n"; EXV_WARNING << "Document too deeply nested at position: " << startPos << "\n";
@ -418,11 +419,11 @@ namespace {
} }
depth--; depth--;
} else { } else {
#ifdef DEBUG #ifdef DEBUG
significantLine = false; significantLine = false;
#endif #endif
} }
#ifdef DEBUG #ifdef DEBUG
if (significantLine) { if (significantLine) {
EXV_DEBUG << "readWriteEpsMetadata: Found significant line \"" << line << "\" at position: " << startPos << "\n"; EXV_DEBUG << "readWriteEpsMetadata: Found significant line \"" << line << "\" at position: " << startPos << "\n";
} }

@ -308,7 +308,7 @@ namespace Exiv2 {
std::string path = url.substr(7); std::string path = url.substr(7);
size_t found = path.find('/'); size_t found = path.find('/');
if (found == std::string::npos) return path; if (found == std::string::npos) return path;
else return path.substr(found); return path.substr(found);
} }
#ifdef EXV_UNICODE_PATH #ifdef EXV_UNICODE_PATH
std::wstring pathOfFileUrl(const std::wstring& wurl) { std::wstring pathOfFileUrl(const std::wstring& wurl) {

@ -69,42 +69,40 @@ namespace Util {
if (arg && strcmp(arg, "--") == 0) { if (arg && strcmp(arg, "--") == 0) {
optind++; optind++;
return -1; return -1;
} else if (!arg || arg[0] != '-' || !isalnum(arg[1])) { }
if (!arg || arg[0] != '-' || !isalnum(arg[1])) {
return -1; return -1;
} else { }
const char *opt = strchr(optstring, arg[optpos]); const char *opt = strchr(optstring, arg[optpos]);
optopt = arg[optpos]; optopt = arg[optpos];
if (!opt) { if (!opt) {
if (opterr && *optstring != ':') if (opterr && *optstring != ':')
fprintf(stderr, "%s: illegal option: %c\n", argv[0], optopt); fprintf(stderr, "%s: illegal option: %c\n", argv[0], optopt);
return '?'; return '?';
} else if (opt[1] == ':') { }
if (opt[1] == ':') {
if (arg[optpos + 1]) { if (arg[optpos + 1]) {
optarg = (char *)arg + optpos + 1; optarg = (char *)arg + optpos + 1;
optind++; optind++;
optpos = 1; optpos = 1;
return optopt; return optopt;
} else if (argv[optind + 1]) { }
if (argv[optind + 1]) {
optarg = (char *)argv[optind + 1]; optarg = (char *)argv[optind + 1];
optind += 2; optind += 2;
optpos = 1; optpos = 1;
return optopt; return optopt;
} else { }
if (opterr && *optstring != ':') if (opterr && *optstring != ':')
fprintf(stderr, fprintf(stderr, "%s: option requires an argument: %c\n", argv[0], optopt);
"%s: option requires an argument: %c\n",
argv[0], optopt);
return *optstring == ':' ? ':' : '?'; return *optstring == ':' ? ':' : '?';
} }
} else {
if (!arg[++optpos]) { if (!arg[++optpos]) {
optind++; optind++;
optpos = 1; optpos = 1;
} }
return optopt; return optopt;
} }
}
}
// ***************************************************************************** // *****************************************************************************
// class Getopt // class Getopt

@ -270,9 +270,8 @@ bool INIReader::GetBoolean(string section, string name, bool default_value)
std::transform(valstr.begin(), valstr.end(), valstr.begin(), ::tolower); std::transform(valstr.begin(), valstr.end(), valstr.begin(), ::tolower);
if (valstr == "true" || valstr == "yes" || valstr == "on" || valstr == "1") if (valstr == "true" || valstr == "yes" || valstr == "on" || valstr == "1")
return true; return true;
else if (valstr == "false" || valstr == "no" || valstr == "off" || valstr == "0") if (valstr == "false" || valstr == "no" || valstr == "off" || valstr == "0")
return false; return false;
else
return default_value; return default_value;
} }

@ -1258,10 +1258,10 @@ namespace Exiv2 {
} }
if (marker == eoi_) { if (marker == eoi_) {
break; break;
} else if (skipApp1Exif == count || skipApp1Xmp == count || }
if (skipApp1Exif == count || skipApp1Xmp == count ||
std::find(skipApp13Ps3.begin(), skipApp13Ps3.end(), count) != skipApp13Ps3.end() || std::find(skipApp13Ps3.begin(), skipApp13Ps3.end(), count) != skipApp13Ps3.end() ||
std::find(skipApp2Icc.begin(), skipApp2Icc.end(), count) != skipApp2Icc.end() || std::find(skipApp2Icc.begin(), skipApp2Icc.end(), count) != skipApp2Icc.end() || skipCom == count) {
skipCom == count) {
--search; --search;
io_->seek(size - bufRead, BasicIo::cur); io_->seek(size - bufRead, BasicIo::cur);
} else { } else {

@ -928,12 +928,13 @@ namespace Exiv2 {
if (size < PentaxDngMnHeader::sizeOfSignature() + 18) if (size < PentaxDngMnHeader::sizeOfSignature() + 18)
return 0; return 0;
return newPentaxDngMn2(tag, group, (tag == 0xc634 ? pentaxDngId:pentaxId)); return newPentaxDngMn2(tag, group, (tag == 0xc634 ? pentaxDngId:pentaxId));
} else if (size > 4 && std::string(reinterpret_cast<const char*>(pData), 4) == std::string("AOC\0", 4)) { }
if (size > 4 && std::string(reinterpret_cast<const char*>(pData), 4) == std::string("AOC\0", 4)) {
// Require at least the header and an IFD with 1 entry // Require at least the header and an IFD with 1 entry
if (size < PentaxMnHeader::sizeOfSignature() + 18) if (size < PentaxMnHeader::sizeOfSignature() + 18)
return 0; return 0;
return newPentaxMn2(tag, group, pentaxId); return newPentaxMn2(tag, group, pentaxId);
} else }
return 0; return 0;
} }
@ -965,13 +966,12 @@ namespace Exiv2 {
if (size < PentaxMnHeader::sizeOfSignature() + 18) return 0; if (size < PentaxMnHeader::sizeOfSignature() + 18) return 0;
return newPentaxMn2(tag, group, pentaxId); return newPentaxMn2(tag, group, pentaxId);
} }
else {
// Genuine Samsung camera: // Genuine Samsung camera:
// Require at least an IFD with 1 entry // Require at least an IFD with 1 entry
if (size < 18) return 0; if (size < 18)
return 0;
return newSamsungMn2(tag, group, mnGroup); return newSamsungMn2(tag, group, mnGroup);
} }
}
TiffComponent* newSamsungMn2(uint16_t tag, TiffComponent* newSamsungMn2(uint16_t tag,
IfdId group, IfdId group,

@ -2620,10 +2620,8 @@ fmountlens[] = {
if (pf->lensname == NULL) { if (pf->lensname == NULL) {
return os << value; return os << value;
} }
else {
return os << pf->manuf << " " << pf->lensname; return os << pf->manuf << " " << pf->lensname;
} }
}
byte raw[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }; byte raw[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 };

@ -1457,8 +1457,6 @@ namespace Exiv2 {
{ 3, N_("Multi AF") }, { 3, N_("Multi AF") },
{ 4, N_("Face detect") }, { 4, N_("Face detect") },
{ 10, N_("MF") }, { 10, N_("MF") },
// End of list marker
{ 0xff, "" }
}; };
static struct { static struct {
uint16_t val; uint16_t val;
@ -1470,39 +1468,37 @@ namespace Exiv2 {
{ 0x0020, N_("Face detect") }, { 0x0020, N_("Face detect") },
{ 0x0040, N_("Imager AF") }, { 0x0040, N_("Imager AF") },
{ 0x0100, N_("AF sensor") }, { 0x0100, N_("AF sensor") },
// End of list marker
{ 0, "" }
}; };
if (value.count() < 1 || value.typeId() != unsignedShort) { if (value.count() < 1 || value.typeId() != unsignedShort) {
return os << "(" << value << ")"; return os << "(" << value << ")";
} else { }
uint16_t v = (uint16_t)value.toLong(0); auto v = (uint16_t)value.toLong(0);
// If value 2 is present, it is used instead of value 1. // If value 2 is present, it is used instead of value 1.
if (value.count() > 1) { if (value.count() > 1) {
std::string p; // Used to enable ',' separation std::string p; // Used to enable ',' separation
v = (uint16_t)value.toLong(1); v = (uint16_t)value.toLong(1);
for (int i = 0; focusModes1[i].val != 0; i++) { for (auto&& mode : focusModes1) {
if ((v & focusModes1[i].val) != 0) { if ((v &mode.val) != 0) {
if (!p.empty()) { if (!p.empty()) {
os << ", "; os << ", ";
} }
p = focusModes1[i].label; p = mode.label;
os << p; os << p;
} }
} }
} else { } else {
for (int i = 0; focusModes0[i].val != 0xff; i++) { for (auto&& mode : focusModes0) {
if (focusModes0[i].val == v) { if (mode.val == v) {
os << focusModes0[i].label; os << mode.label;
break; break;
} }
} }
} }
return os << v; return os << v;
}
} // OlympusMakerNote::printCs0x0301 } // OlympusMakerNote::printCs0x0301
//! OlympusCs ArtFilter, tag 0x0529, OlympusCs MagicFilter, tag 0x052c //! OlympusCs ArtFilter, tag 0x0529, OlympusCs MagicFilter, tag 0x052c

@ -669,10 +669,9 @@ namespace Exiv2 {
}; };
return os; return os;
} }
else
{
return os << value; return os << value;
}; ;
} // PanasonicMakerNote::printPanasonicText } // PanasonicMakerNote::printPanasonicText
// Manometer Pressure // Manometer Pressure

@ -464,7 +464,8 @@ namespace Exiv2 {
if (chunkType == "IEND") { if (chunkType == "IEND") {
return; // Last chunk found: we stop parsing. return; // Last chunk found: we stop parsing.
} else if (chunkType == "IHDR" && chunkData.size_ >= 8) { }
if (chunkType == "IHDR" && chunkData.size_ >= 8) {
PngChunk::decodeIHDRChunk(chunkData, &pixelWidth_, &pixelHeight_); PngChunk::decodeIHDRChunk(chunkData, &pixelWidth_, &pixelHeight_);
} else if (chunkType == "tEXt") { } else if (chunkType == "tEXt") {
PngChunk::decodeTXTChunk(this, chunkData, PngChunk::tEXt_Chunk); PngChunk::decodeTXTChunk(this, chunkData, PngChunk::tEXt_Chunk);
@ -587,12 +588,10 @@ namespace Exiv2 {
throw Error(kerImageWriteFailed); throw Error(kerImageWriteFailed);
return; return;
} }
else if ( !strcmp(szChunk, "eXIf") ) { if (!strcmp(szChunk, "eXIf")) {
; // do nothing Exif metdata is written following IHDR ; // do nothing Exif metdata is written following IHDR
; // as zTXt chunk with signature Raw profile type exif__ ; // as zTXt chunk with signature Raw profile type exif__
} } else if (!strcmp(szChunk, "IHDR")) {
else if ( !strcmp(szChunk, "IHDR") )
{
#ifdef EXIV2_DEBUG_MESSAGES #ifdef EXIV2_DEBUG_MESSAGES
std::cout << "Exiv2::PngImage::doWriteMetadata: Write IHDR chunk (length: " << dataOffset << ")\n"; std::cout << "Exiv2::PngImage::doWriteMetadata: Write IHDR chunk (length: " << dataOffset << ")\n";
#endif #endif
@ -691,12 +690,8 @@ namespace Exiv2 {
throw Error(kerImageWriteFailed); throw Error(kerImageWriteFailed);
} }
} }
} } else if (!strcmp(szChunk, "tEXt") || !strcmp(szChunk, "zTXt") || !strcmp(szChunk, "iTXt") ||
else if (!strcmp(szChunk, "tEXt") || !strcmp(szChunk, "iCCP")) {
!strcmp(szChunk, "zTXt") ||
!strcmp(szChunk, "iTXt") ||
!strcmp(szChunk, "iCCP"))
{
DataBuf key = PngChunk::keyTXTChunk(chunkBuf, true); DataBuf key = PngChunk::keyTXTChunk(chunkBuf, true);
if (compare("Raw profile type exif", key, 21) || if (compare("Raw profile type exif", key, 21) ||
compare("Raw profile type APP1", key, 21) || compare("Raw profile type APP1", key, 21) ||
@ -720,16 +715,13 @@ namespace Exiv2 {
#endif #endif
if (outIo.write(chunkBuf.pData_, chunkBuf.size_) != chunkBuf.size_) throw Error(kerImageWriteFailed); if (outIo.write(chunkBuf.pData_, chunkBuf.size_) != chunkBuf.size_) throw Error(kerImageWriteFailed);
} }
} } else {
else
{
// Write all others chunk as well. // Write all others chunk as well.
#ifdef EXIV2_DEBUG_MESSAGES #ifdef EXIV2_DEBUG_MESSAGES
std::cout << "Exiv2::PngImage::doWriteMetadata: copy " << szChunk std::cout << "Exiv2::PngImage::doWriteMetadata: copy " << szChunk
<< " chunk (length: " << dataOffset << ")" << std::endl; << " chunk (length: " << dataOffset << ")" << std::endl;
#endif #endif
if (outIo.write(chunkBuf.pData_, chunkBuf.size_) != chunkBuf.size_) throw Error(kerImageWriteFailed); if (outIo.write(chunkBuf.pData_, chunkBuf.size_) != chunkBuf.size_) throw Error(kerImageWriteFailed);
} }
} }

@ -473,11 +473,13 @@ namespace {
} }
if (nativePreview_.filter_.empty()) { if (nativePreview_.filter_.empty()) {
return DataBuf(data + nativePreview_.position_, static_cast<long>(nativePreview_.size_)); return DataBuf(data + nativePreview_.position_, static_cast<long>(nativePreview_.size_));
} else if (nativePreview_.filter_ == "hex-ai7thumbnail-pnm") { }
if (nativePreview_.filter_ == "hex-ai7thumbnail-pnm") {
const DataBuf ai7thumbnail = decodeHex(data + nativePreview_.position_, static_cast<long>(nativePreview_.size_)); const DataBuf ai7thumbnail = decodeHex(data + nativePreview_.position_, static_cast<long>(nativePreview_.size_));
const DataBuf rgb = decodeAi7Thumbnail(ai7thumbnail); const DataBuf rgb = decodeAi7Thumbnail(ai7thumbnail);
return makePnm(width_, height_, rgb); return makePnm(width_, height_, rgb);
} else if (nativePreview_.filter_ == "hex-irb") { }
if (nativePreview_.filter_ == "hex-irb") {
const DataBuf psData = decodeHex(data + nativePreview_.position_, static_cast<long>(nativePreview_.size_)); const DataBuf psData = decodeHex(data + nativePreview_.position_, static_cast<long>(nativePreview_.size_));
const byte *record; const byte *record;
uint32_t sizeHdr; uint32_t sizeHdr;
@ -489,9 +491,8 @@ namespace {
return DataBuf(); return DataBuf();
} }
return DataBuf(record + sizeHdr + 28, sizeData - 28); return DataBuf(record + sizeHdr + 28, sizeData - 28);
} else {
throw Error(kerErrorMessage, "Invalid native preview filter: " + nativePreview_.filter_);
} }
throw Error(kerErrorMessage, "Invalid native preview filter: " + nativePreview_.filter_);
} }
bool LoaderNative::readDimensions() bool LoaderNative::readDimensions()

@ -412,10 +412,9 @@ namespace Exiv2 {
return; return;
} }
#ifndef SUPPRESS_WARNINGS #ifndef SUPPRESS_WARNINGS
else {
EXV_WARNING << "Failed to decode IPTC block found in " EXV_WARNING << "Failed to decode IPTC block found in "
<< "Directory Image, entry 0x83bb\n"; << "Directory Image, entry 0x83bb\n";
}
#endif #endif
} }
@ -436,10 +435,9 @@ namespace Exiv2 {
return; return;
} }
#ifndef SUPPRESS_WARNINGS #ifndef SUPPRESS_WARNINGS
else {
EXV_WARNING << "Failed to decode IPTC block found in " EXV_WARNING << "Failed to decode IPTC block found in "
<< "Directory Image, entry 0x8649\n"; << "Directory Image, entry 0x8649\n";
}
#endif #endif
} }
} // TiffMetadataDecoder::decodeIptc } // TiffMetadataDecoder::decodeIptc

@ -280,10 +280,7 @@ namespace Exiv2 {
return (byte)buf[3] << 24 | (byte)buf[2] << 16 return (byte)buf[3] << 24 | (byte)buf[2] << 16
| (byte)buf[1] << 8 | (byte)buf[0]; | (byte)buf[1] << 8 | (byte)buf[0];
} }
else { return (byte)buf[0] << 24 | (byte)buf[1] << 16 | (byte)buf[2] << 8 | (byte)buf[3];
return (byte)buf[0] << 24 | (byte)buf[1] << 16
| (byte)buf[2] << 8 | (byte)buf[3];
}
} }
uint64_t getULongLong(const byte* buf, ByteOrder byteOrder) uint64_t getULongLong(const byte* buf, ByteOrder byteOrder)
@ -294,12 +291,8 @@ namespace Exiv2 {
| (uint64_t)buf[3] << 24 | (uint64_t)buf[2] << 16 | (uint64_t)buf[3] << 24 | (uint64_t)buf[2] << 16
| (uint64_t)buf[1] << 8 | (uint64_t)buf[0]; | (uint64_t)buf[1] << 8 | (uint64_t)buf[0];
} }
else { return (uint64_t)buf[0] << 56 | (uint64_t)buf[1] << 48 | (uint64_t)buf[2] << 40 | (uint64_t)buf[3] << 32 |
return (uint64_t)buf[0] << 56 | (uint64_t)buf[1] << 48 (uint64_t)buf[4] << 24 | (uint64_t)buf[5] << 16 | (uint64_t)buf[6] << 8 | (uint64_t)buf[7];
| (uint64_t)buf[2] << 40 | (uint64_t)buf[3] << 32
| (uint64_t)buf[4] << 24 | (uint64_t)buf[5] << 16
| (uint64_t)buf[6] << 8 | (uint64_t)buf[7];
}
} }
URational getURational(const byte* buf, ByteOrder byteOrder) URational getURational(const byte* buf, ByteOrder byteOrder)
@ -314,10 +307,8 @@ namespace Exiv2 {
if (byteOrder == littleEndian) { if (byteOrder == littleEndian) {
return (byte)buf[1] << 8 | (byte)buf[0]; return (byte)buf[1] << 8 | (byte)buf[0];
} }
else {
return (byte)buf[0] << 8 | (byte)buf[1]; return (byte)buf[0] << 8 | (byte)buf[1];
} }
}
int32_t getLong(const byte* buf, ByteOrder byteOrder) int32_t getLong(const byte* buf, ByteOrder byteOrder)
{ {
@ -325,10 +316,7 @@ namespace Exiv2 {
return (byte)buf[3] << 24 | (byte)buf[2] << 16 return (byte)buf[3] << 24 | (byte)buf[2] << 16
| (byte)buf[1] << 8 | (byte)buf[0]; | (byte)buf[1] << 8 | (byte)buf[0];
} }
else { return (byte)buf[0] << 24 | (byte)buf[1] << 16 | (byte)buf[2] << 8 | (byte)buf[3];
return (byte)buf[0] << 24 | (byte)buf[1] << 16
| (byte)buf[2] << 8 | (byte)buf[3];
}
} }
Rational getRational(const byte* buf, ByteOrder byteOrder) Rational getRational(const byte* buf, ByteOrder byteOrder)

Loading…
Cancel
Save