Update of /cvsroot/gtkpod/libgpod/src
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv31882/src
Modified Files:
itdb_itunesdb.c
Log Message:
* src/itdb_itunesdb.c (itdb_cp_track_to_ipod): removed static
variable "dir_num" which was initialized once and cycled through
for each track transfered. This doesn't seem right since
different iPods with different number of music directories may
be connected at the same time, and itdb_cp_track_to_ipod() may
be called for different iTunesDBs at the same in in a threaded
environment. Since there is no inherent value in cycling through
the directories, a random directory is selected each time.
Index: itdb_itunesdb.c
===================================================================
RCS file: /cvsroot/gtkpod/libgpod/src/itdb_itunesdb.c,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -d -r1.89 -r1.90
--- itdb_itunesdb.c 30 Apr 2007 00:40:54 -0000 1.89
+++ itdb_itunesdb.c 1 May 2007 03:40:38 -0000 1.90
@@ -5493,14 +5493,14 @@
* Copy one track to the iPod. The PC filename is @filename
* and is taken literally.
*
- * The mountpoint of the iPod (in local encoding) is expected in
- * track->itdb->mountpoint.
+ * The mountpoint of the iPod (in local encoding) must have been set
+ * with itdb_set_mountpoint() (done automatically when reading an
+ * iTunesDB).
*
* If @track->transferred is set to TRUE, nothing is done. Upon
* successful transfer @track->transferred is set to TRUE.
*
- * For storage, the directories "f00 ... fnn" will be
- * cycled through.
+ * For storage, the directories "f00 ... fnn" will be used randomly.
*
* The filename is constructed as "gtkpod"<random number> and copied
* to @track->ipod_path. If this file already exists, <random number>
@@ -5518,7 +5518,7 @@
gboolean itdb_cp_track_to_ipod (Itdb_Track *track,
const gchar *filename, GError **error)
{
- static gint dir_num = -1;
+ gint dir_num;
gchar *track_db_path, *ipod_fullfile;
gboolean success;
gint mplen = 0;
@@ -5566,14 +5566,7 @@
return FALSE;
}
- if (dir_num == -1)
- {
- dir_num = g_random_int_range (0, itdb_musicdirs_number (itdb));
- }
- else
- {
- dir_num = (dir_num + 1) % itdb_musicdirs_number (itdb);
- }
+ dir_num = g_random_int_range (0, itdb_musicdirs_number (itdb));
g_snprintf (dir_num_str, 5, "F%02d", dir_num);
dest_components[0] = dir_num_str;
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2