clang-tidy: fixes from version 16
authorRosen Penev <rosenp@gmail.com>
Thu, 29 Jun 2023 22:16:09 +0000 (15:16 -0700)
committerColin Clark <colin.clark@cclark.uk>
Tue, 4 Jul 2023 15:47:41 +0000 (16:47 +0100)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
51 files changed:
src/cellrenderericon.cc
src/color-man.cc
src/dupe.cc
src/editors.cc
src/exif-common.cc
src/exif.cc
src/exiv2.cc
src/format-canon.cc
src/format-fuji.cc
src/format-nikon.cc
src/format-olympus.cc
src/format-raw.cc
src/format-raw.h
src/histogram.cc
src/image-load-cr3.cc
src/image-load-jpeg.cc
src/image-load-jpegxl.cc
src/image-load-psd.cc
src/image-load.cc
src/image.cc
src/keymap-template.cc
src/layout-config.cc
src/main.cc
src/md5-util.cc
src/metadata.cc
src/misc.cc
src/osd.cc
src/pan-view/pan-calendar.cc
src/pan-view/pan-folder.cc
src/pan-view/pan-grid.cc
src/pan-view/pan-view-filter.cc
src/pan-view/pan-view.cc
src/pixbuf-renderer.cc
src/pixbuf-util.cc
src/rcfile.cc
src/remote.cc
src/renderer-tiles.cc
src/search-and-run.cc
src/search.cc
src/ui-bookmark.cc
src/ui-fileops.cc
src/ui-help.cc
src/ui-misc.cc
src/ui-pathsel.cc
src/ui-tabcomp.cc
src/ui-tree-edit.cc
src/ui-utildlg.cc
src/view-dir.cc
src/view-file/view-file.cc
src/whereami.cc
src/zonedetect.cc

index 2585cfd..f4da7c1 100644 (file)
@@ -109,7 +109,7 @@ gqv_cell_renderer_icon_get_type()
 
                cell_icon_type = g_type_register_static(GTK_TYPE_CELL_RENDERER,
                                                        "GQvCellRendererIcon",
-                                                       &cell_icon_info, GTypeFlags(0));
+                                                       &cell_icon_info, static_cast<GTypeFlags>(0));
                }
 
        return cell_icon_type;
index 01e822f..870a3fc 100644 (file)
@@ -490,8 +490,8 @@ void color_man_update()
 }
 
 #ifdef HAVE_HEIF
+#include <cmath>
 #include <libheif/heif.h>
-#include <math.h>
 
 static cmsToneCurve* colorspaces_create_transfer(int32_t size, double (*fct)(double))
 {
index d26bd46..3b5f349 100644 (file)
@@ -19,7 +19,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <inttypes.h>
+#include <cinttypes>
 
 #include "main.h"
 #include "dupe.h"
@@ -47,7 +47,7 @@
 #include "utilops.h"
 #include "window.h"
 
-#include <math.h>
+#include <cmath>
 
 
 #define DUPE_DEF_WIDTH 800
index 1918399..1bdcb31 100644 (file)
@@ -808,7 +808,7 @@ static GString *append_quoted(GString *str, const char *s, gboolean single_quote
 
 EditorFlags editor_command_parse(const EditorDescription *editor, GList *list, gboolean consider_sidecars, gchar **output)
 {
-       auto  flags = static_cast<EditorFlags>(0);
+       auto flags = static_cast<EditorFlags>(0);
        const gchar *p;
        GString *result = nullptr;
        gboolean escape = FALSE;
index b6f07ca..8c87be4 100644 (file)
@@ -21,9 +21,9 @@
 
 #define _XOPEN_SOURCE
 
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
+#include <cmath>
+#include <cstdlib>
+#include <cstring>
 
 #ifdef HAVE_LCMS
 /*** color support enabled ***/
index cda2cb1..e467c72 100644 (file)
 
 #ifndef HAVE_EXIV2
 
-#include <stdio.h>
-#include <string.h>
+#include <cmath>
+#include <cstdio>
+#include <cstring>
 #include <fcntl.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <sys/mman.h>
-#include <math.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include <glib.h>
 #include <glib/gprintf.h>
@@ -91,7 +91,7 @@ ExifFormatAttrib ExifFormatList[] = {
        { EXIF_FORMAT_RATIONAL,         8, "srational", "signed rational" },
        { EXIF_FORMAT_FLOAT,            4, "float",     "float" },
        { EXIF_FORMAT_DOUBLE,           8, "double",    "double" },
-       { (ExifFormatType)-1, 0, NULL, NULL }
+       { static_cast<ExifFormatType>(-1), 0, nullptr, nullptr }
 };
 
 /* tags that are special, or need special treatment */
@@ -319,115 +319,115 @@ Tags that don't match are not supported by exiv2 and should not be used anywhere
 */
 
 ExifMarker ExifKnownMarkersList[] = {
-{ 0x0100, EXIF_FORMAT_LONG_UNSIGNED, 1,                "Exif.Image.ImageWidth",        N_("Image Width"), NULL },
-{ 0x0101, EXIF_FORMAT_LONG_UNSIGNED, 1,                "Exif.Image.ImageLength",       N_("Image Height"), NULL },
-{ 0x0102, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Image.BitsPerSample",     N_("Bits per Sample/Pixel"), NULL },
+{ 0x0100, EXIF_FORMAT_LONG_UNSIGNED, 1,                "Exif.Image.ImageWidth",        N_("Image Width"), nullptr },
+{ 0x0101, EXIF_FORMAT_LONG_UNSIGNED, 1,                "Exif.Image.ImageLength",       N_("Image Height"), nullptr },
+{ 0x0102, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Image.BitsPerSample",     N_("Bits per Sample/Pixel"), nullptr },
 { 0x0103, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Image.Compression",       N_("Compression"), ExifCompressionList },
-{ 0x010e, EXIF_FORMAT_STRING, -1,              "Exif.Image.ImageDescription",  N_("Image description"), NULL },
-{ 0x010f, EXIF_FORMAT_STRING, -1,              "Exif.Image.Make",              N_("Camera make"), NULL },
-{ 0x0110, EXIF_FORMAT_STRING, -1,              "Exif.Image.Model",             N_("Camera model"), NULL },
+{ 0x010e, EXIF_FORMAT_STRING, -1,              "Exif.Image.ImageDescription",  N_("Image description"), nullptr },
+{ 0x010f, EXIF_FORMAT_STRING, -1,              "Exif.Image.Make",              N_("Camera make"), nullptr },
+{ 0x0110, EXIF_FORMAT_STRING, -1,              "Exif.Image.Model",             N_("Camera model"), nullptr },
 { 0x0112, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Image.Orientation",       N_("Orientation"), ExifOrientationList },
-{ 0x011a, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Image.XResolution",       N_("X resolution"), NULL },
-{ 0x011b, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Image.YResolution",       N_("Y Resolution"), NULL },
+{ 0x011a, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Image.XResolution",       N_("X resolution"), nullptr },
+{ 0x011b, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Image.YResolution",       N_("Y Resolution"), nullptr },
 { 0x0128, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Image.ResolutionUnit",    N_("Resolution units"), ExifUnitList },
-{ 0x0131, EXIF_FORMAT_STRING, -1,              "Exif.Image.Software",          N_("Firmware"), NULL },
-{ 0x0132, EXIF_FORMAT_STRING, 20,              "Exif.Image.DateTime",          N_("Date"), NULL },
-{ 0x013e, EXIF_FORMAT_RATIONAL_UNSIGNED, 2,    "Exif.Image.WhitePoint",        N_("White point"), NULL },
-{ 0x013f, EXIF_FORMAT_RATIONAL_UNSIGNED, 6,    "Exif.Image.PrimaryChromaticities",N_("Primary chromaticities"), NULL },
-{ 0x0211, EXIF_FORMAT_RATIONAL_UNSIGNED, 3,    "Exif.Image.YCbCrCoefficients", N_("YCbCy coefficients"), NULL },
+{ 0x0131, EXIF_FORMAT_STRING, -1,              "Exif.Image.Software",          N_("Firmware"), nullptr },
+{ 0x0132, EXIF_FORMAT_STRING, 20,              "Exif.Image.DateTime",          N_("Date"), nullptr },
+{ 0x013e, EXIF_FORMAT_RATIONAL_UNSIGNED, 2,    "Exif.Image.WhitePoint",        N_("White point"), nullptr },
+{ 0x013f, EXIF_FORMAT_RATIONAL_UNSIGNED, 6,    "Exif.Image.PrimaryChromaticities",N_("Primary chromaticities"), nullptr },
+{ 0x0211, EXIF_FORMAT_RATIONAL_UNSIGNED, 3,    "Exif.Image.YCbCrCoefficients", N_("YCbCy coefficients"), nullptr },
 { 0x0213, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Image.YCbCrPositioning",  N_("YCbCr positioning"), ExifYCbCrPosList },
-{ 0x0214, EXIF_FORMAT_RATIONAL_UNSIGNED, 6,    "Exif.Image.ReferenceBlackWhite",N_("Black white reference"), NULL },
-{ 0x8298, EXIF_FORMAT_STRING, -1,              "Exif.Image.Copyright",         N_("Copyright"), NULL },
-{ 0x8769, EXIF_FORMAT_LONG_UNSIGNED, 1,                "Exif.Image.ExifTag",           N_("SubIFD Exif offset"), NULL },
+{ 0x0214, EXIF_FORMAT_RATIONAL_UNSIGNED, 6,    "Exif.Image.ReferenceBlackWhite",N_("Black white reference"), nullptr },
+{ 0x8298, EXIF_FORMAT_STRING, -1,              "Exif.Image.Copyright",         N_("Copyright"), nullptr },
+{ 0x8769, EXIF_FORMAT_LONG_UNSIGNED, 1,                "Exif.Image.ExifTag",           N_("SubIFD Exif offset"), nullptr },
        /* subIFD follows */
-{ 0x829a, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.ExposureTime",      N_("Exposure time (seconds)"), NULL },
-{ 0x829d, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.FNumber",           N_("FNumber"), NULL },
+{ 0x829a, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.ExposureTime",      N_("Exposure time (seconds)"), nullptr },
+{ 0x829d, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.FNumber",           N_("FNumber"), nullptr },
 { 0x8822, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Photo.ExposureProgram",   N_("Exposure program"), ExifExposureProgramList },
-{ 0x8824, EXIF_FORMAT_STRING, -1,              "Exif.Photo.SpectralSensitivity",N_("Spectral Sensitivity"), NULL },
-{ 0x8827, EXIF_FORMAT_SHORT_UNSIGNED, -1,      "Exif.Photo.ISOSpeedRatings",   N_("ISO sensitivity"), NULL },
-{ 0x8828, EXIF_FORMAT_UNDEFINED, -1,           "Exif.Photo.OECF",              N_("Optoelectric conversion factor"), NULL },
-{ 0x9000, EXIF_FORMAT_UNDEFINED, 4,            "Exif.Photo.ExifVersion",       N_("Exif version"), NULL },
-{ 0x9003, EXIF_FORMAT_STRING, 20,              "Exif.Photo.DateTimeOriginal",  N_("Date original"), NULL },
-{ 0x9004, EXIF_FORMAT_STRING, 20,              "Exif.Photo.DateTimeDigitized", N_("Date digitized"), NULL },
-{ 0x9101, EXIF_FORMAT_UNDEFINED, -1,           "Exif.Photo.ComponentsConfiguration",N_("Pixel format"), NULL },
-{ 0x9102, EXIF_FORMAT_RATIONAL_UNSIGNED,1,     "Exif.Photo.CompressedBitsPerPixel",N_("Compression ratio"), NULL },
-{ 0x9201, EXIF_FORMAT_RATIONAL, 1,             "Exif.Photo.ShutterSpeedValue", N_("Shutter speed"), NULL },
-{ 0x9202, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.ApertureValue",     N_("Aperture"), NULL },
-{ 0x9203, EXIF_FORMAT_RATIONAL, 1,             "Exif.Photo.BrightnessValue",   N_("Brightness"), NULL },
-{ 0x9204, EXIF_FORMAT_RATIONAL, 1,             "Exif.Photo.ExposureBiasValue", N_("Exposure bias"), NULL },
-{ 0x9205, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.MaxApertureValue",  N_("Maximum aperture"), NULL },
-{ 0x9206, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.SubjectDistance",   N_("Subject distance"), NULL },
+{ 0x8824, EXIF_FORMAT_STRING, -1,              "Exif.Photo.SpectralSensitivity",N_("Spectral Sensitivity"), nullptr },
+{ 0x8827, EXIF_FORMAT_SHORT_UNSIGNED, -1,      "Exif.Photo.ISOSpeedRatings",   N_("ISO sensitivity"), nullptr },
+{ 0x8828, EXIF_FORMAT_UNDEFINED, -1,           "Exif.Photo.OECF",              N_("Optoelectric conversion factor"), nullptr },
+{ 0x9000, EXIF_FORMAT_UNDEFINED, 4,            "Exif.Photo.ExifVersion",       N_("Exif version"), nullptr },
+{ 0x9003, EXIF_FORMAT_STRING, 20,              "Exif.Photo.DateTimeOriginal",  N_("Date original"), nullptr },
+{ 0x9004, EXIF_FORMAT_STRING, 20,              "Exif.Photo.DateTimeDigitized", N_("Date digitized"), nullptr },
+{ 0x9101, EXIF_FORMAT_UNDEFINED, -1,           "Exif.Photo.ComponentsConfiguration",N_("Pixel format"), nullptr },
+{ 0x9102, EXIF_FORMAT_RATIONAL_UNSIGNED,1,     "Exif.Photo.CompressedBitsPerPixel",N_("Compression ratio"), nullptr },
+{ 0x9201, EXIF_FORMAT_RATIONAL, 1,             "Exif.Photo.ShutterSpeedValue", N_("Shutter speed"), nullptr },
+{ 0x9202, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.ApertureValue",     N_("Aperture"), nullptr },
+{ 0x9203, EXIF_FORMAT_RATIONAL, 1,             "Exif.Photo.BrightnessValue",   N_("Brightness"), nullptr },
+{ 0x9204, EXIF_FORMAT_RATIONAL, 1,             "Exif.Photo.ExposureBiasValue", N_("Exposure bias"), nullptr },
+{ 0x9205, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.MaxApertureValue",  N_("Maximum aperture"), nullptr },
+{ 0x9206, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.SubjectDistance",   N_("Subject distance"), nullptr },
 { 0x9207, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Photo.MeteringMode",      N_("Metering mode"), ExifMeteringModeList },
 { 0x9208, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Photo.LightSource",       N_("Light source"), ExifLightSourceList },
 { 0x9209, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Photo.Flash",             N_("Flash"), ExifFlashList },
-{ 0x920a, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.FocalLength",       N_("Focal length"), NULL },
-{ 0x9214, EXIF_FORMAT_SHORT_UNSIGNED, -1,      "Exif.Photo.SubjectArea",       N_("Subject area"), NULL },
-{ 0x927c, EXIF_FORMAT_UNDEFINED, -1,           "Exif.Photo.MakerNote",         N_("MakerNote"), NULL },
-{ 0x9286, EXIF_FORMAT_UNDEFINED, -1,           "Exif.Photo.UserComment",       N_("UserComment"), NULL },
-{ 0x9290, EXIF_FORMAT_STRING, -1,              "Exif.Photo.SubSecTime",        N_("Subsecond time"), NULL },
-{ 0x9291, EXIF_FORMAT_STRING, -1,              "Exif.Photo.SubSecTimeOriginal",N_("Subsecond time original"), NULL },
-{ 0x9292, EXIF_FORMAT_STRING, -1,              "Exif.Photo.SubSecTimeDigitized",N_("Subsecond time digitized"), NULL },
-{ 0xa000, EXIF_FORMAT_UNDEFINED, 4,            "Exif.Photo.FlashpixVersion",   N_("FlashPix version"), NULL },
+{ 0x920a, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.FocalLength",       N_("Focal length"), nullptr },
+{ 0x9214, EXIF_FORMAT_SHORT_UNSIGNED, -1,      "Exif.Photo.SubjectArea",       N_("Subject area"), nullptr },
+{ 0x927c, EXIF_FORMAT_UNDEFINED, -1,           "Exif.Photo.MakerNote",         N_("MakerNote"), nullptr },
+{ 0x9286, EXIF_FORMAT_UNDEFINED, -1,           "Exif.Photo.UserComment",       N_("UserComment"), nullptr },
+{ 0x9290, EXIF_FORMAT_STRING, -1,              "Exif.Photo.SubSecTime",        N_("Subsecond time"), nullptr },
+{ 0x9291, EXIF_FORMAT_STRING, -1,              "Exif.Photo.SubSecTimeOriginal",N_("Subsecond time original"), nullptr },
+{ 0x9292, EXIF_FORMAT_STRING, -1,              "Exif.Photo.SubSecTimeDigitized",N_("Subsecond time digitized"), nullptr },
+{ 0xa000, EXIF_FORMAT_UNDEFINED, 4,            "Exif.Photo.FlashpixVersion",   N_("FlashPix version"), nullptr },
 { 0xa001, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Photo.ColorSpace",        N_("Colorspace"), ExifColorSpaceList },
        /* ExifImageWidth, ExifImageHeight can also be unsigned short */
-{ 0xa002, EXIF_FORMAT_LONG_UNSIGNED, 1,                "Exif.Photo.PixelXDimension",   N_("Width"), NULL },
-{ 0xa003, EXIF_FORMAT_LONG_UNSIGNED, 1,                "Exif.Photo.PixelYDimension",   N_("Height"), NULL },
-{ 0xa004, EXIF_FORMAT_STRING, -1,              "Exif.Photo.RelatedSoundFile",  N_("Audio data"), NULL },
-{ 0xa005, EXIF_FORMAT_LONG_UNSIGNED, 1,                "ExifInteroperabilityOffset",   N_("ExifR98 extension"), NULL },
-{ 0xa20b, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.FlashEnergy",       N_("Flash strength"), NULL },
-{ 0xa20c, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Photo.SpatialFrequencyResponse",N_("Spatial frequency response"), NULL },
-{ 0xa20e, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.FocalPlaneXResolution", N_("X Pixel density"), NULL },
-{ 0xa20f, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.FocalPlaneYResolution", N_("Y Pixel density"), NULL },
+{ 0xa002, EXIF_FORMAT_LONG_UNSIGNED, 1,                "Exif.Photo.PixelXDimension",   N_("Width"), nullptr },
+{ 0xa003, EXIF_FORMAT_LONG_UNSIGNED, 1,                "Exif.Photo.PixelYDimension",   N_("Height"), nullptr },
+{ 0xa004, EXIF_FORMAT_STRING, -1,              "Exif.Photo.RelatedSoundFile",  N_("Audio data"), nullptr },
+{ 0xa005, EXIF_FORMAT_LONG_UNSIGNED, 1,                "ExifInteroperabilityOffset",   N_("ExifR98 extension"), nullptr },
+{ 0xa20b, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.FlashEnergy",       N_("Flash strength"), nullptr },
+{ 0xa20c, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Photo.SpatialFrequencyResponse",N_("Spatial frequency response"), nullptr },
+{ 0xa20e, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.FocalPlaneXResolution", N_("X Pixel density"), nullptr },
+{ 0xa20f, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.FocalPlaneYResolution", N_("Y Pixel density"), nullptr },
 { 0xa210, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Photo.FocalPlaneResolutionUnit", N_("Pixel density units"), ExifUnitList },
-{ 0x0214, EXIF_FORMAT_SHORT_UNSIGNED, 2,       "Exif.Photo.SubjectLocation",   N_("Subject location"), NULL },
-{ 0xa215, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.ExposureIndex",     N_("ISO sensitivity"), NULL },
+{ 0x0214, EXIF_FORMAT_SHORT_UNSIGNED, 2,       "Exif.Photo.SubjectLocation",   N_("Subject location"), nullptr },
+{ 0xa215, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.ExposureIndex",     N_("ISO sensitivity"), nullptr },
 { 0xa217, EXIF_FORMAT_SHORT_UNSIGNED, -1,      "Exif.Photo.SensingMethod",     N_("Sensor type"), ExifSensorList },
 { 0xa300, EXIF_FORMAT_UNDEFINED, 1,            "Exif.Photo.FileSource",        N_("Source type"), ExifSourceList },
 { 0xa301, EXIF_FORMAT_UNDEFINED, 1,            "Exif.Photo.SceneType",         N_("Scene type"), ExifSceneList },
-{ 0xa302, EXIF_FORMAT_UNDEFINED, -1,           "Exif.Image.CFAPattern",        N_("Color filter array pattern"), NULL },
+{ 0xa302, EXIF_FORMAT_UNDEFINED, -1,           "Exif.Image.CFAPattern",        N_("Color filter array pattern"), nullptr },
        /* tags a4xx were added for Exif 2.2 (not just these - some above, as well) */
 { 0xa401, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Photo.CustomRendered",    N_("Render process"), ExifCustRenderList },
 { 0xa402, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Photo.ExposureMode",      N_("Exposure mode"), ExifExposureModeList },
 { 0xa403, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Photo.WhiteBalance",      N_("White balance"), ExifWhiteBalanceList },
-{ 0xa404, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.DigitalZoomRatio",  N_("Digital zoom ratio"), NULL },
-{ 0xa405, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Photo.FocalLengthIn35mmFilm",N_("Focal length (35mm)"), NULL },
+{ 0xa404, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.DigitalZoomRatio",  N_("Digital zoom ratio"), nullptr },
+{ 0xa405, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Photo.FocalLengthIn35mmFilm",N_("Focal length (35mm)"), nullptr },
 { 0xa406, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Photo.SceneCaptureType",  N_("Scene capture type"), ExifSceneCaptureList },
 { 0xa407, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Photo.GainControl",       N_("Gain control"), ExifGainControlList },
 { 0xa408, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Photo.Contrast",          N_("Contrast"), ExifContrastList },
 { 0xa409, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Photo.Saturation",        N_("Saturation"), ExifSaturationList },
 { 0xa40a, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Photo.Sharpness",         N_("Sharpness"), ExifSharpnessList },
-{ 0xa40b, EXIF_FORMAT_UNDEFINED, -1,           "Exif.Photo.DeviceSettingDescription",N_("Device setting"), NULL },
+{ 0xa40b, EXIF_FORMAT_UNDEFINED, -1,           "Exif.Photo.DeviceSettingDescription",N_("Device setting"), nullptr },
 { 0xa40c, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Exif.Photo.SubjectDistanceRange",N_("Subject range"), ExifSubjectRangeList },
-{ 0xa420, EXIF_FORMAT_STRING, -1,              "Exif.Photo.ImageUniqueID",     N_("Image serial number"), NULL },
+{ 0xa420, EXIF_FORMAT_STRING, -1,              "Exif.Photo.ImageUniqueID",     N_("Image serial number"), nullptr },
        /* place known, but undocumented or lesser used tags here */
-{ 0x00fe, EXIF_FORMAT_LONG_UNSIGNED, 1,                "Exif.Image.NewSubfileType",    NULL, NULL },
-{ 0x00ff, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "SubfileType",                  NULL, NULL },
-{ 0x012d, EXIF_FORMAT_SHORT_UNSIGNED, 3,       "Exif.Image.TransferFunction",  NULL, NULL },
-{ 0x013b, EXIF_FORMAT_STRING, -1,              "Exif.Image.Artist",            "Artist", NULL },
-{ 0x013d, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Predictor",            NULL, NULL },
-{ 0x0142, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "TileWidth",            NULL, NULL },
-{ 0x0143, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "TileLength",           NULL, NULL },
-{ 0x0144, EXIF_FORMAT_LONG_UNSIGNED, -1,       "TileOffsets",          NULL, NULL },
-{ 0x0145, EXIF_FORMAT_SHORT_UNSIGNED, -1,      "TileByteCounts",       NULL, NULL },
-{ 0x014a, EXIF_FORMAT_LONG_UNSIGNED, -1,       "Exif.Image.SubIFDs",           NULL, NULL },
-{ 0x015b, EXIF_FORMAT_UNDEFINED, -1,           "JPEGTables",           NULL, NULL },
-{ 0x828d, EXIF_FORMAT_SHORT_UNSIGNED, 2,       "Exif.Image.CFARepeatPatternDim",       NULL, NULL },
-{ 0x828e, EXIF_FORMAT_BYTE_UNSIGNED, -1,       "Exif.Image.CFAPattern",                NULL, NULL },
-{ 0x828f, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Image.BatteryLevel",              NULL, NULL },
-{ 0x83bb, EXIF_FORMAT_LONG_UNSIGNED, -1,       "IPTC/NAA",             NULL, NULL },
-{ 0x8773, EXIF_FORMAT_UNDEFINED, -1,           "Exif.Image.InterColorProfile",         NULL, NULL },
-{ 0x8825, EXIF_FORMAT_LONG_UNSIGNED, 1,                "GPSInfo",              "SubIFD GPS offset", NULL },
-{ 0x8829, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Interlace",            NULL, NULL },
-{ 0x882a, EXIF_FORMAT_SHORT, 1,                        "TimeZoneOffset",       NULL, NULL },
-{ 0x882b, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "SelfTimerMode",        NULL, NULL },
-{ 0x920b, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.FlashEnergy",               NULL, NULL },
-{ 0x920c, EXIF_FORMAT_UNDEFINED, -1,           "Exif.Photo.SpatialFrequencyResponse", NULL, NULL },
-{ 0x920d, EXIF_FORMAT_UNDEFINED, -1,           "Noise",                NULL, NULL },
-{ 0x9211, EXIF_FORMAT_LONG_UNSIGNED, 1,                "ImageNumber",          NULL, NULL },
-{ 0x9212, EXIF_FORMAT_STRING, 1,               "SecurityClassification", NULL, NULL },
-{ 0x9213, EXIF_FORMAT_STRING, -1,              "ImageHistory",         NULL, NULL },
-{ 0x9215, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.ExposureIndex",     NULL, NULL },
-{ 0x9216, EXIF_FORMAT_BYTE_UNSIGNED, 4,                "TIFF/EPStandardID",    NULL, NULL },
+{ 0x00fe, EXIF_FORMAT_LONG_UNSIGNED, 1,                "Exif.Image.NewSubfileType",    nullptr, nullptr },
+{ 0x00ff, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "SubfileType",                  nullptr, nullptr },
+{ 0x012d, EXIF_FORMAT_SHORT_UNSIGNED, 3,       "Exif.Image.TransferFunction",  nullptr, nullptr },
+{ 0x013b, EXIF_FORMAT_STRING, -1,              "Exif.Image.Artist",            "Artist", nullptr },
+{ 0x013d, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Predictor",            nullptr, nullptr },
+{ 0x0142, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "TileWidth",            nullptr, nullptr },
+{ 0x0143, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "TileLength",           nullptr, nullptr },
+{ 0x0144, EXIF_FORMAT_LONG_UNSIGNED, -1,       "TileOffsets",          nullptr, nullptr },
+{ 0x0145, EXIF_FORMAT_SHORT_UNSIGNED, -1,      "TileByteCounts",       nullptr, nullptr },
+{ 0x014a, EXIF_FORMAT_LONG_UNSIGNED, -1,       "Exif.Image.SubIFDs",           nullptr, nullptr },
+{ 0x015b, EXIF_FORMAT_UNDEFINED, -1,           "JPEGTables",           nullptr, nullptr },
+{ 0x828d, EXIF_FORMAT_SHORT_UNSIGNED, 2,       "Exif.Image.CFARepeatPatternDim",       nullptr, nullptr },
+{ 0x828e, EXIF_FORMAT_BYTE_UNSIGNED, -1,       "Exif.Image.CFAPattern",                nullptr, nullptr },
+{ 0x828f, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Image.BatteryLevel",              nullptr, nullptr },
+{ 0x83bb, EXIF_FORMAT_LONG_UNSIGNED, -1,       "IPTC/NAA",             nullptr, nullptr },
+{ 0x8773, EXIF_FORMAT_UNDEFINED, -1,           "Exif.Image.InterColorProfile",         nullptr, nullptr },
+{ 0x8825, EXIF_FORMAT_LONG_UNSIGNED, 1,                "GPSInfo",              "SubIFD GPS offset", nullptr },
+{ 0x8829, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Interlace",            nullptr, nullptr },
+{ 0x882a, EXIF_FORMAT_SHORT, 1,                        "TimeZoneOffset",       nullptr, nullptr },
+{ 0x882b, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "SelfTimerMode",        nullptr, nullptr },
+{ 0x920b, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.FlashEnergy",               nullptr, nullptr },
+{ 0x920c, EXIF_FORMAT_UNDEFINED, -1,           "Exif.Photo.SpatialFrequencyResponse", nullptr, nullptr },
+{ 0x920d, EXIF_FORMAT_UNDEFINED, -1,           "Noise",                nullptr, nullptr },
+{ 0x9211, EXIF_FORMAT_LONG_UNSIGNED, 1,                "ImageNumber",          nullptr, nullptr },
+{ 0x9212, EXIF_FORMAT_STRING, 1,               "SecurityClassification", nullptr, nullptr },
+{ 0x9213, EXIF_FORMAT_STRING, -1,              "ImageHistory",         nullptr, nullptr },
+{ 0x9215, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Exif.Photo.ExposureIndex",     nullptr, nullptr },
+{ 0x9216, EXIF_FORMAT_BYTE_UNSIGNED, 4,                "TIFF/EPStandardID",    nullptr, nullptr },
 
 EXIF_MARKER_LIST_END
 };
@@ -436,54 +436,54 @@ ExifMarker ExifKnownGPSInfoMarkersList[] = {
         /* The following do not work at the moment as the tag value 0x0000 has a
          * special meaning. */
         /* { 0x0000, EXIF_FORMAT_BYTE, -1, "Exif.GPSInfo.GPSVersionID", NULL, NULL }, */
-        { 0x0001, EXIF_FORMAT_STRING, 2, "Exif.GPSInfo.GPSLatitudeRef", NULL, NULL },
-        { 0x0002, EXIF_FORMAT_RATIONAL_UNSIGNED, 3, "Exif.GPSInfo.GPSLatitude", NULL, NULL },
-        { 0x0003, EXIF_FORMAT_STRING, 2, "Exif.GPSInfo.GPSLongitudeRef", NULL, NULL },
-        { 0x0004, EXIF_FORMAT_RATIONAL_UNSIGNED, 3, "Exif.GPSInfo.GPSLongitude", NULL, NULL },
-        { 0x0005, EXIF_FORMAT_BYTE_UNSIGNED, 1, "Exif.GPSInfo.GPSAltitudeRef", NULL, NULL },
-        { 0x0006, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Exif.GPSInfo.GPSAltitude", NULL, NULL },
-        { 0x0007, EXIF_FORMAT_RATIONAL_UNSIGNED, 3, "Exif.GPSInfo.GPSTimeStamp", NULL, NULL },
-        { 0x0008, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSSatellites", NULL, NULL },
-        { 0x0009, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSStatus", NULL, NULL },
-        { 0x000a, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSMeasureMode", NULL, NULL },
-        { 0x000b, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSDOP", NULL, NULL },
-        { 0x000c, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSSpeedRef", NULL, NULL },
-        { 0x000d, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSSpeed", NULL, NULL },
-        { 0x000e, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSTrackRef", NULL, NULL },
-        { 0x000f, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSTrack", NULL, NULL },
-        { 0x0010, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSImgDirectionRef", NULL, NULL },
-        { 0x0011, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSImgDirection", NULL, NULL },
-        { 0x0012, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSMapDatum", NULL, NULL },
-        { 0x0013, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSDestLatitudeRef", NULL, NULL },
-        { 0x0014, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSDestLatitude", NULL, NULL },
-        { 0x0015, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSDestLongitudeRef", NULL, NULL },
-        { 0x0016, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSDestLongitude", NULL, NULL },
-        { 0x0017, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSDestBearingRef", NULL, NULL },
-        { 0x0018, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSDestBearing", NULL, NULL },
-        { 0x0019, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSDestDistanceRef", NULL, NULL },
-        { 0x001a, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSDestDistance", NULL, NULL },
-        { 0x001b, EXIF_FORMAT_UNDEFINED, -1, "Exif.GPSInfo.GPSProcessingMethod", NULL, NULL },
-        { 0x001c, EXIF_FORMAT_UNDEFINED, -1, "Exif.GPSInfo.GPSAreaInformation", NULL, NULL },
-        { 0x001d, EXIF_FORMAT_RATIONAL_UNSIGNED, 3, "Exif.GPSInfo.GPSDateStamp", NULL, NULL },
-        { 0x001e, EXIF_FORMAT_SHORT, -1, "Exif.GPSInfo.GPSDifferential", NULL, NULL },
+        { 0x0001, EXIF_FORMAT_STRING, 2, "Exif.GPSInfo.GPSLatitudeRef", nullptr, nullptr },
+        { 0x0002, EXIF_FORMAT_RATIONAL_UNSIGNED, 3, "Exif.GPSInfo.GPSLatitude", nullptr, nullptr },
+        { 0x0003, EXIF_FORMAT_STRING, 2, "Exif.GPSInfo.GPSLongitudeRef", nullptr, nullptr },
+        { 0x0004, EXIF_FORMAT_RATIONAL_UNSIGNED, 3, "Exif.GPSInfo.GPSLongitude", nullptr, nullptr },
+        { 0x0005, EXIF_FORMAT_BYTE_UNSIGNED, 1, "Exif.GPSInfo.GPSAltitudeRef", nullptr, nullptr },
+        { 0x0006, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Exif.GPSInfo.GPSAltitude", nullptr, nullptr },
+        { 0x0007, EXIF_FORMAT_RATIONAL_UNSIGNED, 3, "Exif.GPSInfo.GPSTimeStamp", nullptr, nullptr },
+        { 0x0008, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSSatellites", nullptr, nullptr },
+        { 0x0009, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSStatus", nullptr, nullptr },
+        { 0x000a, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSMeasureMode", nullptr, nullptr },
+        { 0x000b, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSDOP", nullptr, nullptr },
+        { 0x000c, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSSpeedRef", nullptr, nullptr },
+        { 0x000d, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSSpeed", nullptr, nullptr },
+        { 0x000e, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSTrackRef", nullptr, nullptr },
+        { 0x000f, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSTrack", nullptr, nullptr },
+        { 0x0010, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSImgDirectionRef", nullptr, nullptr },
+        { 0x0011, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSImgDirection", nullptr, nullptr },
+        { 0x0012, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSMapDatum", nullptr, nullptr },
+        { 0x0013, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSDestLatitudeRef", nullptr, nullptr },
+        { 0x0014, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSDestLatitude", nullptr, nullptr },
+        { 0x0015, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSDestLongitudeRef", nullptr, nullptr },
+        { 0x0016, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSDestLongitude", nullptr, nullptr },
+        { 0x0017, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSDestBearingRef", nullptr, nullptr },
+        { 0x0018, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSDestBearing", nullptr, nullptr },
+        { 0x0019, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSDestDistanceRef", nullptr, nullptr },
+        { 0x001a, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSDestDistance", nullptr, nullptr },
+        { 0x001b, EXIF_FORMAT_UNDEFINED, -1, "Exif.GPSInfo.GPSProcessingMethod", nullptr, nullptr },
+        { 0x001c, EXIF_FORMAT_UNDEFINED, -1, "Exif.GPSInfo.GPSAreaInformation", nullptr, nullptr },
+        { 0x001d, EXIF_FORMAT_RATIONAL_UNSIGNED, 3, "Exif.GPSInfo.GPSDateStamp", nullptr, nullptr },
+        { 0x001e, EXIF_FORMAT_SHORT, -1, "Exif.GPSInfo.GPSDifferential", nullptr, nullptr },
 
         EXIF_MARKER_LIST_END
 };
 
 ExifMarker ExifUnknownMarkersList[] = {
-{ 0x0000, EXIF_FORMAT_UNKNOWN, 0,              "unknown",      NULL, NULL },
-{ 0x0000, EXIF_FORMAT_BYTE_UNSIGNED, -1,       "unknown",      NULL, NULL },
-{ 0x0000, EXIF_FORMAT_STRING, -1,              "unknown",      NULL, NULL },
-{ 0x0000, EXIF_FORMAT_SHORT_UNSIGNED, -1,      "unknown",      NULL, NULL },
-{ 0x0000, EXIF_FORMAT_LONG_UNSIGNED, -1,       "unknown",      NULL, NULL },
-{ 0x0000, EXIF_FORMAT_RATIONAL_UNSIGNED, -1,   "unknown",      NULL, NULL },
-{ 0x0000, EXIF_FORMAT_BYTE, -1,                        "unknown",      NULL, NULL },
-{ 0x0000, EXIF_FORMAT_UNDEFINED, -1,           "unknown",      NULL, NULL },
-{ 0x0000, EXIF_FORMAT_SHORT, -1,               "unknown",      NULL, NULL },
-{ 0x0000, EXIF_FORMAT_LONG, -1,                        "unknown",      NULL, NULL },
-{ 0x0000, EXIF_FORMAT_RATIONAL, -1,            "unknown",      NULL, NULL },
-{ 0x0000, EXIF_FORMAT_FLOAT, -1,               "unknown",      NULL, NULL },
-{ 0x0000, EXIF_FORMAT_DOUBLE, -1,              "unknown",      NULL, NULL },
+{ 0x0000, EXIF_FORMAT_UNKNOWN, 0,              "unknown",      nullptr, nullptr },
+{ 0x0000, EXIF_FORMAT_BYTE_UNSIGNED, -1,       "unknown",      nullptr, nullptr },
+{ 0x0000, EXIF_FORMAT_STRING, -1,              "unknown",      nullptr, nullptr },
+{ 0x0000, EXIF_FORMAT_SHORT_UNSIGNED, -1,      "unknown",      nullptr, nullptr },
+{ 0x0000, EXIF_FORMAT_LONG_UNSIGNED, -1,       "unknown",      nullptr, nullptr },
+{ 0x0000, EXIF_FORMAT_RATIONAL_UNSIGNED, -1,   "unknown",      nullptr, nullptr },
+{ 0x0000, EXIF_FORMAT_BYTE, -1,                        "unknown",      nullptr, nullptr },
+{ 0x0000, EXIF_FORMAT_UNDEFINED, -1,           "unknown",      nullptr, nullptr },
+{ 0x0000, EXIF_FORMAT_SHORT, -1,               "unknown",      nullptr, nullptr },
+{ 0x0000, EXIF_FORMAT_LONG, -1,                        "unknown",      nullptr, nullptr },
+{ 0x0000, EXIF_FORMAT_RATIONAL, -1,            "unknown",      nullptr, nullptr },
+{ 0x0000, EXIF_FORMAT_FLOAT, -1,               "unknown",      nullptr, nullptr },
+{ 0x0000, EXIF_FORMAT_DOUBLE, -1,              "unknown",      nullptr, nullptr },
 };
 
 static const ExifMarker *exif_marker_from_tag(guint16 tag, const ExifMarker *list);
@@ -564,7 +564,7 @@ static void exif_item_free(ExifItem *item)
 
 gchar *exif_item_get_tag_name(ExifItem *item)
 {
-       if (!item || !item->marker) return NULL;
+       if (!item || !item->marker) return nullptr;
        return g_strdup(item->marker->key);
 }
 
@@ -585,9 +585,9 @@ gchar *exif_item_get_data(ExifItem *item, guint *data_len)
        if (data_len)
                *data_len = item->data_len;
 #if GLIB_CHECK_VERSION(2,68,0)
-       return (gchar*)g_memdup2((gpointer)(item->data), item->data_len);
+       return static_cast<gchar*>(g_memdup2(item->data, item->data_len));
 #else
-       return (gchar*)g_memdup((gpointer)(item->data), item->data_len);
+       return static_cast<gchar*>(g_memdup(item->data, item->data_len));
 #endif
 }
 
@@ -600,13 +600,13 @@ guint exif_item_get_format_id(ExifItem *item)
 
 gchar *exif_item_get_description(ExifItem *item)
 {
-       if (!item || !item->marker) return NULL;
+       if (!item || !item->marker) return nullptr;
        return g_strdup(_(item->marker->description));
 }
 
 const gchar *exif_item_get_format_name(ExifItem *item, gboolean brief)
 {
-       if (!item || !item->marker) return NULL;
+       if (!item || !item->marker) return nullptr;
        return (brief) ? ExifFormatList[item->format].short_name : ExifFormatList[item->format].description;
 }
 
@@ -616,7 +616,7 @@ static GString *string_append_raw_bytes(GString *string, gpointer data, gint ne)
 
        for (i = 0 ; i < ne; i++)
                {
-               guchar c = ((gchar *)data)[i];
+               guchar c = (static_cast<gchar *>(data))[i];
                if (c < 32 || c > 127) c = '.';
                g_string_append_printf(string, "%c", c);
                }
@@ -639,7 +639,7 @@ static GString *string_append_raw_bytes(GString *string, gpointer data, gint ne)
                        {
                        spacer = "";
                        }
-               g_string_append_printf(string, "%s%02x", spacer, ((gchar *)data)[i]);
+               g_string_append_printf(string, "%s%02x", spacer, (static_cast<gchar *>(data))[i]);
                }
 
        return string;
@@ -648,13 +648,13 @@ static GString *string_append_raw_bytes(GString *string, gpointer data, gint ne)
 
 gchar *exif_text_list_find_value(ExifTextList *list, guint value)
 {
-       gchar *result = NULL;
+       gchar *result = nullptr;
        gint i;
 
        i = 0;
        while (!result && list[i].value >= 0)
                {
-               if (value == (guint) list[i].value) result = g_strdup(_(list[i].description));
+               if (value == static_cast<guint>(list[i].value)) result = g_strdup(_(list[i].description));
                i++;
                }
        if (!result) result = g_strdup_printf("%d (%s)", value, _("unknown"));
@@ -738,20 +738,20 @@ static const ExifMarker *exif_marker_from_tag(guint16 tag, const ExifMarker *lis
 {
        gint i = 0;
 
-       if (!list) return NULL;
+       if (!list) return nullptr;
 
        while (list[i].tag != 0 && list[i].tag != tag)
                {
                i++;
                }
 
-       return (list[i].tag == 0 ? NULL : &list[i]);
+       return (list[i].tag == 0 ? nullptr : &list[i]);
 }
 
 static void rational_from_data(ExifRational *r, gpointer src, ExifByteOrder bo)
 {
-       r->num = exif_byte_get_int32((guchar *)src, bo);
-       r->den = exif_byte_get_int32((guchar *)src + sizeof(guint32), bo);
+       r->num = exif_byte_get_int32(static_cast<guchar *>(src), bo);
+       r->den = exif_byte_get_int32(static_cast<guchar *>(src) + sizeof(guint32), bo);
 }
 
 /* src_format and item->format must be compatible
@@ -790,13 +790,13 @@ void exif_item_copy_data(ExifItem *item, gpointer src, guint len,
                case EXIF_FORMAT_STRING:
                        memcpy(dest, src, len);
                        /* string is NULL terminated, make sure this is true */
-                       if (((gchar *)dest)[len - 1] != '\0') ((gchar *)dest)[len - 1] = '\0';
+                       if ((static_cast<gchar *>(dest))[len - 1] != '\0') (static_cast<gchar *>(dest))[len - 1] = '\0';
                        break;
                case EXIF_FORMAT_SHORT_UNSIGNED:
                case EXIF_FORMAT_SHORT:
                        for (i = 0; i < ne; i++)
                                {
-                               ((guint16 *)dest)[i] = exif_byte_get_int16((guchar *)src + i * bs, bo);
+                               (static_cast<guint16 *>(dest))[i] = exif_byte_get_int16(static_cast<guchar *>(src) + i * bs, bo);
                                }
                        break;
                case EXIF_FORMAT_LONG_UNSIGNED:
@@ -810,16 +810,16 @@ void exif_item_copy_data(ExifItem *item, gpointer src, guint len,
                                ss = ExifFormatList[src_format].size;
                                for (i = 0; i < ne; i++)
                                        {
-                                       ((gint32 *)dest)[i] =
-                                               (gint32)exif_byte_get_int16((guchar *)src + i * ss, bo);
+                                       (static_cast<gint32 *>(dest))[i] =
+                                               static_cast<gint32>(exif_byte_get_int16(static_cast<guchar *>(src) + i * ss, bo));
                                        }
                                }
                        else
                                {
                                for (i = 0; i < ne; i++)
                                        {
-                                       ((gint32 *)dest)[i] =
-                                               exif_byte_get_int32((guchar *)src + i * bs, bo);
+                                       (static_cast<gint32 *>(dest))[i] =
+                                               exif_byte_get_int32(static_cast<guchar *>(src) + i * bs, bo);
                                        }
                                }
                        break;
@@ -827,13 +827,13 @@ void exif_item_copy_data(ExifItem *item, gpointer src, guint len,
                case EXIF_FORMAT_RATIONAL:
                        for (i = 0; i < ne; i++)
                                {
-                               rational_from_data(&((ExifRational *)dest)[i], (guchar *)src + i * bs, bo);
+                               rational_from_data(&(static_cast<ExifRational *>(dest))[i], static_cast<guchar *>(src) + i * bs, bo);
                                }
                        break;
                case EXIF_FORMAT_FLOAT:
                        for (i = 0; i < ne; i++)
                                {
-                               ((float *)dest)[i] = exif_byte_get_int32((guchar *)src + i * bs, bo);
+                               (static_cast<float *>(dest))[i] = exif_byte_get_int32(static_cast<guchar *>(src) + i * bs, bo);
                                }
                        break;
                case EXIF_FORMAT_DOUBLE:
@@ -841,8 +841,8 @@ void exif_item_copy_data(ExifItem *item, gpointer src, guint len,
                                {
                                ExifRational r;
 
-                               rational_from_data(&r, (guchar *)src + i * bs, bo);
-                               if (r.den) ((gdouble *)dest)[i] = (gdouble)r.num / r.den;
+                               rational_from_data(&r, static_cast<guchar *>(src) + i * bs, bo);
+                               if (r.den) (static_cast<gdouble *>(dest))[i] = static_cast<gdouble>(r.num) / r.den;
                                }
                        break;
                }
@@ -914,7 +914,7 @@ static gint exif_parse_IFD_entry(ExifData *exif, guchar *tiff, guint offset,
 
        /* Where is the data, is it available?
         */
-       if (marker->components > 0 && (guint) marker->components != count)
+       if (marker->components > 0 && static_cast<guint>(marker->components) != count)
                {
                log_printf("warning: exif tag %s has %d elements, exif spec requests %d\n",
                        marker->key, count, marker->components);
@@ -936,7 +936,7 @@ static gint exif_parse_IFD_entry(ExifData *exif, guchar *tiff, guint offset,
                }
 
        item = exif_item_new(marker->format, tag, count, marker);
-       exif_item_copy_data(item, tiff + data_offset, data_length, (ExifFormatType)format, bo);
+       exif_item_copy_data(item, tiff + data_offset, data_length, static_cast<ExifFormatType>(format), bo);
        exif->items = g_list_prepend(exif->items, item);
 
        if (list == ExifKnownMarkersList)
@@ -1055,7 +1055,7 @@ gint exif_tiff_parse(ExifData *exif, guchar *tiff, guint size, ExifMarker *list)
             length of NN... == SSSS - 2.
        NNN.: the data in this segment
  */
-static ExifMarker jpeg_color_marker = { 0x8773, EXIF_FORMAT_UNDEFINED, -1, "Exif.Image.InterColorProfile", NULL, NULL };
+static ExifMarker jpeg_color_marker = { 0x8773, EXIF_FORMAT_UNDEFINED, -1, "Exif.Image.InterColorProfile", nullptr, nullptr };
 
 void exif_add_jpeg_color_profile(ExifData *exif, guchar *cp_data, guint cp_length)
 {
@@ -1102,8 +1102,8 @@ guchar *exif_get_color_profile(ExifData *exif, guint *data_len)
 {
        ExifItem *prof_item = exif_get_item(exif, "Exif.Image.InterColorProfile");
        if (prof_item && exif_item_get_format_id(prof_item) == EXIF_FORMAT_UNDEFINED)
-               return (guchar *) exif_item_get_data(prof_item, data_len);
-       return NULL;
+               return reinterpret_cast<guchar *>(exif_item_get_data(prof_item, data_len));
+       return nullptr;
 }
 
 
@@ -1130,23 +1130,23 @@ ExifItem *exif_get_first_item(ExifData *exif)
 {
        if (exif->items)
                {
-               ExifItem *ret = (ExifItem *)exif->items->data;
+               auto ret = static_cast<ExifItem *>(exif->items->data);
                exif->current = exif->items->next;
                return ret;
                }
-       exif->current = NULL;
-       return NULL;
+       exif->current = nullptr;
+       return nullptr;
 }
 
 ExifItem *exif_get_next_item(ExifData *exif)
 {
        if (exif->current)
                {
-               ExifItem *ret = (ExifItem *)exif->current->data;
+               auto ret = static_cast<ExifItem *>(exif->current->data);
                exif->current = exif->current->next;
                return ret;
                }
-       return NULL;
+       return nullptr;
 }
 
 static gint map_file(const gchar *path, void **mapping, gint *size)
@@ -1170,7 +1170,7 @@ static gint map_file(const gchar *path, void **mapping, gint *size)
 
        *size = fs.st_size;
 
-       *mapping = mmap(0, *size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
+       *mapping = mmap(nullptr, *size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
        if (*mapping == MAP_FAILED)
                {
                perror(path);
@@ -1207,7 +1207,7 @@ void exif_free(ExifData *exif)
        work = exif->items;
        while (work)
                {
-               ExifItem *item = static_cast<ExifItem *>(work->data);
+               auto item = static_cast<ExifItem *>(work->data);
                work = work->next;
                exif_item_free(item);
                }
@@ -1224,23 +1224,23 @@ ExifData *exif_read(gchar *path, gchar *UNUSED(sidecar_path), GHashTable *UNUSED
        gint size, res;
        gchar *pathl;
 
-       if (!path) return NULL;
+       if (!path) return nullptr;
 
        pathl = path_from_utf8(path);
        if (map_file(pathl, &f, &size) == -1)
                {
                g_free(pathl);
-               return NULL;
+               return nullptr;
                }
        g_free(pathl);
 
        exif = g_new0(ExifData, 1);
        exif->path = g_strdup(path);
 
-       res = exif_jpeg_parse(exif, (guchar *)f, size, ExifKnownMarkersList);
+       res = exif_jpeg_parse(exif, static_cast<guchar *>(f), size, ExifKnownMarkersList);
        if (res == -2)
                {
-               res = exif_tiff_parse(exif, (guchar *)f, size, ExifKnownMarkersList);
+               res = exif_tiff_parse(exif, static_cast<guchar *>(f), size, ExifKnownMarkersList);
                }
 
        if (res != 0)
@@ -1249,23 +1249,23 @@ ExifData *exif_read(gchar *path, gchar *UNUSED(sidecar_path), GHashTable *UNUSED
                FormatRawExifParseFunc exif_parse_func;
                guint32 offset = 0;
 
-               exif_type = format_raw_exif_offset((guchar*)f, size, &offset, &exif_parse_func);
+               exif_type = format_raw_exif_offset(static_cast<guchar*>(f), size, &offset, &exif_parse_func);
                switch (exif_type)
                        {
                        case FORMAT_RAW_EXIF_NONE:
                        default:
                                break;
                        case FORMAT_RAW_EXIF_TIFF:
-                               res = exif_tiff_parse(exif, (guchar *)f + offset, size - offset,
+                               res = exif_tiff_parse(exif, static_cast<guchar *>(f) + offset, size - offset,
                                                      ExifKnownMarkersList);
                                break;
                        case FORMAT_RAW_EXIF_JPEG:
-                               res = exif_jpeg_parse(exif, (guchar *)f + offset, size - offset,
+                               res = exif_jpeg_parse(exif, static_cast<guchar *>(f) + offset, size - offset,
                                                      ExifKnownMarkersList);
                                break;
                        case FORMAT_RAW_EXIF_IFD_II:
                        case FORMAT_RAW_EXIF_IFD_MM:
-                               res = exif_parse_IFD_table(exif, (guchar *)f, offset, size - offset,
+                               res = exif_parse_IFD_table(exif, static_cast<guchar *>(f), offset, size - offset,
                                                           (exif_type == FORMAT_RAW_EXIF_IFD_II) ?
                                                                EXIF_BYTE_ORDER_INTEL : EXIF_BYTE_ORDER_MOTOROLA,
                                                           0, ExifKnownMarkersList);
@@ -1273,7 +1273,7 @@ ExifData *exif_read(gchar *path, gchar *UNUSED(sidecar_path), GHashTable *UNUSED
                        case FORMAT_RAW_EXIF_PROPRIETARY:
                                if (exif_parse_func)
                                        {
-                                       res = exif_parse_func((guchar *)f + offset, size - offset, exif);
+                                       res = exif_parse_func(static_cast<guchar *>(f) + offset, size - offset, exif);
                                        }
                                break;
                        }
@@ -1282,7 +1282,7 @@ ExifData *exif_read(gchar *path, gchar *UNUSED(sidecar_path), GHashTable *UNUSED
        if (res != 0)
                {
                exif_free(exif);
-               exif = NULL;
+               exif = nullptr;
                }
 
        unmap_file(f, size);
@@ -1296,18 +1296,18 @@ ExifItem *exif_get_item(ExifData *exif, const gchar *key)
 {
        GList *work;
 
-       if (!key) return NULL;
+       if (!key) return nullptr;
 
        work = exif->items;
        while (work)
                {
                ExifItem *item;
 
-               item = (ExifItem*)(work->data);
+               item = static_cast<ExifItem*>(work->data);
                work = work->next;
                if (item->marker->key && strcmp(key, item->marker->key) == 0) return item;
                }
-       return NULL;
+       return nullptr;
 }
 
 #define EXIF_DATA_AS_TEXT_MAX_COUNT 16
@@ -1322,10 +1322,10 @@ static gchar *exif_item_get_data_as_text_full(ExifItem *item, MetadataFormat for
        gint ne;
        gint i;
 
-       if (!item) return NULL;
+       if (!item) return nullptr;
 
        marker = item->marker;
-       if (!marker) return NULL;
+       if (!marker) return nullptr;
 
        data = item->data;
        ne = item->elements;
@@ -1346,14 +1346,14 @@ static gchar *exif_item_get_data_as_text_full(ExifItem *item, MetadataFormat for
                                if (item->format == EXIF_FORMAT_BYTE_UNSIGNED ||
                                    item->format == EXIF_FORMAT_UNDEFINED)
                                        {
-                                       val = ((guchar *)data)[0];
+                                       val = (static_cast<guchar *>(data))[0];
                                        }
                                else
                                        {
-                                       val = (guchar)(((gchar *)data)[0]);
+                                       val = static_cast<guchar>((static_cast<gchar *>(data))[0]);
                                        }
 
-                               result = exif_text_list_find_value(marker->list, (guint)val);
+                               result = exif_text_list_find_value(marker->list, static_cast<guint>(val));
                                string = g_string_append(string, result);
                                g_free(result);
                                }
@@ -1370,21 +1370,21 @@ static gchar *exif_item_get_data_as_text_full(ExifItem *item, MetadataFormat for
                                {
                                gchar *result;
 
-                               result = exif_text_list_find_value(marker->list, ((guint16 *)data)[0]);
+                               result = exif_text_list_find_value(marker->list, (static_cast<guint16 *>(data))[0]);
                                string = g_string_append(string, result);
                                g_free(result);
                                }
                        else for (i = 0; i < ne; i++)
                                {
                                g_string_append_printf(string, "%s%hd", (i > 0) ? ", " : "",
-                                                       ((guint16 *)data)[i]);
+                                                       (static_cast<guint16 *>(data))[i]);
                                }
                        break;
                case EXIF_FORMAT_LONG_UNSIGNED:
                        for (i = 0; i < ne; i++)
                                {
                                g_string_append_printf(string, "%s%ld", (i > 0) ? ", " : "",
-                                                       (gulong)((guint32 *)data)[i]);
+                                                       static_cast<gulong>((static_cast<guint32 *>(data))[i]));
                                }
                        break;
                case EXIF_FORMAT_RATIONAL_UNSIGNED:
@@ -1392,23 +1392,23 @@ static gchar *exif_item_get_data_as_text_full(ExifItem *item, MetadataFormat for
                                {
                                ExifRational *r;
 
-                               r = &((ExifRational *)data)[i];
+                               r = &(static_cast<ExifRational *>(data))[i];
                                g_string_append_printf(string, "%s%ld/%ld", (i > 0) ? ", " : "",
-                                                       (gulong)r->num, (gulong)r->den);
+                                                       static_cast<gulong>(r->num), static_cast<gulong>(r->den));
                                }
                        break;
                case EXIF_FORMAT_SHORT:
                        for (i = 0; i < ne; i++)
                                {
                                g_string_append_printf(string, "%s%hd", (i > 0) ? ", " : "",
-                                                       ((gint16 *)data)[i]);
+                                                       (static_cast<gint16 *>(data))[i]);
                                }
                        break;
                case EXIF_FORMAT_LONG:
                        for (i = 0; i < ne; i++)
                                {
                                g_string_append_printf(string, "%s%ld", (i > 0) ? ", " : "",
-                                                       (glong)((gint32 *)data)[i]);
+                                                       static_cast<glong>((static_cast<gint32 *>(data))[i]));
                                }
                        break;
                case EXIF_FORMAT_RATIONAL:
@@ -1416,23 +1416,23 @@ static gchar *exif_item_get_data_as_text_full(ExifItem *item, MetadataFormat for
                                {
                                ExifRational *r;
 
-                               r = &((ExifRational *)data)[i];
+                               r = &(static_cast<ExifRational *>(data))[i];
                                g_string_append_printf(string, "%s%ld/%ld", (i > 0) ? ", " : "",
-                                                       (glong)r->num, (glong)r->den);
+                                                       static_cast<glong>(r->num), static_cast<glong>(r->den));
                                }
                        break;
                case EXIF_FORMAT_FLOAT:
                        for (i = 0; i < ne; i++)
                                {
                                g_string_append_printf(string, "%s%f", (i > 0) ? ", " : "",
-                                                       ((float *)data)[i]);
+                                                       (static_cast<float *>(data))[i]);
                                }
                        break;
                case EXIF_FORMAT_DOUBLE:
                        for (i = 0; i < ne; i++)
                                {
                                g_string_append_printf(string, "%s%f", (i > 0) ? ", " : "",
-                                                       ((gdouble *)data)[i]);
+                                                       (static_cast<gdouble *>(data))[i]);
                                }
                        break;
                }
@@ -1467,19 +1467,19 @@ gint exif_item_get_integer(ExifItem *item, gint *value)
        switch (item->format)
                {
                case EXIF_FORMAT_SHORT:
-                       *value = (gint)(((gint16 *)(item->data))[0]);
+                       *value = static_cast<gint>((static_cast<gint16 *>(item->data))[0]);
                        return TRUE;
                        break;
                case EXIF_FORMAT_SHORT_UNSIGNED:
-                       *value = (gint)(((guint16 *)(item->data))[0]);
+                       *value = static_cast<gint>((static_cast<guint16 *>(item->data))[0]);
                        return TRUE;
                        break;
                case EXIF_FORMAT_LONG:
-                       *value = (gint)(((gint32 *)(item->data))[0]);
+                       *value = static_cast<gint>((static_cast<gint32 *>(item->data))[0]);
                        return TRUE;
                        break;
                case EXIF_FORMAT_LONG_UNSIGNED: /**< @FIXME overflow possible */
-                       *value = (gint)(((guint32 *)(item->data))[0]);
+                       *value = static_cast<gint>((static_cast<guint32 *>(item->data))[0]);
                        return TRUE;
                default:
                        /* all other type return FALSE */
@@ -1491,24 +1491,24 @@ gint exif_item_get_integer(ExifItem *item, gint *value)
 
 ExifRational *exif_item_get_rational(ExifItem *item, gint *sign, guint n)
 {
-       if (!item) return NULL;
-       if (n >= item->elements) return NULL;
+       if (!item) return nullptr;
+       if (n >= item->elements) return nullptr;
 
        if (item->format == EXIF_FORMAT_RATIONAL ||
            item->format == EXIF_FORMAT_RATIONAL_UNSIGNED)
                {
                if (sign) *sign = (item->format == EXIF_FORMAT_RATIONAL);
-               return &((ExifRational *)(item->data))[n];
+               return &(static_cast<ExifRational *>(item->data))[n];
                }
 
-       return NULL;
+       return nullptr;
 }
 
 gchar *exif_get_tag_description_by_key(const gchar *key)
 {
        gint i;
 
-       if (!key) return NULL;
+       if (!key) return nullptr;
 
        i = 0;
        while (ExifKnownMarkersList[i].tag > 0)
@@ -1524,7 +1524,7 @@ gchar *exif_get_tag_description_by_key(const gchar *key)
           i++;
        }
 
-       return NULL;
+       return nullptr;
 }
 
 static void exif_write_item(FILE *f, ExifItem *item, ExifData *exif)
@@ -1558,7 +1558,7 @@ void exif_write_data_list(ExifData *exif, FILE *f, gint human_readable_list)
                        {
                        gchar *text;
 
-                       text = exif_get_formatted_by_key(exif, ExifFormattedList[i].key, NULL);
+                       text = exif_get_formatted_by_key(exif, ExifFormattedList[i].key, nullptr);
                        if (text)
                                {
                                g_fprintf(f, "     %9s %30s %s\n", "string", ExifFormattedList[i].key, text);
@@ -1575,7 +1575,7 @@ void exif_write_data_list(ExifData *exif, FILE *f, gint human_readable_list)
                        {
                        ExifItem *item;
 
-                       item = (ExifItem*)(work->data);
+                       item = static_cast<ExifItem*>(work->data);
                        work = work->next;
 
                        exif_write_item(f, item, exif);
@@ -1607,7 +1607,7 @@ GList *exif_get_metadata(ExifData *exif, const gchar *key, MetadataFormat format
        gchar *str;
        ExifItem *item;
 
-       if (!key) return NULL;
+       if (!key) return nullptr;
 
        /* convert xmp key to exif key */
        if (strcmp(key, "Xmp.tiff.Orientation") == 0) key = "Exif.Image.Orientation";
@@ -1617,17 +1617,17 @@ GList *exif_get_metadata(ExifData *exif, const gchar *key, MetadataFormat format
                gchar *text;
                gint key_valid;
                text = exif_get_formatted_by_key(exif, key, &key_valid);
-               if (key_valid) return g_list_append(NULL, text);
+               if (key_valid) return g_list_append(nullptr, text);
                }
 
        item = exif_get_item(exif, key);
-       if (!item) return NULL;
+       if (!item) return nullptr;
 
        str = exif_item_get_data_as_text_full(item, format);
 
-       if (!str) return NULL;
+       if (!str) return nullptr;
 
-       return g_list_append(NULL, str);
+       return g_list_append(nullptr, str);
 }
 
 struct UnmapData
@@ -1637,7 +1637,7 @@ struct UnmapData
        size_t map_len;
 };
 
-static GList *exif_unmap_list = 0;
+static GList *exif_unmap_list = nullptr;
 
 guchar *exif_get_preview(ExifData *exif, guint *data_len, gint UNUSED(requested_width), gint UNUSED(requested_height))
 {
@@ -1648,7 +1648,7 @@ guchar *exif_get_preview(ExifData *exif, guint *data_len, gint UNUSED(requested_
        size_t map_len;
        int fd;
 
-       if (!exif) return NULL;
+       if (!exif) return nullptr;
        path = exif->path;
 
        fd = open(path, O_RDONLY);
@@ -1656,24 +1656,24 @@ guchar *exif_get_preview(ExifData *exif, guint *data_len, gint UNUSED(requested_
 
        if (fd == -1)
                {
-               return 0;
+               return nullptr;
                }
 
        if (fstat(fd, &st) == -1)
                {
                close(fd);
-               return 0;
+               return nullptr;
                }
        map_len = st.st_size;
-       map_data = (guchar *) mmap(0, map_len, PROT_READ, MAP_PRIVATE, fd, 0);
+       map_data = static_cast<guchar *>(mmap(nullptr, map_len, PROT_READ, MAP_PRIVATE, fd, 0));
        close(fd);
 
        if (map_data == MAP_FAILED)
                {
-               return 0;
+               return nullptr;
                }
 
-       if (format_raw_img_exif_offsets(map_data, map_len, &offset, NULL) && offset)
+       if (format_raw_img_exif_offsets(map_data, map_len, &offset, nullptr) && offset)
                {
                UnmapData *ud;
 
@@ -1690,7 +1690,7 @@ guchar *exif_get_preview(ExifData *exif, guint *data_len, gint UNUSED(requested_
                }
 
        munmap(map_data, map_len);
-       return NULL;
+       return nullptr;
 
 }
 
@@ -1700,7 +1700,7 @@ void exif_free_preview(guchar *buf)
 
        while (work)
                {
-               UnmapData *ud = (UnmapData *)work->data;
+               auto ud = static_cast<UnmapData *>(work->data);
                if (ud->ptr == buf)
                        {
                        exif_unmap_list = g_list_remove_link(exif_unmap_list, work);
@@ -1712,7 +1712,7 @@ void exif_free_preview(guchar *buf)
        g_assert_not_reached();
 }
 
-void exif_init(void)
+void exif_init()
 {
 }
 #else
index 5ef9299..ca70401 100644 (file)
@@ -269,7 +269,7 @@ public:
                {
                        if (data_len) *data_len = cp_length_;
 #if GLIB_CHECK_VERSION(2,68,0)
-                       return (unsigned char *) g_memdup2(cp_data_, cp_length_);
+                       return static_cast<unsigned char *>(g_memdup2(cp_data_, cp_length_));
 #else
                        return static_cast<unsigned char *>(g_memdup(cp_data_, cp_length_));
 #endif
index 7b69462..f086404 100644 (file)
@@ -23,8 +23,8 @@
 
 #ifndef HAVE_EXIV2
 
-#include <stdio.h>
-#include <string.h>
+#include <cstdio>
+#include <cstring>
 #include <unistd.h>
 
 #include <glib.h>
@@ -391,7 +391,7 @@ static ExifTextList CanonSet1FocusCont[] = {
 static ExifMarker CanonSet1[] = {
 /* 0 is length of array in bytes (2 x array size) */
 { 1,   EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.MacroMode",   "Macro mode",           CanonSet1MacroMode },
-{ 2,   EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.SelfTimer",   "Self timer (10ths of second)", NULL },
+{ 2,   EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.SelfTimer",   "Self timer (10ths of second)", nullptr },
 { 3,   EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.Quality",     "Quality",              CanonSet1Quality },
 { 4,   EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.FlashMode",   "Flash mode",           CanonSet1FlashMode },
 { 5,   EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.DriveMode",   "Drive mode",           CanonSet1DriveMode },
@@ -410,11 +410,11 @@ static ExifMarker CanonSet1[] = {
 { 19,  EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.AutoFocus",   "AutoFocus point",      CanonSet1AutoFocusPoint },
 { 20,  EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.ExposureMode","Exposure mode",        CanonSet1ExposureMode },
  { 20, EXIF_FORMAT_SHORT_UNSIGNED, 1, "ExposureMode",          "Exposure mode",        CanonSet1ExposureMode },
-{ 23,  EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.FocalLengthLong","Long focal length", NULL },
-{ 24,  EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.FocalLengthShort","Short focal length", NULL },
-{ 25,  EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.FocalLengthUnits","Focal units per mm", NULL },
+{ 23,  EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.FocalLengthLong","Long focal length", nullptr },
+{ 24,  EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.FocalLengthShort","Short focal length", nullptr },
+{ 25,  EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.FocalLengthUnits","Focal units per mm", nullptr },
 { 28,  EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.FlashFired",  "Flash fired",          CanonSet1FlashFired },
-{ 29,  EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.FlashDetails","Flash details",        NULL },
+{ 29,  EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.FlashDetails","Flash details",        nullptr },
 { 32,  EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.ContinuousFocus","Continuous focus",  CanonSet1FocusCont },
 EXIF_MARKER_LIST_END
 };
@@ -460,23 +460,23 @@ static ExifMarker CanonSet2[] = {
 /* 0 is length of array in bytes (2 x array size) */
 { 7,   EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.WhiteBalance","White balance",        CanonSet2WhiteBalance },
  { 7,  EXIF_FORMAT_SHORT_UNSIGNED, 1, "LightSource",           "White balance",        CanonSet2WhiteBalance },
-{ 9,   EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.SequenceNumber","Sequence number",    NULL },
+{ 9,   EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.SequenceNumber","Sequence number",    nullptr },
 { 15,  EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.FlashBias",   "Flash bias",           CanonSet2FlashBias },
 /* distance needs more than just this (metric) value */
-{ 19,  EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.SubjectDistance",     "Subject Distance", NULL },
+{ 19,  EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.SubjectDistance",     "Subject Distance", nullptr },
 EXIF_MARKER_LIST_END
 };
 
 
 static ExifMarker CanonExifMarkersList[] = {
-       { 1,    EXIF_FORMAT_SHORT_UNSIGNED, -1, "MkN.Canon.Settings1",          NULL, NULL },
-       { 4,    EXIF_FORMAT_SHORT_UNSIGNED, -1, "MkN.Canon.Settings2",          NULL, NULL },
-       { 6,    EXIF_FORMAT_STRING, -1,         "MkN.Canon.ImageType",          "Image type", NULL },
-       { 7,    EXIF_FORMAT_STRING, -1,         "MkN.Canon.FirmwareVersion",    "Firmware version", NULL },
-       { 8,    EXIF_FORMAT_LONG_UNSIGNED, 1,   "MkN.Canon.ImageNumber",        "Image number", NULL },
-       { 9,    EXIF_FORMAT_STRING, -1,         "MkN.Canon.OwnerName",          "Owner name", NULL },
-       { 12,   EXIF_FORMAT_LONG_UNSIGNED, -1,  "MkN.Canon.SerialNumber",       "Camera serial number", NULL },
-       { 15,   EXIF_FORMAT_SHORT_UNSIGNED, -1, "MkN.Canon.CustomFunctions",    NULL, NULL },
+       { 1,    EXIF_FORMAT_SHORT_UNSIGNED, -1, "MkN.Canon.Settings1",          nullptr, nullptr },
+       { 4,    EXIF_FORMAT_SHORT_UNSIGNED, -1, "MkN.Canon.Settings2",          nullptr, nullptr },
+       { 6,    EXIF_FORMAT_STRING, -1,         "MkN.Canon.ImageType",          "Image type", nullptr },
+       { 7,    EXIF_FORMAT_STRING, -1,         "MkN.Canon.FirmwareVersion",    "Firmware version", nullptr },
+       { 8,    EXIF_FORMAT_LONG_UNSIGNED, 1,   "MkN.Canon.ImageNumber",        "Image number", nullptr },
+       { 9,    EXIF_FORMAT_STRING, -1,         "MkN.Canon.OwnerName",          "Owner name", nullptr },
+       { 12,   EXIF_FORMAT_LONG_UNSIGNED, -1,  "MkN.Canon.SerialNumber",       "Camera serial number", nullptr },
+       { 15,   EXIF_FORMAT_SHORT_UNSIGNED, -1, "MkN.Canon.CustomFunctions",    nullptr, nullptr },
        EXIF_MARKER_LIST_END
 };
 
@@ -516,13 +516,13 @@ gboolean format_canon_makernote(ExifData *exif, guchar *tiff, guint offset,
        item = exif_get_item(exif, "MkN.Canon.Settings1");
        if (item)
                {
-               canon_mknote_parse_settings(exif, (guint16*)item->data, item->data_len, bo, CanonSet1);
+               canon_mknote_parse_settings(exif, static_cast<guint16*>(item->data), item->data_len, bo, CanonSet1);
                }
 
        item = exif_get_item(exif, "MkN.Canon.Settings2");
        if (item)
                {
-               canon_mknote_parse_settings(exif, (guint16*)item->data, item->data_len, bo, CanonSet2);
+               canon_mknote_parse_settings(exif, static_cast<guint16*>(item->data), item->data_len, bo, CanonSet2);
                }
 
        return TRUE;
index f654db0..1358ac4 100644 (file)
@@ -24,8 +24,8 @@
 
 #ifndef HAVE_EXIV2
 
-#include <stdio.h>
-#include <string.h>
+#include <cstdio>
+#include <cstring>
 #include <unistd.h>
 
 #include <glib.h>
@@ -153,13 +153,13 @@ static ExifTextList FujiTagNoYes[]= {
 
 
 static ExifMarker FujiExifMarkersList[] = {
-{ 0x1000,      EXIF_FORMAT_STRING, 8,          "Fuji.Quality",         "Quality",      NULL },
+{ 0x1000,      EXIF_FORMAT_STRING, 8,          "Fuji.Quality",         "Quality",      nullptr },
 { 0x1001,      EXIF_FORMAT_SHORT_UNSIGNED, 1,  "Fuji.Sharpness",       "Sharpness",    FujiTagSharpness },
 { 0x1002,      EXIF_FORMAT_SHORT_UNSIGNED, 1,  "Fuji.WhiteBalance",    "White balance",FujiTagWhiteBalance },
 { 0x1003,      EXIF_FORMAT_SHORT_UNSIGNED, 1,  "Fuji.Color",           "Color",        FujiTagColorTone },
 { 0x1004,      EXIF_FORMAT_SHORT_UNSIGNED, 1,  "Fuji.Tone",            "Tone",         FujiTagColorTone },
 { 0x1010,      EXIF_FORMAT_SHORT_UNSIGNED, 1,  "Fuji.FlashMode",       "Flash mode",   FujiTagFlashMode },
-{ 0x1011,      EXIF_FORMAT_RATIONAL, 1,        "Fuji.FlashStrength",   "Flash strength", NULL },
+{ 0x1011,      EXIF_FORMAT_RATIONAL, 1,        "Fuji.FlashStrength",   "Flash strength", nullptr },
 { 0x1020,      EXIF_FORMAT_SHORT_UNSIGNED, 1,  "Fuji.Macro",           "Macro",        FujiTagOffOn },
 { 0x1021,      EXIF_FORMAT_SHORT_UNSIGNED, 1,  "Fuji.FocusMode",       "Focus mode",   FujiTagFocusMode },
 { 0x1030,      EXIF_FORMAT_SHORT_UNSIGNED, 1,  "Fuji.SlowSync",        "Slow synchro", FujiTagOffOn },
index 851a772..1d725b3 100644 (file)
@@ -23,8 +23,8 @@
 
 #ifndef HAVE_EXIV2
 
-#include <stdio.h>
-#include <string.h>
+#include <cstdio>
+#include <cstring>
 #include <unistd.h>
 
 #include <glib.h>
@@ -227,7 +227,7 @@ static ExifTextList NikonTagConverter[]= {
 };
 
 static ExifMarker NikonExifMarkersList1[] = {
-{ 0x0002, EXIF_FORMAT_STRING, 6,               "Nikon.unknown",        NULL,           NULL },
+{ 0x0002, EXIF_FORMAT_STRING, 6,               "Nikon.unknown",        nullptr,                nullptr },
 { 0x0003, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Nikon.Quality",        "Quality",      NikonTagQuality },
 { 0x0004, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Nikon.ColorMode",      "Color mode",   NikonTagColorMode },
 { 0x0005, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Nikon.ImageAdjustment",
@@ -235,8 +235,8 @@ static ExifMarker NikonExifMarkersList1[] = {
 { 0x0006, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Nikon.ISOSensitivity",
                                                                "ISO sensitivity",      NikonTagISOSensitivity },
 { 0x0007, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Nikon.WhiteBalance",   "White balance",NikonTagWhiteBalance },
-{ 0x0008, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Nikon.Focus",          "Focus",        NULL },
-{ 0x000a, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Nikon.DigitalZoom",    "Digital zoom", NULL },
+{ 0x0008, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Nikon.Focus",          "Focus",        nullptr },
+{ 0x000a, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,    "Nikon.DigitalZoom",    "Digital zoom", nullptr },
 { 0x000b, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Nikon.Converter",      "Converter",    NikonTagConverter },
 EXIF_MARKER_LIST_END
 };
@@ -281,53 +281,53 @@ static ExifTextList NikonTag2FlashUsed[]= {
 
 
 static ExifMarker NikonExifMarkersList2[] = {
-{ 0x0002, EXIF_FORMAT_SHORT_UNSIGNED, 2,       "Nikon.ISOSpeed",       "ISO speed",    NULL },
-{ 0x0003, EXIF_FORMAT_STRING, -1,              "Nikon.ColorMode",      "Color mode",   NULL },
-{ 0x0004, EXIF_FORMAT_STRING, -1,              "Nikon.Quality",        "Quality",      NULL },
-{ 0x0005, EXIF_FORMAT_STRING, -1,              "Nikon.WhiteBalance",   "White balance",NULL },
-{ 0x0006, EXIF_FORMAT_STRING, -1,              "Nikon.Sharpening",     "Sharpening",   NULL },
-{ 0x0007, EXIF_FORMAT_STRING, -1,              "Nikon.FocusMode",      "Focus mode",   NULL },
-{ 0x0008, EXIF_FORMAT_STRING, -1,              "Nikon.FlashSetting",   "Flash setting",NULL },
-{ 0x0009, EXIF_FORMAT_STRING, -1,              "Nikon.AutoFlashMode","Auto flash mode",NULL },
+{ 0x0002, EXIF_FORMAT_SHORT_UNSIGNED, 2,       "Nikon.ISOSpeed",       "ISO speed",    nullptr },
+{ 0x0003, EXIF_FORMAT_STRING, -1,              "Nikon.ColorMode",      "Color mode",   nullptr },
+{ 0x0004, EXIF_FORMAT_STRING, -1,              "Nikon.Quality",        "Quality",      nullptr },
+{ 0x0005, EXIF_FORMAT_STRING, -1,              "Nikon.WhiteBalance",   "White balance",nullptr },
+{ 0x0006, EXIF_FORMAT_STRING, -1,              "Nikon.Sharpening",     "Sharpening",   nullptr },
+{ 0x0007, EXIF_FORMAT_STRING, -1,              "Nikon.FocusMode",      "Focus mode",   nullptr },
+{ 0x0008, EXIF_FORMAT_STRING, -1,              "Nikon.FlashSetting",   "Flash setting",nullptr },
+{ 0x0009, EXIF_FORMAT_STRING, -1,              "Nikon.AutoFlashMode","Auto flash mode",nullptr },
 { 0x000b, EXIF_FORMAT_SHORT, 1,                        "Nikon.WhiteBalanceBias",
-                                                       "White balance bias value",     NULL },
+                                                       "White balance bias value",     nullptr },
 /* { 0x000c, EXIF_FORMAT_SHORT_UNSIGNED, 1,    "Nikon.WhiteBalanceRB",
                                                "White balance red/blue coefficients",  NULL }, */
 /* { 0x000f, EXIF_FORMAT_STRING, -1,           "Nikon.ISOSelect",      "ISO selection",NULL }, */
 { 0x0012, EXIF_FORMAT_UNDEFINED, 4,            "Nikon.FlashCompensation",
                                                                "Flash compensation",   NikonTag2FlashComp },
 { 0x0013, EXIF_FORMAT_SHORT_UNSIGNED, 2,       "Nikon.ISOSpeedRequest",
-                                                               "ISO speed requested",  NULL },
+                                                               "ISO speed requested",  nullptr },
 { 0x0016, EXIF_FORMAT_SHORT_UNSIGNED, 4,       "Nikon.CornerCoord",
-                                                               "Corner coordinates",   NULL },
+                                                               "Corner coordinates",   nullptr },
 { 0x0018, EXIF_FORMAT_UNDEFINED, 4,            "Nikon.FlashBracketCompensation",
                                                        "Flash bracket compensation",   NikonTag2FlashComp },
 { 0x0019, EXIF_FORMAT_RATIONAL, 1,             "Nikon.AEBracketCompensation",
-                                                       "AE bracket compensation",      NULL },
+                                                       "AE bracket compensation",      nullptr },
 { 0x0080, EXIF_FORMAT_STRING, -1,              "Nikon.ImageAdjustment",
-                                                               "Image adjustment",     NULL },
-{ 0x0081, EXIF_FORMAT_STRING, -1,              "Nikon.Contrast",       "Contrast",     NULL },
-{ 0x0082, EXIF_FORMAT_STRING, -1,              "Nikon.AuxLens", "Aux lens adapter",    NULL },
+                                                               "Image adjustment",     nullptr },
+{ 0x0081, EXIF_FORMAT_STRING, -1,              "Nikon.Contrast",       "Contrast",     nullptr },
+{ 0x0082, EXIF_FORMAT_STRING, -1,              "Nikon.AuxLens", "Aux lens adapter",    nullptr },
 { 0x0083, EXIF_FORMAT_BYTE_UNSIGNED, -1,       "Nikon.LensType",       "Lens type",    NikonTag2LensType },
 { 0x0084, EXIF_FORMAT_RATIONAL_UNSIGNED, -1,   "Nikon.LensFocalLength",
-                                                       "Lens min/max focal length and aperture", NULL },
+                                                       "Lens min/max focal length and aperture", nullptr },
 { 0x0085, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Nikon.ManualFocusDistance",
-                                                       "Manual focus distance",        NULL },
+                                                       "Manual focus distance",        nullptr },
 { 0x0086, EXIF_FORMAT_RATIONAL, 1,             "Nikon.DigitalZoomFactor",
-                                                       "Digital zoom factor",          NULL },
+                                                       "Digital zoom factor",          nullptr },
 { 0x0087, EXIF_FORMAT_BYTE_UNSIGNED, 1,                "Nikon.FlashUsed",      "Flash used",   NikonTag2FlashUsed },
-{ 0x0088, EXIF_FORMAT_UNDEFINED, 4,            "Nikon.AutoFocusArea","Auto focus area",NULL },
+{ 0x0088, EXIF_FORMAT_UNDEFINED, 4,            "Nikon.AutoFocusArea","Auto focus area",nullptr },
 /* { 0x0089, EXIF_FORMAT_SHORT_UNSIGNED, -1,   "Nikon.Bracket/ShootingMode", NULL,     NULL }, */
-{ 0x008d, EXIF_FORMAT_STRING, -1,              "Nikon.ColorMode",      "Color mode",   NULL },
-{ 0x008f, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Nikon.SceneMode",      "Scene mode",   NULL },
-{ 0x0090, EXIF_FORMAT_STRING, -1,              "Nikon.LightingType",   "Lighting type",NULL },
-{ 0x0092, EXIF_FORMAT_SHORT, 1,                        "Nikon.HueAdjust",      "Hue adjustment",NULL },
+{ 0x008d, EXIF_FORMAT_STRING, -1,              "Nikon.ColorMode",      "Color mode",   nullptr },
+{ 0x008f, EXIF_FORMAT_SHORT_UNSIGNED, 1,       "Nikon.SceneMode",      "Scene mode",   nullptr },
+{ 0x0090, EXIF_FORMAT_STRING, -1,              "Nikon.LightingType",   "Lighting type",nullptr },
+{ 0x0092, EXIF_FORMAT_SHORT, 1,                        "Nikon.HueAdjust",      "Hue adjustment",nullptr },
 /* { 0x0094, EXIF_FORMAT_SHORT_UNSIGNED, 1,    "Nikon.Saturation",     "Saturation",   NikonTag2Saturation }, */
-{ 0x0095, EXIF_FORMAT_STRING, -1,              "Nikon.NoiseReduction", "Noise reduction", NULL },
-{ 0x00a7, EXIF_FORMAT_LONG_UNSIGNED, 1,                "Nikon.ShutterCount", "Shutter release count", NULL },
-{ 0x00a9, EXIF_FORMAT_STRING, -1,              "Nikon.ImageOptimization", "Image optimization", NULL },
-{ 0x00aa, EXIF_FORMAT_STRING, -1,              "Nikon.Saturation", "Saturation",       NULL },
-{ 0x00ab, EXIF_FORMAT_STRING, -1,              "Nikon.DigitalVariProg", "Digital Vari-program", NULL },
+{ 0x0095, EXIF_FORMAT_STRING, -1,              "Nikon.NoiseReduction", "Noise reduction", nullptr },
+{ 0x00a7, EXIF_FORMAT_LONG_UNSIGNED, 1,                "Nikon.ShutterCount", "Shutter release count", nullptr },
+{ 0x00a9, EXIF_FORMAT_STRING, -1,              "Nikon.ImageOptimization", "Image optimization", nullptr },
+{ 0x00aa, EXIF_FORMAT_STRING, -1,              "Nikon.Saturation", "Saturation",       nullptr },
+{ 0x00ab, EXIF_FORMAT_STRING, -1,              "Nikon.DigitalVariProg", "Digital Vari-program", nullptr },
 EXIF_MARKER_LIST_END
 };
 
@@ -386,12 +386,12 @@ gboolean format_nikon_makernote(ExifData *exif, guchar *tiff, guint offset,
        if (item && item->data_len == 4 * sizeof(guchar))
                {
                static ExifMarker marker = { 0x0088, EXIF_FORMAT_STRING, -1,
-                                            "Nikon.AutoFocusPoint", "Auto focus point", NULL };
-               guchar *array = (guchar*)item->data;
+                                            "Nikon.AutoFocusPoint", "Auto focus point", nullptr };
+               auto array = static_cast<guchar*>(item->data);
                gchar *text;
                gint l;
 
-               text = exif_text_list_find_value(NikonAFPoint, (gint)array[1]);
+               text = exif_text_list_find_value(NikonAFPoint, static_cast<gint>(array[1]));
                l = strlen(text) + 1;
 
                item = exif_item_new(marker.format, marker.tag, l, &marker);
@@ -406,11 +406,11 @@ gboolean format_nikon_makernote(ExifData *exif, guchar *tiff, guint offset,
        if (item && item->data_len == 2 * 2)
                {
                static ExifMarker marker = { 0x0002, EXIF_FORMAT_SHORT_UNSIGNED, 1,
-                                            "ISOSpeedRatings", "ISO speed", NULL };
+                                            "ISOSpeedRatings", "ISO speed", nullptr };
                ExifItem *shadow;
 
                shadow = exif_item_new(marker.format, marker.tag, 1, &marker);
-               memcpy(shadow->data, (char *)item->data + 2, 2);
+               memcpy(shadow->data, static_cast<char *>(item->data) + 2, 2);
 
                exif->items = g_list_prepend(exif->items, shadow);
                }
@@ -419,7 +419,7 @@ gboolean format_nikon_makernote(ExifData *exif, guchar *tiff, guint offset,
        if (item && item->format == EXIF_FORMAT_STRING)
                {
                static ExifMarker marker = { 0x0005, EXIF_FORMAT_STRING, -1,
-                                            "LightSource", "Light source", NULL };
+                                            "LightSource", "Light source", nullptr };
                ExifItem *shadow;
 
                shadow = exif_item_new(marker.format, marker.tag, item->data_len, &marker);
index da4af22..ab3573a 100644 (file)
@@ -21,8 +21,8 @@
 
 #ifndef HAVE_EXIV2
 
-#include <stdio.h>
-#include <string.h>
+#include <cstdio>
+#include <cstring>
 #include <unistd.h>
 
 #include <glib.h>
@@ -214,48 +214,48 @@ static ExifTextList OlympusTagContrast[]= {
 
 
 static ExifMarker OlympusExifMarkersList[] = {
-{ 0x0001, EXIF_FORMAT_LONG_UNSIGNED, -1, "Konica/MinoltaSettings", "Konica / Minolta settings", NULL },
-{ 0x0003, EXIF_FORMAT_LONG_UNSIGNED, -1, "Konica/MinoltaSettings", "Konica / Minolta settings", NULL },
-{ 0x0040, EXIF_FORMAT_LONG_UNSIGNED, -1, "CompressedImageSize",        "Compressed image size", NULL },
-{ 0x0081, EXIF_FORMAT_LONG_UNSIGNED, 1,  "ThumbnailOffset",    "Thumbnail offset",     NULL },
-{ 0x0088, EXIF_FORMAT_LONG_UNSIGNED, 1,  "ThumbnailOffset",    "Thumbnail offset",     NULL },
-{ 0x0089, EXIF_FORMAT_LONG_UNSIGNED, 1,  "ThumbnailLength",    "Thumbnail length",     NULL },
+{ 0x0001, EXIF_FORMAT_LONG_UNSIGNED, -1, "Konica/MinoltaSettings", "Konica / Minolta settings", nullptr },
+{ 0x0003, EXIF_FORMAT_LONG_UNSIGNED, -1, "Konica/MinoltaSettings", "Konica / Minolta settings", nullptr },
+{ 0x0040, EXIF_FORMAT_LONG_UNSIGNED, -1, "CompressedImageSize",        "Compressed image size", nullptr },
+{ 0x0081, EXIF_FORMAT_LONG_UNSIGNED, 1,  "ThumbnailOffset",    "Thumbnail offset",     nullptr },
+{ 0x0088, EXIF_FORMAT_LONG_UNSIGNED, 1,  "ThumbnailOffset",    "Thumbnail offset",     nullptr },
+{ 0x0089, EXIF_FORMAT_LONG_UNSIGNED, 1,  "ThumbnailLength",    "Thumbnail length",     nullptr },
 { 0x0101, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Konica/Minolta.ColorMode", "Color mode",     KonMinTagColorMode },
 { 0x0102, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Konica/Minolta.Quality", "Quality",          KonMinTagQuality },
 { 0x0103, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Konica/Minolta.Quality", "Quality",          KonMinTagQuality },
-{ 0x0200, EXIF_FORMAT_LONG_UNSIGNED, 3,  "Olympus.SpecialMode",        "Special mode",         NULL },
+{ 0x0200, EXIF_FORMAT_LONG_UNSIGNED, 3,  "Olympus.SpecialMode",        "Special mode",         nullptr },
 { 0x0201, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Olympus.JpegQuality",        "Jpeg quality",         OlympusTagJpegQuality },
 { 0x0202, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Olympus.Macro",      "Macro",                OlympusTagMacro },
-{ 0x0204, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Olympus.DigitalZoom", "Digital zoom",     NULL },
-{ 0x0207, EXIF_FORMAT_STRING, -1,       "Olympus.Firmware",    "Firmware version",     NULL },
-{ 0x0208, EXIF_FORMAT_STRING, -1,       "Olympus.PictureInfo", "Picture info",         NULL },
-{ 0x0209, EXIF_FORMAT_UNDEFINED, -1,    "Olympus.CameraID",    "Camera ID",            NULL },
-{ 0x020b, EXIF_FORMAT_LONG_UNSIGNED, 1,         "Epson.ImageWidth",    "Image width",          NULL },
-{ 0x020c, EXIF_FORMAT_LONG_UNSIGNED, 1,  "Epson.ImageHeight",  "Image height",         NULL },
-{ 0x020d, EXIF_FORMAT_STRING, -1,       "Epson.Manufacturer",  "Manufacturer",         NULL },
-{ 0x0e00, EXIF_FORMAT_BYTE, -1,                 "Olympus.PrintImageMatching", "Print image matching", NULL },
+{ 0x0204, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Olympus.DigitalZoom", "Digital zoom",     nullptr },
+{ 0x0207, EXIF_FORMAT_STRING, -1,       "Olympus.Firmware",    "Firmware version",     nullptr },
+{ 0x0208, EXIF_FORMAT_STRING, -1,       "Olympus.PictureInfo", "Picture info",         nullptr },
+{ 0x0209, EXIF_FORMAT_UNDEFINED, -1,    "Olympus.CameraID",    "Camera ID",            nullptr },
+{ 0x020b, EXIF_FORMAT_LONG_UNSIGNED, 1,         "Epson.ImageWidth",    "Image width",          nullptr },
+{ 0x020c, EXIF_FORMAT_LONG_UNSIGNED, 1,  "Epson.ImageHeight",  "Image height",         nullptr },
+{ 0x020d, EXIF_FORMAT_STRING, -1,       "Epson.Manufacturer",  "Manufacturer",         nullptr },
+{ 0x0e00, EXIF_FORMAT_BYTE, -1,                 "Olympus.PrintImageMatching", "Print image matching", nullptr },
 { 0x1004, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Olympus.FlashMode",  "Flash mode",           OlympusTagFlashMode },
-{ 0x1006, EXIF_FORMAT_RATIONAL, 1,      "Olympus.Bracket",     "Bracket",              NULL },
+{ 0x1006, EXIF_FORMAT_RATIONAL, 1,      "Olympus.Bracket",     "Bracket",              nullptr },
 { 0x100b, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Olympus.FocusMode",  "Focus mode",           OlympusTagFocusMode },
-{ 0x100c, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Olympus.FocusDistance", "Focus distance", NULL },
-{ 0x100d, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Olympus.Zoom",       "Zoom",                 NULL },
-{ 0x1006, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Olympus.MacroFocus", "Macro focus",          NULL },
+{ 0x100c, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Olympus.FocusDistance", "Focus distance", nullptr },
+{ 0x100d, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Olympus.Zoom",       "Zoom",                 nullptr },
+{ 0x1006, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Olympus.MacroFocus", "Macro focus",          nullptr },
 { 0x100f, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Olympus.Sharpness",  "Sharpness",            OlympusTagSharpness },
-{ 0x1011, EXIF_FORMAT_SHORT_UNSIGNED, 9, "Olympus.ColorMatrix",        "Color matrix",         NULL },
-{ 0x1012, EXIF_FORMAT_SHORT_UNSIGNED, 4, "Olympus.BlackLevel", "Black level",          NULL },
-{ 0x1015, EXIF_FORMAT_SHORT_UNSIGNED, 2, "Olympus.WhiteBalance", "White balance",      NULL },
-{ 0x1017, EXIF_FORMAT_SHORT_UNSIGNED, 2, "Olympus.RedBias",    "Red bias",             NULL },
-{ 0x1018, EXIF_FORMAT_SHORT_UNSIGNED, 2, "Olympus.BlueBias",   "Blue bias",            NULL },
-{ 0x101a, EXIF_FORMAT_STRING, -1,       "Olympus.SerialNumber", "Serial number",       NULL },
-{ 0x1023, EXIF_FORMAT_RATIONAL, 1,      "Olympus.FlashBias",   "Flash bias",           NULL },
+{ 0x1011, EXIF_FORMAT_SHORT_UNSIGNED, 9, "Olympus.ColorMatrix",        "Color matrix",         nullptr },
+{ 0x1012, EXIF_FORMAT_SHORT_UNSIGNED, 4, "Olympus.BlackLevel", "Black level",          nullptr },
+{ 0x1015, EXIF_FORMAT_SHORT_UNSIGNED, 2, "Olympus.WhiteBalance", "White balance",      nullptr },
+{ 0x1017, EXIF_FORMAT_SHORT_UNSIGNED, 2, "Olympus.RedBias",    "Red bias",             nullptr },
+{ 0x1018, EXIF_FORMAT_SHORT_UNSIGNED, 2, "Olympus.BlueBias",   "Blue bias",            nullptr },
+{ 0x101a, EXIF_FORMAT_STRING, -1,       "Olympus.SerialNumber", "Serial number",       nullptr },
+{ 0x1023, EXIF_FORMAT_RATIONAL, 1,      "Olympus.FlashBias",   "Flash bias",           nullptr },
 { 0x1029, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Olympus.Contrast",   "Contrast",             OlympusTagContrast },
-{ 0x102a, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Olympus.SharpnessFactor", "Sharpness factor",        NULL },
-{ 0x102b, EXIF_FORMAT_SHORT_UNSIGNED, 6, "Olympus.ColorControl", "Color control",      NULL },
-{ 0x102c, EXIF_FORMAT_SHORT_UNSIGNED, 2, "Olympus.ValidBits",  "Valid bits",           NULL },
-{ 0x102d, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Olympus.CoringFilter", "Coring filter",      NULL },
-{ 0x102e, EXIF_FORMAT_LONG_UNSIGNED, 1,  "Olympus.FinalWidth", "Final width",          NULL },
-{ 0x102f, EXIF_FORMAT_LONG_UNSIGNED, 1,  "Olympus.FinalHeight",        "Final height",         NULL },
-{ 0x1034, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Olympus.CompressionRatio", "Compression ratio", NULL },
+{ 0x102a, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Olympus.SharpnessFactor", "Sharpness factor",        nullptr },
+{ 0x102b, EXIF_FORMAT_SHORT_UNSIGNED, 6, "Olympus.ColorControl", "Color control",      nullptr },
+{ 0x102c, EXIF_FORMAT_SHORT_UNSIGNED, 2, "Olympus.ValidBits",  "Valid bits",           nullptr },
+{ 0x102d, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Olympus.CoringFilter", "Coring filter",      nullptr },
+{ 0x102e, EXIF_FORMAT_LONG_UNSIGNED, 1,  "Olympus.FinalWidth", "Final width",          nullptr },
+{ 0x102f, EXIF_FORMAT_LONG_UNSIGNED, 1,  "Olympus.FinalHeight",        "Final height",         nullptr },
+{ 0x1034, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Olympus.CompressionRatio", "Compression ratio", nullptr },
 EXIF_MARKER_LIST_END
 };
 
@@ -320,10 +320,10 @@ gboolean format_olympus_makernote(ExifData *exif, guchar *tiff, guint offset,
        if (item && item->data_len == 3 * sizeof(guint32))
                {
                static ExifMarker marker = { 0x0200, EXIF_FORMAT_STRING, -1,
-                                            "Olympus.ShootingMode", "Shooting mode", NULL };
-               guint32 *array = (guint32 *)item->data;
+                                            "Olympus.ShootingMode", "Shooting mode", nullptr };
+               auto array = static_cast<guint32 *>(item->data);
                gchar *mode;
-               gchar *pdir = NULL;
+               gchar *pdir = nullptr;
                gchar *text;
                gint l;
 
@@ -351,10 +351,10 @@ gboolean format_olympus_makernote(ExifData *exif, guchar *tiff, guint offset,
        if (item && item->data_len == 2 * sizeof(guint16))
                {
                static ExifMarker marker = { 0x1015, EXIF_FORMAT_STRING, -1,
-                                            "Olympus.WhiteBalance", "White balance", NULL };
-               guint16 *array = (guint16 *)item->data;
+                                            "Olympus.WhiteBalance", "White balance", nullptr };
+               auto array = static_cast<guint16 *>(item->data);
                gchar *mode;
-               gchar *color = NULL;
+               gchar *color = nullptr;
                gchar *text;
                gint l;
 
index 1fb8c9a..0a8f2f4 100644 (file)
 
 #ifndef HAVE_EXIV2
 
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+#include <cstdio>
+#include <cstring>
 #include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include <glib.h>
 
@@ -65,7 +65,7 @@ static FormatRawEntry format_raw_list[] = {
        FORMAT_RAW_OLYMPUS,
        FORMAT_RAW_PENTAX,
        FORMAT_RAW_SAMSUNG,
-       { NULL, (FormatRawMatchType)0, 0, NULL, 0, (FormatRawExifType)0, NULL, NULL, NULL }
+       { nullptr, static_cast<FormatRawMatchType>(0), 0, nullptr, 0, static_cast<FormatRawExifType>(0), nullptr, nullptr, nullptr }
 };
 
 
@@ -82,7 +82,7 @@ static FormatExifEntry format_exif_list[] = {
        FORMAT_EXIF_FUJI,
        FORMAT_EXIF_NIKON,
        FORMAT_EXIF_OLYMPUS,
-       { (FormatExifMatchType)0, NULL, 0, NULL, NULL }
+       { static_cast<FormatExifMatchType>(0), nullptr, 0, nullptr, nullptr }
 };
 
 
@@ -231,7 +231,7 @@ static FormatRawEntry *format_raw_find(guchar *data, const guint len)
                n++;
                }
 
-       return NULL;
+       return nullptr;
 }
 
 static gboolean format_raw_parse(FormatRawEntry *entry,
@@ -281,13 +281,13 @@ FormatRawExifType format_raw_exif_offset(guchar *data, const guint len, guint *e
 {
        FormatRawEntry *entry;
 
-       if (!data || len < 1) return (FormatRawExifType)FALSE;
+       if (!data || len < 1) return static_cast<FormatRawExifType>FALSE;
 
        entry = format_raw_find(data, len);
 
-       if (!entry || !entry->func_parse) return (FormatRawExifType)FALSE;
+       if (!entry || !entry->func_parse) return static_cast<FormatRawExifType>FALSE;
 
-       if (!format_raw_parse(entry, data, len, NULL, exif_offset)) return FORMAT_RAW_EXIF_NONE;
+       if (!format_raw_parse(entry, data, len, nullptr, exif_offset)) return FORMAT_RAW_EXIF_NONE;
 
        if (entry->exif_type == FORMAT_RAW_EXIF_PROPRIETARY && exif_parse_func)
                {
@@ -303,7 +303,7 @@ gboolean format_raw_img_exif_offsets_fd(gint fd, const gchar *path,
                                        guint *image_offset, guint *exif_offset)
 {
        FormatRawEntry *entry;
-       gpointer map_data = NULL;
+       gpointer map_data = nullptr;
        size_t map_len = 0;
        struct stat st;
        gboolean success;
@@ -351,14 +351,14 @@ gboolean format_raw_img_exif_offsets_fd(gint fd, const gchar *path,
                return FALSE;
                }
        map_len = st.st_size;
-       map_data = mmap(0, map_len, PROT_READ, MAP_PRIVATE, fd, 0);
+       map_data = mmap(nullptr, map_len, PROT_READ, MAP_PRIVATE, fd, 0);
        if (map_data == MAP_FAILED)
                {
                log_printf("Failed to mmap file %d\n", fd);
                return FALSE;
                }
 
-       success = format_raw_parse(entry, (guchar*)map_data, map_len, image_offset, exif_offset);
+       success = format_raw_parse(entry, static_cast<guchar*>(map_data), map_len, image_offset, exif_offset);
 
        if (munmap(map_data, map_len) == -1)
                {
@@ -367,7 +367,7 @@ gboolean format_raw_img_exif_offsets_fd(gint fd, const gchar *path,
 
        if (success && image_offset)
                {
-               if (lseek(fd, *image_offset, SEEK_SET) != (off_t) *image_offset)
+               if (lseek(fd, *image_offset, SEEK_SET) != static_cast<off_t>(*image_offset))
                        {
                        log_printf("Failed to seek to embedded image\n");
 
index 1635acc..fc01e9a 100644 (file)
@@ -39,11 +39,8 @@ enum FormatRawExifType {
        FORMAT_RAW_EXIF_PROPRIETARY
 };
 
-typedef gboolean (* FormatRawParseFunc)(guchar *data, const guint len,
-                                       guint *image_offset, guint *exif_offset);
-
-typedef gboolean (* FormatRawExifParseFunc)(guchar *data, const guint len,
-                                           ExifData *exif);
+using FormatRawParseFunc = gboolean (*)(guchar *, const guint, guint *, guint *);
+using FormatRawExifParseFunc = gboolean (*)(guchar *, const guint, ExifData *);
 
 gboolean format_raw_img_exif_offsets(guchar *data, const guint len,
                                     guint *image_offset, guint *exif_offset);
@@ -60,8 +57,7 @@ enum FormatExifMatchType {
        FORMAT_EXIF_MATCH_MAKERNOTE
 };
 
-typedef gint (* FormatExifParseFunc)(ExifData *exif, guchar *tiff, guint offset,
-                                    guint size, ExifByteOrder bo);
+using FormatExifParseFunc = gint (*)(ExifData *, guchar *, guint, guint, ExifByteOrder);
 
 gboolean format_exif_makernote_parse(ExifData *exif, guchar *tiff, guint offset,
                                     guint size, ExifByteOrder bo);
index dcc3a04..485339a 100644 (file)
@@ -24,7 +24,7 @@
 #include "pixbuf-util.h"
 #include "filedata.h"
 
-#include <math.h>
+#include <cmath>
 
 /*
  *----------------------------------------------------------------------------
index 14be327..ebc4786 100644 (file)
@@ -29,9 +29,9 @@
 
 #ifdef HAVE_JPEG
 
-#include <setjmp.h>
-#include <jpeglib.h>
+#include <csetjmp>
 #include <jerror.h>
+#include <jpeglib.h>
 
 struct ImageLoaderJpeg {
        ImageLoaderBackendCbAreaUpdated area_updated_cb;
@@ -215,7 +215,7 @@ static boolean fill_input_buffer (j_decompress_ptr cinfo)
 }
 static void skip_input_data (j_decompress_ptr cinfo, long num_bytes)
 {
-       auto  src = static_cast<struct jpeg_source_mgr*>(cinfo->src);
+       auto src = static_cast<struct jpeg_source_mgr*>(cinfo->src);
 
        if (static_cast<gulong>(num_bytes) > src->bytes_in_buffer)
                {
index b446cbd..f6278fd 100644 (file)
@@ -32,9 +32,9 @@
 
 #ifdef HAVE_JPEG
 
-#include <setjmp.h>
-#include <jpeglib.h>
+#include <csetjmp>
 #include <jerror.h>
+#include <jpeglib.h>
 
 struct ImageLoaderJpeg {
        ImageLoaderBackendCbAreaUpdated area_updated_cb;
@@ -218,7 +218,7 @@ static boolean fill_input_buffer (j_decompress_ptr cinfo)
 }
 static void skip_input_data (j_decompress_ptr cinfo, long num_bytes)
 {
-       auto  src = static_cast<struct jpeg_source_mgr*>(cinfo->src);
+       auto src = static_cast<struct jpeg_source_mgr*>(cinfo->src);
 
        if (static_cast<gulong>(num_bytes) > src->bytes_in_buffer)
                {
index 53a3882..2cc9605 100644 (file)
@@ -77,18 +77,18 @@ static void free_buffer(guchar *pixels, gpointer UNUSED(data))
 
 static uint8_t *JxlMemoryToPixels(const uint8_t *next_in, size_t size, size_t *stride,
                            size_t *xsize, size_t *ysize, int *has_alpha) {
-  JxlDecoder *dec = JxlDecoderCreate(NULL);
+  JxlDecoder *dec = JxlDecoderCreate(nullptr);
   *has_alpha = 1;
-  uint8_t *pixels = NULL;
+  uint8_t *pixels = nullptr;
   if (!dec) {
     log_printf("JxlDecoderCreate failed\n");
-    return 0;
+    return nullptr;
   }
   if (JXL_DEC_SUCCESS !=
       JxlDecoderSubscribeEvents(dec, JXL_DEC_BASIC_INFO | JXL_DEC_FULL_IMAGE)) {
     log_printf("JxlDecoderSubscribeEvents failed\n");
     JxlDecoderDestroy(dec);
-    return 0;
+    return nullptr;
   }
 
   JxlBasicInfo info;
@@ -127,7 +127,7 @@ static uint8_t *JxlMemoryToPixels(const uint8_t *next_in, size_t size, size_t *s
       }
       size_t pixels_buffer_size = buffer_size * sizeof(uint8_t);
       pixels = static_cast<uint8_t *>(malloc(pixels_buffer_size));
-      void *pixels_buffer = (void *)pixels;
+      auto pixels_buffer = (void *)pixels;
       if (JXL_DEC_SUCCESS != JxlDecoderSetImageOutBuffer(dec, &format,
                                                          pixels_buffer,
                                                          pixels_buffer_size)) {
@@ -152,25 +152,25 @@ static uint8_t *JxlMemoryToPixels(const uint8_t *next_in, size_t size, size_t *s
     return pixels;
   } else {
     free(pixels);
-    return NULL;
+    return nullptr;
   }
 }
 
 static gboolean image_loader_jpegxl_load(gpointer loader, const guchar *buf, gsize count, GError **UNUSED(error))
 {
-       ImageLoaderJPEGXL *ld = (ImageLoaderJPEGXL *) loader;
+       auto ld = static_cast<ImageLoaderJPEGXL *>(loader);
        gboolean ret = FALSE;
        size_t stride;
        size_t xsize;
        size_t ysize;
        int has_alpha;
-       uint8_t *decoded = NULL;
+       uint8_t *decoded = nullptr;
 
        decoded = JxlMemoryToPixels(buf, count, &stride, &xsize, &ysize, &has_alpha);
 
        if (decoded)
                {
-               ld->pixbuf = gdk_pixbuf_new_from_data(decoded, GDK_COLORSPACE_RGB, has_alpha, 8, xsize, ysize, stride, free_buffer, NULL);
+               ld->pixbuf = gdk_pixbuf_new_from_data(decoded, GDK_COLORSPACE_RGB, has_alpha, 8, xsize, ysize, stride, free_buffer, nullptr);
 
                ld->area_updated_cb(loader, 0, 0, xsize, ysize, ld->data);
 
@@ -210,7 +210,7 @@ static gchar* image_loader_jpegxl_get_format_name(gpointer UNUSED(loader))
 
 static gchar** image_loader_jpegxl_get_format_mime_types(gpointer UNUSED(loader))
 {
-       static const gchar *mime[] = {"image/jxl", NULL};
+       static const gchar *mime[] = {"image/jxl", nullptr};
        return g_strdupv(const_cast<gchar **>(mime));
 }
 
@@ -237,7 +237,7 @@ void image_loader_backend_set_jpegxl(ImageLoaderBackend *funcs)
        funcs->loader_new = image_loader_jpegxl_new;
        funcs->set_size = image_loader_jpegxl_set_size;
        funcs->load = image_loader_jpegxl_load;
-       funcs->write = NULL;
+       funcs->write = nullptr;
        funcs->get_pixbuf = image_loader_jpegxl_get_pixbuf;
        funcs->close = image_loader_jpegxl_close;
        funcs->abort = image_loader_jpegxl_abort;
index 64ff97d..08cff11 100644 (file)
@@ -286,7 +286,7 @@ static void free_context(PsdContext *ctx)
 static gboolean image_loader_psd_load(gpointer loader, const guchar *buf, gsize count, GError **UNUSED(error))
 {
        auto ld = static_cast<ImageLoaderPSD *>(loader);
-       auto  ctx = g_new0(PsdContext, 1);
+       auto ctx = g_new0(PsdContext, 1);
        guint i;
        guint32 j;
        guint size = count;
index e559b3d..c1b1235 100644 (file)
@@ -88,7 +88,7 @@ GType image_loader_get_type()
                        static_cast<GInstanceInitFunc>(image_loader_init), /* instance_init */
                        nullptr /* value_table */
                        };
-               type = g_type_register_static(G_TYPE_OBJECT, "ImageLoaderType", &info, GTypeFlags(0));
+               type = g_type_register_static(G_TYPE_OBJECT, "ImageLoaderType", &info, static_cast<GTypeFlags>(0));
                }
        return type;
 }
index 24404fc..245ba10 100644 (file)
@@ -35,7 +35,7 @@
 #include "ui-fileops.h"
 #include "filecache.h"
 
-#include <math.h>
+#include <cmath>
 
 static GList *image_list = nullptr;
 
index 2a33373..9196296 100644 (file)
@@ -19,7 +19,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <stddef.h>
+#include <cstddef>
 
 const char *keymap_template [] = {
 "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>",
index b1b5ea1..3e2175e 100644 (file)
@@ -64,7 +64,7 @@ static const gchar *layout_titles[] = { N_("Tools"), N_("Files"), N_("Image") };
 
 static void layout_config_destroy(GtkWidget *UNUSED(widget), gpointer data)
 {
-       auto  lc = static_cast<LayoutConfig *>(data);
+       auto lc = static_cast<LayoutConfig *>(data);
 
        g_list_free(lc->style_widgets);
        g_free(lc);
index 45d2d7b..4c29e17 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <signal.h>
+#include <csignal>
 #include <sys/mman.h>
 
 #ifdef G_OS_UNIX
 #include <pwd.h>
 #endif
-#include <locale.h>
+#include <clocale>
 
 #include "main.h"
 
index a4d79db..75154e0 100644 (file)
@@ -35,9 +35,9 @@
  * will fill a supplied 16-byte array with the digest.
  */
 
-#include <stdio.h>
-#include <string.h>
 #include "md5-util.h"
+#include <cstdio>
+#include <cstring>
 
 
 static void md5_transform(guint32 buf[4], const guint32 in[16]);
index da7e98f..126b13c 100644 (file)
@@ -19,7 +19,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <locale.h>
+#include <clocale>
 
 #include "main.h"
 #include "metadata.h"
index a2ad3eb..36823a8 100644 (file)
@@ -18,7 +18,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <locale.h>
+#include <clocale>
 
 #include "main.h"
 #include "misc.h"
index 42f5d38..cd16be8 100644 (file)
@@ -32,7 +32,7 @@
 #include "ui-fileops.h"
 #include "ui-misc.h"
 
-#include <math.h>
+#include <cmath>
 
 static const gchar *predefined_tags[][2] = {
        {"%name%",                                                      N_("Name")},
index 65f9b4f..cc038ba 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "pan-calendar.h"
 
-#include <math.h>
+#include <cmath>
 
 #include "misc.h"
 #include "pan-util.h"
index 3a8de9b..bb972f6 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "pan-folder.h"
 
-#include <math.h>
+#include <cmath>
 
 #include "pan-item.h"
 #include "pan-util.h"
index e9967b6..8f08670 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "pan-grid.h"
 
-#include <math.h>
+#include <cmath>
 
 #include "pan-item.h"
 #include "pan-util.h"
index cbb2ff3..597c1f0 100644 (file)
@@ -308,7 +308,7 @@ static gboolean pan_view_list_contains_kw_pattern(GList *haystack, PanViewFilter
                        {
                        auto keyword = static_cast<gchar *>(work->data);
                        work = work->next;
-                       if (g_regex_match(filter->kw_regex, keyword, GRegexMatchFlags(0), nullptr))
+                       if (g_regex_match(filter->kw_regex, keyword, static_cast<GRegexMatchFlags>(0), nullptr))
                                {
                                if (found_kw) *found_kw = keyword;
                                return TRUE;
index 8e8bfb3..d0bb6ec 100644 (file)
@@ -48,7 +48,7 @@
 #include "utilops.h"
 #include "window.h"
 
-#include <math.h>
+#include <cmath>
 
 
 #define PAN_WINDOW_DEFAULT_WIDTH 720
index 7f95c77..97ec4fa 100644 (file)
@@ -19,9 +19,9 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
+#include <cmath>
+#include <cstdlib>
+#include <cstring>
 
 #include "main.h"
 #include "pixbuf-renderer.h"
@@ -174,7 +174,7 @@ GType pixbuf_renderer_get_type()
                        };
 
                pixbuf_renderer_type = g_type_register_static(GTK_TYPE_EVENT_BOX, "PixbufRenderer",
-                                                             &pixbuf_renderer_info, GTypeFlags(0));
+                                                             &pixbuf_renderer_info, static_cast<GTypeFlags>(0));
                }
 
        return pixbuf_renderer_type;
index 252d0cb..2cc2dce 100644 (file)
@@ -24,7 +24,7 @@
 #include "exif.h"
 #include "ui-fileops.h"
 
-#include <math.h>
+#include <cmath>
 
 
 /*
index 6bb474a..46f0dda 100644 (file)
@@ -1745,7 +1745,7 @@ gboolean load_config_from_buf(const gchar *buf, gsize size, gboolean startup)
        parser_data->startup = startup;
        options_parse_func_push(parser_data, options_parse_toplevel, nullptr, nullptr);
 
-       context = g_markup_parse_context_new(&parser, GMarkupParseFlags(0), parser_data, nullptr);
+       context = g_markup_parse_context_new(&parser, static_cast<GMarkupParseFlags>(0), parser_data, nullptr);
 
        if (g_markup_parse_context_parse(context, buf, size, nullptr) == FALSE)
                {
index df0bbbf..dbd61e1 100644 (file)
@@ -39,9 +39,9 @@
 #include "rcfile.h"
 #include "view-file.h"
 
+#include <csignal>
 #include <sys/socket.h>
 #include <sys/un.h>
-#include <signal.h>
 
 #include "glua.h"
 
index c76aeac..924dfb8 100644 (file)
@@ -19,9 +19,9 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
+#include <cmath>
+#include <cstdlib>
+#include <cstring>
 
 #include "main.h"
 #include "renderer-tiles.h"
index 31949b3..993f421 100644 (file)
@@ -253,16 +253,16 @@ static gboolean match_func(GtkEntryCompletion *completion, const gchar *key, Gtk
        reg_exp_str = g_string_new("\\b(\?=.*:)");
        reg_exp_str = g_string_append(reg_exp_str, key);
 
-       reg_exp = g_regex_new(reg_exp_str->str, G_REGEX_CASELESS, GRegexMatchFlags(0), &error);
+       reg_exp = g_regex_new(reg_exp_str->str, G_REGEX_CASELESS, static_cast<GRegexMatchFlags>(0), &error);
        if (error)
                {
                log_printf("Error: could not compile regular expression %s\n%s\n", reg_exp_str->str, error->message);
                g_error_free(error);
                error = nullptr;
-               reg_exp = g_regex_new("", GRegexCompileFlags(0), GRegexMatchFlags(0), nullptr);
+               reg_exp = g_regex_new("", static_cast<GRegexCompileFlags>(0), static_cast<GRegexMatchFlags>(0), nullptr);
                }
 
-       ret = g_regex_match(reg_exp, normalized, GRegexMatchFlags(0), nullptr);
+       ret = g_regex_match(reg_exp, normalized, static_cast<GRegexMatchFlags>(0), nullptr);
 
        if (sar->match_found == FALSE && ret == TRUE)
                {
index fc7f1e2..0d9f89e 100644 (file)
@@ -22,6 +22,7 @@
 #include "main.h"
 #include "search.h"
 
+#include "bar-keywords.h"
 #include "cache.h"
 #include "collect-table.h"
 #include "dnd.h"
@@ -31,7 +32,6 @@
 #include "image-load.h"
 #include "img-view.h"
 #include "layout-util.h"
-#include "math.h"
 #include "menu.h"
 #include "metadata.h"
 #include "misc.h"
@@ -48,7 +48,7 @@
 #include "uri-utils.h"
 #include "utilops.h"
 #include "window.h"
-#include "bar-keywords.h"
+#include <cmath>
 
 #define DEF_SEARCH_WIDTH  700
 #define DEF_SEARCH_HEIGHT 650
@@ -1988,13 +1988,13 @@ static gboolean search_file_next(SearchData *sd)
                                }
                        if (sd->search_name_match_case)
                                {
-                               match = g_regex_match(sd->search_name_regex, fd_name_or_path, GRegexMatchFlags(0), nullptr);
+                               match = g_regex_match(sd->search_name_regex, fd_name_or_path, static_cast<GRegexMatchFlags>(0), nullptr);
                                }
                        else
                                {
                                /* sd->search_name is converted in search_start() */
                                gchar *haystack = g_utf8_strdown(fd_name_or_path, -1);
-                               match = g_regex_match(sd->search_name_regex, haystack, GRegexMatchFlags(0), nullptr);
+                               match = g_regex_match(sd->search_name_regex, haystack, static_cast<GRegexMatchFlags>(0), nullptr);
                                g_free(haystack);
                                }
                        }
@@ -2185,11 +2185,11 @@ static gboolean search_file_next(SearchData *sd)
 
                        if (sd->match_comment == SEARCH_MATCH_CONTAINS)
                                {
-                               match = g_regex_match(sd->search_comment_regex, comment, GRegexMatchFlags(0), nullptr);
+                               match = g_regex_match(sd->search_comment_regex, comment, static_cast<GRegexMatchFlags>(0), nullptr);
                                }
                        else if (sd->match_comment == SEARCH_MATCH_NONE)
                                {
-                               match = !g_regex_match(sd->search_comment_regex, comment, GRegexMatchFlags(0), nullptr);
+                               match = !g_regex_match(sd->search_comment_regex, comment, static_cast<GRegexMatchFlags>(0), nullptr);
                                }
                        g_free(comment);
                        }
@@ -2578,13 +2578,13 @@ static void search_start(SearchData *sd)
                g_regex_unref(sd->search_name_regex);
                }
 
-       sd->search_name_regex = g_regex_new(sd->search_name, GRegexCompileFlags(0), GRegexMatchFlags(0), &error);
+       sd->search_name_regex = g_regex_new(sd->search_name, static_cast<GRegexCompileFlags>(0), static_cast<GRegexMatchFlags>(0), &error);
        if (error)
                {
                log_printf("Error: could not compile regular expression %s\n%s\n", sd->search_name, error->message);
                g_error_free(error);
                error = nullptr;
-               sd->search_name_regex = g_regex_new("", GRegexCompileFlags(0), GRegexMatchFlags(0), nullptr);
+               sd->search_name_regex = g_regex_new("", static_cast<GRegexCompileFlags>(0), static_cast<GRegexMatchFlags>(0), nullptr);
                }
 
        if (!sd->search_comment_match_case)
@@ -2600,13 +2600,13 @@ static void search_start(SearchData *sd)
                g_regex_unref(sd->search_comment_regex);
                }
 
-       sd->search_comment_regex = g_regex_new(sd->search_comment, GRegexCompileFlags(0), GRegexMatchFlags(0), &error);
+       sd->search_comment_regex = g_regex_new(sd->search_comment, static_cast<GRegexCompileFlags>(0), static_cast<GRegexMatchFlags>(0), &error);
        if (error)
                {
                log_printf("Error: could not compile regular expression %s\n%s\n", sd->search_comment, error->message);
                g_error_free(error);
                error = nullptr;
-               sd->search_comment_regex = g_regex_new("", GRegexCompileFlags(0), GRegexMatchFlags(0), nullptr);
+               sd->search_comment_regex = g_regex_new("", static_cast<GRegexCompileFlags>(0), static_cast<GRegexMatchFlags>(0), nullptr);
                }
 
        sd->search_count = 0;
index 3448d5a..38e594d 100644 (file)
@@ -19,7 +19,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <string.h>
+#include <cstring>
 
 #include "main.h"
 #include "ui-bookmark.h"
index b58c194..dbf7aa6 100644 (file)
@@ -19,9 +19,9 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
 #include <unistd.h>
 #include <utime.h>
 
index d0d93ec..26b0aac 100644 (file)
@@ -19,8 +19,8 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <stdio.h>
-#include <string.h>
+#include <cstdio>
+#include <cstring>
 
 #include "main.h"
 #include "ui-help.h"
index 733c576..d527364 100644 (file)
@@ -19,8 +19,8 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <stdlib.h>
-#include <string.h>
+#include <cstdlib>
+#include <cstring>
 
 #include "main.h"
 #include "ui-misc.h"
index 8b391d1..67312ce 100644 (file)
@@ -19,7 +19,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <string.h>
+#include <cstring>
 
 #include <dirent.h>
 #include <sys/types.h>
index b85621a..7c03ae9 100644 (file)
@@ -19,9 +19,9 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <string.h>
-#include <sys/types.h>
+#include <cstring>
 #include <dirent.h>
+#include <sys/types.h>
 
 #include "main.h"
 #include "ui-tabcomp.h"
index a8be7e4..378c25e 100644 (file)
@@ -19,7 +19,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <string.h>
+#include <cstring>
 
 #include "main.h"
 #include "ui-tree-edit.h"
index 7532476..dbd9fde 100644 (file)
@@ -19,7 +19,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <string.h>
+#include <cstring>
 
 #include "main.h"
 #include "ui-utildlg.h"
index 9419d22..1f0d3a4 100644 (file)
@@ -621,7 +621,7 @@ static void vd_pop_submenu_dir_view_as_cb(GtkWidget *widget, gpointer data)
 {
        auto vd = static_cast<ViewDir *>(data);
 
-       auto  new_type = static_cast<DirViewType>(GPOINTER_TO_INT((g_object_get_data(G_OBJECT(widget), "menu_item_radio_data"))));
+       auto new_type = static_cast<DirViewType>(GPOINTER_TO_INT((g_object_get_data(G_OBJECT(widget), "menu_item_radio_data"))));
        layout_views_set(vd->layout, new_type, vd->layout->options.file_view_type);
 }
 
index 0ad233e..06b5184 100644 (file)
@@ -558,7 +558,7 @@ static void vf_pop_menu_toggle_mark_sel_cb(GtkWidget *UNUSED(widget), gpointer d
 static void vf_pop_menu_toggle_view_type_cb(GtkWidget *widget, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
-       auto  new_type = static_cast<FileViewType>(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "menu_item_radio_data")));
+       auto new_type = static_cast<FileViewType>(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "menu_item_radio_data")));
        if (!vf->layout) return;
 
        layout_views_set(vf->layout, vf->layout->options.dir_view_type, new_type);
@@ -1635,26 +1635,26 @@ GRegex *vf_file_filter_get_filter(ViewFile *vf)
 
        if (!gtk_widget_get_visible(vf->file_filter.combo))
                {
-               return g_regex_new("", GRegexCompileFlags(0), GRegexMatchFlags(0), nullptr);
+               return g_regex_new("", static_cast<GRegexCompileFlags>(0), static_cast<GRegexMatchFlags>(0), nullptr);
                }
 
        file_filter_text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vf->file_filter.combo));
 
        if (file_filter_text[0] != '\0')
                {
-               ret = g_regex_new(file_filter_text, vf->file_filter.case_sensitive ? GRegexCompileFlags(0) : G_REGEX_CASELESS, GRegexMatchFlags(0), &error);
+               ret = g_regex_new(file_filter_text, vf->file_filter.case_sensitive ? static_cast<GRegexCompileFlags>(0) : G_REGEX_CASELESS, static_cast<GRegexMatchFlags>(0), &error);
                if (error)
                        {
                        log_printf("Error: could not compile regular expression %s\n%s\n", file_filter_text, error->message);
                        g_error_free(error);
                        error = nullptr;
-                       ret = g_regex_new("", GRegexCompileFlags(0), GRegexMatchFlags(0), nullptr);
+                       ret = g_regex_new("", static_cast<GRegexCompileFlags>(0), static_cast<GRegexMatchFlags>(0), nullptr);
                        }
                g_free(file_filter_text);
                }
        else
                {
-               ret = g_regex_new("", GRegexCompileFlags(0), GRegexMatchFlags(0), nullptr);
+               ret = g_regex_new("", static_cast<GRegexCompileFlags>(0), static_cast<GRegexMatchFlags>(0), nullptr);
                }
 
        return ret;
@@ -1734,7 +1734,7 @@ void vf_notify_cb(FileData *fd, NotifyType type, gpointer data)
        auto vf = static_cast<ViewFile *>(data);
        gboolean refresh;
 
-       auto  interested = static_cast<NotifyType>(NOTIFY_CHANGE | NOTIFY_REREAD | NOTIFY_GROUPING);
+       auto interested = static_cast<NotifyType>(NOTIFY_CHANGE | NOTIFY_REREAD | NOTIFY_GROUPING);
        if (vf->marks_enabled) interested = static_cast<NotifyType>(interested | NOTIFY_MARKS | NOTIFY_METADATA);
        /** @FIXME NOTIFY_METADATA should be checked by the keyword-to-mark functions and converted to NOTIFY_MARKS only if there was a change */
 
index 8043c05..188c2e2 100644 (file)
@@ -275,7 +275,7 @@ int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
 
       if (sscanf(buffer, "%" PRIx64 "-%" PRIx64 " %s %" PRIx64 " %x:%x %u %s\n", &low, &high, perms, &offset, &major, &minor, &inode, path) == 8)
       {
-        uint64_t addr = (uintptr_t)WAI_RETURN_ADDRESS();
+        auto addr = reinterpret_cast<uintptr_t>(WAI_RETURN_ADDRESS());
         if (low <= addr && addr <= high)
         {
           char* resolved;
index 151da36..2c1c97a 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
+#include <cassert>
+#include <cmath>
+#include <cstdlib>
+#include <cstring>
 #if defined(_MSC_VER) || defined(__MINGW32__)
 #include <windows.h>
 #elif defined(__APPLE__) || defined(__linux__) || defined(__unix__) || defined(_POSIX_VERSION)
-#include <errno.h>
-#include <sys/mman.h>
+#include <cerrno>
 #include <fcntl.h>
+#include <sys/mman.h>
 #include <unistd.h>
 #endif
 
@@ -542,7 +542,7 @@ static int32_t* ZDPolygonToListInternal(const ZoneDetect *library, uint32_t poly
     size_t listLength = 2 * 100;
     size_t listIndex = 0;
 
-    auto  list = static_cast<int32_t *>(malloc(sizeof(int32_t) * listLength));
+    auto list = static_cast<int32_t *>(malloc(sizeof(int32_t) * listLength));
     if(!list) {
         goto fail;
     }
@@ -904,7 +904,7 @@ ZoneDetectResult *ZDLookup(const ZoneDetect *library, float lat, float lon, floa
     const int32_t latFixedPoint = ZDFloatToFixedPoint(lat, 90, library->precision);
     const int32_t lonFixedPoint = ZDFloatToFixedPoint(lon, 180, library->precision);
     size_t numResults = 0;
-    auto  distanceSqrMin = static_cast<uint64_t>(-1);
+    auto distanceSqrMin = static_cast<uint64_t>(-1);
 
     /* Iterate over all polygons */
     uint32_t bboxIndex = library->bboxOffset;