|
|
|
@ -315,52 +315,50 @@ exports.validateUIDList = function(uids) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var CHARR_CRLF = [13, 10];
|
|
|
|
|
function line(b) {
|
|
|
|
|
function line(b, s) {
|
|
|
|
|
var len = b.length, p = b.p, start = p, ret = false, retest = false;
|
|
|
|
|
while (p < len && !ret) {
|
|
|
|
|
if (b[p] === CHARR_CRLF[line.p]) {
|
|
|
|
|
if (++line.p === 2)
|
|
|
|
|
if (b[p] === CHARR_CRLF[s.p]) {
|
|
|
|
|
if (++s.p === 2)
|
|
|
|
|
ret = true;
|
|
|
|
|
} else {
|
|
|
|
|
retest = (line.p > 0);
|
|
|
|
|
line.p = 0;
|
|
|
|
|
retest = (s.p > 0);
|
|
|
|
|
s.p = 0;
|
|
|
|
|
if (retest)
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
++p;
|
|
|
|
|
}
|
|
|
|
|
if (ret === false) {
|
|
|
|
|
if (line.ret)
|
|
|
|
|
line.ret += b.toString('ascii', start);
|
|
|
|
|
if (s.ret)
|
|
|
|
|
s.ret += b.toString('ascii', start);
|
|
|
|
|
else
|
|
|
|
|
line.ret = b.toString('ascii', start);
|
|
|
|
|
s.ret = b.toString('ascii', start);
|
|
|
|
|
} else {
|
|
|
|
|
var iCR = p - 2;
|
|
|
|
|
if (iCR < 0) {
|
|
|
|
|
// the CR is at the end of line.ret
|
|
|
|
|
if (line.ret && line.ret.length > 1)
|
|
|
|
|
ret = line.ret.substr(0, line.ret.length - 1);
|
|
|
|
|
// the CR is at the end of s.ret
|
|
|
|
|
if (s.ret && s.ret.length > 1)
|
|
|
|
|
ret = s.ret.substr(0, s.ret.length - 1);
|
|
|
|
|
else
|
|
|
|
|
ret = '';
|
|
|
|
|
} else {
|
|
|
|
|
// the entire CRLF is in b
|
|
|
|
|
if (iCR === 0)
|
|
|
|
|
ret = (line.ret ? line.ret : '');
|
|
|
|
|
ret = (s.ret ? s.ret : '');
|
|
|
|
|
else {
|
|
|
|
|
if (line.ret) {
|
|
|
|
|
ret = line.ret;
|
|
|
|
|
if (s.ret) {
|
|
|
|
|
ret = s.ret;
|
|
|
|
|
ret += b.toString('ascii', start, iCR);
|
|
|
|
|
} else
|
|
|
|
|
ret = b.toString('ascii', start, iCR);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
line.p = 0;
|
|
|
|
|
line.ret = undefined;
|
|
|
|
|
s.p = 0;
|
|
|
|
|
s.ret = undefined;
|
|
|
|
|
}
|
|
|
|
|
b.p = p;
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
line.p = 0;
|
|
|
|
|
line.ret = undefined;
|
|
|
|
|
|
|
|
|
|
exports.line = line;
|
|
|
|
|