Use size_t and ssize_t with Vector
Use size_t with size() and ssize_t with indexOfKey(). Exception:
use ssize_t for backwards loops, and indices that are overloaded as a
marker or error code.
Change-Id: Ibf2a360af4539b72b09c818dda22ea2a0de92431
diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp
index 21b5811..041b5a8 100644
--- a/services/audioflinger/AudioPolicyService.cpp
+++ b/services/audioflinger/AudioPolicyService.cpp
@@ -768,7 +768,7 @@
snprintf(buffer, SIZE, "- Commands:\n");
result = String8(buffer);
result.append(" Command Time Wait pParam\n");
- for (int i = 0; i < (int)mAudioCommands.size(); i++) {
+ for (size_t i = 0; i < mAudioCommands.size(); i++) {
mAudioCommands[i]->dump(buffer, SIZE);
result.append(buffer);
}
@@ -902,7 +902,7 @@
// insertCommand_l() must be called with mLock held
void AudioPolicyService::AudioCommandThread::insertCommand_l(AudioCommand *command, int delayMs)
{
- ssize_t i;
+ ssize_t i; // not size_t because i will count down to -1
Vector <AudioCommand *> removedCommands;
command->mTime = systemTime() + milliseconds(delayMs);