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

Reply via email to