changeset 3182:631d217913e0

alsa-ng: Fix arithmetic overflow on 32-bit systems.
author John Lindgren <john.lindgren@tds.net>
date Fri, 12 Jun 2009 09:17:09 -0400
parents dc22f5fa8f2f
children 19e3ec80dac9
files src/alsa-ng/alsa-core.c
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/alsa-ng/alsa-core.c	Thu Jun 11 20:21:16 2009 -0500
+++ b/src/alsa-ng/alsa-core.c	Fri Jun 12 09:17:09 2009 -0400
@@ -116,7 +116,7 @@
         snd_mixer_close(*mixer);
         _ERROR("failed to load hardware mixer controls: %s", snd_strerror(ret));
         return ret;
-    }    
+    }
 
     return 0;
 }
@@ -148,7 +148,7 @@
             snd_mixer_selem_set_playback_switch(elem, SND_MIXER_SCHN_FRONT_LEFT, l != 0);
             snd_mixer_selem_set_playback_switch(elem, SND_MIXER_SCHN_FRONT_RIGHT, r != 0);
         }
-    }    
+    }
 
     snd_mixer_handle_events(amixer);
 }
@@ -220,7 +220,7 @@
         {
             snd_pcm_drop(pcm_handle);
             snd_pcm_prepare(pcm_handle);
-            wr_total = flush_request * (bps / 1000);
+            wr_total = flush_request * (long long) bps / 1000;
             flush_request = -1;
 
             g_cond_broadcast(pcm_flush_cond);
@@ -380,7 +380,7 @@
                 bytes -= d;
         }
 
-        ret = (bytes * 1000) / bps;
+        ret = bytes * (long long) 1000 / bps;
     }
 
     g_mutex_unlock(pcm_state_mutex);
@@ -442,7 +442,7 @@
 
     if (pcm_going == FALSE)
         ret = 0;
-    else 
+    else
         ret = alsaplug_ringbuffer_used(&pcm_ringbuf) != 0;
 
     g_mutex_unlock(pcm_state_mutex);