mirror of https://github.com/Icinga/icinga2.git
stream: remove ReadLine maxLength
it doesn't do what its name suggests. refs #4370
This commit is contained in:
parent
80c91aa91e
commit
8c3663ab0e
|
@ -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]));
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue