Hello Patrick,
That looks ok to me as well. Parts of the RRULE v2 code is from a
customer of ours, who needed v2 RRULEs long before we supported them
on the SyncML side, he needed it to store RRULEs towards an Exchange
server, if I correctly remember.
I can see no reason for the -1, except that the developer was coming
from Java and not familiar with STL strings. I guess he wanted to
express "at least one char remaining", but forgot to write "<="
instead of "<".
I agree however that the fix you did (i<length) looks much more
familiar for C/C++ eyes...
The fix will appear in master once I've sorted out all the other
contributions from moblin.
Best Regards,
Lukas
On Aug 11, 2009, at 15:48 , Patrick Ohly wrote:
Hello!
Yongsheng found a problem in libsynthesis' rrule2internal parser
function when testing with mobical.net and vCalendar 1.0 format. For
example, BYMONTHDAY=1 was not parsed correctly.
The fix is in git.moblin.org's mobical branch. It looks right to me,
but
I wanted to check with the experts before merging it:
RRULE: rrule2internal will lose the last item of daylist of
fields like 'BY***'
There is an expression for each value parsing of 'BY***' field:
startIndex < bymonthday.length() - 1
This will lose the last item of daylist if day number has only one
character. For example, 'BYMONTHDAY=1', startIndex is 0, bymonthday
.length()-1 is also 0. This causes expression false and field's
value
is lost.
---------------------------- src/sysync/rrules.cpp
----------------------------
index b0bc9d7..703f2ee 100755
@@ -1870,7 +1870,7 @@ bool RRULE2toInternal(
}
}
// check if anything is behind endindex
- if (endIndex == string::npos && startIndex < byday.length()
- 1)
+ if (endIndex == string::npos && startIndex < byday.length())
{
endIndex = byday.length();
if (!setWeekday(byday, firstmask, lastmask, startIndex,
endIndex, false))
@@ -1916,7 +1916,7 @@ bool RRULE2toInternal(
}
}
// check if anything is behind endindex
- if (endIndex == string::npos && startIndex < byday.length()
- 1)
+ if (endIndex == string::npos && startIndex < byday.length())
{
endIndex = byday.length();
if (!setWeekday(byday, firstmask, lastmask, startIndex,
endIndex, false))
@@ -1957,7 +1957,7 @@ bool RRULE2toInternal(
}
}
// check if anything is behind endindex
- if (endIndex == string::npos && startIndex <
bymonthday.length() - 1)
+ if (endIndex == string::npos && startIndex <
bymonthday.length())
{
endIndex = bymonthday.length();
if (!setMonthDay(bymonthday, firstmask, lastmask,
startIndex, endIndex))
@@ -1986,7 +1986,7 @@ bool RRULE2toInternal(
}
}
// check if anything is behind endindex
- if (endIndex == string::npos && startIndex < byday.length()
- 1)
+ if (endIndex == string::npos && startIndex < byday.length())
{
endIndex = byday.length();
if (!setWeekday(byday, firstmask, lastmask, startIndex,
endIndex, true))
--
Best Regards, Patrick Ohly
The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.
_______________________________________________
os-libsynthesis mailing list
os-libsynthesis@synthesis.ch
http://lists.synthesis.ch/mailman/listinfo/os-libsynthesis
Lukas Zeller (l...@synthesis.ch)
-
Synthesis AG, SyncML Solutions & Sustainable Software Concepts
i...@synthesis.ch, http://www.synthesis.ch
_______________________________________________
os-libsynthesis mailing list
os-libsynthesis@synthesis.ch
http://lists.synthesis.ch/mailman/listinfo/os-libsynthesis