Compare commits

..

4 Commits

Author SHA1 Message Date
75bbb1a252 vxWorks does not support %hhx scanf format 2020-12-11 11:42:55 +01:00
227bb83f60 fix formats for vxWorks 6.9 2020-09-29 17:40:04 +02:00
4edff374d0 fix some type conversion warning on Windows 2020-09-29 17:39:07 +02:00
9273476135 install missing headers 2020-09-29 17:34:58 +02:00
9 changed files with 33 additions and 20 deletions

View File

@ -25,6 +25,10 @@ HEADERS += src/StreamFormatConverter.h
HEADERS += src/StreamBuffer.h
HEADERS += src/StreamError.h
HEADERS += src/StreamVersion.h
HEADERS += src/StreamProtocol.h
HEADERS += src/StreamBusInterface.h
HEADERS += src/StreamCore.h
HEADERS += src/MacroMagic.h
CPPFLAGS += -DSTREAM_INTERNAL -I$(COMMON_DIR)

View File

@ -24,10 +24,16 @@
#include "StreamError.h"
#include <ctype.h>
#if defined(__vxworks) || defined(vxWorks)
#include <version.h>
#if defined(_WRS_VXWORKS_MAJOR) && _WRS_VXWORKS_MAJOR > 6 || (_WRS_VXWORKS_MAJOR == 6 && _WRS_VXWORKS_MINOR > 8)
#include <stdint.h>
#define PRIX32 "X"
#define PRIu32 "u"
#else
#define PRIX32 "lX"
#define PRIu32 "lu"
#endif
#define PRIX8 "X"
#define SCNx8 "hhx"
#define uint_fast8_t uint8_t
#define int_fast8_t int8_t
#elif defined(_MSC_VER) && _MSC_VER < 1700 /* Visual Studio 2010 does not have inttypes.h */
@ -35,7 +41,6 @@
#define PRIX32 "X"
#define PRIu32 "u"
#define PRIX8 "X"
#define SCNx8 "hhx"
#else
#define __STDC_FORMAT_MACROS
#include <stdint.h>
@ -747,7 +752,7 @@ scanPseudo(const StreamFormat& format, StreamBuffer& input, size_t& cursor)
debug("ChecksumConverter %s: input checksum is 0x%0*" PRIX32 "\n",
checksumMap[fnum].name, 2*checksumMap[fnum].bytes, sum);
uint_fast8_t inchar;
unsigned int inchar;
if (format.flags & sign_flag) // decimal
{
@ -774,7 +779,7 @@ scanPseudo(const StreamFormat& format, StreamBuffer& input, size_t& cursor)
{
if (format.flags & zero_flag) // ASCII
{
if (sscanf(input(cursor+2*i), "%2" SCNx8, (int8_t *) &inchar) != 1)
if (sscanf(input(cursor+2*i), "%2x", &inchar) != 1)
{
debug("ChecksumConverter %s: Input byte '%s' is not a hex byte\n",
checksumMap[fnum].name, input.expand(cursor+2*i,2)());
@ -818,7 +823,7 @@ scanPseudo(const StreamFormat& format, StreamBuffer& input, size_t& cursor)
{
if (format.flags & zero_flag) // ASCII
{
sscanf(input(cursor+2*i), "%2" SCNx8, (int8_t *) &inchar);
sscanf(input(cursor+2*i), "%2x", &inchar);
}
else
if (format.flags & left_flag) // poor man's hex: 0x30 - 0x3F

View File

@ -71,6 +71,10 @@ INC += StreamFormatConverter.h
INC += StreamBuffer.h
INC += StreamError.h
INC += StreamVersion.h
INC += StreamProtocol.h
INC += StreamBusInterface.h
INC += StreamCore.h
INC += MacroMagic.h
# switch off annoying rset warnings in 3.16+
CPPFLAGS += -DUSE_TYPED_RSET

View File

@ -171,10 +171,10 @@ static long writeData(dbCommon *record, format_t *format)
break;
#ifdef DBR_INT64
case DBF_INT64:
dval = ((epicsInt64 *)aai->bptr)[nowd];
dval = (double)((epicsInt64 *)aai->bptr)[nowd];
break;
case DBF_UINT64:
dval = ((epicsUInt64 *)aai->bptr)[nowd];
dval = (double)((epicsUInt64 *)aai->bptr)[nowd];
break;
#endif
case DBF_LONG:
@ -214,10 +214,10 @@ static long writeData(dbCommon *record, format_t *format)
{
#ifdef DBR_INT64
case DBF_INT64:
lval = ((epicsInt64 *)aai->bptr)[nowd];
lval = (long)((epicsInt64 *)aai->bptr)[nowd];
break;
case DBF_UINT64:
lval = ((epicsUInt64 *)aai->bptr)[nowd];
lval = (long)((epicsUInt64 *)aai->bptr)[nowd];
break;
#endif
case DBF_LONG:

View File

@ -200,10 +200,10 @@ static long writeData(dbCommon *record, format_t *format)
break;
#ifdef DBR_INT64
case DBF_INT64:
dval = ((epicsInt64 *)aao->bptr)[nowd];
dval = (double)((epicsInt64 *)aao->bptr)[nowd];
break;
case DBF_UINT64:
dval = ((epicsUInt64 *)aao->bptr)[nowd];
dval = (double)((epicsUInt64 *)aao->bptr)[nowd];
break;
#endif
case DBF_LONG:
@ -243,10 +243,10 @@ static long writeData(dbCommon *record, format_t *format)
{
#ifdef DBR_INT64
case DBF_INT64:
lval = ((epicsInt64 *)aao->bptr)[nowd];
lval = (long)((epicsInt64 *)aao->bptr)[nowd];
break;
case DBF_UINT64:
lval = ((epicsUInt64 *)aao->bptr)[nowd];
lval = (long)((epicsUInt64 *)aao->bptr)[nowd];
break;
#endif
case DBF_LONG:

View File

@ -73,7 +73,7 @@ static long readData(dbCommon *record, format_t *format)
if (record->pact) return DO_NOT_CONVERT;
/* In @init handler, no processing, enforce monitor updates. */
ao->omod = ao->oval != val;
ao->orbv = ao->oval = val;
ao->orbv = (epicsInt32)(ao->oval = val);
monitor_mask = recGblResetAlarms(record);
if (!(fabs(ao->mlst - val) <= ao->mdel))
{

View File

@ -37,7 +37,7 @@ static long readData(dbCommon *record, format_t *format)
{
lsi->val[length] = 0;
}
lsi->len = length;
lsi->len = (epicsUInt32)length;
return OK;
}

View File

@ -39,7 +39,7 @@ static long readData(dbCommon *record, format_t *format)
{
lso->val[length] = 0;
}
lso->len = length;
lso->len = (epicsUInt32)length;
if (record->pact) return OK;
/* In @init handler, no processing, enforce monitor updates. */
monitor_mask = recGblResetAlarms(record);

View File

@ -172,10 +172,10 @@ static long writeData(dbCommon *record, format_t *format)
break;
#ifdef DBR_INT64
case DBF_INT64:
dval = ((epicsInt64 *)wf->bptr)[nowd];
dval = (double)((epicsInt64 *)wf->bptr)[nowd];
break;
case DBF_UINT64:
dval = ((epicsUInt64 *)wf->bptr)[nowd];
dval = (double)((epicsUInt64 *)wf->bptr)[nowd];
break;
#endif
case DBF_LONG:
@ -215,10 +215,10 @@ static long writeData(dbCommon *record, format_t *format)
{
#ifdef DBR_INT64
case DBF_INT64:
lval = ((epicsInt64 *)wf->bptr)[nowd];
lval = (long)((epicsInt64 *)wf->bptr)[nowd];
break;
case DBF_UINT64:
lval = ((epicsUInt64 *)wf->bptr)[nowd];
lval = (long)((epicsUInt64 *)wf->bptr)[nowd];
break;
#endif
case DBF_LONG: