summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/AudioFlinger.h
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2012-01-30 10:15:48 -0800
committerGlenn Kasten <gkasten@google.com>2012-01-30 10:31:09 -0800
commit435dbe6c3ecd04bcb4bd80584064e287ebccd720 (patch)
treeaa42e717d186dc84491e03c675c8c93683407fcf /services/audioflinger/AudioFlinger.h
parentfd267d7cf640225bb57f0ed1af44efc153275f6d (diff)
downloadframeworks_av-435dbe6c3ecd04bcb4bd80584064e287ebccd720.zip
frameworks_av-435dbe6c3ecd04bcb4bd80584064e287ebccd720.tar.gz
frameworks_av-435dbe6c3ecd04bcb4bd80584064e287ebccd720.tar.bz2
Fix const sp<>& in parameter list and return value
EffectModule::addHandle and Client::heap() were declared incorrectly. As a parameter, an sp<> should be & for efficiency, and for input parameters it should also be const to protect the caller's value. But as a return value, an sp<> should have neither const or &. The "e" in "return e;" might be located on the stack, and if there is "&" then the caller would see the address of a variable which no longer exists. Also, an & would make it hard to do "return 0;". A "const" without & is meaningless in the return type. (In this particular case, the "e" is a member field, so it was safe.) Change-Id: I3df5f294214eb15a9d4d596c6d5ef29de97b5c27
Diffstat (limited to 'services/audioflinger/AudioFlinger.h')
-rw-r--r--services/audioflinger/AudioFlinger.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 766ba44..ece4ba2 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -226,7 +226,7 @@ private:
public:
Client(const sp<AudioFlinger>& audioFlinger, pid_t pid);
virtual ~Client();
- const sp<MemoryDealer>& heap() const;
+ sp<MemoryDealer> heap() const;
pid_t pid() const { return mPid; }
sp<AudioFlinger> audioFlinger() { return mAudioFlinger; }
@@ -1107,7 +1107,7 @@ private:
void setThread(const wp<ThreadBase>& thread) { mThread = thread; }
wp<ThreadBase>& thread() { return mThread; }
- status_t addHandle(sp<EffectHandle>& handle);
+ status_t addHandle(const sp<EffectHandle>& handle);
void disconnect(const wp<EffectHandle>& handle, bool unpiniflast);
size_t removeHandle (const wp<EffectHandle>& handle);