Mercurial > geeqie
comparison src/ui_fileops.c @ 516:b7e99bfeadc9
Convert the minority of while() to while ().
author | zas_ |
---|---|
date | Thu, 24 Apr 2008 15:49:57 +0000 |
parents | 48c8e49b571c |
children | b68fd1eb3243 |
comparison
equal
deleted
inserted
replaced
515:adc45cd3f08b | 516:b7e99bfeadc9 |
---|---|
424 g_free(sl); | 424 g_free(sl); |
425 g_free(tl); | 425 g_free(tl); |
426 | 426 |
427 if (!fi || !fo) return FALSE; | 427 if (!fi || !fo) return FALSE; |
428 | 428 |
429 while((b = fread(buf, sizeof(char), sizeof(buf), fi)) && b != 0) | 429 while ((b = fread(buf, sizeof(char), sizeof(buf), fi)) && b != 0) |
430 { | 430 { |
431 if (fwrite(buf, sizeof(char), b, fo) != b) | 431 if (fwrite(buf, sizeof(char), b, fo) != b) |
432 { | 432 { |
433 fclose(fi); | 433 fclose(fi); |
434 fclose(fo); | 434 fclose(fo); |
632 path8 = path_from_utf8(path); | 632 path8 = path_from_utf8(path); |
633 f = fopen(path8, "r"); | 633 f = fopen(path8, "r"); |
634 g_free(path8); | 634 g_free(path8); |
635 if (!f) return -1; | 635 if (!f) return -1; |
636 | 636 |
637 while((c = fgetc(f)) != EOF) | 637 while ((c = fgetc(f)) != EOF) |
638 { | 638 { |
639 sum += c; | 639 sum += c; |
640 } | 640 } |
641 | 641 |
642 fclose(f); | 642 fclose(f); |
725 | 725 |
726 if (!path) return NULL; | 726 if (!path) return NULL; |
727 | 727 |
728 p = strlen(path) - 1; | 728 p = strlen(path) - 1; |
729 if (p < 0) return NULL; | 729 if (p < 0) return NULL; |
730 while(ptr[p] != '/' && p > 0) p--; | 730 while (ptr[p] != '/' && p > 0) p--; |
731 if (p == 0 && ptr[p] == '/') p++; | 731 if (p == 0 && ptr[p] == '/') p++; |
732 new_path = g_strndup(path, (guint)p); | 732 new_path = g_strndup(path, (guint)p); |
733 return new_path; | 733 return new_path; |
734 } | 734 } |
735 | 735 |
770 | 770 |
771 if (!path) return NULL; | 771 if (!path) return NULL; |
772 if (strlen(path) < 2) return g_strdup(path); | 772 if (strlen(path) < 2) return g_strdup(path); |
773 | 773 |
774 p = strlen(path) - 1; | 774 p = strlen(path) - 1; |
775 while(ptr[p] != '.' && p > 0) p--; | 775 while (ptr[p] != '.' && p > 0) p--; |
776 if (p == 0) p = strlen(path) - 1; | 776 if (p == 0) p = strlen(path) - 1; |
777 new_path = g_strndup(path, (guint)p); | 777 new_path = g_strndup(path, (guint)p); |
778 return new_path; | 778 return new_path; |
779 } | 779 } |
780 | 780 |