Switch to unified view

a/src/utils/mimeparse.cpp b/src/utils/mimeparse.cpp
...
...
604
// And also hopeless things like: Fri Nov  3 13:13:33 2006
604
// And also hopeless things like: Fri Nov  3 13:13:33 2006
605
time_t rfc2822DateToUxTime(const string& dt)
605
time_t rfc2822DateToUxTime(const string& dt)
606
{
606
{
607
    // Strip everything up to first comma if any, we don't need weekday,
607
    // Strip everything up to first comma if any, we don't need weekday,
608
    // then break into tokens
608
    // then break into tokens
609
    list<string> toks;
609
    vector<string> toks;
610
    string::size_type idx;
610
    string::size_type idx;
611
    if ((idx = dt.find_first_of(",")) != string::npos) {
611
    if ((idx = dt.find_first_of(",")) != string::npos) {
612
    if (idx == dt.length() - 1) {
612
    if (idx == dt.length() - 1) {
613
        DATEDEB((stderr, "Bad rfc822 date format (short1): [%s]\n", 
613
        DATEDEB((stderr, "Bad rfc822 date format (short1): [%s]\n", 
614
             dt.c_str()));
614
             dt.c_str()));
...
...
621
    stringToTokens(dt, toks, " \t:");
621
    stringToTokens(dt, toks, " \t:");
622
        // Test for date like: Sun Nov 19 06:18:41 2006
622
        // Test for date like: Sun Nov 19 06:18:41 2006
623
        //                      0   1  2   3 4  5  6
623
        //                      0   1  2   3 4  5  6
624
        // and change to:      19 Nov 2006 06:18:41
624
        // and change to:      19 Nov 2006 06:18:41
625
        if (toks.size() == 7) {
625
        if (toks.size() == 7) {
626
            list<string>::iterator it0 = toks.begin();
627
            if (it0->length() == 3 &&
626
            if (toks[0].length() == 3 &&
628
                it0->find_first_of("0123456789") == string::npos) {
627
                toks[0].find_first_of("0123456789") == string::npos) {
629
                list<string>::iterator it2 = it0;
630
                for (int i = 0; i < 2; i++) it2++;
631
                list<string>::iterator it6 = it2;
632
                for (int i = 0; i < 4; i++) it6++;
633
                iter_swap(it0, it2);
628
                swap(toks[0], toks[2]);
634
                iter_swap(it6, it2);
629
                swap(toks[6], toks[2]);
635
                toks.erase(it6);
630
                toks.pop_back();
636
            }
631
            }
637
        }
632
        }
638
    }
633
    }
639
634
640
#if DEBUGDATE
635
#if DEBUGDATE
...
...
659
    memset(&tm, 0, sizeof(tm));
654
    memset(&tm, 0, sizeof(tm));
660
655
661
    // Load struct tm with appropriate tokens, possibly converting
656
    // Load struct tm with appropriate tokens, possibly converting
662
    // when needed
657
    // when needed
663
658
664
    list<string>::iterator it = toks.begin();
659
    vector<string>::iterator it = toks.begin();
665
660
666
    // Day of month: no conversion needed
661
    // Day of month: no conversion needed
667
    tm.tm_mday = atoi(it->c_str());
662
    tm.tm_mday = atoi(it->c_str());
668
    it++;
663
    it++;
669
664