[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-dev] [patch] Get rid of warning in findmicrophones.cpp
From: |
Petter Reinholdtsen |
Subject: |
[Gnash-dev] [patch] Get rid of warning in findmicrophones.cpp |
Date: |
Sat, 20 Nov 2010 18:57:49 +0100 |
User-agent: |
Mutt/1.4.2.2i |
Here is another patch to get rid of this warning from the compiler:
findmicrophones.cpp:152: warning: comparison between signed and
unsigned integer expressions
The cause is the integer fromrc being compared to the unsigned integer
returned from size(), which stay unsigned even after subtracting 1.
The else block in question is used when fromrc != -1, which I believe
also mean that it is a index into the audioVector array, ie values
from 0 and above.
Based on this assumtion, I believe the correct fix is to cast fromrc
to unsigned before comparing to ensure a correct result.
diff --git a/utilities/findmicrophones.cpp b/utilities/findmicrophones.cpp
index e368b5c..435295c 100644
--- a/utilities/findmicrophones.cpp
+++ b/utilities/findmicrophones.cpp
@@ -149,7 +149,7 @@ int main () {
g_print("set microphoneDevice %d\n", dev_select);
} else {
numdevs = findAudioDevs(audioVector);
- if (fromrc <= (audioVector.size() - 1)) {
+ if ((unsigned int)fromrc <= (audioVector.size() - 1)) {
g_print("\nThe gnashrc file reports default microphone is set
to:\n"
g_print("%s (%s)\n", audioVector[fromrc]->deviceName,
audioVector[fromrc]->deviceType);
Happy hacking,
--
Petter Reinholdtsen
- [Gnash-dev] [patch] Get rid of warning in findmicrophones.cpp,
Petter Reinholdtsen <=