From 5fdf3912c8a108165f02d600b85357189f09c1e3 Mon Sep 17 00:00:00 2001 From: zimoch Date: Tue, 16 Sep 2008 07:27:27 +0000 Subject: [PATCH] avoid compiler warning on 64 bit machines --- src/RegexpConverter.cc | 2 +- src/StreamEpics.cc | 4 ++-- src/StreamFormatConverter.cc | 16 ++++++++++------ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/RegexpConverter.cc b/src/RegexpConverter.cc index f9cfada..2ff54e4 100644 --- a/src/RegexpConverter.cc +++ b/src/RegexpConverter.cc @@ -112,7 +112,7 @@ scanString(const StreamFormat& fmt, const char* input, if (!(fmt.flags & sign_flag)) { debug("Matching string \"%s\" too long (%d>%d bytes)\n", StreamBuffer(input+ovector[subexpr*2], len).expand()(), - len, maxlen-1); + (int)len, (int)maxlen-1); return -1; } len = maxlen-1; diff --git a/src/StreamEpics.cc b/src/StreamEpics.cc index 54a21d5..53a66ff 100644 --- a/src/StreamEpics.cc +++ b/src/StreamEpics.cc @@ -501,8 +501,8 @@ long streamScanSep(dbCommon* record) long streamScanfN(dbCommon* record, format_t *format, void* value, size_t maxStringSize) { - debug("streamScanfN(%s,format=%%%c,maxStringSize=%d)\n", - record->name, format->priv->conv, maxStringSize); + debug("streamScanfN(%s,format=%%%c,maxStringSize=%ld)\n", + record->name, format->priv->conv, (long)maxStringSize); Stream* pstream = (Stream*)record->dpvt; if (!pstream) return ERROR; if (!pstream->scan(format, value, maxStringSize)) diff --git a/src/StreamFormatConverter.cc b/src/StreamFormatConverter.cc index e5806ae..30a8686 100644 --- a/src/StreamFormatConverter.cc +++ b/src/StreamFormatConverter.cc @@ -160,7 +160,8 @@ scanLong(const StreamFormat& fmt, const char* input, long& value) int length = -1; if (fmt.flags & skip_flag) { - /* on vxWorks, return value of sscanf with %*... is buggy */ + /* can't use return value on vxWorks: sscanf with %* format + returns -1 at end of string whether value is found or not */ sscanf(input, fmt.info, &length); } else @@ -217,7 +218,8 @@ scanDouble(const StreamFormat& fmt, const char* input, double& value) int length = -1; if (fmt.flags & skip_flag) { - /* on vxWorks, return value of sscanf with %*... is buggy */ + /* can't use return value on vxWorks: sscanf with %* format + returns -1 at end of string whether value is found or not */ sscanf(input, fmt.info, &length); } else @@ -281,7 +283,8 @@ scanString(const StreamFormat& fmt, const char* input, } if (fmt.flags & skip_flag) { - /* on vxWorks, return value of sscanf with %*... is buggy */ + /* can't use return value on vxWorks: sscanf with %* format + returns -1 at end of string whether value is found or not */ sscanf(input, fmt.info, &length); } else @@ -291,7 +294,7 @@ scanString(const StreamFormat& fmt, const char* input, if (maxlen <= fmt.width || fmt.width == 0) { // assure not to read too much - sprintf(tmpformat, "%%%d%c%%n", maxlen-1, fmt.conv); + sprintf(tmpformat, "%%%ld%c%%n", (long)maxlen-1, fmt.conv); f = tmpformat; } else @@ -409,7 +412,8 @@ scanString(const StreamFormat& fmt, const char* input, int length = -1; if (fmt.flags & skip_flag) { - /* on vxWorks, return value of sscanf with %*... is buggy */ + /* can't use return value on vxWorks: sscanf with %* format + returns -1 at end of string whether value is found or not */ sscanf(input, fmt.info, &length); } else @@ -420,7 +424,7 @@ scanString(const StreamFormat& fmt, const char* input, { const char *p = strchr (fmt.info, '['); // assure not to read too much - sprintf(tmpformat, "%%%d%s", maxlen-1, p); + sprintf(tmpformat, "%%%ld%s", (long)maxlen-1, p); f = tmpformat; } else