From 8c3663ab0e535cfa044ad6503a3e37254041a382 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Thu, 4 Jul 2013 09:41:51 +0200 Subject: [PATCH] stream: remove ReadLine maxLength it doesn't do what its name suggests. refs #4370 --- lib/base/stream.cpp | 6 +++--- lib/base/stream.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/base/stream.cpp b/lib/base/stream.cpp index 0ef95715c..7914b0dec 100644 --- a/lib/base/stream.cpp +++ b/lib/base/stream.cpp @@ -24,19 +24,19 @@ using namespace icinga; -bool Stream::ReadLine(String *line, ReadLineContext& context, size_t maxLength) +bool Stream::ReadLine(String *line, ReadLineContext& context) { if (context.Eof) return false; for (;;) { if (context.MustRead) { - context.Buffer = (char *)realloc(context.Buffer, context.Size + maxLength); + context.Buffer = (char *)realloc(context.Buffer, context.Size + 4096); if (!context.Buffer) 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) { *line = String(context.Buffer, &(context.Buffer[context.Size])); diff --git a/lib/base/stream.h b/lib/base/stream.h index b51eb59ad..ce47d6ea1 100644 --- a/lib/base/stream.h +++ b/lib/base/stream.h @@ -75,7 +75,7 @@ public: */ virtual void Close(void) = 0; - bool ReadLine(String *line, ReadLineContext& context, size_t maxLength = 4096); + bool ReadLine(String *line, ReadLineContext& context); }; } -- 2.50.1