summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-12-22 16:10:05 +0100
committerMax Kellermann <max@musicpd.org>2017-12-22 16:10:05 +0100
commit300a619991392662cf3406fee8b97c36e2132a0d (patch)
tree58c0bbef3a89fcc7c4b8b42c1b8c11cfc41b0be6 /src
parent4319dedb239e65f16a0ec21153eae0a534e9b5da (diff)
parentd094c168aa0d9752ca2ffaf3d9569445c251ccc0 (diff)
Merge branch 'v0.20.x'
Diffstat (limited to 'src')
-rw-r--r--src/archive/plugins/Bzip2ArchivePlugin.cxx5
-rw-r--r--src/archive/plugins/Iso9660ArchivePlugin.cxx2
-rw-r--r--src/archive/plugins/ZzipArchivePlugin.cxx4
-rw-r--r--src/util/WStringAPI.hxx14
4 files changed, 19 insertions, 6 deletions
diff --git a/src/archive/plugins/Bzip2ArchivePlugin.cxx b/src/archive/plugins/Bzip2ArchivePlugin.cxx
index 3dc0b51c3..04597e2a2 100644
--- a/src/archive/plugins/Bzip2ArchivePlugin.cxx
+++ b/src/archive/plugins/Bzip2ArchivePlugin.cxx
@@ -162,7 +162,7 @@ Bzip2InputStream::FillBuffer()
if (bzstream.avail_in > 0)
return true;
- size_t count = archive->istream->Read(buffer, sizeof(buffer));
+ size_t count = archive->istream->LockRead(buffer, sizeof(buffer));
if (count == 0)
return false;
@@ -174,6 +174,8 @@ Bzip2InputStream::FillBuffer()
size_t
Bzip2InputStream::Read(void *ptr, size_t length)
{
+ const ScopeUnlock unlock(mutex);
+
int bz_result;
size_t nbytes = 0;
@@ -224,4 +226,3 @@ const ArchivePlugin bz2_archive_plugin = {
bz2_open,
bz2_extensions,
};
-
diff --git a/src/archive/plugins/Iso9660ArchivePlugin.cxx b/src/archive/plugins/Iso9660ArchivePlugin.cxx
index 9e4c4f16a..536745d85 100644
--- a/src/archive/plugins/Iso9660ArchivePlugin.cxx
+++ b/src/archive/plugins/Iso9660ArchivePlugin.cxx
@@ -182,6 +182,8 @@ Iso9660ArchiveFile::OpenStream(const char *pathname,
size_t
Iso9660InputStream::Read(void *ptr, size_t read_size)
{
+ const ScopeUnlock unlock(mutex);
+
int readed = 0;
int no_blocks, cur_block;
size_t left_bytes = statbuf->size - offset;
diff --git a/src/archive/plugins/ZzipArchivePlugin.cxx b/src/archive/plugins/ZzipArchivePlugin.cxx
index 5ba087f48..fc1e50b16 100644
--- a/src/archive/plugins/ZzipArchivePlugin.cxx
+++ b/src/archive/plugins/ZzipArchivePlugin.cxx
@@ -138,6 +138,8 @@ ZzipArchiveFile::OpenStream(const char *pathname,
size_t
ZzipInputStream::Read(void *ptr, size_t read_size)
{
+ const ScopeUnlock unlock(mutex);
+
int ret = zzip_file_read(file, ptr, read_size);
if (ret < 0)
throw std::runtime_error("zzip_file_read() has failed");
@@ -155,6 +157,8 @@ ZzipInputStream::IsEOF() noexcept
void
ZzipInputStream::Seek(offset_type new_offset)
{
+ const ScopeUnlock unlock(mutex);
+
zzip_off_t ofs = zzip_seek(file, new_offset, SEEK_SET);
if (ofs < 0)
throw std::runtime_error("zzip_seek() has failed");
diff --git a/src/util/WStringAPI.hxx b/src/util/WStringAPI.hxx
index e27f76bb8..6e3aa204d 100644
--- a/src/util/WStringAPI.hxx
+++ b/src/util/WStringAPI.hxx
@@ -103,11 +103,13 @@ UnsafeCopyStringP(wchar_t *dest, const wchar_t *src) noexcept
{
#if defined(_WIN32) || defined(__BIONIC__) || defined(__OpenBSD__) || \
defined(__NetBSD__)
- /* emulate wcpcpy() */
- UnsafeCopyString(dest, src);
- return dest + StringLength(dest);
+ /* emulate wcpcpy() */
+ UnsafeCopyString(dest, src);
+ return dest + StringLength(dest);
+#elif defined(__sun) && defined (__SVR4)
+ return std::wcpcpy(dest, src);
#else
- return wcpcpy(dest, src);
+ return wcpcpy(dest, src);
#endif
}
@@ -159,7 +161,11 @@ gcc_malloc gcc_returns_nonnull gcc_nonnull_all
static inline wchar_t *
DuplicateString(const wchar_t *p)
{
+#if defined(__sun) && defined (__SVR4)
+ return std::wcsdup(p);
+#else
return wcsdup(p);
+#endif
}
#endif