[Box Backup-commit] COMMIT r2883 - box/trunk/lib/common
subversion at boxbackup.org
subversion at boxbackup.org
Sun Mar 27 02:01:35 BST 2011
Author: chris
Date: 2011-03-27 02:01:34 +0100 (Sun, 27 Mar 2011)
New Revision: 2883
Modified:
box/trunk/lib/common/FdGetLine.cpp
box/trunk/lib/common/IOStreamGetLine.cpp
Log:
Fix off-by-one errors caught by MSVC.
Modified: box/trunk/lib/common/FdGetLine.cpp
===================================================================
--- box/trunk/lib/common/FdGetLine.cpp 2011-03-26 23:49:48 UTC (rev 2882)
+++ box/trunk/lib/common/FdGetLine.cpp 2011-03-27 01:01:34 UTC (rev 2883)
@@ -185,11 +185,16 @@
{
begin++;
}
- if(!iw(r[end])) end--;
- while(end > begin && iw(r[end]))
+
+ if(end < size && !iw(r[end]))
{
end--;
}
+
+ while(end > begin && end < size && iw(r[end]))
+ {
+ end--;
+ }
// Return a sub string
return r.substr(begin, end - begin + 1);
Modified: box/trunk/lib/common/IOStreamGetLine.cpp
===================================================================
--- box/trunk/lib/common/IOStreamGetLine.cpp 2011-03-26 23:49:48 UTC (rev 2882)
+++ box/trunk/lib/common/IOStreamGetLine.cpp 2011-03-27 01:01:34 UTC (rev 2883)
@@ -168,11 +168,16 @@
{
begin++;
}
- if(!iw(r[end])) end--;
- while(end > begin && iw(r[end]))
+
+ if(end < size && !iw(r[end]))
{
end--;
}
+
+ while(end > begin && end < size && iw(r[end]))
+ {
+ end--;
+ }
// Return a sub string
rOutput = r.substr(begin, end - begin + 1);
More information about the Boxbackup-commit
mailing list