]> granicus.if.org Git - icinga2/commitdiff
stream: remove ReadLine maxLength
authorMichael Friedrich <michael.friedrich@netways.de>
Thu, 4 Jul 2013 07:41:51 +0000 (09:41 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Thu, 4 Jul 2013 07:41:51 +0000 (09:41 +0200)
it doesn't do what its name suggests.

refs #4370

lib/base/stream.cpp
lib/base/stream.h

index 0ef95715c57cb0cedcd955ce4c8044b211a6a174..7914b0dec96a504a2b0d138106ff28815ec6503b 100644 (file)
 
 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]));
index b51eb59ad0729731ba7d3207e74e2f3923c40d64..ce47d6ea145ee826f7e7dff5af835ebc4abfa8a1 100644 (file)
@@ -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);
 };
 
 }