Ignore:
Timestamp:
Jul 13, 2009, 2:34:39 AM (15 years ago)
Author:
Bruno Cornec
Message:

r3263@localhost: bruno | 2009-07-13 02:25:52 +0200

  • Fix printing bug in text mode during afio backup
  • Fix a wrong tmp usage after mr_asprintf migration in libmondo-archive.c
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mondo/src/common/newt-specific.c

    r2274 r2277  
    9696    long g_maximum_progress = 999;  ///< The maximum amount of progress (100%) for the currently opened progress form.
    9797    long g_current_progress = -999; ///< The current amount of progress (filelist #, etc.) for the currently opened progress form.
    98     long g_start_time = 0;      ///< The time (in seconds since the epoch) that the progress form was opened.
     98    long g_start_time = 0L;     ///< The time (in seconds since the epoch) that the progress form was opened.
    9999    bool g_text_mode = TRUE;    ///< If FALSE, use a newt interface; if TRUE, use an ugly (but more compatible) dumb terminal interface.
    100100    char g_xmondo_stdin[MAX_NEWT_COMMENT_LEN],  ///< ... @bug Unneeded w/current XMondo.
     
    979979
    980980        /*@ long ************************************************************ */
    981         long current_time = 0;
    982         long time_taken = 0;
    983         long time_total_est = 0;
    984         long time_remaining = 0;
     981        long current_time = 0L;
     982        long time_taken = 0L;
     983        long time_total_est = 0L;
     984        long time_remaining = 0L;
    985985
    986986        /*@ buffers ********************************************************** */
     
    10061006            time_remaining = time_total_est - time_taken;
    10071007        } else {
    1008             time_remaining = 0;
     1008            time_remaining = 0L;
    10091009        }
    10101010        if (!g_text_mode) {
     
    10171017            || percentage > g_isoform_old_progress) {
    10181018            g_isoform_old_progress = percentage;
    1019             mr_asprintf(&timeline_str,
    1020                     "%2ld:%02ld taken            %2ld:%02ld remaining",
    1021                     time_taken / 60, time_taken % 60, time_remaining / 60,
    1022                     time_remaining % 60);
     1019            mr_asprintf(&timeline_str, "%2ld:%02ld taken            %2ld:%02ld remaining", (long) time_taken / 60, (long) time_taken % 60,
     1020                            (long) time_remaining / 60, (long) time_remaining % 60);
    10231021            if (percentage < 3) {
    10241022                mr_asprintf(&pcline_str, " Working");
     
    10431041                }
    10441042                if (percentage >= 3) {
    1045                     mr_strcat(taskprogress, "] %3d%% done; %2ld:%02ld to go", percentage,
    1046                             time_remaining / 60, time_remaining % 60);
    1047                     printf("---evalcall---1--- %s\n",
    1048                            g_isoform_header_str);
     1043                    mr_strcat(taskprogress, "] %3d%% done; %2ld:%02ld to go", percentage, time_remaining / 60, time_remaining % 60);
     1044                    printf("---evalcall---1--- %s\n", g_isoform_header_str);
    10491045                    printf("---evalcall---2--- %s\n", taskprogress);
    10501046                    printf("---evalcall---E---\n");
    10511047                }
    1052                 paranoid_free(taskprogress);
     1048                mr_free(taskprogress);
    10531049            } else {
    10541050                newtScaleSet(g_isoform_scale,
     
    11101106     update_progress_form_full(char *blurb1, char *blurb2, char *blurb3) {
    11111107        /*@ long ***************************************************** */
    1112         long current_time = 0;
    1113         long time_taken = 0;
    1114         long time_remaining = 0;
    1115         long time_total_est = 0;
     1108        long current_time = 0L;
     1109        long time_taken = 0L;
     1110        long time_remaining = 0L;
     1111        long time_total_est = 0L;
    11161112
    11171113        /*@ int ******************************************************* */
     
    11461142                g_current_progress = g_maximum_progress;
    11471143            }
    1148             percentage =
    1149                 (int) ((g_current_progress * 100L) / g_maximum_progress);
     1144            percentage = (int) ((g_current_progress * 100L) / g_maximum_progress);
    11501145        }
    11511146        if (percentage < 1) {
     
    11561151        }
    11571152        if (g_current_progress) {
    1158             time_total_est =
    1159                 time_taken * (long) g_maximum_progress /
    1160                 (long) (g_current_progress);
     1153            time_total_est = time_taken * (long) g_maximum_progress / (long) g_current_progress;
    11611154            time_remaining = time_total_est - time_taken;
    11621155        } else {
    1163             time_remaining = 0;
     1156            time_remaining = 0L;
    11641157        }
    11651158        g_mysterious_dot_counter = (g_mysterious_dot_counter + 1) % 27;
     
    11791172                log_msg(2, "percentage = %d", percentage);
    11801173            }
    1181             mr_strcat(taskprogress, "] %3d%c", percentage, '%');
    1182             mr_strcat(taskprogress, " done; %2ld:%02ld to go",
    1183                     time_remaining / 60, time_remaining % 60);
     1174            mr_strcat(taskprogress, "] %3d%% done; %2ld:%02ld to go", percentage, (long) time_remaining / 60, (long) time_remaining % 60);
    11841175            printf("---progress-form---4--- %s\n", taskprogress);
    11851176            paranoid_free(taskprogress);
    11861177        } else {
    1187             mr_asprintf(&timeline_str,
    1188                 "%2ld:%02ld taken               %2ld:%02ld remaining  ",
    1189                 time_taken / 60, time_taken % 60, time_remaining / 60,
    1190                 time_remaining % 60);
    1191             mr_asprintf(percentline_str, " %3d%% done                 %3d%% to go",
    1192                 percentage, 100 - percentage);
     1178            mr_asprintf(&timeline_str, "%2ld:%02ld taken               %2ld:%02ld remaining  ",
     1179                (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60, (long) time_remaining % 60);
     1180            mr_asprintf(percentline_str, " %3d%% done                 %3d%% to go", percentage, 100 - percentage);
    11931181
    11941182            center_string(blurb1, 54);
Note: See TracChangeset for help on using the changeset viewer.