Skip to content

Commit

Permalink
try to fix some CodeQL warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Rosen Penev <[email protected]>
  • Loading branch information
neheb committed Jan 28, 2025
1 parent 5b5cea0 commit 112112e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/exiv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ void Params::getStdin(Exiv2::DataBuf& buf) {

int Params::getopt(int argc, char* const Argv[]) {
std::vector<char*> argv(argc + 1);
argv[argc] = nullptr;
argv.back() = nullptr;

const std::unordered_map<std::string, std::string> longs{
{"--adjust", "-a"}, {"--binary", "-b"}, {"--comment", "-c"}, {"--delete", "-d"}, {"--days", "-D"},
Expand Down
9 changes: 5 additions & 4 deletions src/fujimn_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,11 @@ constexpr TagDetails fujiDriveSettingByte1[] = {

//! DriveSetting, tag 0x1103
static std::ostream& printFujiDriveSetting(std::ostream& os, const Value& value, const ExifData*) {
auto byte1 = value.toInt64() & 0xff;
auto byte2 = (value.toInt64() >> 8) & 0xff;
auto byte3 = (value.toInt64() >> 16) & 0xff;
auto fps = value.toInt64() >> 24;
auto valint = value.toUint32();
auto byte1 = valint & 0xff;
auto byte2 = (valint >> 8) & 0xff;
auto byte3 = (valint >> 16) & 0xff;
auto fps = valint >> 24;

if (auto setting = Exiv2::find(fujiDriveSettingByte1, byte1)) {
os << exvGettext(setting->label_);
Expand Down
3 changes: 2 additions & 1 deletion src/preview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,8 @@ bool LoaderXmpJpeg::readDimensions() {
DataBuf decodeHex(const byte* src, size_t srcSize) {
// create decoding table
byte invalid = 16;
auto decodeHexTable = std::vector<byte>(256, invalid);
std::array<byte, 256> decodeHexTable;
decodeHexTable.fill(invalid);
for (byte i = 0; i < 10; i++)
decodeHexTable[static_cast<byte>('0') + i] = i;
for (byte i = 0; i < 6; i++)
Expand Down

0 comments on commit 112112e

Please sign in to comment.