Changeset 3190 in MondoRescue for branches/3.1/mondo/src/common/libmondo-string.c
- Timestamp:
- Sep 25, 2013, 8:55:43 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.1/mondo/src/common/libmondo-string.c
r3147 r3190 141 141 142 142 143 144 145 146 147 148 149 150 143 /** 151 144 * Turn an entry from the RAID editor's disklist into a GUI-friendly string. … … 186 179 long outval; 187 180 int i; 188 char *tmp 1= NULL;181 char *tmp = NULL; 189 182 char ch; 190 183 … … 198 191 } 199 192 200 mr_asprintf(tmp 1, "%s", incoming);201 i = (int) strlen(tmp 1);202 if (tmp 1[i - 1] == 'B' || tmp1[i - 1] == 'b') {203 tmp 1[i - 1] = '\0';204 } 205 for (i = 0; i < (int) strlen(tmp 1) && isdigit(tmp1[i]); i++);206 ch = tmp 1[i];207 tmp 1[i] = '\0';208 outval = atol(tmp 1);209 paranoid_free(tmp1);193 mr_asprintf(tmp, "%s", incoming); 194 i = (int) strlen(tmp); 195 if (tmp[i - 1] == 'B' || tmp[i - 1] == 'b') { 196 tmp[i - 1] = '\0'; 197 } 198 for (i = 0; i < (int) strlen(tmp) && isdigit(tmp[i]); i++); 199 ch = tmp[i]; 200 tmp[i] = '\0'; 201 outval = atol(tmp); 202 mr_free(tmp); 210 203 211 204 if (ch == 'g' || ch == 'G') { … … 224 217 fatal_error("Integer overflow."); 225 218 } else if (ch != 'm' && ch != 'M') { 226 mr_asprintf(tmp 1, "Re: parameter '%s' - bad multiplier ('%c')", incoming, ch);227 fatal_error(tmp 1);219 mr_asprintf(tmp, "Re: parameter '%s' - bad multiplier ('%c')", incoming, ch); 220 fatal_error(tmp); 228 221 } 229 222 return (outval); … … 1043 1036 assert(bkpinfo != NULL); 1044 1037 1045 if (bkpinfo->media_size [g_current_media_number]<= 0) {1038 if (bkpinfo->media_size <= 0) { 1046 1039 mr_asprintf(tmp, "%lld", g_tape_posK); 1047 1040 mr_asprintf(pos_w_commas, "%s", commarize(tmp)); … … 1052 1045 } 1053 1046 1054 /* update screen */1047 /* update screen */ 1055 1048 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 1056 percentage = 1057 (int) (g_tape_posK / 10 / 1058 bkpinfo->media_size[g_current_media_number]); 1049 percentage = (int) (g_tape_posK / 10 / bkpinfo->media_size); 1059 1050 if (percentage > 100) { 1060 1051 percentage = 100; … … 1062 1053 mr_asprintf(outstr, "Volume %d: [", g_current_media_number); 1063 1054 } else { 1064 percentage = 1065 (int) (space_occupied_by_cd(bkpinfo->scratchdir) * 100 / 1024 / 1066 bkpinfo->media_size[g_current_media_number]); 1055 percentage = (int) (space_occupied_by_cd(bkpinfo->scratchdir) * 100 / 1024 / bkpinfo->media_size); 1067 1056 mds = media_descriptor_string(bkpinfo->backup_media_type); 1068 1057 mr_asprintf(outstr, "%s %d: [", mds, g_current_media_number);
Note:
See TracChangeset
for help on using the changeset viewer.