nntpgrab-single-error.patch

Increase size of date/time static buffer; warn/error only once - swsnyder, 01/06/2011 02:40 am

Download (2.3 KB)

 
nntpgrab-0.6.91/base/utils.c 2011-01-05 20:01:42.114380499 -0500
354 354
void
355 355
nntpgrab_utils_get_readable_finished_time(int estimated_time_remaining, char *time_remaining_str, int time_remaining_str_len)
356 356
{
357 357
    struct tm *now;
358 358
    time_t stamp;
359
    static int nugrft_once = 0;
359 360

                
360 361
    if (estimated_time_remaining <= 0) {
361 362
        time_remaining_str[0] = '\0';
362 363
        return;
363 364
    }
... ...
369 370
        time_remaining_str[0] = '\0';
370 371
        return;
371 372
    }
372 373

                
373 374
    if (strftime(time_remaining_str, time_remaining_str_len, "%c", now) == 0) {
374
        g_error(__FILE__ ":%i buffer too small", __LINE__);
375
        if (!nugrft_once) {
376
            g_error(__FILE__ ":%i buffer too small", __LINE__);
377
            nugrft_once = 1;
378
        }
375 379
    }
376 380
}
377 381

                
378 382
static gint
379 383
sort_folders_func(gconstpointer a, gconstpointer b)
nntpgrab-0.6.91/client/gui_qt/DownloadQueueItem.cpp 2011-01-05 20:01:39.289246765 -0500
75 75
        case FIELD_FILE_SIZE_REMAINING_STR:
76 76
            return sizeRemainingStr;
77 77

                
78 78
        case FIELD_STAMP:
79 79
        {
80
            char stamp_str[32];
80
            char stamp_str[64];
81 81
            struct tm *stamp_tm;
82 82
            time_t stamp_time_t;
83
            static int dlqidata_once = 0;
83 84

                
84 85
            memset(&stamp_str, 0, sizeof(stamp_str));
85 86
            stamp_time_t = stamp.toTime_t();
86 87
            if ((stamp_tm = localtime(&stamp_time_t)) == NULL) {
87 88
                /* Date could not be parsed */
88 89
                return stamp.toString();
89 90
            }
90 91

                
91 92
            if (strftime(stamp_str, sizeof(stamp_str) - 1, "%c", stamp_tm) == 0) {
92
                qWarning(__FILE__ ":%i buffer too small", __LINE__);
93
                if (!dlqidata_once) {
94
                    qWarning(__FILE__ ":%i buffer too small", __LINE__);
95
                    dlqidata_once = 1;
96
                }
93 97
            }
94 98

                
95 99
            return QString(stamp_str);
96 100
        }
97 101