From a4f4fc50b9e1c825806dc7dc44ac8eb4398a3a5b Mon Sep 17 00:00:00 2001 From: PHO Date: Mon, 26 Jan 2015 14:54:16 +0900 Subject: Avoid integer overflow in MonotonicClock{S,MS,US} This is Darwin specific: the previous implementation was causing an integer overflow when base.numer is very large. On PPC Darwin, the timebase info is 1000000000/33330116 and this is too large for integer arithmetic. --- NEWS | 1 + src/system/Clock.cxx | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index e7a80b964..9cd558070 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,6 @@ ver 0.18.23 (not yet released) * despotify: remove defunct plugin +* fix clock integer overflow on OS X * fix gcc 5.0 warnings ver 0.18.22 (2014/01/14) diff --git a/src/system/Clock.cxx b/src/system/Clock.cxx index 347997a44..916bda56c 100644 --- a/src/system/Clock.cxx +++ b/src/system/Clock.cxx @@ -40,8 +40,8 @@ MonotonicClockMS(void) if (base.denom == 0) (void)mach_timebase_info(&base); - return (unsigned)((mach_absolute_time() * base.numer) - / (1000000 * base.denom)); + return (unsigned)(((double)mach_absolute_time() * base.numer) + / base.denom / 1000000); #elif defined(CLOCK_MONOTONIC) struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); @@ -82,8 +82,8 @@ MonotonicClockUS(void) if (base.denom == 0) (void)mach_timebase_info(&base); - return ((uint64_t)mach_absolute_time() * (uint64_t)base.numer) - / (1000 * (uint64_t)base.denom); + return (uint64_t)(((double)mach_absolute_time() * base.numer) + / base.denom / 1000); #elif defined(CLOCK_MONOTONIC) struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); -- cgit v1.2.3 From df43b6a05cc231cd45ebf06415a8095d6ff6d98d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 31 Jan 2015 00:05:01 +0100 Subject: Makefile.am: generate icon before compiling JNI classes Apparently, Android's build.xml requires the icon to be available, even when only running the Java compiler. --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 7131dd9d4..027fe0098 100644 --- a/Makefile.am +++ b/Makefile.am @@ -283,7 +283,7 @@ android/build/build.xml: android/AndroidManifest.xml ln -s $(abs_srcdir)/android/res/values android/build/res $(ANDROID_SDK)/tools/android update project --path android/build --target android-17 -android/build/bin/classes/org/musicpd/Bridge.class: android/src/Bridge.java android/build/build.xml +android/build/bin/classes/org/musicpd/Bridge.class: android/src/Bridge.java android/build/build.xml android/build/res/drawable/icon.png cd android/build && ant compile-jni-classes android/build/include/org_musicpd_Bridge.h: android/build/bin/classes/org/musicpd/Bridge.class -- cgit v1.2.3 From 8a6b4db19f63f95a7167ca27026cb16aa80fffad Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 30 Jan 2015 23:39:06 +0100 Subject: Makefile.am: move org_musicpd_Bridge.h to BUILT_SOURCES --- Makefile.am | 4 +--- NEWS | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 027fe0098..89819de36 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,8 +28,6 @@ noinst_LIBRARIES = \ libmixer_plugins.a \ liboutput_plugins.a -libmpd_a_DEPENDENCIES = - libmpd_a_CPPFLAGS = $(AM_CPPFLAGS) \ $(LIBMPDCLIENT_CFLAGS) \ $(AVAHI_CFLAGS) \ @@ -289,7 +287,7 @@ android/build/bin/classes/org/musicpd/Bridge.class: android/src/Bridge.java andr android/build/include/org_musicpd_Bridge.h: android/build/bin/classes/org/musicpd/Bridge.class javah -classpath $(ANDROID_SDK)/platforms/android-17/android.jar:android/build/bin/classes -d $(@D) org.musicpd.Bridge -libmpd_a_DEPENDENCIES += android/build/include/org_musicpd_Bridge.h +BUILT_SOURCES = android/build/include/org_musicpd_Bridge.h android/build/libs/armeabi-v7a/libmpd.so: libmpd.so android/build/build.xml mkdir -p $(@D) diff --git a/NEWS b/NEWS index ac9caacb1..da153cfa1 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ ver 0.19.9 (not yet released) * fix clock integer overflow on OS X * fix build failure with uClibc * fix build failure on non-POSIX operating systems +* fix dependency issue on parallel Android build ver 0.19.8 (2015/01/14) * input -- cgit v1.2.3 From 5489dec28d77f9339b0372100a4838f66e35dfd5 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 1 Feb 2015 12:22:17 +0100 Subject: NEWS: fix v0.18.22 release date --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 9cd558070..8d8493ae1 100644 --- a/NEWS +++ b/NEWS @@ -3,7 +3,7 @@ ver 0.18.23 (not yet released) * fix clock integer overflow on OS X * fix gcc 5.0 warnings -ver 0.18.22 (2014/01/14) +ver 0.18.22 (2015/01/14) * fix clang 3.6 warnings ver 0.18.21 (2014/12/17) -- cgit v1.2.3 From b3fe3e8b3de5794762f21000d5771b0491e8a041 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 6 Feb 2015 12:25:34 +0100 Subject: TagBuilder: allow adding duplicate tag types in Complement() Build a table of pre-existing tag types before adding new items. The old way would check HasType() each time, which would return true after the first instance of that tag type had been added, preventing duplicate tag types to be merged. This broke duplicate tag types loaded from the state file, because this code path uses TagBuilder::Complement(). --- NEWS | 1 + src/tag/TagBuilder.cxx | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index da153cfa1..22920348b 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ ver 0.19.9 (not yet released) * decoder - dsdiff, dsf: raise ID3 tag limit to 1 MB +* playlist: fix loading duplicate tag types from state file * fix clock integer overflow on OS X * fix build failure with uClibc * fix build failure on non-POSIX operating systems diff --git a/src/tag/TagBuilder.cxx b/src/tag/TagBuilder.cxx index 93518f6e9..0882f9561 100644 --- a/src/tag/TagBuilder.cxx +++ b/src/tag/TagBuilder.cxx @@ -25,6 +25,8 @@ #include "Tag.hxx" #include "util/WritableBuffer.hxx" +#include + #include #include #include @@ -168,12 +170,19 @@ TagBuilder::Complement(const Tag &other) has_playlist |= other.has_playlist; + /* build a table of tag types that were already present in + this object, which will not be copied from #other */ + std::array present; + present.fill(false); + for (const TagItem *i : items) + present[i->type] = true; + items.reserve(items.size() + other.num_items); tag_pool_lock.lock(); for (unsigned i = 0, n = other.num_items; i != n; ++i) { TagItem *item = other.items[i]; - if (!HasType(item->type)) + if (!present[item->type]) items.push_back(tag_pool_dup_item(item)); } tag_pool_lock.unlock(); -- cgit v1.2.3 From d38034bb5c7bb58c01ce817fbeb394b178961a13 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 6 Feb 2015 14:36:55 +0100 Subject: fs/io/FileOutputStream: don't auto-delete file on WIN32 The file handle is never reset to INVALID_HANDLE_VALUE, and thus the destructor will assume the operation shall be cancelled and will delete the temporary file. This was a major breakage for saving the database file and the state file. --- NEWS | 1 + src/fs/io/FileOutputStream.cxx | 2 ++ 2 files changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 22920348b..5ac89971e 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,7 @@ ver 0.19.9 (not yet released) * fix build failure with uClibc * fix build failure on non-POSIX operating systems * fix dependency issue on parallel Android build +* fix database/state file saving on Windows ver 0.19.8 (2015/01/14) * input diff --git a/src/fs/io/FileOutputStream.cxx b/src/fs/io/FileOutputStream.cxx index dc4456d1f..0eff8b5f0 100644 --- a/src/fs/io/FileOutputStream.cxx +++ b/src/fs/io/FileOutputStream.cxx @@ -62,6 +62,7 @@ FileOutputStream::Commit(gcc_unused Error &error) assert(IsDefined()); CloseHandle(handle); + handle = INVALID_HANDLE_VALUE; return true; } @@ -71,6 +72,7 @@ FileOutputStream::Cancel() assert(IsDefined()); CloseHandle(handle); + handle = INVALID_HANDLE_VALUE; RemoveFile(path); } -- cgit v1.2.3 From 4a5528697dce85d1fd30d0c9640f1adb791d0a8b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 6 Feb 2015 17:04:14 +0100 Subject: release v0.18.23 --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 8d8493ae1..5eb98cb49 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -ver 0.18.23 (not yet released) +ver 0.18.23 (2015/02/06) * despotify: remove defunct plugin * fix clock integer overflow on OS X * fix gcc 5.0 warnings -- cgit v1.2.3 From 5761800197a86ba6de70af026546e678cbda4b91 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 6 Feb 2015 17:08:25 +0100 Subject: release v0.19.9 --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 00c057998..c03ef44e9 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -ver 0.19.9 (not yet released) +ver 0.19.9 (2015/02/06) * decoder - dsdiff, dsf: raise ID3 tag limit to 1 MB * playlist: fix loading duplicate tag types from state file -- cgit v1.2.3