summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJorg Schuler <jcsjcs@users.sourceforge.net>2007-05-01 03:40:38 +0000
committerJorg Schuler <jcsjcs@users.sourceforge.net>2007-05-01 03:40:38 +0000
commit11007f2c0535c595001a21699c3afed8b20168aa (patch)
tree5ead541a00da651be4f126ff370bee9e1dee492a /src
parent8b23407b284cd01b207cb9ad1a54bdad3d5468d5 (diff)
downloadlibgpod-11007f2c0535c595001a21699c3afed8b20168aa.tar.gz
libgpod-11007f2c0535c595001a21699c3afed8b20168aa.tar.xz
libgpod-11007f2c0535c595001a21699c3afed8b20168aa.zip
* 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. git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1425 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'src')
-rw-r--r--src/itdb_itunesdb.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/itdb_itunesdb.c b/src/itdb_itunesdb.c
index 1114886..43215d7 100644
--- a/src/itdb_itunesdb.c
+++ b/src/itdb_itunesdb.c
@@ -5493,14 +5493,14 @@ gint itdb_musicdirs_number (Itdb_iTunesDB *itdb)
* 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-&gt;itdb-&gt;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-&gt;transferred is set to TRUE, nothing is done. Upon
* successful transfer @track-&gt;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"&lt;random number&gt; and copied
* to @track-&gt;ipod_path. If this file already exists, &lt;random number&gt;
@@ -5518,7 +5518,7 @@ gint itdb_musicdirs_number (Itdb_iTunesDB *itdb)
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 @@ gboolean itdb_cp_track_to_ipod (Itdb_Track *track,
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;