Changeset 2277 in MondoRescue for branches/2.2.10/mondo/src/common/newt-specific.c
- Timestamp:
- Jul 13, 2009, 2:34:39 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/newt-specific.c
r2274 r2277 96 96 long g_maximum_progress = 999; ///< The maximum amount of progress (100%) for the currently opened progress form. 97 97 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. 99 99 bool g_text_mode = TRUE; ///< If FALSE, use a newt interface; if TRUE, use an ugly (but more compatible) dumb terminal interface. 100 100 char g_xmondo_stdin[MAX_NEWT_COMMENT_LEN], ///< ... @bug Unneeded w/current XMondo. … … 979 979 980 980 /*@ 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; 985 985 986 986 /*@ buffers ********************************************************** */ … … 1006 1006 time_remaining = time_total_est - time_taken; 1007 1007 } else { 1008 time_remaining = 0 ;1008 time_remaining = 0L; 1009 1009 } 1010 1010 if (!g_text_mode) { … … 1017 1017 || percentage > g_isoform_old_progress) { 1018 1018 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); 1023 1021 if (percentage < 3) { 1024 1022 mr_asprintf(&pcline_str, " Working"); … … 1043 1041 } 1044 1042 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); 1049 1045 printf("---evalcall---2--- %s\n", taskprogress); 1050 1046 printf("---evalcall---E---\n"); 1051 1047 } 1052 paranoid_free(taskprogress);1048 mr_free(taskprogress); 1053 1049 } else { 1054 1050 newtScaleSet(g_isoform_scale, … … 1110 1106 update_progress_form_full(char *blurb1, char *blurb2, char *blurb3) { 1111 1107 /*@ 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; 1116 1112 1117 1113 /*@ int ******************************************************* */ … … 1146 1142 g_current_progress = g_maximum_progress; 1147 1143 } 1148 percentage = 1149 (int) ((g_current_progress * 100L) / g_maximum_progress); 1144 percentage = (int) ((g_current_progress * 100L) / g_maximum_progress); 1150 1145 } 1151 1146 if (percentage < 1) { … … 1156 1151 } 1157 1152 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; 1161 1154 time_remaining = time_total_est - time_taken; 1162 1155 } else { 1163 time_remaining = 0 ;1156 time_remaining = 0L; 1164 1157 } 1165 1158 g_mysterious_dot_counter = (g_mysterious_dot_counter + 1) % 27; … … 1179 1172 log_msg(2, "percentage = %d", percentage); 1180 1173 } 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); 1184 1175 printf("---progress-form---4--- %s\n", taskprogress); 1185 1176 paranoid_free(taskprogress); 1186 1177 } 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); 1193 1181 1194 1182 center_string(blurb1, 54);
Note:
See TracChangeset
for help on using the changeset viewer.