Hi,
When I compile cpp_exiftool with gcc 8.1.1 with -Wall -Werror flags (on Linux), I get this error (without the -Werror flag, it's just a warning):
cpp_exiftool/inc/ExifTool.h:84:19: error: 'ExifTool::mCmdQueueSize' will be initialized after [-Werror=reorder]
int mCmdQueueSize;// size of command queue
This is because the member 'mWatchdog' is positioned differently in the ExifTool member initialization list (in the cpp file) compared to the member declarations in the header. Moving the declaration in the header file fixes the problem (see patch below).
Is this a modification that could be considered for inclusion in the official code release?
Thanks for reading!
*** ExifTool_original.h 2018-07-24 13:13:15.363888877 +0200
--- ExifTool.h 2018-07-24 13:13:20.044173569 +0200
***************
*** 77,87 ****
ExifToolPipe mStderr; // buffer for exiftool stderr read pipe
int mTo; // write pipe for exiftool stdin
int mPid; // exiftool application process ID
- int mWatchdog; // watchdog process ID
TagInfo * mWriteInfo; // tag information to write
char * mCmdQueue; // queued command arguments (NULL if nothing queued)
int mCmdQueueLen; // length of data in command queue
int mCmdQueueSize;// size of command queue
int mLastComplete;// result of last Complete() call
int mCmdNum; // last command number
};
--- 77,87 ----
ExifToolPipe mStderr; // buffer for exiftool stderr read pipe
int mTo; // write pipe for exiftool stdin
int mPid; // exiftool application process ID
TagInfo * mWriteInfo; // tag information to write
char * mCmdQueue; // queued command arguments (NULL if nothing queued)
int mCmdQueueLen; // length of data in command queue
int mCmdQueueSize;// size of command queue
+ int mWatchdog; // watchdog process ID
int mLastComplete;// result of last Complete() call
int mCmdNum; // last command number
};
Thanks for letting me know about this.
I hate the C++ compiler.
I would rather change the initialization than the order of the class members. How about this?:
===================================================================
RCS file: /Users/phil/cvs/exiftool2/cpp_exiftool/src/ExifTool.cpp,v
retrieving revision 1.30
diff -r1.30 ExifTool.cpp
122,123c122,123
< : mWriteInfo(NULL), mCmdQueue(NULL), mCmdQueueLen(0), mCmdQueueSize(0),
< mWatchdog(-1), mLastComplete(0), mCmdNum(0)
---
> : mWatchdog(-1), mWriteInfo(NULL), mCmdQueue(NULL), mCmdQueueLen(0),
> mCmdQueueSize(0), mLastComplete(0), mCmdNum(0)
- Phil
Looks good to me! I wasn't sure which fix you would prefer, but your version is perhaps safer since it doesn't mess with memory layout, like mine did.
Thanks for your attention and the great tool you've created.
Thanks.
I've updated the web page (http://owl.phy.queensu.ca/~phil/cpp_exiftool/) with the new version.
- Phil