OSDN Git Service

Change struct timeout * to const struct timeout *
authorGlenn Kasten <gkasten@google.com>
Sun, 16 Oct 2016 21:51:15 +0000 (14:51 -0700)
committerGlenn Kasten <gkasten@google.com>
Mon, 17 Oct 2016 22:21:09 +0000 (15:21 -0700)
Test: builds OK
Change-Id: I8372ab83a50d527dffbfbb5014ac93ee4692f577

audio_utils/fifo.cpp
audio_utils/include/audio_utils/fifo.h

index 29c6642..a148db6 100644 (file)
@@ -65,7 +65,8 @@ int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *reques
 }
 #endif  // __linux__
 
-static int sys_futex(void *addr1, int op, int val1, struct timespec *timeout, void *addr2, int val3)
+static int sys_futex(void *addr1, int op, int val1, const struct timespec *timeout, void *addr2,
+        int val3)
 {
 #ifdef __linux__
     return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);
@@ -200,7 +201,8 @@ audio_utils_fifo_writer::~audio_utils_fifo_writer()
 {
 }
 
-ssize_t audio_utils_fifo_writer::write(const void *buffer, size_t count, struct timespec *timeout)
+ssize_t audio_utils_fifo_writer::write(const void *buffer, size_t count,
+        const struct timespec *timeout)
         __attribute__((no_sanitize("integer")))
 {
     audio_utils_iovec iovec[2];
@@ -220,7 +222,7 @@ ssize_t audio_utils_fifo_writer::write(const void *buffer, size_t count, struct
 
 // iovec == NULL is not part of the public API, but is used internally to mean don't set mObtained
 ssize_t audio_utils_fifo_writer::obtain(audio_utils_iovec iovec[2], size_t count,
-        struct timespec *timeout)
+        const struct timespec *timeout)
         __attribute__((no_sanitize("integer")))
 {
     int err = 0;
@@ -426,7 +428,7 @@ audio_utils_fifo_reader::~audio_utils_fifo_reader()
     // TODO Need a way to pass throttle capability to the another reader, should one reader exit.
 }
 
-ssize_t audio_utils_fifo_reader::read(void *buffer, size_t count, struct timespec *timeout,
+ssize_t audio_utils_fifo_reader::read(void *buffer, size_t count, const struct timespec *timeout,
         size_t *lost)
         __attribute__((no_sanitize("integer")))
 {
@@ -446,7 +448,7 @@ ssize_t audio_utils_fifo_reader::read(void *buffer, size_t count, struct timespe
 }
 
 ssize_t audio_utils_fifo_reader::obtain(audio_utils_iovec iovec[2], size_t count,
-        struct timespec *timeout)
+        const struct timespec *timeout)
         __attribute__((no_sanitize("integer")))
 {
     return obtain(iovec, count, timeout, NULL /*lost*/);
@@ -502,7 +504,7 @@ void audio_utils_fifo_reader::release(size_t count)
 
 // iovec == NULL is not part of the public API, but is used internally to mean don't set mObtained
 ssize_t audio_utils_fifo_reader::obtain(audio_utils_iovec iovec[2], size_t count,
-        struct timespec *timeout, size_t *lost)
+        const struct timespec *timeout, size_t *lost)
         __attribute__((no_sanitize("integer")))
 {
     int err = 0;
index bb55ab4..35326a8 100644 (file)
@@ -243,7 +243,7 @@ public:
      * except they convey extra information as to the cause.
      */
     virtual ssize_t obtain(audio_utils_iovec iovec[2], size_t count,
-            struct timespec *timeout = NULL) = 0;
+            const struct timespec *timeout = NULL) = 0;
 
     /**
      * Release access to a portion of the most recently obtained slice.
@@ -310,11 +310,11 @@ public:
      *  \retval -EINTR     count is greater than zero, timeout is non-NULL and not {0, 0}, timeout
      *                     was interrupted by a signal, and no frames were available after signal.
      */
-    ssize_t write(const void *buffer, size_t count, struct timespec *timeout = NULL);
+    ssize_t write(const void *buffer, size_t count, const struct timespec *timeout = NULL);
 
     // Implement audio_utils_fifo_provider
     virtual ssize_t obtain(audio_utils_iovec iovec[2], size_t count,
-            struct timespec *timeout = NULL);
+            const struct timespec *timeout = NULL);
     virtual void release(size_t count);
     virtual ssize_t available();
 
@@ -424,11 +424,12 @@ public:
      *  \retval -EINTR      count is greater than zero, timeout is non-NULL and not {0, 0}, timeout
      *                      was interrupted by a signal, and no frames were available after signal.
      */
-    ssize_t read(void *buffer, size_t count, struct timespec *timeout = NULL, size_t *lost = NULL);
+    ssize_t read(void *buffer, size_t count, const struct timespec *timeout = NULL,
+            size_t *lost = NULL);
 
     // Implement audio_utils_fifo_provider
     virtual ssize_t obtain(audio_utils_iovec iovec[2], size_t count,
-            struct timespec *timeout = NULL);
+            const struct timespec *timeout = NULL);
     virtual void release(size_t count);
     virtual ssize_t available();
 
@@ -441,7 +442,7 @@ public:
      * \param lost    If non-NULL, updated to the approximate number of lost frames before re-sync.
      * \return See audio_utils_fifo_provider::obtain for 'Returns' and 'Return values'.
      */
-    ssize_t obtain(audio_utils_iovec iovec[2], size_t count, struct timespec *timeout,
+    ssize_t obtain(audio_utils_iovec iovec[2], size_t count, const struct timespec *timeout,
             size_t *lost);
 
     /**