stream: remove ReadLine maxLength

it doesn't do what its name suggests.

refs #4370
This commit is contained in:
Michael Friedrich 2013-07-04 09:41:51 +02:00
parent 80c91aa91e
commit 8c3663ab0e
2 changed files with 4 additions and 4 deletions

View File

@ -24,19 +24,19 @@
using namespace icinga; using namespace icinga;
bool Stream::ReadLine(String *line, ReadLineContext& context, size_t maxLength) bool Stream::ReadLine(String *line, ReadLineContext& context)
{ {
if (context.Eof) if (context.Eof)
return false; return false;
for (;;) { for (;;) {
if (context.MustRead) { if (context.MustRead) {
context.Buffer = (char *)realloc(context.Buffer, context.Size + maxLength); context.Buffer = (char *)realloc(context.Buffer, context.Size + 4096);
if (!context.Buffer) if (!context.Buffer)
throw std::bad_alloc(); throw std::bad_alloc();
size_t rc = Read(context.Buffer + context.Size, maxLength); size_t rc = Read(context.Buffer + context.Size, 4096);
if (rc == 0) { if (rc == 0) {
*line = String(context.Buffer, &(context.Buffer[context.Size])); *line = String(context.Buffer, &(context.Buffer[context.Size]));

View File

@ -75,7 +75,7 @@ public:
*/ */
virtual void Close(void) = 0; virtual void Close(void) = 0;
bool ReadLine(String *line, ReadLineContext& context, size_t maxLength = 4096); bool ReadLine(String *line, ReadLineContext& context);
}; };
} }