Fixed various errors/warnings reported by cppcheck:

* memory leaks
* resource leaks
* added const's to getters
* removed a few reundant conditions


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35433 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Artur Wyszynski
2010-02-08 22:50:38 +00:00
parent c0cd8cf199
commit cee04e8074
54 changed files with 153 additions and 126 deletions
+24 -28
View File
@@ -17,50 +17,50 @@ class BGLRenderer
{
// Private unimplemented copy constructors
BGLRenderer(const BGLRenderer &);
BGLRenderer & operator=(const BGLRenderer &);
BGLRenderer(const BGLRenderer &);
BGLRenderer & operator=(const BGLRenderer &);
public:
BGLRenderer(BGLView *view, ulong bgl_options, BGLDispatcher *dispatcher);
virtual ~BGLRenderer();
BGLRenderer(BGLView *view, ulong bgl_options, BGLDispatcher *dispatcher);
virtual ~BGLRenderer();
void Acquire();
void Release();
void Acquire();
void Release();
virtual void LockGL();
virtual void UnlockGL();
virtual void SwapBuffers(bool VSync = false);
virtual void Draw(BRect updateRect);
virtual status_t CopyPixelsOut(BPoint source, BBitmap *dest);
virtual status_t CopyPixelsIn(BBitmap *source, BPoint dest);
virtual status_t CopyPixelsOut(BPoint source, BBitmap *dest);
virtual status_t CopyPixelsIn(BBitmap *source, BPoint dest);
virtual void FrameResized(float width, float height);
virtual void DirectConnected(direct_buffer_info *info);
virtual void EnableDirectMode(bool enabled);
virtual void DirectConnected(direct_buffer_info *info);
virtual void EnableDirectMode(bool enabled);
inline int32 ReferenceCount() { return fRefCount; };
inline ulong Options() { return fOptions; };
inline BGLView * GLView() { return fView; };
inline int32 ReferenceCount() const { return fRefCount; };
inline ulong Options() const { return fOptions; };
inline BGLView * GLView() { return fView; };
inline BGLDispatcher * GLDispatcher() { return fDispatcher; };
private:
friend class GLRendererRoster;
virtual status_t _Reserved_Renderer_0(int32, void *);
virtual status_t _Reserved_Renderer_1(int32, void *);
virtual status_t _Reserved_Renderer_2(int32, void *);
virtual status_t _Reserved_Renderer_3(int32, void *);
virtual status_t _Reserved_Renderer_4(int32, void *);
virtual status_t _Reserved_Renderer_0(int32, void *);
virtual status_t _Reserved_Renderer_1(int32, void *);
virtual status_t _Reserved_Renderer_2(int32, void *);
virtual status_t _Reserved_Renderer_3(int32, void *);
virtual status_t _Reserved_Renderer_4(int32, void *);
volatile int32 fRefCount; // How much we're still usefull?
BGLView * fView; // Never forget who is the boss!
ulong fOptions; // Keep that tune in memory
BGLDispatcher * fDispatcher; // Our personal OpenGL API call dispatcher
volatile int32 fRefCount; // How much we're still usefull?
BGLView* fView; // Never forget who is the boss!
ulong fOptions; // Keep that tune in memory
BGLDispatcher* fDispatcher; // Our personal OpenGL API call dispatcher
GLRendererRoster *fOwningRoster;
renderer_id fID;
GLRendererRoster* fOwningRoster;
renderer_id fID;
};
extern "C" _EXPORT BGLRenderer * instantiate_gl_renderer(BGLView *view, ulong options, BGLDispatcher *dispatcher);
@@ -68,7 +68,3 @@ extern "C" _EXPORT BGLRenderer * instantiate_gl_renderer(BGLView *view, ulong op
#endif // GLRENDERER_H
+1 -1
View File
@@ -27,7 +27,7 @@ class LinkReceiver {
virtual ~LinkReceiver(void);
void SetPort(port_id port);
port_id Port(void) { return fReceivePort; }
port_id Port(void) const { return fReceivePort; }
status_t GetNextMessage(int32& code, bigtime_t timeout = B_INFINITE_TIMEOUT);
bool HasMessages() const;
+1 -1
View File
@@ -22,7 +22,7 @@ class LinkSender {
virtual ~LinkSender(void);
void SetPort(port_id port);
port_id Port() { return fPort; }
port_id Port() const { return fPort; }
status_t StartMessage(int32 code, size_t minSize = 0);
void CancelMessage(void);
+2 -2
View File
@@ -77,10 +77,10 @@ public:
throw fError;
}
status_t Status() { return fError >= B_OK ? B_OK : fError; };
status_t Status() const { return fError >= B_OK ? B_OK : fError; };
void SetSwap(bool yesNo) { fSwap = yesNo; };
bool IsSwapping() { return fSwap; };
bool IsSwapping() const { return fSwap; };
private:
BDataIO *fStream;
@@ -71,7 +71,7 @@ class Autolock {
}
bool
IsLocked()
IsLocked() const
{
return fStatus == B_OK;
}
+2 -2
View File
@@ -82,12 +82,12 @@ public:
return -1;
}
int CountItems()
int CountItems() const
{
return item_count;
}
bool IsEmpty()
bool IsEmpty() const
{
return item_count == 0;
}
@@ -44,16 +44,16 @@ public:
BPath& Path() { return fSettingsPath; }
// General screen saver settings
int32 TimeFlags() { return fTimeFlags; }
bigtime_t BlankTime() { return fBlankTime; }
bigtime_t StandByTime() { return fStandByTime; }
bigtime_t SuspendTime() { return fSuspendTime; }
bigtime_t OffTime() { return fOffTime; }
int32 TimeFlags() const { return fTimeFlags; }
bigtime_t BlankTime() const { return fBlankTime; }
bigtime_t StandByTime() const { return fStandByTime; }
bigtime_t SuspendTime() const { return fSuspendTime; }
bigtime_t OffTime() const { return fOffTime; }
screen_corner BlankCorner() { return fBlankCorner; }
screen_corner NeverBlankCorner() { return fNeverBlankCorner; }
bool LockEnable() { return fLockEnabled; }
bigtime_t PasswordTime() { return fPasswordTime; }
screen_corner BlankCorner() const { return fBlankCorner; }
screen_corner NeverBlankCorner() const { return fNeverBlankCorner; }
bool LockEnable() const { return fLockEnabled; }
bigtime_t PasswordTime() const { return fPasswordTime; }
const char* Password() { return fPassword.String(); }
const char* LockMethod() { return fLockMethod.String(); }
bool IsNetworkPassword()
@@ -93,8 +93,8 @@ public:
BMessage* stateMessage);
// ScreenSaver preferences settings
BRect WindowFrame() { return fWindowFrame; }
int32 WindowTab() { return fWindowTab; }
BRect WindowFrame() const { return fWindowFrame; }
int32 WindowTab() const { return fWindowTab; }
void SetWindowFrame(const BRect& frame)
{ fWindowFrame = frame; }