HuntnGather – Diff between revs 38 and 39

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 38 Rev 39
Line 270... Line 270...
270 * 270 *
271 * Create multiple temporary files and return their names. 271 * Create multiple temporary files and return their names.
272 */ 272 */
273 VECTOR *CreateTemporaryFiles(int files) { 273 VECTOR *CreateTemporaryFiles(int files) {
274 VECTOR *tmpNames; 274 VECTOR *tmpNames;
-   275 int total;
Line 275... Line 276...
275   276  
276 if((tmpNames = malloc(1 * sizeof(*tmpNames))) == NULL) { 277 if((tmpNames = malloc(1 * sizeof(*tmpNames))) == NULL) {
277 fprintf(stderr, "Memory allocation failure.\n"); 278 fprintf(stderr, "Memory allocation failure.\n");
278 return NULL; 279 return NULL;
Line 286... Line 287...
286 if(PROGRAM_VERBOSE) { 287 if(PROGRAM_VERBOSE) {
287 fprintf(stdout, "Creating temporary files...\r"); 288 fprintf(stdout, "Creating temporary files...\r");
288 } 289 }
Line 289... Line 290...
289   290  
-   291 tmpNames->length = 0;
290 tmpNames->length = 0; 292 total = files;
291 while(PROGRAM_RUN && --files > -1) { 293 while(PROGRAM_RUN && --files > -1) {
292 #if defined ___AmigaOS___ 294 #if defined ___AmigaOS___
293 // Check if CTRL+C was pressed and abort the program. 295 // Check if CTRL+C was pressed and abort the program.
294 if(SetSignal(0L, SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C) { 296 if(SetSignal(0L, SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C) {
295 PROGRAM_RUN = FALSE; 297 PROGRAM_RUN = FALSE;
296 continue; 298 continue;
297 } 299 }
298 #endif 300 #endif
299 tmpNames[files] = CreateTemporaryFile(); 301 tmpNames->array[files] = CreateTemporaryFile();
Line 300... Line 302...
300 ++tmpNames->length; 302 ++tmpNames->length;
301   303  
302 if(PROGRAM_VERBOSE) { 304 if(PROGRAM_VERBOSE) {
303 fprintf(stdout, "Creating temporary files: %d%%.\r", 100 - (int)(((float)count / files) * 100.0)); 305 fprintf(stdout, "Creating temporary files: %d%%.\r", (int)(((float)tmpNames->length / total) * 100.0));
Line 304... Line 306...
304 } 306 }
305 } 307 }
Line 477... Line 479...
477 int RemoveFile(char *name) { 479 int RemoveFile(char *name) {
478 return remove(name) == 0; 480 return remove(name) == 0;
479 #endif 481 #endif
480 } 482 }
Line 481... Line -...
481   -  
482   483  
483 /* 484 /*
484 * 485 *
485 * Deletes files. 486 * Deletes files.
486 */ 487 */
487 void RemoveFiles(char **names, int count) { 488 void RemoveFiles(VECTOR *names) {
488 int i; 489 int i;
489 for(i = 0; i < count; ++i) { 490 for(i = 0; i < names->length; ++i) {
490 if(RemoveFile(names[i]) == FALSE) { 491 if(RemoveFile(names->array[i]) == FALSE) {
491 fprintf(stderr, "Could not remove file '%s'.\n", names[i]); 492 fprintf(stderr, "Could not remove file '%s'.\n", (char *)names->array[i]);
492 continue; 493 continue;
493 } 494 }
494 fprintf(stderr, "Removing file '%s'\n", names[i]); 495 fprintf(stderr, "Removing file '%s'\n", (char *)names->array[i]);
495 } 496 }
Line 496... Line 497...
496 } 497 }
497   498