]> git.alsa-project.org Git - alsa-plugins.git/commitdiff
Alsa support for Maemo SDK (n770) - Remove compile warnings
authorEduardo Valentin <eduardo.valentin@indt.org.br>
Tue, 7 Nov 2006 10:32:10 +0000 (11:32 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 7 Nov 2006 10:32:10 +0000 (11:32 +0100)
    Here is a patch to remove compile warnings. It must be applied
after last patch set I sent.
    This patch simply changes signedness of some point from the code
to match the correct sign used by dsp-protocol structures. All must
use unsigned variables.
    It also changes the way the pthread_mutex is initialized. The
warning about pthreads is also removed.

    I tested the compilation with:
gcc (GCC) 4.1.2 20061028 (prerelease) (Debian 4.1.1-19)
and
sbox-arm-linux-gcc (GCC) 3.4.4 (release) (CodeSourcery ARM 2005q3-2)

Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br>
maemo/alsa-dsp.c
maemo/dsp-ctl.c
maemo/dsp-protocol.c
maemo/dsp-protocol.h

index f23741ccb86ade40a54105fbb4c877b3e1a83a53..50ffb00625934914af8cfc575313ff5906b914c4 100644 (file)
@@ -164,7 +164,6 @@ static snd_pcm_sframes_t alsa_dsp_transfer(snd_pcm_ioplug_t * io,
                                                    words);
        result *= 2;
        result /= alsa_dsp->bytes_per_frame;
-      out:
        alsa_dsp->hw_pointer += result;
        DLEAVE(result);
        return result;
index a7a2be01bc59f610a1174103ecae5a9596155f4c..da00c1aa47ee43d5e8b678bb64ec88307be6effb 100644 (file)
@@ -273,7 +273,7 @@ static int dsp_ctl_read_integer(snd_ctl_ext_t * ext, snd_ctl_ext_key_t key,
                                long *value)
 {
        int ret = 0;
-       char left, right;
+       unsigned char left, right;
        snd_ctl_dsp_t *dsp_ctl = ext->private_data;
        control_list_t *tmp = dsp_ctl->controls[key];
 
@@ -317,7 +317,7 @@ static int dsp_ctl_write_integer(snd_ctl_ext_t * ext, snd_ctl_ext_key_t key,
                                 long *value)
 {
        int ret;
-       char left, right;
+       unsigned char left, right;
        snd_ctl_dsp_t *dsp_ctl = ext->private_data;
        control_list_t *tmp = dsp_ctl->controls[key];
 
index a0fa6a09ca73179a62bbe1af055fb8858652b0de..1e7ef66cbe1b675d242e9bbbf65d61b4a6fc58e8 100644 (file)
@@ -69,10 +69,12 @@ union semun {
 static int dsp_protocol_flush(dsp_protocol_t * dsp_protocol);
 static int dsp_protocol_send_command(dsp_protocol_t * dsp_protocol,
                                     const short int command);
-static void dsp_protocol_linear2Q15(const short int input,
-                                   short int *scale, short int *power2);
-static void dsp_protocol_Q152linear(const short int scale,
-                                   const short int power2, short int *output);
+static void dsp_protocol_linear2Q15(const unsigned short int input,
+                                   unsigned short int *scale, 
+                                   unsigned short int *power2);
+static void dsp_protocol_Q152linear(const unsigned short int scale,
+                                   const unsigned short int power2, 
+                                   unsigned short int *output);
 static int dsp_protocol_update_state(dsp_protocol_t * dsp_protocol);
 static inline int dsp_protocol_get_sem(dsp_protocol_t * dsp_protocol);
 static inline int dsp_protocol_lock_dev(dsp_protocol_t * dsp_protocol);
@@ -90,8 +92,8 @@ static inline int dsp_protocol_unlock_dev(dsp_protocol_t * dsp_protocol);
  */
 int dsp_protocol_create(dsp_protocol_t ** dsp_protocol)
 {
+       pthread_mutex_t mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
        int ret = 0;
-       pthread_mutexattr_t mattr;
        DENTER();
        *dsp_protocol = (dsp_protocol_t *) calloc(1, sizeof(dsp_protocol_t));
        if ((*dsp_protocol) == NULL) {
@@ -107,9 +109,7 @@ int dsp_protocol_create(dsp_protocol_t ** dsp_protocol)
        (*dsp_protocol)->bridge_buffer_size = 0;
        (*dsp_protocol)->mmap_buffer_size = 0;
        (*dsp_protocol)->mmap_buffer = NULL;
-       pthread_mutexattr_init(&mattr);
-       pthread_mutexattr_settype(PTHREAD_MUTEX_ERRORCHECK_NP);
-       pthread_mutex_init(&((*dsp_protocol)->mutex), &mattr);
+       (*dsp_protocol)->mutex = mutex;
        (*dsp_protocol)->sem_set_id = -1;
 #ifdef USE_RESOURCE_MANAGER
         (*dsp_protocol)->dbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
@@ -719,7 +719,7 @@ int dsp_protocol_set_volume(dsp_protocol_t * dsp_protocol,
 int dsp_protocol_get_volume(dsp_protocol_t * dsp_protocol,
                            unsigned char *left, unsigned char *right)
 {
-       short int tmp;
+       unsigned short int tmp;
        int ret;
        audio_status_info_t audio_status_info;
        DENTER();
@@ -1050,8 +1050,9 @@ static int dsp_protocol_send_command(dsp_protocol_t * dsp_protocol,
  * Converts a 0 - 100 value to a Q15 format value.
  * 
  */
-static void dsp_protocol_linear2Q15(const short int input,
-                                   short int *scale, short int *power2)
+static void dsp_protocol_linear2Q15(const unsigned short int input,
+                                   unsigned short int *scale, 
+                                   unsigned short int *power2)
 {
        unsigned long int val = MAGIC_NUMBER * input;
        DENTER();
@@ -1079,8 +1080,8 @@ static void dsp_protocol_linear2Q15(const short int input,
  * Converts a Q15 format value to a 0 - 100 value.
  * 
  */
-static void dsp_protocol_Q152linear(const short int scale,
-                                   const short int power2, short int *output)
+static void dsp_protocol_Q152linear(const unsigned short int scale,
+                                   const unsigned short int power2, unsigned short int *output)
 {
        float result = scale * 1.0 / 0x8000 * pow(2.0, 1.0 * power2) * 100.0;
        DENTER();
index be5d554e8884c9fcf28345aa96d7d1a8cbd2aa1c..d3f271177539402811e3ff7ade8673936ab6e706 100644 (file)
@@ -24,7 +24,7 @@
 #ifndef _DSP_PROTOCOL_H
 #define _DSP_PROTOCOL_H
 
-#define _GNU_SOURCE
+#define __USE_GNU
 #include <features.h>
 #include <pthread.h>
 #include <semaphore.h>