Compare commits

...

4 Commits

5 changed files with 29 additions and 12 deletions

View File

@ -223,7 +223,7 @@ static void regsubst(const StreamFormat& fmt, StreamBuffer& buffer, long start)
}
buffer.replace(start+c+ovector[0], l, s);
length += s.length() - l;
c += s.length();
c += ovector[0] + s.length();
if (n == fmt.prec) // max match reached
return;
}

View File

@ -196,8 +196,12 @@ extern "C" long streamReload(char* recordname)
dbCommon* record;
long status;
int oldStreamError = streamError;
streamError = 1;
if(!pdbbase) {
error("No database has been loaded\n");
streamError = oldStreamError;
return ERROR;
}
debug("streamReload(%s)\n", recordname);
@ -234,6 +238,7 @@ extern "C" long streamReload(char* recordname)
}
dbFinishEntry(&dbentry);
StreamProtocolParser::free();
streamError = oldStreamError;
return OK;
}
@ -408,6 +413,7 @@ long streamInit(int after)
{
if (after)
{
streamError = 0; // Switch off errors after init in order not to spam messages when a device is down.
StreamProtocolParser::free();
}
return OK;

View File

@ -23,7 +23,7 @@
#include <stdio.h>
int streamDebug = 0;
int streamError = 0;
int streamError = 1;
extern "C" {
#ifdef _WIN32
__declspec(dllexport)

View File

@ -512,20 +512,31 @@ Each time newline is read, line is incremented.
buffer(token));
return false;
}
if (c == '$' && buffer[-1] == '\\')
{
// quoted variable reference
// terminate string here and do variable in next pass
buffer[-1] = quote;
ungetc(c, file);
break;
}
buffer.append(c);
if (c == quote && buffer[-2] != '\\')
if (c == quote)
{
quote = false;
break;
}
if (c == '\\')
{
c = getc(file);
if (c == '$')
{
// quoted variable reference
// terminate string here and do variable in next pass
buffer[-1] = quote;
ungetc(c, file);
break;
}
if (c == EOF || c == '\n')
{
error(line, filename(), "Backslash at end of line: %s\n",
buffer(token));
return false;
}
buffer.append(c);
}
c = getc(file);
}
buffer.append('\0').append(&l, sizeof(l)); // append line number

View File

@ -23,7 +23,7 @@
#define STREAM_MAJOR 2
#define STREAM_MINOR 7
#define STREAM_PATCHLEVEL 10
#define STREAM_PATCHLEVEL 12
#if defined(__vxworks) || defined(vxWorks)
#include <vxWorks.h>