+ const char *pos = NULL;
+ const char *pLF;
+ int len, rlen, retlen;
+ int nSuccessLess = 0;
+ const char *pch = NULL;
+
+ retlen = 0;
+ if ((Line == NULL) ||
+ (Pos == NULL) ||
+ (IOBuf == NULL))
+ {
+ if (Pos != NULL)
+ *Pos = NULL;
+// *Error = ErrRBLF_PreConditionFailed;
+ return -1;
+ }
+
+ pos = *Pos;
+ if ((StrLength(IOBuf) > 0) &&
+ (pos != NULL) &&
+ (pos < ChrPtr(IOBuf) + StrLength(IOBuf)))
+ {
+ pch = pos;
+ pch = strchr(pch, '\n');
+
+ if (pch == NULL) {
+ StrBufAppendBufPlain(Line, pos,
+ StrLength(IOBuf) - (pos - ChrPtr(IOBuf)), 0);
+ FlushStrBuf(IOBuf);
+ pos = *Pos = NULL;
+ }
+ else {
+ int n = 0;
+ if ((pch > ChrPtr(IOBuf)) &&
+ (*(pch - 1) == '\r')) {
+ n = 1;
+ }
+ StrBufAppendBufPlain(Line, pos,
+ (pch - pos - n), 0);