diff --git a/fuzz/fuzz-read-print-write.cpp b/fuzz/fuzz-read-print-write.cpp index 53933d5d..f12d43fb 100644 --- a/fuzz/fuzz-read-print-write.cpp +++ b/fuzz/fuzz-read-print-write.cpp @@ -17,7 +17,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size) { try { Exiv2::DataBuf data_copy(data, size); Exiv2::Image::UniquePtr image = - Exiv2::ImageFactory::open(data_copy.c_data(0), size); + Exiv2::ImageFactory::open(data_copy.c_data(), size); assert(image.get() != 0); image->readMetadata(); diff --git a/include/exiv2/types.hpp b/include/exiv2/types.hpp index becdf6b1..cc84392a 100644 --- a/include/exiv2/types.hpp +++ b/include/exiv2/types.hpp @@ -256,13 +256,13 @@ namespace Exiv2 { int cmpBytes(size_t offset, const void* buf, size_t bufsize) const; //! Returns a data pointer. - byte* data(size_t offset); + byte* data(size_t offset = 0); //! Returns a (read-only) data pointer. - const byte* c_data(size_t offset) const; + const byte* c_data(size_t offset = 0) const; //! Returns a (read-only) C-style string pointer. - const char* c_str(size_t offset) const; + const char* c_str(size_t offset = 0) const; private: // DATA diff --git a/samples/largeiptc-test.cpp b/samples/largeiptc-test.cpp index 73db7660..770ba237 100644 --- a/samples/largeiptc-test.cpp +++ b/samples/largeiptc-test.cpp @@ -47,7 +47,7 @@ int main(int argc, char* const argv[]) } Exiv2::DataBuf buf(static_cast(io.size())); std::cout << "Reading " << buf.size() << " bytes from " << data << "\n"; - long readBytes = io.read(buf.data(0), buf.size()); + long readBytes = io.read(buf.data(), buf.size()); if (readBytes != buf.size() || io.error() || io.eof()) { throw Exiv2::Error(Exiv2::kerFailedToReadImageData); } @@ -59,7 +59,7 @@ int main(int argc, char* const argv[]) // Set Preview field to the content of the data file Exiv2::DataValue value; - value.read(buf.data(0), buf.size()); + value.read(buf.data(), buf.size()); Exiv2::IptcData& iptcData = image->iptcData(); std::cout << "IPTC fields: " << iptcData.size() << "\n"; iptcData["Iptc.Application2.Preview"] = value; @@ -71,7 +71,7 @@ int main(int argc, char* const argv[]) const Exiv2::byte* record; uint32_t sizeHdr = 0; uint32_t sizeData = 0; - Exiv2::Photoshop::locateIptcIrb(irb.data(0), irb.size(), &record, &sizeHdr, &sizeData); + Exiv2::Photoshop::locateIptcIrb(irb.data(), irb.size(), &record, &sizeHdr, &sizeData); Exiv2::DataBuf rawIptc = Exiv2::IptcParser::encode(iptcData); std::cout << "Comparing IPTC and IRB size... "; if (static_cast(rawIptc.size()) != sizeData) { diff --git a/samples/mmap-test.cpp b/samples/mmap-test.cpp index 61f277a4..e0ab5997 100644 --- a/samples/mmap-test.cpp +++ b/samples/mmap-test.cpp @@ -52,7 +52,7 @@ try { // Read from the memory mapped region buf.copyBytes(0, pData, buf.size()); // Reopen file in write mode and write to it - file.write(buf.c_data(0), buf.size()); + file.write(buf.c_data(), buf.size()); // Read from the mapped region again buf.copyBytes(0, pData, buf.size()); file.close(); diff --git a/samples/mrwthumb.cpp b/samples/mrwthumb.cpp index 284b6aab..3b2a96ae 100644 --- a/samples/mrwthumb.cpp +++ b/samples/mrwthumb.cpp @@ -61,7 +61,7 @@ int main(int argc, char* const argv[]) Exiv2::FileIo file("img_thumb.jpg"); file.open("wb"); - file.write(buf.c_data(0), buf.size()); + file.write(buf.c_data(), buf.size()); file.close(); } diff --git a/samples/tiff-test.cpp b/samples/tiff-test.cpp index 01a51a0d..6174d92b 100644 --- a/samples/tiff-test.cpp +++ b/samples/tiff-test.cpp @@ -73,7 +73,7 @@ void mini1(const char* path) // Write nothing, this time with a previous binary image DataBuf buf = readFile(path); - wm = ExifParser::encode(blob, buf.c_data(0), buf.size(), bigEndian, exifData); + wm = ExifParser::encode(blob, buf.c_data(), buf.size(), bigEndian, exifData); enforce(wm == wmIntrusive, Exiv2::kerErrorMessage, "encode returned an unexpected value"); assert(blob.empty()); std::cout << "Test 2: Writing empty Exif data with original binary data: ok.\n"; diff --git a/samples/xmpparse.cpp b/samples/xmpparse.cpp index 78d0a430..70af215b 100644 --- a/samples/xmpparse.cpp +++ b/samples/xmpparse.cpp @@ -39,7 +39,7 @@ try { } Exiv2::DataBuf buf = Exiv2::readFile(argv[1]); std::string xmpPacket; - xmpPacket.assign(buf.c_str(0), buf.size()); + xmpPacket.assign(buf.c_str(), buf.size()); Exiv2::XmpData xmpData; if (0 != Exiv2::XmpParser::decode(xmpData, xmpPacket)) { std::string error(argv[1]); diff --git a/samples/xmpparser-test.cpp b/samples/xmpparser-test.cpp index 2911672e..6a943d92 100644 --- a/samples/xmpparser-test.cpp +++ b/samples/xmpparser-test.cpp @@ -40,7 +40,7 @@ try { std::string filename(argv[1]); Exiv2::DataBuf buf = Exiv2::readFile(filename); std::string xmpPacket; - xmpPacket.assign(buf.c_str(0), buf.size()); + xmpPacket.assign(buf.c_str(), buf.size()); std::cerr << "-----> Decoding XMP data read from " << filename << " <-----\n"; Exiv2::XmpData xmpData; if (0 != Exiv2::XmpParser::decode(xmpData, xmpPacket)) { diff --git a/src/actions.cpp b/src/actions.cpp index 10058aaa..5366c1a9 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -232,9 +232,9 @@ namespace Action { Exiv2::DataBuf ascii(static_cast(size * 3 + 1)); ascii.write_uint8(size * 3, 0); iccProfile.copyBytes(0,output.str().c_str(),size); - if (Exiv2::base64encode(iccProfile.c_data(0), size, reinterpret_cast(ascii.data(0)), size * 3)) { + if (Exiv2::base64encode(iccProfile.c_data(), size, reinterpret_cast(ascii.data()), size * 3)) { long chunk = 60 ; - std::string code = std::string("data:") + std::string(ascii.c_str(0)); + std::string code = std::string("data:") + std::string(ascii.c_str()); long length = static_cast(code.size()); for ( long start = 0 ; start < length ; start += chunk ) { long count = (start+chunk) < length ? chunk : length - start ; @@ -615,8 +615,8 @@ namespace Action { std::cout << std::endl; first = false; Exiv2::DataBuf buf(md.size()); - md.copy(buf.data(0), pImage->byteOrder()); - Exiv2::hexdump(std::cout, buf.c_data(0), buf.size()); + md.copy(buf.data(), pImage->byteOrder()); + Exiv2::hexdump(std::cout, buf.c_data(), buf.size()); } std::cout << std::endl; return true; @@ -1025,7 +1025,7 @@ namespace Action { } else { if ( bStdout ) { // -eC- - std::cout.write(image->iccProfile()->c_str(0), + std::cout.write(image->iccProfile()->c_str(), image->iccProfile()->size()); } else { if (Params::instance().verbose_) { @@ -1033,7 +1033,7 @@ namespace Action { } Exiv2::FileIo iccFile(target); iccFile.open("wb") ; - iccFile.write(image->iccProfile()->c_data(0),image->iccProfile()->size()); + iccFile.write(image->iccProfile()->c_data(),image->iccProfile()->size()); iccFile.close(); } } @@ -1888,7 +1888,7 @@ namespace { Exiv2::DataBuf stdIn; if ( bStdin ) Params::instance().getStdin(stdIn); - Exiv2::BasicIo::UniquePtr ioStdin = Exiv2::BasicIo::UniquePtr(new Exiv2::MemIo(stdIn.c_data(0),stdIn.size())); + Exiv2::BasicIo::UniquePtr ioStdin = Exiv2::BasicIo::UniquePtr(new Exiv2::MemIo(stdIn.c_data(),stdIn.size())); Exiv2::Image::UniquePtr sourceImage = bStdin ? Exiv2::ImageFactory::open(std::move(ioStdin)) : Exiv2::ImageFactory::open(source); assert(sourceImage.get() != 0); diff --git a/src/basicio.cpp b/src/basicio.cpp index 1ee523d2..f0a6e667 100644 --- a/src/basicio.cpp +++ b/src/basicio.cpp @@ -516,7 +516,7 @@ namespace Exiv2 { #else // Workaround for platforms without mmap: Read the file into memory DataBuf buf(static_cast(p_->mappedLength_)); - if (read(buf.data(0), buf.size()) != buf.size()) { + if (read(buf.data(), buf.size()) != buf.size()) { #ifdef EXV_UNICODE_PATH if (p_->wpMode_ == Impl::wpUnicode) { throw WError(kerCallFailed, wpath(), strError().c_str(), "FileIo::read"); @@ -671,7 +671,7 @@ namespace Exiv2 { if (statOk && S_ISLNK(buf1.st_mode)) { lbuf.alloc(buf1.st_size + 1); lbuf.clear(); - pf = reinterpret_cast(lbuf.data(0)); + pf = reinterpret_cast(lbuf.data()); if (::readlink(path().c_str(), pf, lbuf.size() - 1) == -1) { throw Error(kerCallFailed, path(), strError(), "readlink"); } @@ -990,7 +990,7 @@ namespace Exiv2 { if (static_cast(rcount) > size()) throw Error(kerInvalidMalloc); DataBuf buf(rcount); - long readCount = read(buf.data(0), buf.size()); + long readCount = read(buf.data(), buf.size()); if (readCount < 0) { throw Error(kerInputDataReadFailed); } @@ -1351,7 +1351,7 @@ namespace Exiv2 { DataBuf MemIo::read(long rcount) { DataBuf buf(rcount); - long readCount = read(buf.data(0), buf.size()); + long readCount = read(buf.data(), buf.size()); if (readCount < 0) { throw Error(kerInputDataReadFailed); } @@ -1831,7 +1831,7 @@ namespace Exiv2 { DataBuf RemoteIo::read(long rcount) { DataBuf buf(rcount); - long readCount = read(buf.data(0), buf.size()); + long readCount = read(buf.data(), buf.size()); if (readCount < 0) { throw Error(kerInputDataReadFailed); } @@ -2442,7 +2442,7 @@ namespace Exiv2 { throw Error(kerCallFailed, path, strError(), "::stat"); } DataBuf buf(st.st_size); - long len = file.read(buf.data(0), buf.size()); + long len = file.read(buf.data(), buf.size()); if (len != buf.size()) { throw Error(kerCallFailed, path, strError(), "FileIo::read"); } @@ -2461,7 +2461,7 @@ namespace Exiv2 { throw WError(kerCallFailed, wpath, strError().c_str(), "::_wstat"); } DataBuf buf(st.st_size); - long len = file.read(buf.data(0), buf.size()); + long len = file.read(buf.data(), buf.size()); if (len != buf.size()) { throw WError(kerCallFailed, wpath, strError().c_str(), "FileIo::read"); } @@ -2475,7 +2475,7 @@ namespace Exiv2 { if (file.open("wb") != 0) { throw Error(kerFileOpenFailed, path, "wb", strError()); } - return file.write(buf.c_data(0), buf.size()); + return file.write(buf.c_data(), buf.size()); } #ifdef EXV_UNICODE_PATH @@ -2485,7 +2485,7 @@ namespace Exiv2 { if (file.open("wb") != 0) { throw WError(kerFileOpenFailed, wpath, "wb", strError().c_str()); } - return file.write(buf.c_data(0), buf.size()); + return file.write(buf.c_data(), buf.size()); } #endif diff --git a/src/bmffimage.cpp b/src/bmffimage.cpp index 7e915920..b84d64ec 100644 --- a/src/bmffimage.cpp +++ b/src/bmffimage.cpp @@ -220,7 +220,7 @@ namespace Exiv2 hdrsize += 8; enforce(hdrsize <= static_cast(pbox_end - address), Exiv2::kerCorruptedMetadata); DataBuf data(8); - io_->read(data.data(0), data.size()); + io_->read(data.data(), data.size()); box_length = data.read_uint64(0, endian_); } @@ -230,7 +230,7 @@ namespace Exiv2 enforce(box_length - hdrsize <= static_cast(pbox_end - restore), Exiv2::kerCorruptedMetadata); DataBuf data(static_cast(box_length - hdrsize)); const long box_end = restore + data.size(); - io_->read(data.data(0), data.size()); + io_->read(data.data(), data.size()); io_->seek(restore, BasicIo::beg); long skip = 0; // read position in data.pData_ @@ -407,7 +407,7 @@ namespace Exiv2 uint8_t meth = data.read_uint8(skip+0); uint8_t prec = data.read_uint8(skip+1); uint8_t approx = data.read_uint8(skip+2); - std::string colour_type = std::string(data.c_str(0), 4); + std::string colour_type = std::string(data.c_str(), 4); skip+=4; if ( colour_type == "rICC" || colour_type == "prof" ) { DataBuf profile(data.c_data(skip),data.size()-skip); @@ -423,7 +423,7 @@ namespace Exiv2 case TAG_uuid: { DataBuf uuid(16); - io_->read(uuid.data(0), uuid.size()); + io_->read(uuid.data(), uuid.size()); std::string name = uuidName(uuid); if ( bTrace ) { out << " uuidName " << name << std::endl; @@ -476,7 +476,7 @@ namespace Exiv2 long restore = io_->tell(); DataBuf exif(static_cast(length)); io_->seek(static_cast(start),BasicIo::beg); - if ( exif.size() > 8 && io_->read(exif.data(0),exif.size()) == exif.size() ) { + if ( exif.size() > 8 && io_->read(exif.data(),exif.size()) == exif.size() ) { // hunt for "II" or "MM" long eof = 0xffffffff; // impossible value for punt long punt = eof; @@ -500,7 +500,7 @@ namespace Exiv2 enforce(length - 8 <= io_->size() - io_->tell(), kerCorruptedMetadata); enforce(length - 8 <= static_cast(std::numeric_limits::max()), kerCorruptedMetadata); DataBuf data(static_cast(length - 8)); - long bufRead = io_->read(data.data(0), data.size()); + long bufRead = io_->read(data.data(), data.size()); if (io_->error()) throw Error(kerFailedToReadImageData); @@ -508,7 +508,7 @@ namespace Exiv2 throw Error(kerInputDataReadFailed); Internal::TiffParserWorker::decode(exifData(), iptcData(), xmpData(), - data.c_data(0), data.size(), root_tag, + data.c_data(), data.size(), root_tag, Internal::TiffMapping::findDecoder); } } @@ -526,12 +526,12 @@ namespace Exiv2 enforce(length < static_cast(std::numeric_limits::max()), kerCorruptedMetadata); DataBuf xmp(static_cast(length+1)); xmp.write_uint8(static_cast(length), 0); // ensure xmp is null terminated! - if ( io_->read(xmp.data(0), static_cast(length)) != static_cast(length) ) + if ( io_->read(xmp.data(), static_cast(length)) != static_cast(length) ) throw Error(kerInputDataReadFailed); if ( io_->error() ) throw Error(kerFailedToReadImageData); try { - Exiv2::XmpParser::decode(xmpData(), std::string(xmp.c_str(0))); + Exiv2::XmpParser::decode(xmpData(), std::string(xmp.c_str())); } catch (...) { throw Error(kerFailedToReadImageData); } @@ -588,7 +588,7 @@ namespace Exiv2 default: break; // do nothing case kpsIccProfile : { - out.write(iccProfile_.c_str(0), iccProfile_.size()); + out.write(iccProfile_.c_str(), iccProfile_.size()); } break; #ifdef EXV_HAVE_XMP_TOOLKIT diff --git a/src/convert.cpp b/src/convert.cpp index f759928a..9abe62e0 100644 --- a/src/convert.cpp +++ b/src/convert.cpp @@ -1195,8 +1195,8 @@ namespace Exiv2 { auto pos = exifData_->findKey(key); if (pos == exifData_->end()) continue; DataBuf data(pos->size()); - pos->copy(data.data(0), littleEndian /* FIXME ? */); - MD5Update ( &context, data.c_data(0), data.size()); + pos->copy(data.data(), littleEndian /* FIXME ? */); + MD5Update ( &context, data.c_data(), data.size()); } } MD5Final(digest, &context); @@ -1266,7 +1266,7 @@ namespace Exiv2 { MD5Init(&context); DataBuf data = IptcParser::encode(*iptcData_); - MD5Update(&context, data.c_data(0), data.size()); + MD5Update(&context, data.c_data(), data.size()); MD5Final(digest, &context); res << std::setw(2) << std::setfill('0') << std::hex << std::uppercase; for (auto&& i : digest) { diff --git a/src/crwimage.cpp b/src/crwimage.cpp index a145a5e4..0ab9b5f2 100644 --- a/src/crwimage.cpp +++ b/src/crwimage.cpp @@ -102,7 +102,7 @@ namespace Exiv2 { } clearMetadata(); DataBuf file(static_cast(io().size())); - io_->read(file.data(0), file.size()); + io_->read(file.data(), file.size()); CrwParser::decode(this, io_->mmap(), static_cast(io_->size())); @@ -121,7 +121,7 @@ namespace Exiv2 { if (isCrwType(*io_, false)) { // Read the image into a memory buffer buf.alloc(static_cast(io_->size())); - io_->read(buf.data(0), buf.size()); + io_->read(buf.data(), buf.size()); if (io_->error() || io_->eof()) { buf.reset(); } @@ -129,7 +129,7 @@ namespace Exiv2 { } Blob blob; - CrwParser::encode(blob, buf.c_data(0), buf.size(), this); + CrwParser::encode(blob, buf.c_data(), buf.size(), this); // Write new buffer to file MemIo::UniquePtr tempIo(new MemIo); diff --git a/src/crwimage_int.cpp b/src/crwimage_int.cpp index 1234d30c..2597c3e5 100644 --- a/src/crwimage_int.cpp +++ b/src/crwimage_int.cpp @@ -1028,7 +1028,7 @@ namespace Exiv2 { // Set the new value or remove the entry if (ed != image.exifData().end()) { DataBuf buf(ed->size()); - ed->copy(buf.data(0), pHead->byteOrder()); + ed->copy(buf.data(), pHead->byteOrder()); pHead->add(pCrwMapping->crwTagId_, pCrwMapping->crwDir_, buf); } else { @@ -1085,7 +1085,7 @@ namespace Exiv2 { DataBuf buf(size); long pos = 0; if (ed1 != edEnd) { - ed1->copy(buf.data(0), pHead->byteOrder()); + ed1->copy(buf.data(), pHead->byteOrder()); pos += ed1->size(); } if (ed2 != edEnd) { @@ -1187,7 +1187,7 @@ namespace Exiv2 { buf.clear(); if (cc) buf.copyBytes(8, cc->pData() + 8, cc->size() - 8); if (edX != edEnd && edX->size() == 4) { - edX->copy(buf.data(0), pHead->byteOrder()); + edX->copy(buf.data(), pHead->byteOrder()); } if (edY != edEnd && edY->size() == 4) { edY->copy(buf.data(4), pHead->byteOrder()); diff --git a/src/exif.cpp b/src/exif.cpp index a3c0e9e4..39bd2bc2 100644 --- a/src/exif.cpp +++ b/src/exif.cpp @@ -522,7 +522,7 @@ namespace Exiv2 { ) { DataBuf thumb = readFile(path); // may throw - setJpegThumbnail(thumb.c_data(0), thumb.size(), xres, yres, unit); + setJpegThumbnail(thumb.c_data(), thumb.size(), xres, yres, unit); } #ifdef EXV_UNICODE_PATH @@ -534,7 +534,7 @@ namespace Exiv2 { ) { DataBuf thumb = readFile(wpath); // may throw - setJpegThumbnail(thumb.c_data(0), thumb.size(), xres, yres, unit); + setJpegThumbnail(thumb.c_data(), thumb.size(), xres, yres, unit); } #endif @@ -555,14 +555,14 @@ namespace Exiv2 { void ExifThumb::setJpegThumbnail(const std::string& path) { DataBuf thumb = readFile(path); // may throw - setJpegThumbnail(thumb.c_data(0), thumb.size()); + setJpegThumbnail(thumb.c_data(), thumb.size()); } #ifdef EXV_UNICODE_PATH void ExifThumb::setJpegThumbnail(const std::wstring& wpath) { DataBuf thumb = readFile(wpath); // may throw - setJpegThumbnail(thumb.c_data(0), thumb.size()); + setJpegThumbnail(thumb.c_data(), thumb.size()); } #endif diff --git a/src/exiv2.cpp b/src/exiv2.cpp index ab7bb1d0..bd2d18f0 100644 --- a/src/exiv2.cpp +++ b/src/exiv2.cpp @@ -993,7 +993,7 @@ void Params::getStdin(Exiv2::DataBuf& buf) // copy stdinBuf to buf if ( stdinBuf.size() ) { buf.alloc(stdinBuf.size()); - buf.copyBytes(0,stdinBuf.c_data(0),buf.size()); + buf.copyBytes(0,stdinBuf.c_data(),buf.size()); } #ifdef DEBUG std::cerr << "getStdin stdinBuf.size_ = " << stdinBuf.size() << std::endl; diff --git a/src/image.cpp b/src/image.cpp index 523a52f3..7135177f 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -343,7 +343,7 @@ namespace Exiv2 { do { // Read top of directory seekOrThrow(io, start, BasicIo::beg, kerCorruptedMetadata); - readOrThrow(io, dir.data(0), 2, kerCorruptedMetadata); + readOrThrow(io, dir.data(), 2, kerCorruptedMetadata); uint16_t dirLength = byteSwap2(dir,0,bSwap); // Prevent infinite loops. (GHSA-m479-7frc-gqqg) enforce(dirLength > 0, kerCorruptedMetadata); @@ -369,7 +369,7 @@ namespace Exiv2 { } bFirst = false; - readOrThrow(io, dir.data(0), 12, kerCorruptedMetadata); + readOrThrow(io, dir.data(), 12, kerCorruptedMetadata); uint16_t tag = byteSwap2(dir,0,bSwap); uint16_t type = byteSwap2(dir,2,bSwap); uint32_t count = byteSwap4(dir,4,bSwap); @@ -421,7 +421,7 @@ namespace Exiv2 { if ( bOffsetIsPointer ) { // read into buffer const long restore = io.tell(); // save seekOrThrow(io, offset, BasicIo::beg, kerCorruptedMetadata); // position - readOrThrow(io, buf.data(0), static_cast(count_x_size), kerCorruptedMetadata); // read + readOrThrow(io, buf.data(), static_cast(count_x_size), kerCorruptedMetadata); // read seekOrThrow(io, restore, BasicIo::beg, kerCorruptedMetadata); // restore } @@ -494,8 +494,8 @@ namespace Exiv2 { // tag is an embedded tiff const long byteslen = count-jump; DataBuf bytes(byteslen); // allocate a buffer - readOrThrow(io, bytes.data(0), byteslen, kerCorruptedMetadata); // read - MemIo memIo(bytes.c_data(0), byteslen) ; // create a file + readOrThrow(io, bytes.data(), byteslen, kerCorruptedMetadata); // read + MemIo memIo(bytes.c_data(), byteslen) ; // create a file printTiffStructure(memIo,out,option,depth); } else { // tag is an IFD @@ -509,14 +509,14 @@ namespace Exiv2 { if ( isPrintXMP(tag,option) ) { buf.write_uint8(count, 0); - out << buf.c_str(0); + out << buf.c_str(); } if ( isPrintICC(tag,option) ) { - out.write(buf.c_str(0), count); + out.write(buf.c_str(), count); } } if ( start ) { - readOrThrow(io, dir.data(0), 4, kerCorruptedMetadata); + readOrThrow(io, dir.data(), 4, kerCorruptedMetadata); start = byteSwap4(dir,0,bSwap); } } while (start) ; @@ -536,7 +536,7 @@ namespace Exiv2 { DataBuf dir(dirSize); // read header (we already know for certain that we have a Tiff file) - readOrThrow(io, dir.data(0), 8, kerCorruptedMetadata); + readOrThrow(io, dir.data(), 8, kerCorruptedMetadata); char c = static_cast(dir.read_uint8(0)); bool bSwap = ( c == 'M' && isLittleEndianPlatform() ) || ( c == 'I' && isBigEndianPlatform() ) diff --git a/src/iptc.cpp b/src/iptc.cpp index ea24adf2..df3148b0 100644 --- a/src/iptc.cpp +++ b/src/iptc.cpp @@ -507,7 +507,7 @@ namespace Exiv2 { DataBuf IptcParser::encode(const IptcData& iptcData) { DataBuf buf(iptcData.size()); - byte *pWrite = buf.data(0); + byte *pWrite = buf.data(); // Copy the iptc data sets and sort them by record but preserve the order of datasets IptcMetadata sortedIptcData; diff --git a/src/jp2image.cpp b/src/jp2image.cpp index 5efd25be..5fa12f92 100644 --- a/src/jp2image.cpp +++ b/src/jp2image.cpp @@ -285,7 +285,7 @@ static void boxes_check(size_t b,size_t m) throw Error(kerCorruptedMetadata); } DataBuf data(static_cast(data_length)); - io_->read(data.data(0), data.size()); + io_->read(data.data(), data.size()); const long iccLength = data.read_uint32(pad, bigEndian); // subtracting pad from data.size() is safe: // data.size() is at least 8 and pad = 3 @@ -298,7 +298,7 @@ static void boxes_check(size_t b,size_t m) const char* iccPath = "/tmp/libexiv2_jp2.icc"; FILE* f = fopen(iccPath,"wb"); if ( f ) { - fwrite(icc.c_data(0),icc.size(),1,f); + fwrite(icc.c_data(),icc.size(),1,f); fclose(f); } std::cout << "Exiv2::Jp2Image::readMetadata: wrote iccProfile " << icc.size() << " bytes to " << iccPath << std::endl ; @@ -351,7 +351,7 @@ static void boxes_check(size_t b,size_t m) #endif enforce(box.length >= sizeof(box) + sizeof(uuid), kerCorruptedMetadata); rawData.alloc(box.length - (sizeof(box) + sizeof(uuid))); - bufRead = io_->read(rawData.data(0), rawData.size()); + bufRead = io_->read(rawData.data(), rawData.size()); if (io_->error()) throw Error(kerFailedToReadImageData); if (bufRead != rawData.size()) throw Error(kerInputDataReadFailed); @@ -406,11 +406,11 @@ static void boxes_check(size_t b,size_t m) #endif enforce(box.length >= sizeof(box) + sizeof(uuid), kerCorruptedMetadata); rawData.alloc(box.length - (sizeof(box) + sizeof(uuid))); - bufRead = io_->read(rawData.data(0), rawData.size()); + bufRead = io_->read(rawData.data(), rawData.size()); if (io_->error()) throw Error(kerFailedToReadImageData); if (bufRead != rawData.size()) throw Error(kerInputDataReadFailed); - if (IptcParser::decode(iptcData_, rawData.c_data(0), rawData.size())) + if (IptcParser::decode(iptcData_, rawData.c_data(), rawData.size())) { #ifndef SUPPRESS_WARNINGS EXV_WARNING << "Failed to decode IPTC metadata." << std::endl; @@ -426,12 +426,12 @@ static void boxes_check(size_t b,size_t m) #endif enforce(box.length >= sizeof(box) + sizeof(uuid), kerCorruptedMetadata); rawData.alloc(box.length - static_cast(sizeof(box) + sizeof(uuid))); - bufRead = io_->read(rawData.data(0), rawData.size()); + bufRead = io_->read(rawData.data(), rawData.size()); if (io_->error()) throw Error(kerFailedToReadImageData); if (bufRead != rawData.size()) throw Error(kerInputDataReadFailed); - xmpPacket_.assign(rawData.c_str(0), rawData.size()); + xmpPacket_.assign(rawData.c_str(), rawData.size()); std::string::size_type idx = xmpPacket_.find_first_of('<'); if (idx != std::string::npos && idx > 0) { @@ -530,7 +530,7 @@ static void boxes_check(size_t b,size_t m) } DataBuf data(subBox.length - sizeof(box)); - io_->read(data.data(0), data.size()); + io_->read(data.data(), data.size()); if (bPrint) { out << Internal::stringFormat("%8ld | %8ld | sub:", static_cast(address), static_cast(subBox.length)) @@ -585,7 +585,7 @@ static void boxes_check(size_t b,size_t m) DataBuf rawData; enforce(box.length >= sizeof(uuid) + sizeof(box), kerCorruptedMetadata); rawData.alloc(box.length - sizeof(uuid) - sizeof(box)); - long bufRead = io_->read(rawData.data(0), rawData.size()); + long bufRead = io_->read(rawData.data(), rawData.size()); if (io_->error()) throw Error(kerFailedToReadImageData); if (bufRead != rawData.size()) @@ -602,7 +602,7 @@ static void boxes_check(size_t b,size_t m) const char a = rawData.read_uint8(0); const char b = rawData.read_uint8(1); if (a == b && (a == 'I' || a == 'M')) { - BasicIo::UniquePtr p = BasicIo::UniquePtr(new MemIo(rawData.c_data(0), rawData.size())); + BasicIo::UniquePtr p = BasicIo::UniquePtr(new MemIo(rawData.c_data(), rawData.size())); printTiffStructure(*p, out, option, depth); } } @@ -612,7 +612,7 @@ static void boxes_check(size_t b,size_t m) } if (bIsXMP && bXMP) { - out.write(rawData.c_str(0), rawData.size()); + out.write(rawData.c_str(), rawData.size()); } } } break; @@ -659,11 +659,11 @@ static void boxes_check(size_t b,size_t m) long outlen = sizeof(Jp2BoxHeader) ; // now many bytes have we written to output? long inlen = sizeof(Jp2BoxHeader) ; // how many bytes have we read from boxBuf? enforce(sizeof(Jp2BoxHeader) <= static_cast(output.size()), Exiv2::kerCorruptedMetadata); - auto pBox = reinterpret_cast(boxBuf.c_data(0)); + auto pBox = reinterpret_cast(boxBuf.c_data()); uint32_t length = getLong(reinterpret_cast(&pBox->length), bigEndian); enforce(length <= static_cast(output.size()), Exiv2::kerCorruptedMetadata); uint32_t count = sizeof (Jp2BoxHeader); - auto p = boxBuf.c_str(0); + auto p = boxBuf.c_str(); bool bWroteColor = false ; while ( count < length && !bWroteColor ) { @@ -711,7 +711,7 @@ static void boxes_check(size_t b,size_t m) ul2Data(reinterpret_cast(&newBox.type), newBox.type, bigEndian); output.copyBytes(outlen ,&newBox ,sizeof(newBox) ); output.copyBytes(outlen+sizeof(newBox) , pad ,psize ); - output.copyBytes(outlen+sizeof(newBox)+psize,iccProfile_.c_data(0),iccProfile_.size()); + output.copyBytes(outlen+sizeof(newBox)+psize,iccProfile_.c_data(),iccProfile_.size()); } } else { enforce(newlen <= static_cast(output.size() - outlen), Exiv2::kerCorruptedMetadata); @@ -724,8 +724,8 @@ static void boxes_check(size_t b,size_t m) // allocate the correct number of bytes, copy the data and update the box header outBuf.alloc(outlen); - outBuf.copyBytes(0,output.c_data(0),outlen); - auto oBox = reinterpret_cast(outBuf.data(0)); + outBuf.copyBytes(0,output.c_data(),outlen); + auto oBox = reinterpret_cast(outBuf.data()); ul2Data(reinterpret_cast(&oBox->type), kJp2BoxTypeJp2Header, bigEndian); ul2Data(reinterpret_cast(&oBox->length), outlen, bigEndian); } // Jp2Image::encodeJp2Header @@ -771,7 +771,7 @@ static void boxes_check(size_t b,size_t m) // Read chunk header. bheaderBuf.clear(); - long bufRead = io_->read(bheaderBuf.data(0), bheaderBuf.size()); + long bufRead = io_->read(bheaderBuf.data(), bheaderBuf.size()); if (io_->error()) throw Error(kerFailedToReadImageData); if (bufRead != bheaderBuf.size()) throw Error(kerInputDataReadFailed); @@ -804,7 +804,7 @@ static void boxes_check(size_t b,size_t m) // Read whole box : Box header + Box data (not fixed size - can be null). DataBuf boxBuf(box.length); // Box header (8 bytes) + box data. - boxBuf.copyBytes(0, bheaderBuf.c_data(0), 8); // Copy header. + boxBuf.copyBytes(0, bheaderBuf.c_data(), 8); // Copy header. bufRead = io_->read(boxBuf.data(8), box.length - 8); // Extract box data. if (io_->error()) { @@ -831,7 +831,7 @@ static void boxes_check(size_t b,size_t m) #ifdef EXIV2_DEBUG_MESSAGES std::cout << "Exiv2::Jp2Image::doWriteMetadata: Write JP2Header box (length: " << box.length << ")" << std::endl; #endif - if (outIo.write(newBuf.data(0), newBuf.size()) != newBuf.size()) throw Error(kerImageWriteFailed); + if (outIo.write(newBuf.data(), newBuf.size()) != newBuf.size()) throw Error(kerImageWriteFailed); // Write all updated metadata here, just after JP2Header. @@ -851,13 +851,13 @@ static void boxes_check(size_t b,size_t m) boxData.copyBytes(0, boxDataSize, 4); boxData.copyBytes(4, boxUUIDtype, 4); boxData.copyBytes(8, kJp2UuidExif, 16); - boxData.copyBytes(8 + 16, rawExif.c_data(0), rawExif.size()); + boxData.copyBytes(8 + 16, rawExif.c_data(), rawExif.size()); #ifdef EXIV2_DEBUG_MESSAGES std::cout << "Exiv2::Jp2Image::doWriteMetadata: Write box with Exif metadata (length: " << boxData.size() << std::endl; #endif - if (outIo.write(boxData.c_data(0), boxData.size()) != boxData.size()) throw Error(kerImageWriteFailed); + if (outIo.write(boxData.c_data(), boxData.size()) != boxData.size()) throw Error(kerImageWriteFailed); } } @@ -874,13 +874,13 @@ static void boxes_check(size_t b,size_t m) boxData.copyBytes(0, boxDataSize, 4); boxData.copyBytes(4, boxUUIDtype, 4); boxData.copyBytes(8, kJp2UuidIptc, 16); - boxData.copyBytes(8 + 16, rawIptc.c_data(0), rawIptc.size()); + boxData.copyBytes(8 + 16, rawIptc.c_data(), rawIptc.size()); #ifdef EXIV2_DEBUG_MESSAGES std::cout << "Exiv2::Jp2Image::doWriteMetadata: Write box with Iptc metadata (length: " << boxData.size() << std::endl; #endif - if (outIo.write(boxData.c_data(0), boxData.size()) != boxData.size()) throw Error(kerImageWriteFailed); + if (outIo.write(boxData.c_data(), boxData.size()) != boxData.size()) throw Error(kerImageWriteFailed); } } @@ -902,13 +902,13 @@ static void boxes_check(size_t b,size_t m) boxData.copyBytes(0, boxDataSize, 4); boxData.copyBytes(4, boxUUIDtype, 4); boxData.copyBytes(8, kJp2UuidXmp, 16); - boxData.copyBytes(8 + 16, xmp.c_data(0), xmp.size()); + boxData.copyBytes(8 + 16, xmp.c_data(), xmp.size()); #ifdef EXIV2_DEBUG_MESSAGES std::cout << "Exiv2::Jp2Image::doWriteMetadata: Write box with XMP metadata (length: " << boxData.size() << ")" << std::endl; #endif - if (outIo.write(boxData.c_data(0), boxData.size()) != boxData.size()) throw Error(kerImageWriteFailed); + if (outIo.write(boxData.c_data(), boxData.size()) != boxData.size()) throw Error(kerImageWriteFailed); } break; @@ -940,7 +940,7 @@ static void boxes_check(size_t b,size_t m) #ifdef EXIV2_DEBUG_MESSAGES std::cout << "Exiv2::Jp2Image::doWriteMetadata: write Uuid box (length: " << box.length << ")" << std::endl; #endif - if (outIo.write(boxBuf.c_data(0), boxBuf.size()) != boxBuf.size()) throw Error(kerImageWriteFailed); + if (outIo.write(boxBuf.c_data(), boxBuf.size()) != boxBuf.size()) throw Error(kerImageWriteFailed); } break; } @@ -950,7 +950,7 @@ static void boxes_check(size_t b,size_t m) #ifdef EXIV2_DEBUG_MESSAGES std::cout << "Exiv2::Jp2Image::doWriteMetadata: write box (length: " << box.length << ")" << std::endl; #endif - if (outIo.write(boxBuf.c_data(0), boxBuf.size()) != boxBuf.size()) throw Error(kerImageWriteFailed); + if (outIo.write(boxBuf.c_data(), boxBuf.size()) != boxBuf.size()) throw Error(kerImageWriteFailed); break; } diff --git a/src/jpgimage.cpp b/src/jpgimage.cpp index 65d28cdd..db6b9dfa 100644 --- a/src/jpgimage.cpp +++ b/src/jpgimage.cpp @@ -281,7 +281,7 @@ namespace Exiv2 { tmpBuf[7] = 0; ul2Data(tmpBuf + 8, rawIptc.size(), bigEndian); append(psBlob, tmpBuf, 12); - append(psBlob, rawIptc.c_data(0), rawIptc.size()); + append(psBlob, rawIptc.c_data(), rawIptc.size()); // Data is padded to be even (but not included in size) if (rawIptc.size() & 1) psBlob.push_back(0x00); } @@ -307,7 +307,7 @@ namespace Exiv2 { #ifdef EXIV2_DEBUG_MESSAGES std::cerr << "IRB block at the end of Photoshop::setIptcIrb\n"; if (rc.size() == 0) std::cerr << " None.\n"; - else hexdump(std::cerr, rc.c_data(0), rc.size()); + else hexdump(std::cerr, rc.c_data(), rc.size()); #endif return rc; @@ -493,7 +493,7 @@ namespace Exiv2 { DataBuf profile(Safe::add(iccProfile_.size(), icc_size)); if ( iccProfile_.size() ) { - profile.copyBytes(0, iccProfile_.c_data(0), iccProfile_.size()); + profile.copyBytes(0, iccProfile_.c_data(), iccProfile_.size()); } profile.copyBytes(iccProfile_.size(), buf.c_data(2+14), icc_size); setIccProfile(profile,chunk==chunks); @@ -651,7 +651,7 @@ namespace Exiv2 { // 1787 | 0xe1 APP1 | 65460 | http://ns.adobe.com/xmp/extensio if (option == kpsXMP && signature.rfind("http://ns.adobe.com/x", 0) == 0) { // extract XMP - const char* xmp = buf.c_str(0); + const char* xmp = buf.c_str(); size_t start = 2; // http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/xmp/pdfs/XMPSpecificationPart3.pdf @@ -724,7 +724,7 @@ namespace Exiv2 { // extract Exif data block which is tiff formatted out << std::endl; -// const byte* exif = buf.c_data(0); +// const byte* exif = buf.c_data(); uint32_t start = signature == "Exif" ? 8 : 6; uint32_t max = static_cast(size) - 1; @@ -849,8 +849,8 @@ namespace Exiv2 { #endif seekOrThrow(*io_, start, BasicIo::beg, kerFailedToReadImageData); DataBuf buf(length); - readOrThrow(*io_, buf.data(0), buf.size(), kerFailedToReadImageData); - tempIo->write(buf.c_data(0), buf.size()); + readOrThrow(*io_, buf.data(), buf.size(), kerFailedToReadImageData); + tempIo->write(buf.c_data(), buf.size()); } } @@ -1062,8 +1062,8 @@ namespace Exiv2 { bo = littleEndian; setByteOrder(bo); } - WriteMethod wm = ExifParser::encode(blob, rawExif.c_data(0), rawExif.size(), bo, exifData_); - const byte* pExifData = rawExif.c_data(0); + WriteMethod wm = ExifParser::encode(blob, rawExif.c_data(), rawExif.size(), bo, exifData_); + const byte* pExifData = rawExif.c_data(); size_t exifSize = rawExif.size(); if (wm == wmIntrusive) { pExifData = !blob.empty() ? &blob[0] : nullptr; @@ -1166,7 +1166,7 @@ namespace Exiv2 { DataBuf newPsData = Photoshop::setIptcIrb(!psBlob.empty() ? &psBlob[0] : nullptr, static_cast(psBlob.size()), iptcData_); const long maxChunkSize = 0xffff - 16; - const byte* chunkStart = newPsData.c_data(0); + const byte* chunkStart = newPsData.c_data(); const byte* chunkEnd = newPsData.c_data(newPsData.size()); while (chunkStart < chunkEnd) { // Determine size of next chunk @@ -1174,8 +1174,8 @@ namespace Exiv2 { if (chunkSize > maxChunkSize) { chunkSize = maxChunkSize; // Don't break at a valid IRB boundary - const long writtenSize = static_cast(chunkStart - newPsData.c_data(0)); - if (Photoshop::valid(newPsData.c_data(0), writtenSize + chunkSize)) { + const long writtenSize = static_cast(chunkStart - newPsData.c_data()); + if (Photoshop::valid(newPsData.c_data(), writtenSize + chunkSize)) { // Since an IRB has minimum size 12, // (chunkSize - 8) can't be also a IRB boundary chunkSize -= 8; @@ -1242,7 +1242,7 @@ namespace Exiv2 { tmpBuf[1] = marker; if (outIo.write(tmpBuf, 2) != 2) throw Error(kerImageWriteFailed); - if (outIo.write(buf.c_data(0), size) != size) + if (outIo.write(buf.c_data(), size) != size) throw Error(kerImageWriteFailed); if (outIo.error()) throw Error(kerImageWriteFailed); @@ -1266,8 +1266,8 @@ namespace Exiv2 { DataBuf buf(4096); long readSize = 0; - while ((readSize = io_->read(buf.data(0), buf.size()))) { - if (outIo.write(buf.c_data(0), readSize) != readSize) + while ((readSize = io_->read(buf.data(), buf.size()))) { + if (outIo.write(buf.c_data(), readSize) != readSize) throw Error(kerImageWriteFailed); } if (outIo.error()) diff --git a/src/makernote_int.cpp b/src/makernote_int.cpp index 9a9a4793..97bf4dd5 100644 --- a/src/makernote_int.cpp +++ b/src/makernote_int.cpp @@ -495,12 +495,12 @@ namespace Exiv2 { { assert(buf_.size() >= 10); - ioWrapper.write(buf_.c_data(0), 10); + ioWrapper.write(buf_.c_data(), 10); // Todo: This removes any gap between the header and // makernote IFD. The gap should be copied too. TiffHeader th(byteOrder); DataBuf buf = th.write(); - ioWrapper.write(buf.c_data(0), buf.size()); + ioWrapper.write(buf.c_data(), buf.size()); return 10 + buf.size(); } // Nikon3MnHeader::write diff --git a/src/mrwimage.cpp b/src/mrwimage.cpp index 4a6b8b48..c01007e6 100644 --- a/src/mrwimage.cpp +++ b/src/mrwimage.cpp @@ -134,13 +134,13 @@ namespace Exiv2 { // will fail if there are fewer than siz bytes left to read. enforce(siz <= io_->size(), kerFailedToReadImageData); DataBuf buf(siz); - io_->read(buf.data(0), buf.size()); + io_->read(buf.data(), buf.size()); enforce(!io_->error() && !io_->eof(), kerFailedToReadImageData); ByteOrder bo = TiffParser::decode(exifData_, iptcData_, xmpData_, - buf.c_data(0), + buf.c_data(), buf.size()); setByteOrder(bo); } // MrwImage::readMetadata diff --git a/src/pgfimage.cpp b/src/pgfimage.cpp index 0d160159..94679a9d 100644 --- a/src/pgfimage.cpp +++ b/src/pgfimage.cpp @@ -139,11 +139,11 @@ namespace Exiv2 { DataBuf imgData(size); imgData.clear(); - long bufRead = io_->read(imgData.data(0), imgData.size()); + long bufRead = io_->read(imgData.data(), imgData.size()); if (io_->error()) throw Error(kerFailedToReadImageData); if (bufRead != imgData.size()) throw Error(kerInputDataReadFailed); - Image::UniquePtr image = Exiv2::ImageFactory::open(imgData.c_data(0), imgData.size()); + Image::UniquePtr image = Exiv2::ImageFactory::open(imgData.c_data(), imgData.size()); image->readMetadata(); exifData() = image->exifData(); iptcData() = image->iptcData(); @@ -218,7 +218,7 @@ namespace Exiv2 { DataBuf buffer(4); buffer.copyBytes(0, &newHeaderSize, 4); byteSwap_(buffer,0,bSwap_); - if (outIo.write(buffer.c_data(0), 4) != 4) throw Error(kerImageWriteFailed); + if (outIo.write(buffer.c_data(), 4) != 4) throw Error(kerImageWriteFailed); #ifdef EXIV2_DEBUG_MESSAGES std::cout << "Exiv2::PgfImage: new PGF header size : " << newHeaderSize << " bytes\n"; @@ -230,18 +230,18 @@ namespace Exiv2 { #endif // Write Header data. - if (outIo.write(header.c_data(0), header.size()) != header.size()) throw Error(kerImageWriteFailed); + if (outIo.write(header.c_data(), header.size()) != header.size()) throw Error(kerImageWriteFailed); // Write new metadata byte array. - if (outIo.write(imgBuf.c_data(0), imgBuf.size()) != imgBuf.size()) throw Error(kerImageWriteFailed); + if (outIo.write(imgBuf.c_data(), imgBuf.size()) != imgBuf.size()) throw Error(kerImageWriteFailed); // Copy the rest of PGF image data. DataBuf buf(4096); long readSize = 0; - while ((readSize=io_->read(buf.data(0), buf.size()))) + while ((readSize=io_->read(buf.data(), buf.size()))) { - if (outIo.write(buf.c_data(0), readSize) != readSize) throw Error(kerImageWriteFailed); + if (outIo.write(buf.c_data(), readSize) != readSize) throw Error(kerImageWriteFailed); } if (outIo.error()) throw Error(kerImageWriteFailed); @@ -266,7 +266,7 @@ namespace Exiv2 { uint32_t PgfImage::readPgfHeaderSize(BasicIo& iIo) const { DataBuf buffer(4); - long bufRead = iIo.read(buffer.data(0), buffer.size()); + long bufRead = iIo.read(buffer.data(), buffer.size()); if (iIo.error()) throw Error(kerFailedToReadImageData); if (bufRead != buffer.size()) throw Error(kerInputDataReadFailed); @@ -283,12 +283,12 @@ namespace Exiv2 { DataBuf PgfImage::readPgfHeaderStructure(BasicIo& iIo, int& width, int& height) const { DataBuf header(16); - long bufRead = iIo.read(header.data(0), header.size()); + long bufRead = iIo.read(header.data(), header.size()); if (iIo.error()) throw Error(kerFailedToReadImageData); if (bufRead != header.size()) throw Error(kerInputDataReadFailed); DataBuf work(8); // don't disturb the binary data - doWriteMetadata reuses it - work.copyBytes(0,header.c_data(0),8); + work.copyBytes(0,header.c_data(),8); width = byteSwap_(work,0,bSwap_); height = byteSwap_(work,4,bSwap_); diff --git a/src/pngchunk_int.cpp b/src/pngchunk_int.cpp index 1ec3636b..0a7926c6 100644 --- a/src/pngchunk_int.cpp +++ b/src/pngchunk_int.cpp @@ -82,9 +82,9 @@ namespace Exiv2 { #ifdef EXIV2_DEBUG_MESSAGES std::cout << "Exiv2::PngChunk::decodeTXTChunk: TXT chunk data: " - << std::string(arr.c_str(0), arr.size()) << std::endl; + << std::string(arr.c_str(), arr.size()) << std::endl; #endif - parseChunkContent(pImage, key.c_data(0), key.size(), arr); + parseChunkContent(pImage, key.c_data(), key.size(), arr); } // PngChunk::decodeTXTChunk @@ -95,7 +95,7 @@ namespace Exiv2 { #ifdef EXIV2_DEBUG_MESSAGES std::cout << "Exiv2::PngChunk::decodeTXTChunk: TXT chunk key: " - << std::string(key.c_str(0), key.size()) << std::endl; + << std::string(key.c_str(), key.size()) << std::endl; #endif return parseTXTChunk(data, key.size(), type); @@ -305,7 +305,7 @@ namespace Exiv2 { uint32_t sizeHdr = 0; const byte* pEnd = psData.c_data(psData.size()); - const byte* pCur = psData.c_data(0); + const byte* pCur = psData.c_data(); while ( pCur < pEnd && 0 == Photoshop::locateIptcIrb(pCur, static_cast(pEnd - pCur), @@ -331,7 +331,7 @@ namespace Exiv2 { // If there is no IRB, try to decode the complete chunk data if ( iptcBlob.empty() && IptcParser::decode(pImage->iptcData(), - psData.c_data(0), + psData.c_data(), psData.size())) { #ifndef SUPPRESS_WARNINGS EXV_WARNING << "Failed to decode IPTC metadata.\n"; @@ -353,7 +353,7 @@ namespace Exiv2 { if (length > 0) { std::string& xmpPacket = pImage->xmpPacket(); - xmpPacket.assign(xmpBuf.c_str(0), length); + xmpPacket.assign(xmpBuf.c_str(), length); std::string::size_type idx = xmpPacket.find_first_of('<'); if (idx != std::string::npos && idx > 0) { @@ -381,7 +381,7 @@ namespace Exiv2 { if (arr.size() > 0) { std::string& xmpPacket = pImage->xmpPacket(); - xmpPacket.assign(arr.c_str(0), arr.size()); + xmpPacket.assign(arr.c_str(), arr.size()); std::string::size_type idx = xmpPacket.find_first_of('<'); if (idx != std::string::npos && idx > 0) { @@ -407,7 +407,7 @@ namespace Exiv2 { && memcmp("Description", key, 11) == 0 && pImage->comment().empty()) { - pImage->setComment(std::string(arr.c_str(0), arr.size())); + pImage->setComment(std::string(arr.c_str(), arr.size())); } } // PngChunk::parseChunkContent @@ -453,7 +453,7 @@ namespace Exiv2 { do { arr.alloc(uncompressedLen); - zlibResult = uncompress(arr.data(0), + zlibResult = uncompress(arr.data(), &uncompressedLen, compressedText, compressedTextSize); @@ -490,7 +490,7 @@ namespace Exiv2 { DataBuf arr; do { arr.resize(compressedLen); - zlibResult = compress2(arr.data(0), &compressedLen, reinterpret_cast(text.data()), + zlibResult = compress2(arr.data(), &compressedLen, reinterpret_cast(text.data()), static_cast(text.size()), Z_BEST_COMPRESSION); switch (zlibResult) { @@ -513,7 +513,7 @@ namespace Exiv2 { } } while (zlibResult == Z_BUF_ERROR); - return std::string(arr.c_str(0), arr.size()); + return std::string(arr.c_str(), arr.size()); } // PngChunk::zlibCompress @@ -610,7 +610,7 @@ namespace Exiv2 { if ( iTXt ) { info.alloc(text.size()); - info.copyBytes(0, text.c_data(0), text.size()); + info.copyBytes(0, text.c_data(), text.size()); return info; } @@ -687,7 +687,7 @@ namespace Exiv2 { // Copy profile, skipping white space and column 1 "=" signs - unsigned char *dp = info.data(0); // decode pointer + unsigned char *dp = info.data(); // decode pointer unsigned int nibbles = length * 2; for (long i = 0; i < static_cast(nibbles); i++) { diff --git a/src/pngimage.cpp b/src/pngimage.cpp index 4b9beea2..ccdc624e 100644 --- a/src/pngimage.cpp +++ b/src/pngimage.cpp @@ -109,13 +109,13 @@ namespace Exiv2 { do { result.alloc(uncompressedLen); - zlibResult = uncompress(result.data(0),&uncompressedLen,bytes,length); + zlibResult = uncompress(result.data(),&uncompressedLen,bytes,length); // if result buffer is large than necessary, redo to fit perfectly. if (zlibResult == Z_OK && static_cast(uncompressedLen) < result.size()) { result.reset(); result.alloc(uncompressedLen); - zlibResult = uncompress(result.data(0),&uncompressedLen,bytes,length); + zlibResult = uncompress(result.data(),&uncompressedLen,bytes,length); } if (zlibResult == Z_BUF_ERROR) { // the uncompressed buffer needs to be larger @@ -137,7 +137,7 @@ namespace Exiv2 { do { result.alloc(compressedLen); - zlibResult = compress(result.data(0),&compressedLen,bytes,length); + zlibResult = compress(result.data(),&compressedLen,bytes,length); if (zlibResult == Z_BUF_ERROR) { // the compressedArray needs to be larger result.reset(); @@ -145,7 +145,7 @@ namespace Exiv2 { } else { result.reset(); result.alloc(compressedLen); - zlibResult = compress(result.data(0),&compressedLen,bytes,length); + zlibResult = compress(result.data(),&compressedLen,bytes,length); } } while (zlibResult == Z_BUF_ERROR); @@ -189,7 +189,7 @@ namespace Exiv2 { // hex to binary count = 0 ; - byte* r = result.data(0); + byte* r = result.data(); int n = 0 ; // nibble for ( long i = 0 ; i < length ; i++ ) { if ( value[p[i]] ) { @@ -250,7 +250,7 @@ namespace Exiv2 { size_t address = io_->tell(); cheaderBuf.clear(); - long bufRead = io_->read(cheaderBuf.data(0), cheaderBuf.size()); + long bufRead = io_->read(cheaderBuf.data(), cheaderBuf.size()); if (io_->error()) throw Error(kerFailedToReadImageData); if (bufRead != cheaderBuf.size()) throw Error(kerInputDataReadFailed); @@ -270,7 +270,7 @@ namespace Exiv2 { } DataBuf buff(dataOffset); - bufRead = io_->read(buff.data(0),dataOffset); + bufRead = io_->read(buff.data(),dataOffset); enforce(bufRead == static_cast(dataOffset), kerFailedToReadImageData); io_->seek(restore, BasicIo::beg); @@ -324,10 +324,10 @@ namespace Exiv2 { enforce(static_cast(dataOffset) < static_cast(std::numeric_limits::max()), kerFailedToReadImageData); DataBuf data(static_cast(dataOffset) + 1); data.write_uint8(dataOffset, 0); - bufRead = io_->read(data.data(0), static_cast(dataOffset)); + bufRead = io_->read(data.data(), static_cast(dataOffset)); enforce(bufRead == static_cast(dataOffset), kerFailedToReadImageData); io_->seek(restore, BasicIo::beg); - size_t name_l = std::strlen(data.c_str(0)) + + size_t name_l = std::strlen(data.c_str()) + 1; // leading string length enforce(name_l < dataOffset, kerCorruptedMetadata); @@ -359,7 +359,7 @@ namespace Exiv2 { if ( bExif || bIptc ) { DataBuf parsedBuf = PngChunk::readRawProfile(dataBuf,tEXt); #if EXIV2_DEBUG_MESSAGES - std::cerr << Exiv2::Internal::binaryToString(makeSlice(parsedBuf.c_data(0), parsedBuf.size()>50?50:parsedBuf.size(),0)) << std::endl; + std::cerr << Exiv2::Internal::binaryToString(makeSlice(parsedBuf.c_data(), parsedBuf.size()>50?50:parsedBuf.size(),0)) << std::endl; #endif if ( parsedBuf.size() ) { if ( bExif ) { @@ -375,26 +375,26 @@ namespace Exiv2 { if ( bSoft && dataBuf.size() > 0) { DataBuf s(dataBuf.size()+1); // allocate buffer with an extra byte - s.copyBytes(0,dataBuf.c_data(0),dataBuf.size());// copy in the dataBuf + s.copyBytes(0,dataBuf.c_data(),dataBuf.size());// copy in the dataBuf s.write_uint8(dataBuf.size(), 0); // nul terminate it - const auto str = s.c_str(0); // give it name - out << Internal::indent(depth) << buff.c_str(0) << ": " << str; + const auto str = s.c_str(); // give it name + out << Internal::indent(depth) << buff.c_str() << ": " << str; bLF=true; } if ( bICC || bComm ) { - out.write(dataBuf.c_str(0), dataBuf.size()); + out.write(dataBuf.c_str(), dataBuf.size()); bLF = bComm ; } if ( bDesc && iTXt ) { DataBuf decoded = PngChunk::decodeTXTChunk(buff,PngChunk::iTXt_Chunk ); - out.write(decoded.c_str(0), decoded.size()); + out.write(decoded.c_str(), decoded.size()); bLF = true; } if ( eXIf && option == kpsRecursive ) { // create memio object with the data, then print the structure - BasicIo::UniquePtr p = BasicIo::UniquePtr(new MemIo(data.c_data(0), dataOffset)); + BasicIo::UniquePtr p = BasicIo::UniquePtr(new MemIo(data.c_data(), dataOffset)); printTiffStructure(*p,out,option,depth); } @@ -412,7 +412,7 @@ namespace Exiv2 { #ifdef EXIV2_DEBUG_MESSAGES std::cout << "Exiv2::PngImage::readMetadata: Position: " << io.tell() << std::endl; #endif - long bufRead = io.read(buffer.data(0), buffer.size()); + long bufRead = io.read(buffer.data(), buffer.size()); if (io.error()) { throw Error(kerFailedToReadImageData); } @@ -484,7 +484,7 @@ namespace Exiv2 { ByteOrder bo = TiffParser::decode(exifData(), iptcData(), xmpData(), - chunkData.c_data(0), + chunkData.c_data(), chunkData.size()); setByteOrder(bo); } else if (chunkType == "iCCP") { @@ -495,7 +495,7 @@ namespace Exiv2 { Exiv2::kerCorruptedMetadata); } while(chunkData.read_uint8(iccOffset++) != 0x00); - profileName_ = std::string(chunkData.c_str(0), iccOffset-1); + profileName_ = std::string(chunkData.c_str(), iccOffset-1); ++iccOffset; // +1 = 'compressed' flag enforce(iccOffset <= chunkLength, Exiv2::kerCorruptedMetadata); @@ -564,7 +564,7 @@ namespace Exiv2 { // Read chunk header. cheaderBuf.clear(); - long bufRead = io_->read(cheaderBuf.data(0), 8); + long bufRead = io_->read(cheaderBuf.data(), 8); if (io_->error()) throw Error(kerFailedToReadImageData); if (bufRead != 8) throw Error(kerInputDataReadFailed); @@ -576,7 +576,7 @@ namespace Exiv2 { // Read whole chunk : Chunk header + Chunk data (not fixed size - can be null) + CRC (4 bytes). DataBuf chunkBuf(8 + dataOffset + 4); // Chunk header (8 bytes) + Chunk data + CRC (4 bytes). - chunkBuf.copyBytes(0, cheaderBuf.c_data(0), 8); // Copy header. + chunkBuf.copyBytes(0, cheaderBuf.c_data(), 8); // Copy header. bufRead = io_->read(chunkBuf.data(8), dataOffset + 4); // Extract chunk data + CRC if (io_->error()) throw Error(kerFailedToReadImageData); if (bufRead != static_cast(dataOffset) + 4L) @@ -592,7 +592,7 @@ namespace Exiv2 { #ifdef EXIV2_DEBUG_MESSAGES std::cout << "Exiv2::PngImage::doWriteMetadata: Write IEND chunk (length: " << dataOffset << ")\n"; #endif - if (outIo.write(chunkBuf.data(0), chunkBuf.size()) != chunkBuf.size()) + if (outIo.write(chunkBuf.data(), chunkBuf.size()) != chunkBuf.size()) throw Error(kerImageWriteFailed); return; } @@ -603,7 +603,7 @@ namespace Exiv2 { #ifdef EXIV2_DEBUG_MESSAGES std::cout << "Exiv2::PngImage::doWriteMetadata: Write IHDR chunk (length: " << dataOffset << ")\n"; #endif - if (outIo.write(chunkBuf.data(0), chunkBuf.size()) != chunkBuf.size()) throw Error(kerImageWriteFailed); + if (outIo.write(chunkBuf.data(), chunkBuf.size()) != chunkBuf.size()) throw Error(kerImageWriteFailed); // Write all updated metadata here, just after IHDR. if (!comment_.empty()) @@ -639,7 +639,7 @@ namespace Exiv2 { DataBuf newPsData = Photoshop::setIptcIrb(nullptr, 0, iptcData_); if (newPsData.size() > 0) { - std::string rawIptc(newPsData.c_str(0), newPsData.size()); + std::string rawIptc(newPsData.c_str(), newPsData.size()); std::string chunk = PngChunk::makeMetadataChunk(rawIptc, mdIptc); if (outIo.write(reinterpret_cast(chunk.data()), static_cast(chunk.size())) != static_cast(chunk.size())) { @@ -650,7 +650,7 @@ namespace Exiv2 { if ( iccProfileDefined() ) { DataBuf compressed; - if ( zlibToCompressed(iccProfile_.c_data(0),iccProfile_.size(),compressed) ) { + if ( zlibToCompressed(iccProfile_.c_data(),iccProfile_.size(),compressed) ) { const auto nameLength = static_cast(profileName_.size()); const uint32_t chunkLength = nameLength + 2 + compressed.size() ; byte length[4]; @@ -661,7 +661,7 @@ namespace Exiv2 { tmp = crc32(tmp, typeICCP, 4); tmp = crc32(tmp, (const Bytef*)profileName_.data(), nameLength); tmp = crc32(tmp, nullComp, 2); - tmp = crc32(tmp, compressed.c_data(0), compressed.size()); + tmp = crc32(tmp, compressed.c_data(), compressed.size()); byte crc[4]; ul2Data(crc, tmp, bigEndian); @@ -669,7 +669,7 @@ namespace Exiv2 { || outIo.write(typeICCP, 4) != 4 || outIo.write(reinterpret_cast(profileName_.data()), nameLength) != nameLength || outIo.write(nullComp,2) != 2 - || outIo.write (compressed.c_data(0),compressed.size()) != compressed.size() + || outIo.write (compressed.c_data(),compressed.size()) != compressed.size() || outIo.write(crc,4) != 4 ){ throw Error(kerImageWriteFailed); @@ -719,7 +719,7 @@ namespace Exiv2 { std::cout << "Exiv2::PngImage::doWriteMetadata: write " << szChunk << " chunk (length: " << dataOffset << ")" << std::endl; #endif - if (outIo.write(chunkBuf.c_data(0), chunkBuf.size()) != chunkBuf.size()) throw Error(kerImageWriteFailed); + if (outIo.write(chunkBuf.c_data(), chunkBuf.size()) != chunkBuf.size()) throw Error(kerImageWriteFailed); } } else { // Write all others chunk as well. @@ -727,7 +727,7 @@ namespace Exiv2 { std::cout << "Exiv2::PngImage::doWriteMetadata: copy " << szChunk << " chunk (length: " << dataOffset << ")" << std::endl; #endif - if (outIo.write(chunkBuf.c_data(0), chunkBuf.size()) != chunkBuf.size()) throw Error(kerImageWriteFailed); + if (outIo.write(chunkBuf.c_data(), chunkBuf.size()) != chunkBuf.size()) throw Error(kerImageWriteFailed); } } diff --git a/src/preview.cpp b/src/preview.cpp index 823089fb..39a3023b 100644 --- a/src/preview.cpp +++ b/src/preview.cpp @@ -484,7 +484,7 @@ namespace { const byte *record; uint32_t sizeHdr = 0; uint32_t sizeData = 0; - if (Photoshop::locatePreviewIrb(psData.c_data(0), psData.size(), &record, &sizeHdr, &sizeData) != 0) { + if (Photoshop::locatePreviewIrb(psData.c_data(), psData.size(), &record, &sizeHdr, &sizeData) != 0) { #ifndef SUPPRESS_WARNINGS EXV_WARNING << "Missing preview IRB in Photoshop EPS preview.\n"; #endif @@ -503,7 +503,7 @@ namespace { const DataBuf data = getData(); if (data.size() == 0) return false; try { - Image::UniquePtr image = ImageFactory::open(data.c_data(0), data.size()); + Image::UniquePtr image = ImageFactory::open(data.c_data(), data.size()); if (image.get() == nullptr) return false; image->readMetadata(); @@ -651,7 +651,7 @@ namespace { if (buf.size() == 0) { // direct data buf = DataBuf(pos->size()); - pos->copy(buf.data(0), invalidByteOrder); + pos->copy(buf.data(), invalidByteOrder); } buf.write_uint8(0, 0xff); // fix Minolta thumbnails with invalid jpeg header @@ -669,7 +669,7 @@ namespace { if (buf.size() == 0) return false; try { - Image::UniquePtr image = ImageFactory::open(buf.c_data(0), buf.size()); + Image::UniquePtr image = ImageFactory::open(buf.c_data(), buf.size()); if (image.get() == nullptr) return false; image->readMetadata(); @@ -819,7 +819,7 @@ namespace { idxBuf += size; } - dataValue.setDataArea(buf.c_data(0), buf.size()); + dataValue.setDataArea(buf.c_data(), buf.size()); } } } @@ -886,7 +886,7 @@ namespace { DataBuf LoaderXmpJpeg::getData() const { if (!valid()) return DataBuf(); - return DataBuf(preview_.c_data(0), preview_.size()); + return DataBuf(preview_.c_data(), preview_.size()); } bool LoaderXmpJpeg::readDimensions() @@ -972,7 +972,7 @@ namespace { DataBuf decodeAi7Thumbnail(const DataBuf &src) { - const byte *colorTable = src.c_data(0); + const byte *colorTable = src.c_data(); const long colorTableSize = 256 * 3; if (src.size() < colorTableSize) { #ifndef SUPPRESS_WARNINGS @@ -1028,7 +1028,7 @@ namespace { DataBuf dest(static_cast(header.size() + rgb.size())); dest.copyBytes(0, headerBytes, header.size()); - dest.copyBytes(header.size(), rgb.c_data(0), rgb.size()); + dest.copyBytes(header.size(), rgb.c_data(), rgb.size()); return dest; } @@ -1078,7 +1078,7 @@ namespace Exiv2 { const byte* PreviewImage::pData() const { - return preview_.c_data(0); + return preview_.c_data(); } uint32_t PreviewImage::size() const diff --git a/src/psdimage.cpp b/src/psdimage.cpp index a4f12fd6..d442bbb5 100644 --- a/src/psdimage.cpp +++ b/src/psdimage.cpp @@ -247,9 +247,9 @@ namespace Exiv2 { case kPhotoshopResourceID_IPTC_NAA: { DataBuf rawIPTC(resourceSize); - io_->read(rawIPTC.data(0), rawIPTC.size()); + io_->read(rawIPTC.data(), rawIPTC.size()); if (io_->error() || io_->eof()) throw Error(kerFailedToReadImageData); - if (IptcParser::decode(iptcData_, rawIPTC.c_data(0), rawIPTC.size())) { + if (IptcParser::decode(iptcData_, rawIPTC.c_data(), rawIPTC.size())) { #ifndef SUPPRESS_WARNINGS EXV_WARNING << "Failed to decode IPTC metadata.\n"; #endif @@ -261,9 +261,9 @@ namespace Exiv2 { case kPhotoshopResourceID_ExifInfo: { DataBuf rawExif(resourceSize); - io_->read(rawExif.data(0), rawExif.size()); + io_->read(rawExif.data(), rawExif.size()); if (io_->error() || io_->eof()) throw Error(kerFailedToReadImageData); - ByteOrder bo = ExifParser::decode(exifData_, rawExif.c_data(0), rawExif.size()); + ByteOrder bo = ExifParser::decode(exifData_, rawExif.c_data(), rawExif.size()); setByteOrder(bo); if (rawExif.size() > 0 && byteOrder() == invalidByteOrder) { #ifndef SUPPRESS_WARNINGS @@ -277,9 +277,9 @@ namespace Exiv2 { case kPhotoshopResourceID_XMPPacket: { DataBuf xmpPacket(resourceSize); - io_->read(xmpPacket.data(0), xmpPacket.size()); + io_->read(xmpPacket.data(), xmpPacket.size()); if (io_->error() || io_->eof()) throw Error(kerFailedToReadImageData); - xmpPacket_.assign(xmpPacket.c_str(0), xmpPacket.size()); + xmpPacket_.assign(xmpPacket.c_str(), xmpPacket.size()); if (!xmpPacket_.empty() && XmpParser::decode(xmpData_, xmpPacket_)) { #ifndef SUPPRESS_WARNINGS EXV_WARNING << "Failed to decode XMP metadata.\n"; @@ -404,9 +404,9 @@ namespace Exiv2 { while (readTotal < colorDataLength) { toRead = static_cast(colorDataLength - readTotal) < lbuf.size() ? static_cast(colorDataLength - readTotal) : lbuf.size(); - if (io_->read(lbuf.data(0), toRead) != toRead) throw Error(kerNotAnImage, "Photoshop"); + if (io_->read(lbuf.data(), toRead) != toRead) throw Error(kerNotAnImage, "Photoshop"); readTotal += toRead; - if (outIo.write(lbuf.c_data(0), toRead) != toRead) throw Error(kerImageWriteFailed); + if (outIo.write(lbuf.c_data(), toRead) != toRead) throw Error(kerImageWriteFailed); } if (outIo.error()) throw Error(kerImageWriteFailed); @@ -450,7 +450,7 @@ namespace Exiv2 { // read rest of resource name, plus any padding DataBuf resName(256); - if ( io_->read(resName.data(0), adjResourceNameLen) + if ( io_->read(resName.data(), adjResourceNameLen) != static_cast(adjResourceNameLen)) throw Error(kerNotAnImage, "Photoshop"); // read resource size (actual length w/o padding!) @@ -500,7 +500,7 @@ namespace Exiv2 { if (outIo.write(buf, 1) != 1) throw Error(kerImageWriteFailed); buf[0] = resourceNameFirstChar; if (outIo.write(buf, 1) != 1) throw Error(kerImageWriteFailed); - if ( outIo.write(resName.c_data(0), adjResourceNameLen) + if ( outIo.write(resName.c_data(), adjResourceNameLen) != static_cast(adjResourceNameLen)) throw Error(kerImageWriteFailed); ul2Data(buf, resourceSize, bigEndian); if (outIo.write(buf, 4) != 4) throw Error(kerImageWriteFailed); @@ -510,11 +510,11 @@ namespace Exiv2 { while (readTotal < pResourceSize) { toRead = static_cast(pResourceSize - readTotal) < lbuf.size() ? static_cast(pResourceSize - readTotal) : lbuf.size(); - if (io_->read(lbuf.data(0), toRead) != toRead) { + if (io_->read(lbuf.data(), toRead) != toRead) { throw Error(kerNotAnImage, "Photoshop"); } readTotal += toRead; - if (outIo.write(lbuf.c_data(0), toRead) != toRead) throw Error(kerImageWriteFailed); + if (outIo.write(lbuf.c_data(), toRead) != toRead) throw Error(kerImageWriteFailed); } if (outIo.error()) throw Error(kerImageWriteFailed); newResLength += pResourceSize + adjResourceNameLen + 12; @@ -548,8 +548,8 @@ namespace Exiv2 { // Copy remaining data long readSize = 0; - while ((readSize=io_->read(lbuf.data(0), lbuf.size()))) { - if (outIo.write(lbuf.c_data(0), readSize) != readSize) throw Error(kerImageWriteFailed); + while ((readSize=io_->read(lbuf.data(), lbuf.size()))) { + if (outIo.write(lbuf.c_data(), readSize) != readSize) throw Error(kerImageWriteFailed); } if (outIo.error()) throw Error(kerImageWriteFailed); @@ -583,7 +583,7 @@ namespace Exiv2 { ul2Data(buf, rawIptc.size(), bigEndian); if (out.write(buf, 4) != 4) throw Error(kerImageWriteFailed); // Write encoded Iptc data - if (out.write(rawIptc.c_data(0), rawIptc.size()) != rawIptc.size()) throw Error(kerImageWriteFailed); + if (out.write(rawIptc.c_data(), rawIptc.size()) != rawIptc.size()) throw Error(kerImageWriteFailed); resLength += rawIptc.size() + 12; if (rawIptc.size() & 1) // even padding { diff --git a/src/rafimage.cpp b/src/rafimage.cpp index ef77975a..82e37d47 100644 --- a/src/rafimage.cpp +++ b/src/rafimage.cpp @@ -160,7 +160,7 @@ namespace Exiv2 { address = io_->tell(); DataBuf unknown(20); - io_->read(unknown.data(0),unknown.size()); + io_->read(unknown.data(),unknown.size()); { out << Internal::indent(depth) << Internal::stringFormat(format,address, 20) @@ -249,7 +249,7 @@ namespace Exiv2 { io_->seek(jpg_img_off, BasicIo::beg); // rewind address = io_->tell(); DataBuf payload(16); // header is different from chunks - io_->read(payload.data(0), payload.size()); + io_->read(payload.data(), payload.size()); { out << Internal::indent(depth) << Internal::stringFormat(format,address, jpg_img_len) // , jpg_img_off) @@ -260,7 +260,7 @@ namespace Exiv2 { io_->seek(cfa_hdr_off, BasicIo::beg); // rewind address = io_->tell(); - io_->read(payload.data(0), payload.size()); + io_->read(payload.data(), payload.size()); { out << Internal::indent(depth) << Internal::stringFormat(format,address, cfa_hdr_len, cfa_hdr_off) @@ -271,7 +271,7 @@ namespace Exiv2 { io_->seek(cfa_off, BasicIo::beg); // rewind address = io_->tell(); - io_->read(payload.data(0), payload.size()); + io_->read(payload.data(), payload.size()); { out << Internal::indent(depth) << Internal::stringFormat(format,address, cfa_len, cfa_off) @@ -321,7 +321,7 @@ namespace Exiv2 { DataBuf buf(jpg_img_len - 12); if (io_->seek(jpg_img_off + 12,BasicIo::beg) != 0) throw Error(kerFailedToReadImageData); - io_->read(buf.data(0), buf.size()); + io_->read(buf.data(), buf.size()); if (io_->error() || io_->eof()) throw Error(kerFailedToReadImageData); io_->seek(0,BasicIo::beg); // rewind @@ -329,7 +329,7 @@ namespace Exiv2 { ByteOrder bo = TiffParser::decode(exifData_, iptcData_, xmpData_, - buf.c_data(0), + buf.c_data(), buf.size()); exifData_["Exif.Image2.JPEGInterchangeFormat"] = getULong(jpg_img_offset, bigEndian); @@ -360,14 +360,14 @@ namespace Exiv2 { memcmp(readBuff, "\x4D\x4D\x00\x2A", 4) == 0) { DataBuf tiff(tiffLength); - io_->read(tiff.data(0), tiff.size()); + io_->read(tiff.data(), tiff.size()); if (!io_->error() && !io_->eof()) { TiffParser::decode(exifData_, iptcData_, xmpData_, - tiff.c_data(0), + tiff.c_data(), tiff.size()); } } diff --git a/src/tags_int.cpp b/src/tags_int.cpp index 1b2e2817..53b28ba0 100644 --- a/src/tags_int.cpp +++ b/src/tags_int.cpp @@ -2693,7 +2693,7 @@ namespace Exiv2 { bool cnv = false; if (value.typeId() == unsignedByte && value.size() > 0) { DataBuf buf(value.size()); - value.copy(buf.data(0), invalidByteOrder); + value.copy(buf.data(), invalidByteOrder); // Strip trailing odd byte due to failing UCS-2 conversion if (buf.size() % 2 == 1) { buf.resize(buf.size() - 1); @@ -2708,7 +2708,7 @@ namespace Exiv2 { } } - std::string str(buf.c_str(0), buf.size()); + std::string str(buf.c_str(), buf.size()); cnv = convertStringCharset(str, "UCS-2LE", "UTF-8"); if (cnv) os << str; } diff --git a/src/tiffcomposite_int.cpp b/src/tiffcomposite_int.cpp index 3be0615c..943f33bb 100644 --- a/src/tiffcomposite_int.cpp +++ b/src/tiffcomposite_int.cpp @@ -1231,8 +1231,8 @@ namespace Exiv2 { if (!pValue_) return 0; DataBuf buf(pValue_->size()); - pValue_->copy(buf.data(0), byteOrder); - ioWrapper.write(buf.c_data(0), buf.size()); + pValue_->copy(buf.data(), byteOrder); + ioWrapper.write(buf.c_data(), buf.size()); return buf.size(); } // TiffEntryBase::doWrite @@ -1279,7 +1279,7 @@ namespace Exiv2 { tiffType(), byteOrder); } - ioWrapper.write(buf.c_data(0), buf.size()); + ioWrapper.write(buf.c_data(), buf.size()); return buf.size(); } // TiffDataEntry::doWrite @@ -1311,7 +1311,7 @@ namespace Exiv2 { imageIdx += strip.second & 1; // Align strip data to word boundary } } - ioWrapper.write(buf.c_data(0), buf.size()); + ioWrapper.write(buf.c_data(), buf.size()); return buf.size(); } // TiffImageEntry::doWrite @@ -1330,7 +1330,7 @@ namespace Exiv2 { idx += writeOffset(buf.data(idx), offset + dataIdx, tiffType(), byteOrder); dataIdx += ifd->size(); } - ioWrapper.write(buf.c_data(0), buf.size()); + ioWrapper.write(buf.c_data(), buf.size()); return buf.size(); } // TiffSubIfd::doWrite @@ -1419,7 +1419,7 @@ namespace Exiv2 { DataBuf buf = cryptFct(tag(), mio.mmap(), static_cast(mio.size()), pRoot_); if ( buf.size()) { mio.seek(0,Exiv2::FileIo::beg); - mio.write(buf.c_data(0), buf.size()); + mio.write(buf.c_data(), buf.size()); } } ioWrapper.write(mio.mmap(), static_cast(mio.size())); @@ -1437,8 +1437,8 @@ namespace Exiv2 { Value const* pv = pValue(); if (!pv || pv->count() == 0) return 0; DataBuf buf(pv->size()); - pv->copy(buf.data(0), byteOrder); - ioWrapper.write(buf.c_data(0), buf.size()); + pv->copy(buf.data(), byteOrder); + ioWrapper.write(buf.c_data(), buf.size()); return buf.size(); } // TiffBinaryElement::doWrite @@ -1496,7 +1496,7 @@ namespace Exiv2 { if (!pValue()) return 0; DataBuf buf = pValue()->dataArea(); - ioWrapper.write(buf.c_data(0), buf.size()); + ioWrapper.write(buf.c_data(), buf.size()); // Align data to word boundary uint32_t align = (buf.size() & 1); if (align) ioWrapper.putb(0x0); @@ -1604,7 +1604,7 @@ namespace Exiv2 { << ": Writing data area, size = " << len; #endif DataBuf buf = pValue()->dataArea(); - ioWrapper.write(buf.c_data(0), buf.size()); + ioWrapper.write(buf.c_data(), buf.size()); uint32_t align = len & 1; // Align image data to word boundary if (align) ioWrapper.putb(0x0); len += align; @@ -1912,7 +1912,7 @@ namespace { if (curr < tobe) { Exiv2::DataBuf buf(tobe - curr); buf.clear(); - ioWrapper.write(buf.c_data(0), buf.size()); + ioWrapper.write(buf.c_data(), buf.size()); return tobe - curr; } return 0; diff --git a/src/tiffimage.cpp b/src/tiffimage.cpp index 8050e24d..5db5b8f6 100644 --- a/src/tiffimage.cpp +++ b/src/tiffimage.cpp @@ -199,7 +199,7 @@ namespace Exiv2 { throw Error(kerFailedToReadImageData); } iccProfile_.alloc(size); - pos->copy(iccProfile_.data(0),bo); + pos->copy(iccProfile_.data(),bo); } } @@ -234,7 +234,7 @@ namespace Exiv2 { auto pos = exifData_.findKey(key); bool found = pos != exifData_.end(); if ( iccProfileDefined() ) { - Exiv2::DataValue value(iccProfile_.c_data(0), iccProfile_.size()); + Exiv2::DataValue value(iccProfile_.c_data(), iccProfile_.size()); if ( found ) pos->setValue(&value); else exifData_.add(key,&value); } else { diff --git a/src/tiffimage_int.cpp b/src/tiffimage_int.cpp index f8dc339d..da740bc2 100644 --- a/src/tiffimage_int.cpp +++ b/src/tiffimage_int.cpp @@ -1929,7 +1929,7 @@ namespace Exiv2 { DataBuf header = pHeader->write(); BasicIo::UniquePtr tempIo(new MemIo); assert(tempIo.get() != 0); - IoWrapper ioWrapper(*tempIo, header.c_data(0), header.size(), pOffsetWriter); + IoWrapper ioWrapper(*tempIo, header.c_data(), header.size(), pOffsetWriter); auto imageIdx(uint32_t(-1)); createdTree->write(ioWrapper, pHeader->byteOrder(), diff --git a/src/tiffvisitor_int.cpp b/src/tiffvisitor_int.cpp index 0303c4a3..ab568748 100644 --- a/src/tiffvisitor_int.cpp +++ b/src/tiffvisitor_int.cpp @@ -624,12 +624,12 @@ namespace Exiv2 { // Pad the last unsignedLong value with 0s buf.alloc((rawIptc.size() / 4) * 4 + 4); buf.clear(); - buf.copyBytes(0, rawIptc.c_data(0), rawIptc.size()); + buf.copyBytes(0, rawIptc.c_data(), rawIptc.size()); } else { buf = rawIptc; // Note: This resets rawIptc } - value->read(buf.data(0), buf.size(), byteOrder_); + value->read(buf.data(), buf.size(), byteOrder_); Exifdatum iptcDatum(iptcNaaKey, value.get()); exifData_.add(iptcDatum); pos = exifData_.findKey(irbKey); // needed after add() @@ -638,12 +638,12 @@ namespace Exiv2 { // but don't create it if not. if (pos != exifData_.end()) { DataBuf irbBuf(pos->value().size()); - pos->value().copy(irbBuf.data(0), invalidByteOrder); - irbBuf = Photoshop::setIptcIrb(irbBuf.c_data(0), irbBuf.size(), iptcData_); + pos->value().copy(irbBuf.data(), invalidByteOrder); + irbBuf = Photoshop::setIptcIrb(irbBuf.c_data(), irbBuf.size(), iptcData_); exifData_.erase(pos); if (irbBuf.size() != 0) { Value::UniquePtr value = Value::create(unsignedByte); - value->read(irbBuf.data(0), irbBuf.size(), invalidByteOrder); + value->read(irbBuf.data(), irbBuf.size(), invalidByteOrder); Exifdatum iptcDatum(irbKey, value.get()); exifData_.add(iptcDatum); } @@ -833,7 +833,7 @@ namespace Exiv2 { const byte* pData = object->pData(); DataBuf buf = cryptFct(object->tag(), pData, size, pRoot_); if (buf.size() > 0) { - pData = buf.c_data(0); + pData = buf.c_data(); size = buf.size(); } if (!object->updOrigDataBuf(pData, size)) { @@ -948,7 +948,7 @@ namespace Exiv2 { #endif DataBuf buf = object->pValue()->dataArea(); if ( buf.size() > 0 ) { - memcpy(object->pDataArea_, buf.c_data(0), buf.size()); + memcpy(object->pDataArea_, buf.c_data(), buf.size()); if (object->sizeDataArea_ > static_cast(buf.size())) { memset(object->pDataArea_ + buf.size(), 0x0, object->sizeDataArea_ - buf.size()); diff --git a/src/types.cpp b/src/types.cpp index 2218b522..026cc4c3 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -304,13 +304,13 @@ namespace Exiv2 { Slice makeSlice(DataBuf& buf, size_t begin, size_t end) { checkDataBufBounds(buf, end); - return {buf.data(0), begin, end}; + return {buf.data(), begin, end}; } Slice makeSlice(const DataBuf& buf, size_t begin, size_t end) { checkDataBufBounds(buf, end); - return {buf.c_data(0), begin, end}; + return {buf.c_data(), begin, end}; } std::ostream& operator<<(std::ostream& os, const Rational& r) diff --git a/src/webpimage.cpp b/src/webpimage.cpp index a6c8ade7..9ae77786 100644 --- a/src/webpimage.cpp +++ b/src/webpimage.cpp @@ -180,7 +180,7 @@ namespace Exiv2 { case we have any exif or xmp data, also check for any chunks with alpha frame/layer set */ while (!io_->eof() && static_cast(io_->tell()) < filesize) { - readOrThrow(*io_, chunkId.data(0), WEBP_TAG_SIZE, Exiv2::kerCorruptedMetadata); + readOrThrow(*io_, chunkId.data(), WEBP_TAG_SIZE, Exiv2::kerCorruptedMetadata); readOrThrow(*io_, size_buff, WEBP_TAG_SIZE, Exiv2::kerCorruptedMetadata); const uint32_t size_u32 = Exiv2::getULong(size_buff, littleEndian); @@ -189,7 +189,7 @@ namespace Exiv2 { Exiv2::kerCorruptedMetadata); const long size = static_cast(size_u32); DataBuf payload(size); - readOrThrow(*io_, payload.data(0), payload.size(), Exiv2::kerCorruptedMetadata); + readOrThrow(*io_, payload.data(), payload.size(), Exiv2::kerCorruptedMetadata); if ( payload.size() % 2 ) { byte c = 0; readOrThrow(*io_, &c, 1, Exiv2::kerCorruptedMetadata); @@ -317,7 +317,7 @@ namespace Exiv2 { io_->seek(12, BasicIo::beg); while (!io_->eof() && static_cast(io_->tell()) < filesize) { - readOrThrow(*io_, chunkId.data(0), 4, Exiv2::kerCorruptedMetadata); + readOrThrow(*io_, chunkId.data(), 4, Exiv2::kerCorruptedMetadata); readOrThrow(*io_, size_buff, 4, Exiv2::kerCorruptedMetadata); const uint32_t size_u32 = Exiv2::getULong(size_buff, littleEndian); @@ -328,7 +328,7 @@ namespace Exiv2 { const long size = static_cast(size_u32); DataBuf payload(size); - readOrThrow(*io_, payload.data(0), size, Exiv2::kerCorruptedMetadata); + readOrThrow(*io_, payload.data(), size, Exiv2::kerCorruptedMetadata); if ( io_->tell() % 2 ) io_->seek(+1,BasicIo::cur); // skip pad if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_VP8X)) { @@ -357,11 +357,11 @@ namespace Exiv2 { payload.write_uint8(0, x & ~WEBP_VP8X_EXIF_BIT); } - if (outIo.write(chunkId.c_data(0), WEBP_TAG_SIZE) != WEBP_TAG_SIZE) + if (outIo.write(chunkId.c_data(), WEBP_TAG_SIZE) != WEBP_TAG_SIZE) throw Error(kerImageWriteFailed); if (outIo.write(size_buff, WEBP_TAG_SIZE) != WEBP_TAG_SIZE) throw Error(kerImageWriteFailed); - if (outIo.write(payload.c_data(0), payload.size()) != payload.size()) + if (outIo.write(payload.c_data(), payload.size()) != payload.size()) throw Error(kerImageWriteFailed); if (outIo.tell() % 2) { if (outIo.write(&WEBP_PAD_ODD, 1) != 1) throw Error(kerImageWriteFailed); @@ -373,7 +373,7 @@ namespace Exiv2 { throw Error(kerImageWriteFailed); ul2Data(data, static_cast(iccProfile_.size()), littleEndian); if (outIo.write(data, WEBP_TAG_SIZE) != WEBP_TAG_SIZE) throw Error(kerImageWriteFailed); - if (outIo.write(iccProfile_.c_data(0), iccProfile_.size()) != iccProfile_.size()) { + if (outIo.write(iccProfile_.c_data(), iccProfile_.size()) != iccProfile_.size()) { throw Error(kerImageWriteFailed); } has_icc = false; @@ -385,11 +385,11 @@ namespace Exiv2 { } else if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_XMP)) { // Skip and add new data afterwards } else { - if (outIo.write(chunkId.c_data(0), WEBP_TAG_SIZE) != WEBP_TAG_SIZE) + if (outIo.write(chunkId.c_data(), WEBP_TAG_SIZE) != WEBP_TAG_SIZE) throw Error(kerImageWriteFailed); if (outIo.write(size_buff, WEBP_TAG_SIZE) != WEBP_TAG_SIZE) throw Error(kerImageWriteFailed); - if (outIo.write(payload.c_data(0), payload.size()) != payload.size()) + if (outIo.write(payload.c_data(), payload.size()) != payload.size()) throw Error(kerImageWriteFailed); } @@ -471,15 +471,15 @@ namespace Exiv2 { while (!io_->eof() && static_cast(io_->tell()) < filesize) { auto offset = static_cast(io_->tell()); byte size_buff[WEBP_TAG_SIZE]; - io_->read(chunkId.data(0), WEBP_TAG_SIZE); + io_->read(chunkId.data(), WEBP_TAG_SIZE); io_->read(size_buff, WEBP_TAG_SIZE); long size = Exiv2::getULong(size_buff, littleEndian); DataBuf payload(offset?size:WEBP_TAG_SIZE); // header is different from chunks - io_->read(payload.data(0), payload.size()); + io_->read(payload.data(), payload.size()); if ( bPrint ) { out << Internal::indent(depth) - << Internal::stringFormat(" %s | %8u | %8u | ", chunkId.c_str(0), + << Internal::stringFormat(" %s | %8u | %8u | ", chunkId.c_str(), static_cast(size), static_cast(offset)) << Internal::binaryToString(makeSlice(payload, 0, payload.size() > 32 ? 32 : payload.size())) << std::endl; @@ -487,7 +487,7 @@ namespace Exiv2 { if ( equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_EXIF) && option==kpsRecursive ) { // create memio object with the payload, then print the structure - BasicIo::UniquePtr p = BasicIo::UniquePtr(new MemIo(payload.c_data(0),payload.size())); + BasicIo::UniquePtr p = BasicIo::UniquePtr(new MemIo(payload.c_data(),payload.size())); printTiffStructure(*p,out,option,depth); } @@ -495,7 +495,7 @@ namespace Exiv2 { || (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_ICCP) && option==kpsIccProfile) ; if ( bPrintPayload ) { - out.write(payload.c_str(0), payload.size()); + out.write(payload.c_str(), payload.size()); } if ( offset && io_->tell() % 2 ) io_->seek(+1, BasicIo::cur); // skip padding byte on sub-chunks @@ -546,7 +546,7 @@ namespace Exiv2 { chunkId.write_uint8(4, '\0'); while (!io_->eof() && io_->tell() < filesize) { - readOrThrow(*io_, chunkId.data(0), WEBP_TAG_SIZE, Exiv2::kerCorruptedMetadata); + readOrThrow(*io_, chunkId.data(), WEBP_TAG_SIZE, Exiv2::kerCorruptedMetadata); readOrThrow(*io_, size_buff, WEBP_TAG_SIZE, Exiv2::kerCorruptedMetadata); const uint32_t size_u32 = Exiv2::getULong(size_buff, littleEndian); @@ -568,7 +568,7 @@ namespace Exiv2 { has_canvas_data = true; byte size_buf[WEBP_TAG_SIZE]; - readOrThrow(*io_, payload.data(0), payload.size(), Exiv2::kerCorruptedMetadata); + readOrThrow(*io_, payload.data(), payload.size(), Exiv2::kerCorruptedMetadata); // Fetch width memcpy(&size_buf, payload.c_data(4), 3); @@ -583,7 +583,7 @@ namespace Exiv2 { enforce(size >= 10, Exiv2::kerCorruptedMetadata); has_canvas_data = true; - readOrThrow(*io_, payload.data(0), payload.size(), Exiv2::kerCorruptedMetadata); + readOrThrow(*io_, payload.data(), payload.size(), Exiv2::kerCorruptedMetadata); byte size_buf[WEBP_TAG_SIZE]; // Fetch width"" @@ -604,7 +604,7 @@ namespace Exiv2 { byte size_buf_w[2]; byte size_buf_h[3]; - readOrThrow(*io_, payload.data(0), payload.size(), Exiv2::kerCorruptedMetadata); + readOrThrow(*io_, payload.data(), payload.size(), Exiv2::kerCorruptedMetadata); // Fetch width memcpy(&size_buf_w, payload.c_data(1), 2); @@ -622,7 +622,7 @@ namespace Exiv2 { has_canvas_data = true; byte size_buf[WEBP_TAG_SIZE]; - readOrThrow(*io_, payload.data(0), payload.size(), Exiv2::kerCorruptedMetadata); + readOrThrow(*io_, payload.data(), payload.size(), Exiv2::kerCorruptedMetadata); // Fetch width memcpy(&size_buf, payload.c_data(6), 3); @@ -634,10 +634,10 @@ namespace Exiv2 { size_buf[3] = 0; pixelHeight_ = Exiv2::getULong(size_buf, littleEndian) + 1; } else if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_ICCP)) { - readOrThrow(*io_, payload.data(0), payload.size(), Exiv2::kerCorruptedMetadata); + readOrThrow(*io_, payload.data(), payload.size(), Exiv2::kerCorruptedMetadata); this->setIccProfile(payload); } else if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_EXIF)) { - readOrThrow(*io_, payload.data(0), payload.size(), Exiv2::kerCorruptedMetadata); + readOrThrow(*io_, payload.data(), payload.size(), Exiv2::kerCorruptedMetadata); byte size_buff2[2]; // 4 meaningful bytes + 2 padding bytes @@ -649,22 +649,22 @@ namespace Exiv2 { bool s_header = false; bool le_header = false; bool be_header = false; - long pos = getHeaderOffset(payload.c_data(0), payload.size(), reinterpret_cast(&exifLongHeader), 4); + long pos = getHeaderOffset(payload.c_data(), payload.size(), reinterpret_cast(&exifLongHeader), 4); if (pos == -1) { - pos = getHeaderOffset(payload.c_data(0), payload.size(), reinterpret_cast(&exifLongHeader), 6); + pos = getHeaderOffset(payload.c_data(), payload.size(), reinterpret_cast(&exifLongHeader), 6); if (pos != -1) { s_header = true; } } if (pos == -1) { - pos = getHeaderOffset(payload.c_data(0), payload.size(), reinterpret_cast(&exifTiffLEHeader), 3); + pos = getHeaderOffset(payload.c_data(), payload.size(), reinterpret_cast(&exifTiffLEHeader), 3); if (pos != -1) { le_header = true; } } if (pos == -1) { - pos = getHeaderOffset(payload.c_data(0), payload.size(), reinterpret_cast(&exifTiffBEHeader), 4); + pos = getHeaderOffset(payload.c_data(), payload.size(), reinterpret_cast(&exifTiffBEHeader), 4); if (pos != -1) { be_header = true; } @@ -693,11 +693,11 @@ namespace Exiv2 { rawExifData.copyBytes(6, reinterpret_cast(&exifShortHeader), 6); } - rawExifData.copyBytes(offset, payload.c_data(0), payload.size()); + rawExifData.copyBytes(offset, payload.c_data(), payload.size()); #ifdef EXIV2_DEBUG_MESSAGES std::cout << "Display Hex Dump [size:" << static_cast(sizePayload) << "]" << std::endl; - std::cout << Internal::binaryToHex(rawExifData.c_data(0), sizePayload); + std::cout << Internal::binaryToHex(rawExifData.c_data(), sizePayload); #endif if (pos != -1) { @@ -715,8 +715,8 @@ namespace Exiv2 { exifData_.clear(); } } else if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_XMP)) { - readOrThrow(*io_, payload.data(0), payload.size(), Exiv2::kerCorruptedMetadata); - xmpPacket_.assign(payload.c_str(0), payload.size()); + readOrThrow(*io_, payload.data(), payload.size(), Exiv2::kerCorruptedMetadata); + xmpPacket_.assign(payload.c_str(), payload.size()); if (!xmpPacket_.empty() && XmpParser::decode(xmpData_, xmpPacket_)) { #ifndef SUPPRESS_WARNINGS EXV_WARNING << "Failed to decode XMP metadata." << std::endl; @@ -725,7 +725,7 @@ namespace Exiv2 { #ifdef EXIV2_DEBUG_MESSAGES std::cout << "Display Hex Dump [size:" << static_cast(payload.size()) << "]" << std::endl; - std::cout << Internal::binaryToHex(payload.c_data(0), payload.size()); + std::cout << Internal::binaryToHex(payload.c_data(), payload.size()); #endif } } else { @@ -837,7 +837,7 @@ namespace Exiv2 { throw Error(kerImageWriteFailed); if (iIo.write(size_buff, WEBP_TAG_SIZE) != WEBP_TAG_SIZE) throw Error(kerImageWriteFailed); - if (iIo.write(iccProfile_.c_data(0), iccProfile_.size()) != iccProfile_.size()) + if (iIo.write(iccProfile_.c_data(), iccProfile_.size()) != iccProfile_.size()) throw Error(kerImageWriteFailed); if (iIo.tell() % 2) { if (iIo.write(&WEBP_PAD_ODD, 1) != 1) throw Error(kerImageWriteFailed); diff --git a/unitTests/test_types.cpp b/unitTests/test_types.cpp index fa5287ce..96c5742c 100644 --- a/unitTests/test_types.cpp +++ b/unitTests/test_types.cpp @@ -47,14 +47,14 @@ TEST(ExivTime, doesNotGetTimeWithBadFormedString) TEST(DataBuf, pointsToNullByDefault) { DataBuf instance; - ASSERT_EQ(nullptr, instance.c_data(0)); + ASSERT_EQ(nullptr, instance.c_data()); ASSERT_EQ(0, instance.size()); } TEST(DataBuf, allocatesDataWithNonEmptyConstructor) { DataBuf instance (5); - ASSERT_NE(static_cast(nullptr), instance.c_data(0)); /// \todo use nullptr once we move to c++11 + ASSERT_NE(static_cast(nullptr), instance.c_data()); /// \todo use nullptr once we move to c++11 ASSERT_EQ(5, instance.size()); }