compiler warnings

This commit is contained in:
john30
2016-12-10 10:29:46 +01:00
parent b4a596da5a
commit b3e8d16e19
4 changed files with 6 additions and 7 deletions
+2 -2
View File
@@ -426,7 +426,7 @@ error_t parse_opt(int key, char *arg, struct argp_state *state)
opt->logRawFile = arg;
break;
case O_RAWSIZ: // --lograwdatasize=100
opt->logRawSize = parseInt(arg, 10, 1, 1000000, result);
opt->logRawSize = (unsigned int)parseInt(arg, 10, 1, 1000000, result);
if (result != RESULT_OK) {
argp_error(state, "invalid dumpsize");
return EINVAL;
@@ -446,7 +446,7 @@ error_t parse_opt(int key, char *arg, struct argp_state *state)
opt->dumpFile = arg;
break;
case O_DMPSIZ: // --dumpsize=100
opt->dumpSize = parseInt(arg, 10, 1, 1000000, result);
opt->dumpSize = (unsigned int)parseInt(arg, 10, 1, 1000000, result);
if (result != RESULT_OK) {
argp_error(state, "invalid dumpsize");
return EINVAL;
+2 -2
View File
@@ -62,11 +62,11 @@ struct options
bool logRaw; //!< raw log each received/sent byte on the bus
const char* logRawFile; //!< name of raw log file [/var/log/ebusd.log]
int logRawSize; //!< maximum size of raw log file in kB [100]
unsigned int logRawSize; //!< maximum size of raw log file in kB [100]
bool dump; //!< binary dump received bytes
const char* dumpFile; //!< name of dump file [/tmp/ebusd_dump.bin]
int dumpSize; //!< maximum size of dump file in kB [100]
unsigned int dumpSize; //!< maximum size of dump file in kB [100]
};
/**
-1
View File
@@ -67,7 +67,6 @@ void RotateFile::write(unsigned char* value, unsigned int size, bool received)
struct tm* tm;
clockGettime(&ts);
tm = localtime(&ts.tv_sec);
char* buf;
fprintf(m_stream, "%04d-%02d-%02d %02d:%02d:%02d.%03ld %c",
tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec, ts.tv_nsec/1000000,
+2 -2
View File
@@ -41,7 +41,7 @@ public:
* @param maxSize the maximum size of the file to write to.
* @param textMode whether to write each byte with prefixed timestamp and direction as text.
*/
RotateFile(const string fileName, const long maxSize, const bool textMode=false)
RotateFile(const string fileName, const unsigned long maxSize, const bool textMode=false)
: m_enabled(false), m_fileName(fileName), m_maxSize(maxSize), m_textMode(textMode), m_stream(), m_fileSize(0) {}
/**
@@ -78,7 +78,7 @@ private:
const string m_fileName;
/** the maximum size of @a m_file, or 0 for infinite. */
const long m_maxSize;
const unsigned long m_maxSize;
/** whether to write each byte with prefixed timestamp and direction as text. */
const bool m_textMode;