Skip to content

Commit

Permalink
std::vector<long> is a better choice
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinbackhouse committed Jul 20, 2021
1 parent 140e3a1 commit 1c67748
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/jpgimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ namespace Exiv2 {
}

bool bPrint = option == kpsBasic || option == kpsRecursive;
Exiv2::Uint32Vector iptcDataSegs;
std::vector<long> iptcDataSegs;

if (bPrint || option == kpsXMP || option == kpsIccProfile || option == kpsIptcErase) {
// nmonic for markers
Expand Down Expand Up @@ -801,7 +801,7 @@ namespace Exiv2 {
#ifdef EXIV2_DEBUG_MESSAGES
std::cout << "iptc data blocks: " << iptcDataSegs.size() << std::endl;
uint32_t toggle = 0;
for (Uint32Vector_i i = iptcDataSegs.begin(); i != iptcDataSegs.end(); i++) {
for (std::vector<long>::const_iterator i = iptcDataSegs.begin(); i != iptcDataSegs.end(); i++) {
std::cout << *i;
if (toggle++ % 2)
std::cout << std::endl;
Expand All @@ -812,17 +812,17 @@ namespace Exiv2 {
size_t count = iptcDataSegs.size();

// figure out which blocks to copy
std::vector<uint64_t> pos(count + 2);
std::vector<long> pos(count + 2);
pos[0] = 0;
// copy the data that is not iptc
Uint32Vector_i it = iptcDataSegs.begin();
for (uint64_t i = 0; i < count; i++) {
std::vector<long>::const_iterator it = iptcDataSegs.begin();
for (size_t i = 0; i < count; i++) {
bool bOdd = (i % 2) != 0;
bool bEven = !bOdd;
pos[i + 1] = bEven ? *it : pos[i] + *it;
++it;
}
pos[count + 1] = io_->size();
pos[count + 1] = static_cast<long>(io_->size());
#ifdef EXIV2_DEBUG_MESSAGES
for (size_t i = 0; i < count + 2; i++)
std::cout << pos[i] << " ";
Expand All @@ -838,10 +838,10 @@ namespace Exiv2 {

assert(tempIo.get() != 0);
for (size_t i = 0; i < (count / 2) + 1; i++) {
uint64_t start = pos[2 * i] + 2; // step JPG 2 byte marker
long start = pos[2 * i] + 2; // step JPG 2 byte marker
if (start == 2)
start = 0; // read the file 2 byte SOI
long length = (long)(pos[2 * i + 1] - start);
long length = pos[2 * i + 1] - start;
if (length) {
#ifdef EXIV2_DEBUG_MESSAGES
std::cout << start << ":" << length << std::endl;
Expand Down

0 comments on commit 1c67748

Please sign in to comment.