diff --git a/include/exiv2/slice.hpp b/include/exiv2/slice.hpp index c533d231..f6cbfa24 100644 --- a/include/exiv2/slice.hpp +++ b/include/exiv2/slice.hpp @@ -248,7 +248,6 @@ namespace Exiv2 const value_type& at(size_t index) const { - // TODO: use using base_type::at once we have C++11 return base_type::at(index); } @@ -412,8 +411,7 @@ namespace Exiv2 */ PtrSliceStorage(storage_type ptr, size_t /*begin*/, size_t /*end*/) : data_(ptr) { - // TODO: change this to nullptr once we use C++11 - if (ptr == NULL) { + if (!ptr) { throw std::invalid_argument("Null pointer passed to slice constructor"); } } diff --git a/samples/exifprint.cpp b/samples/exifprint.cpp index 1a7e8f67..65ff5e47 100644 --- a/samples/exifprint.cpp +++ b/samples/exifprint.cpp @@ -29,7 +29,7 @@ static const Exiv2::TagInfo* findTag(const Exiv2::TagInfo* pList,uint16_t tag) { while ( pList->tag_ != 0xffff && pList->tag_ != tag ) pList++; - return pList->tag_ != 0xffff ? pList : NULL; + return pList->tag_ != 0xffff ? pList : nullptr; } diff --git a/src/basicio.cpp b/src/basicio.cpp index 921f570e..bb1744d2 100644 --- a/src/basicio.cpp +++ b/src/basicio.cpp @@ -375,7 +375,8 @@ namespace Exiv2 { if (hKernel) { ReplaceFileA_t pfcn_ReplaceFileA = (ReplaceFileA_t)GetProcAddress(hKernel, "ReplaceFileA"); if (pfcn_ReplaceFileA) { - BOOL ret = pfcn_ReplaceFileA(pf, fileIo->path().c_str(), NULL, REPLACEFILE_IGNORE_MERGE_ERRORS, NULL, NULL); + BOOL ret = pfcn_ReplaceFileA(pf, fileIo->path().c_str(), nullptr, + REPLACEFILE_IGNORE_MERGE_ERRORS, nullptr, nullptr); if (ret == 0) { if (GetLastError() == ERROR_FILE_NOT_FOUND) { fs::rename(fileIo->path().c_str(), pf); @@ -1834,7 +1835,8 @@ namespace Exiv2 { size_t curlWriter(char* data, size_t size, size_t nmemb, std::string* writerData) { - if (writerData == NULL) return 0; + if (writerData == nullptr) + return 0; writerData->append(data, size*nmemb); return size * nmemb; } diff --git a/src/futils.cpp b/src/futils.cpp index 4640df80..34f76f39 100644 --- a/src/futils.cpp +++ b/src/futils.cpp @@ -354,28 +354,28 @@ namespace Exiv2 { { std::string ret("unknown"); #if defined(WIN32) - HANDLE processHandle = NULL; + HANDLE processHandle = nullptr; processHandle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, GetCurrentProcessId()); - if (processHandle != NULL) { + if (processHandle) { TCHAR filename[MAX_PATH]; - if (GetModuleFileNameEx(processHandle, NULL, filename, MAX_PATH) != 0) { + if (GetModuleFileNameEx(processHandle, nullptr, filename, MAX_PATH) != 0) { ret = filename; } CloseHandle(processHandle); } - #elif defined(__APPLE__) - #ifdef EXV_HAVE_LIBPROC_H +#elif defined(__APPLE__) +#ifdef EXV_HAVE_LIBPROC_H const int pid = getpid(); char pathbuf[PROC_PIDPATHINFO_MAXSIZE]; if (proc_pidpath (pid, pathbuf, sizeof(pathbuf)) > 0) { ret = pathbuf; } - #endif - #elif defined(__FreeBSD__) +#endif +#elif defined(__FreeBSD__) unsigned int n; char buffer[PATH_MAX] = {}; struct procstat* procstat = procstat_open_sysctl(); - struct kinfo_proc* procs = procstat ? procstat_getprocs(procstat, KERN_PROC_PID, getpid(), &n) : NULL; + struct kinfo_proc* procs = procstat ? procstat_getprocs(procstat, KERN_PROC_PID, getpid(), &n) : nullptr; if ( procs ) { procstat_getpathname(procstat, procs, buffer, PATH_MAX); ret = std::string(buffer); @@ -383,7 +383,7 @@ namespace Exiv2 { // release resources if ( procs ) procstat_freeprocs(procstat, procs); if ( procstat ) procstat_close(procstat); - #elif defined(__sun__) +#elif defined(__sun__) // https://stackoverflow.com/questions/47472762/on-solaris-how-to-get-the-full-path-of-executable-of-running-process-programatic const char* proc = Internal::stringFormat("/proc/%d/path/a.out",getpid()).c_str(); char path[500]; @@ -392,7 +392,7 @@ namespace Exiv2 { path[l]=0; ret = path; } - #elif defined(__unix__) +#elif defined(__unix__) // http://stackoverflow.com/questions/606041/how-do-i-get-the-path-of-a-process-in-unix-linux char path[500]; ssize_t l = readlink ("/proc/self/exe", path,sizeof(path)-1); @@ -400,7 +400,7 @@ namespace Exiv2 { path[l]=0; ret = path; } - #endif +#endif const size_t idxLastSeparator = ret.find_last_of(EXV_SEPARATOR_STR); return ret.substr(0, idxLastSeparator); diff --git a/src/makernote_int.cpp b/src/makernote_int.cpp index 10707a78..cd638cfa 100644 --- a/src/makernote_int.cpp +++ b/src/makernote_int.cpp @@ -81,7 +81,7 @@ namespace Exiv2::Internal { #if defined(_MSC_VER) || defined(__MINGW__) char buffer[1024]; - if (SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_PROFILE, NULL, 0, buffer))) { + if (SUCCEEDED(SHGetFolderPathA(nullptr, CSIDL_PROFILE, nullptr, 0, buffer))) { currentPath = buffer; } #else diff --git a/src/tiffcomposite_int.cpp b/src/tiffcomposite_int.cpp index d72dcba1..d3c07f73 100644 --- a/src/tiffcomposite_int.cpp +++ b/src/tiffcomposite_int.cpp @@ -1522,7 +1522,7 @@ namespace Exiv2::Internal { if (component->tag() == 0x014a) { // Hack: delay writing of sub-IFD image data to get the order correct #ifndef SUPPRESS_WARNINGS - if (pSubIfd != 0) { + if (pSubIfd) { EXV_ERROR << "Multiple sub-IFD image data tags found\n"; } #endif diff --git a/src/version.cpp b/src/version.cpp index e14648ac..1616341b 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -155,8 +155,8 @@ static std::vector getLoadedLibraries() if ( isatty(STDIN_FILENO) ) { unsigned int n; struct procstat* procstat = procstat_open_sysctl(); - struct kinfo_proc* procs = procstat ? procstat_getprocs(procstat, KERN_PROC_PID, getpid(), &n) : NULL; - struct filestat_list* files = procs ? procstat_getfiles(procstat, procs, true) : NULL; + struct kinfo_proc* procs = procstat ? procstat_getprocs(procstat, KERN_PROC_PID, getpid(), &n) : nullptr; + struct filestat_list* files = procs ? procstat_getfiles(procstat, procs, true) : nullptr; if ( files ) { filestat* entry; STAILQ_FOREACH(entry, files, next) { diff --git a/src/xmp.cpp b/src/xmp.cpp index 47d96531..12a1eb7e 100644 --- a/src/xmp.cpp +++ b/src/xmp.cpp @@ -570,28 +570,28 @@ namespace Exiv2 { pLockData_ = pLockData; initialized_ = SXMPMeta::Initialize(); #ifdef EXV_ADOBE_XMPSDK - SXMPMeta::RegisterNamespace("http://ns.adobe.com/lightroom/1.0/", "lr",NULL); - SXMPMeta::RegisterNamespace("http://rs.tdwg.org/dwc/index.htm", "dwc",NULL); - SXMPMeta::RegisterNamespace("http://purl.org/dc/terms/", "dcterms",NULL); - SXMPMeta::RegisterNamespace("http://www.digikam.org/ns/1.0/", "digiKam",NULL); - SXMPMeta::RegisterNamespace("http://www.digikam.org/ns/kipi/1.0/", "kipi",NULL); - SXMPMeta::RegisterNamespace("http://ns.microsoft.com/photo/1.0/", "MicrosoftPhoto",NULL); - SXMPMeta::RegisterNamespace("http://ns.acdsee.com/iptc/1.0/", "acdsee",NULL); - SXMPMeta::RegisterNamespace("http://iptc.org/std/Iptc4xmpExt/2008-02-29/", "iptcExt",NULL); - SXMPMeta::RegisterNamespace("http://ns.useplus.org/ldf/xmp/1.0/", "plus",NULL); - SXMPMeta::RegisterNamespace("http://ns.iview-multimedia.com/mediapro/1.0/", "mediapro",NULL); - SXMPMeta::RegisterNamespace("http://ns.microsoft.com/expressionmedia/1.0/", "expressionmedia",NULL); - SXMPMeta::RegisterNamespace("http://ns.microsoft.com/photo/1.2/", "MP",NULL); - SXMPMeta::RegisterNamespace("http://ns.microsoft.com/photo/1.2/t/RegionInfo#", "MPRI",NULL); - SXMPMeta::RegisterNamespace("http://ns.microsoft.com/photo/1.2/t/Region#", "MPReg",NULL); - SXMPMeta::RegisterNamespace("http://ns.google.com/photos/1.0/panorama/", "GPano",NULL); - SXMPMeta::RegisterNamespace("http://www.metadataworkinggroup.com/schemas/regions/", "mwg-rs",NULL); - SXMPMeta::RegisterNamespace("http://www.metadataworkinggroup.com/schemas/keywords/", "mwg-kw",NULL); - SXMPMeta::RegisterNamespace("http://ns.adobe.com/xmp/sType/Area#", "stArea",NULL); - SXMPMeta::RegisterNamespace("http://cipa.jp/exif/1.0/", "exifEX",NULL); - SXMPMeta::RegisterNamespace("http://ns.adobe.com/camera-raw-saved-settings/1.0/", "crss",NULL); - SXMPMeta::RegisterNamespace("http://www.audio/", "audio",NULL); - SXMPMeta::RegisterNamespace("http://www.video/", "video",NULL); + SXMPMeta::RegisterNamespace("http://ns.adobe.com/lightroom/1.0/", "lr", nullptr); + SXMPMeta::RegisterNamespace("http://rs.tdwg.org/dwc/index.htm", "dwc", nullptr); + SXMPMeta::RegisterNamespace("http://purl.org/dc/terms/", "dcterms", nullptr); + SXMPMeta::RegisterNamespace("http://www.digikam.org/ns/1.0/", "digiKam", nullptr); + SXMPMeta::RegisterNamespace("http://www.digikam.org/ns/kipi/1.0/", "kipi", nullptr); + SXMPMeta::RegisterNamespace("http://ns.microsoft.com/photo/1.0/", "MicrosoftPhoto", nullptr); + SXMPMeta::RegisterNamespace("http://ns.acdsee.com/iptc/1.0/", "acdsee", nullptr); + SXMPMeta::RegisterNamespace("http://iptc.org/std/Iptc4xmpExt/2008-02-29/", "iptcExt", nullptr); + SXMPMeta::RegisterNamespace("http://ns.useplus.org/ldf/xmp/1.0/", "plus", nullptr); + SXMPMeta::RegisterNamespace("http://ns.iview-multimedia.com/mediapro/1.0/", "mediapro", nullptr); + SXMPMeta::RegisterNamespace("http://ns.microsoft.com/expressionmedia/1.0/", "expressionmedia", nullptr); + SXMPMeta::RegisterNamespace("http://ns.microsoft.com/photo/1.2/", "MP", nullptr); + SXMPMeta::RegisterNamespace("http://ns.microsoft.com/photo/1.2/t/RegionInfo#", "MPRI", nullptr); + SXMPMeta::RegisterNamespace("http://ns.microsoft.com/photo/1.2/t/Region#", "MPReg", nullptr); + SXMPMeta::RegisterNamespace("http://ns.google.com/photos/1.0/panorama/", "GPano", nullptr); + SXMPMeta::RegisterNamespace("http://www.metadataworkinggroup.com/schemas/regions/", "mwg-rs", nullptr); + SXMPMeta::RegisterNamespace("http://www.metadataworkinggroup.com/schemas/keywords/", "mwg-kw", nullptr); + SXMPMeta::RegisterNamespace("http://ns.adobe.com/xmp/sType/Area#", "stArea", nullptr); + SXMPMeta::RegisterNamespace("http://cipa.jp/exif/1.0/", "exifEX", nullptr); + SXMPMeta::RegisterNamespace("http://ns.adobe.com/camera-raw-saved-settings/1.0/", "crss", nullptr); + SXMPMeta::RegisterNamespace("http://www.audio/", "audio", nullptr); + SXMPMeta::RegisterNamespace("http://www.video/", "video", nullptr); #else SXMPMeta::RegisterNamespace("http://ns.adobe.com/lightroom/1.0/", "lr"); SXMPMeta::RegisterNamespace("http://rs.tdwg.org/dwc/index.htm", "dwc"); @@ -700,7 +700,7 @@ namespace Exiv2 { AutoLock autoLock(xmpLockFct_, pLockData_); SXMPMeta::DeleteNamespace(ns.c_str()); #ifdef EXV_ADOBE_XMPSDK - SXMPMeta::RegisterNamespace(ns.c_str(), prefix.c_str(),NULL); + SXMPMeta::RegisterNamespace(ns.c_str(), prefix.c_str(), nullptr); #else SXMPMeta::RegisterNamespace(ns.c_str(), prefix.c_str()); #endif