mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-26 23:24:09 +02:00
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;
|
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]));
|
||||||
|
@ -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);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user