From: <ny...@us...> - 2007-02-27 14:29:39
|
Revision: 399 http://svn.sourceforge.net/pmplib/?rev=399&view=rev Author: nyaochi Date: 2007-02-27 06:29:36 -0800 (Tue, 27 Feb 2007) Log Message: ----------- Fixed a bug in settlement operation. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/settle.c trunk/pmplib/lib/filepath/filepath_win32.c Modified: trunk/pmplib/frontend/easypmp/common/settle.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/settle.c 2007-02-27 14:15:54 UTC (rev 398) +++ trunk/pmplib/frontend/easypmp/common/settle.c 2007-02-27 14:29:36 UTC (rev 399) @@ -20,7 +20,7 @@ * */ -/* $Id:$ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -103,13 +103,17 @@ } n = 0; - for (i = 0;i < musics->num_elements;++i) { + i = 0; + while (i < musics->num_elements) { ucs2cpy(music, musics->elements[i].name); // Check the existence of a link referring to the music file. for (j = 0;j < music_links->num_elements;++j) { // Obtain the filename pointed by this link. ucs2cpy(link, music_links->elements[j].name); + if (i == 20) { + i = 20; + } if (filepath_followlink(link, target) == 0) { if (ucs2icmp(music, target) == 0) { break; @@ -121,28 +125,31 @@ if (j == music_links->num_elements) { filepath_removefile(music); remove_file_from_list(musics, i); - --i; if (progress(instance, EASYPMPP_REMOVE_UNREF|EASYPMPSP_PROGRESS, n, 0, music) != 0) { result = EASYPMPE_CANCEL; goto error_exit; } n++; + } else { + ++i; } } - for (i = 0;i < music_links->num_elements;++i) { + i = 0; + while (i < music_links->num_elements) { ucs2cpy(link, music_links->elements[j].name); if (filepath_followlink(link, target) != 0) { filepath_removelinkfile(link); remove_file_from_list(music_links, i); - --i; if (progress(instance, EASYPMPP_REMOVE_UNREF|EASYPMPSP_PROGRESS, n, 0, music) != 0) { result = EASYPMPE_CANCEL; goto error_exit; } n++; + } else { + ++i; } } @@ -160,7 +167,8 @@ } n = 0; - for (i = 0;i < musics_unsettled->num_elements;++i) { + i = 0; + while (i < musics_unsettled->num_elements) { // Source music file. ucs2cpy(music, musics_unsettled->elements[i].name); @@ -181,7 +189,6 @@ filepath_movefile(music, target); add_file_to_list(musics, target); remove_file_from_list(musics_unsettled, i); - --i; // Create a symbolic link (or shortcut) from the source to the destination. filepath_linkfile(target, music); @@ -207,7 +214,8 @@ } n = 0; - for (i = 0;i < music_links->num_elements;++i) { + i = 0; + while (i < music_links->num_elements) { // Source music link. ucs2cpy(link, music_links->elements[i].name); @@ -228,13 +236,14 @@ // Remove the link file. filepath_removelinkfile(link); remove_file_from_list(music_links, i); - --i; if (progress(instance, EASYPMPP_UNSETTLE|EASYPMPSP_PROGRESS, n, 0, music) != 0) { result = EASYPMPE_CANCEL; goto error_exit; } n++; + } else { + ++i; } } Modified: trunk/pmplib/lib/filepath/filepath_win32.c =================================================================== --- trunk/pmplib/lib/filepath/filepath_win32.c 2007-02-27 14:15:54 UTC (rev 398) +++ trunk/pmplib/lib/filepath/filepath_win32.c 2007-02-27 14:29:36 UTC (rev 399) @@ -280,6 +280,7 @@ fgets(buff, sizeof(buff)-1, fp); utf8toucs2(target, MAX_PATH, buff, strlen(buff)+1); filepath_combinepath(org, MAX_PATH, link, target); + fclose(fp); return 0; } else { return -1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |