|
reSIProcate/rutil
9694
|
#include <cassert>#include "rutil/Logger.hxx"#include "rutil/ParseBuffer.hxx"#include "rutil/ParseException.hxx"#include "rutil/DataStream.hxx"#include "rutil/WinLeakCheck.hxx"
Go to the source code of this file.
Defines | |
| #define | RESIPROCATE_SUBSYSTEM Subsystem::SIP |
Functions | |
| Data | spaces (unsigned int numSpaces) |
| Data | escapeAndAnnotate (const char *buffer, Data::size_type size, const char *position) |
Variables | |
| static Data | CRLF ("\r\n") |
| static const unsigned char | hexToByte [256] |
| #define RESIPROCATE_SUBSYSTEM Subsystem::SIP |
Definition at line 11 of file ParseBuffer.cxx.
| Data escapeAndAnnotate | ( | const char * | buffer, |
| Data::size_type | size, | ||
| const char * | position | ||
| ) |
Definition at line 888 of file ParseBuffer.cxx.
References resip::Data::Preallocate, and spaces().
Referenced by resip::ParseBuffer::fail().
{
Data ret(2*size+16, Data::Preallocate);
const char* lastReturn = buffer;
int lineCount = 0;
bool doneAt = false;
const char* p = buffer;
for (unsigned int i = 0; i < size; i++)
{
unsigned char c = *p++;
switch (c)
{
case 0x0D: // CR
{
continue;
}
case 0x0A: // LF
{
if (!doneAt && p >= position)
{
ret += "[CRLF]\n";
ret += spaces((unsigned int)(position - lastReturn));
ret += "^[CRLF]\n";
doneAt = true;
}
else
{
lastReturn = p;
ret += c;
}
lineCount++;
continue;
}
}
if (iscntrl(c) || (c >= 0x7F))
{
ret +='*'; // indicates unprintable character
continue;
}
ret += c;
}
if (!doneAt && p >= position)
{
ret += "\n";
ret += spaces((unsigned int)(position - lastReturn));
ret += "^\n";
}
return ret;
}

| Data spaces | ( | unsigned int | numSpaces | ) |
Definition at line 877 of file ParseBuffer.cxx.
References resip::Data::Preallocate.
Referenced by escapeAndAnnotate().
{
Data sps(numSpaces, Data::Preallocate);
for (unsigned int i = 0; i < numSpaces; i++)
{
sps += ' ';
}
return sps;
}
Referenced by resip::ParseBuffer::skipToTermCRLF().
const unsigned char hexToByte[256] [static] |
{
'k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k',
'k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k',
'k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k',
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'k','k','k','k','k','k',
'k',0xA,0xB,0xC,0xD,0xE,0xF,'k','k','k','k','k','k','k','k','k',
'k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k',
'k',0xA,0xB,0xC,0xD,0xE,0xF,'k','k','k','k','k','k','k','k','k',
'k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k',
'k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k',
'k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k',
'k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k',
'k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k',
'k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k',
'k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k',
'k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k'
}
Definition at line 530 of file ParseBuffer.cxx.
Referenced by resip::ParseBuffer::dataUnescaped().
1.7.5.1