aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/db/update/Walk.cxx2
-rw-r--r--src/decoder/plugins/DsdLib.cxx15
-rw-r--r--src/system/Clock.cxx12
3 files changed, 14 insertions, 15 deletions
diff --git a/src/db/update/Walk.cxx b/src/db/update/Walk.cxx
index 6442e6d23..152971677 100644
--- a/src/db/update/Walk.cxx
+++ b/src/db/update/Walk.cxx
@@ -334,7 +334,7 @@ UpdateWalk::UpdateDirectory(Directory &directory, const FileInfo &info)
directory_set_stat(directory, info);
Error error;
- const std::auto_ptr<StorageDirectoryReader> reader(storage.OpenDirectory(directory.GetPath(), error));
+ const std::unique_ptr<StorageDirectoryReader> reader(storage.OpenDirectory(directory.GetPath(), error));
if (reader.get() == nullptr) {
LogError(error);
return false;
diff --git a/src/decoder/plugins/DsdLib.cxx b/src/decoder/plugins/DsdLib.cxx
index c5df5beec..0b006a71d 100644
--- a/src/decoder/plugins/DsdLib.cxx
+++ b/src/decoder/plugins/DsdLib.cxx
@@ -125,27 +125,26 @@ dsdlib_tag_id3(InputStream &is,
const id3_length_t count = size - offset;
- if (count < 10 || count > 256*1024)
+ if (count < 10 || count > 1024 * 1024)
return;
- id3_byte_t *const id3_buf = static_cast<id3_byte_t*>(xalloc(count));
+ id3_byte_t *const id3_buf = new id3_byte_t[count];
+ if (id3_buf == nullptr)
+ return;
if (!decoder_read_full(nullptr, is, id3_buf, count)) {
- free(id3_buf);
+ delete[] id3_buf;
return;
}
struct id3_tag *id3_tag = id3_tag_parse(id3_buf, count);
- if (id3_tag == nullptr) {
- free(id3_buf);
+ delete[] id3_buf;
+ if (id3_tag == nullptr)
return;
- }
scan_id3_tag(id3_tag, handler, handler_ctx);
id3_tag_delete(id3_tag);
-
- free(id3_buf);
return;
}
#endif
diff --git a/src/system/Clock.cxx b/src/system/Clock.cxx
index 38b24420d..161525fe1 100644
--- a/src/system/Clock.cxx
+++ b/src/system/Clock.cxx
@@ -40,8 +40,8 @@ MonotonicClockS(void)
if (base.denom == 0)
(void)mach_timebase_info(&base);
- return (unsigned)((mach_absolute_time() * base.numer / 1000)
- / (1000000 * base.denom));
+ return (unsigned)(((double)mach_absolute_time() * base.numer / 1000)
+ / base.denom / 1000000);
#elif defined(CLOCK_MONOTONIC)
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
@@ -62,8 +62,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);
@@ -104,8 +104,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);