Merge pull request #3113 from ace20022/cleanup_guilib
authorMartijn Kaijser <machine.sanctum@gmail.com>
Sun, 25 Aug 2013 21:21:31 +0000 (14:21 -0700)
committerMartijn Kaijser <machine.sanctum@gmail.com>
Sun, 25 Aug 2013 21:21:31 +0000 (14:21 -0700)
[guilib] Cleanup things found by Cppcheck

70 files changed:
xbmc/guilib/AnimatedGif.h
xbmc/guilib/D3DResource.h
xbmc/guilib/DDSImage.cpp
xbmc/guilib/DDSImage.h
xbmc/guilib/DirectXGraphics.cpp
xbmc/guilib/FrameBufferObject.cpp
xbmc/guilib/FrameBufferObject.h
xbmc/guilib/GUIAction.cpp
xbmc/guilib/GUIBaseContainer.cpp
xbmc/guilib/GUIBaseContainer.h
xbmc/guilib/GUIBorderedImage.cpp
xbmc/guilib/GUIButtonControl.h
xbmc/guilib/GUICallback.h
xbmc/guilib/GUICheckMarkControl.cpp
xbmc/guilib/GUIControl.cpp
xbmc/guilib/GUIControl.h
xbmc/guilib/GUIControlFactory.h
xbmc/guilib/GUIControlGroup.cpp
xbmc/guilib/GUIControlGroup.h
xbmc/guilib/GUIEditControl.h
xbmc/guilib/GUIFadeLabelControl.cpp
xbmc/guilib/GUIFontManager.cpp
xbmc/guilib/GUIFontManager.h
xbmc/guilib/GUIFontTTF.cpp
xbmc/guilib/GUIFontTTF.h
xbmc/guilib/GUIFontTTFDX.cpp
xbmc/guilib/GUIImage.cpp
xbmc/guilib/GUIImage.h
xbmc/guilib/GUIInfoTypes.cpp
xbmc/guilib/GUIInfoTypes.h
xbmc/guilib/GUILabel.cpp
xbmc/guilib/GUIListItem.cpp
xbmc/guilib/GUIListItem.h
xbmc/guilib/GUIListLabel.cpp
xbmc/guilib/GUIMessage.cpp
xbmc/guilib/GUIMessage.h
xbmc/guilib/GUIMultiImage.cpp
xbmc/guilib/GUIMultiSelectText.cpp
xbmc/guilib/GUIRSSControl.cpp
xbmc/guilib/GUISliderControl.h
xbmc/guilib/GUISpinControl.cpp
xbmc/guilib/GUIStaticItem.cpp
xbmc/guilib/GUITextBox.cpp
xbmc/guilib/GUITextLayout.cpp
xbmc/guilib/GUITextLayout.h
xbmc/guilib/GUITexture.cpp
xbmc/guilib/GUITexture.h
xbmc/guilib/GUIVisualisationControl.cpp
xbmc/guilib/GUIWindow.cpp
xbmc/guilib/GUIWindowManager.cpp
xbmc/guilib/GUIWindowManager.h
xbmc/guilib/GraphicContext.cpp
xbmc/guilib/JpegIO.cpp
xbmc/guilib/JpegIO.h
xbmc/guilib/Key.cpp
xbmc/guilib/Key.h
xbmc/guilib/LocalizeStrings.h
xbmc/guilib/MatrixGLES.h
xbmc/guilib/Resolution.h
xbmc/guilib/Shader.h
xbmc/guilib/StereoscopicsManager.cpp
xbmc/guilib/Texture.cpp
xbmc/guilib/Texture.h
xbmc/guilib/TextureBundleXPR.cpp
xbmc/guilib/TextureManager.cpp
xbmc/guilib/TextureManager.h
xbmc/guilib/Tween.h
xbmc/guilib/VisibleEffect.cpp
xbmc/guilib/VisibleEffect.h
xbmc/guilib/iimage.h

index 4c4d23d..4739b29 100644 (file)
@@ -154,6 +154,6 @@ public:
 
   void Release();
 protected:
-  unsigned char getbyte(FILE *fd);
+  static unsigned char getbyte(FILE *fd);
 };
 
index 36c7350..a926736 100644 (file)
@@ -50,8 +50,8 @@ public:
 
   // Accessors
   LPDIRECT3DTEXTURE9 Get() const { return m_texture; };
-  UINT GetWidth()  { return m_width; }
-  UINT GetHeight() { return m_height; }
+  UINT GetWidth()  const { return m_width; }
+  UINT GetHeight() const { return m_height; }
 
   virtual void OnDestroyDevice();
   virtual void OnCreateDevice();
index a21bf4b..9d1cbba 100644 (file)
@@ -144,7 +144,7 @@ bool CDDSImage::WriteFile(const std::string &outputFile) const
   return true;
 }
 
-unsigned int CDDSImage::GetStorageRequirements(unsigned int width, unsigned int height, unsigned int format) const
+unsigned int CDDSImage::GetStorageRequirements(unsigned int width, unsigned int height, unsigned int format)
 {
   switch (format)
   {
@@ -248,7 +248,7 @@ void CDDSImage::Allocate(unsigned int width, unsigned int height, unsigned int f
   m_data = new unsigned char[m_desc.linearSize];
 }
 
-const char *CDDSImage::GetFourCC(unsigned int format) const
+const char *CDDSImage::GetFourCC(unsigned int format)
 {
   switch (format)
   {
index aa9a0cc..3856ebe 100644 (file)
@@ -63,7 +63,7 @@ public:
 
 private:
   void Allocate(unsigned int width, unsigned int height, unsigned int format);
-  const char *GetFourCC(unsigned int format) const;
+  static const char *GetFourCC(unsigned int format);
   bool WriteFile(const std::string &file) const;
 
   /*! \brief Compress an ARGB buffer into a DXT1/3/5 image
@@ -76,7 +76,7 @@ private:
    */
   bool Compress(unsigned int width, unsigned int height, unsigned int pitch, unsigned char const *argb, double maxMSE = 0);
 
-  unsigned int GetStorageRequirements(unsigned int width, unsigned int height, unsigned int format) const;
+  static unsigned int GetStorageRequirements(unsigned int width, unsigned int height, unsigned int format);
   enum {
     ddsd_caps        = 0x00000001,
     ddsd_height      = 0x00000002,
index fdcf800..47efb29 100644 (file)
@@ -117,7 +117,7 @@ bool IsSwizzledFormat(XB_D3DFORMAT format)
 // Currently only works for 32bit and 8bit textures, with power of 2 width and height
 void Unswizzle(const void *src, unsigned int depth, unsigned int width, unsigned int height, void *dest)
 {
-  if (height <= 0 || width <= 0)
+  if (height == 0 || width == 0)
     return;
 
   for (UINT y = 0; y < height; y++)
index 6b41452..1fa9398 100644 (file)
@@ -154,7 +154,7 @@ bool CFrameBufferObject::BeginRender()
 }
 
 // Finish rendering to FBO
-void CFrameBufferObject::EndRender()
+void CFrameBufferObject::EndRender() const
 {
   if (IsValid())
     glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
index e7e5af2..9aa6386 100644 (file)
@@ -55,10 +55,10 @@ public:
   bool IsSupported();
 
   // returns true if FBO has been initialized
-  bool IsValid() { return m_valid; }
+  bool IsValid() const { return m_valid; }
 
   // returns true if FBO has a texture bound to it
-  bool IsBound() { return m_bound; }
+  bool IsBound() const { return m_bound; }
 
   // initialize the FBO
   bool Initialize();
@@ -77,12 +77,12 @@ public:
                               GLenum filter=GL_LINEAR, GLenum clampmode=GL_CLAMP_TO_EDGE);
 
   // Return the internally created texture ID
-  GLuint Texture() { return m_texid; }
+  GLuint Texture() const { return m_texid; }
 
   // Begin rendering to FBO
   bool BeginRender();
   // Finish rendering to FBO
-  void EndRender();
+  void EndRender() const;
 
 private:
   GLuint m_fbo;
index 0633a23..26b7694 100644 (file)
@@ -42,7 +42,7 @@ bool CGUIAction::ExecuteActions(int controlID, int parentID) const
   if (m_actions.size() == 0) return false;
   // take a copy of actions that satisfy our conditions
   vector<CStdString> actions;
-  for (ciActions it = m_actions.begin() ; it != m_actions.end() ; it++)
+  for (ciActions it = m_actions.begin() ; it != m_actions.end() ; ++it)
   {
     if (it->condition.IsEmpty() || g_infoManager.EvaluateBool(it->condition))
     {
@@ -67,7 +67,7 @@ bool CGUIAction::ExecuteActions(int controlID, int parentID) const
 
 int CGUIAction::GetNavigation() const
 {
-  for (ciActions it = m_actions.begin() ; it != m_actions.end() ; it++)
+  for (ciActions it = m_actions.begin() ; it != m_actions.end() ; ++it)
   {
     if (StringUtils::IsInteger(it->action))
     {
@@ -83,7 +83,7 @@ void CGUIAction::SetNavigation(int id)
   if (id == 0) return;
   CStdString strId;
   strId.Format("%i", id);
-  for (iActions it = m_actions.begin() ; it != m_actions.end() ; it++)
+  for (iActions it = m_actions.begin() ; it != m_actions.end() ; ++it)
   {
     if (StringUtils::IsInteger(it->action) && it->condition.IsEmpty())
     {
@@ -98,7 +98,7 @@ void CGUIAction::SetNavigation(int id)
 
 bool CGUIAction::HasActionsMeetingCondition() const
 {
-  for (ciActions it = m_actions.begin() ; it != m_actions.end() ; it++)
+  for (ciActions it = m_actions.begin() ; it != m_actions.end() ; ++it)
   {
     if (it->condition.IsEmpty() || g_infoManager.EvaluateBool(it->condition))
       return true;
index e37750a..a89e4e8 100644 (file)
@@ -807,7 +807,7 @@ void CGUIBaseContainer::UpdateLayout(bool updateAllItems)
 {
   if (updateAllItems)
   { // free memory of items
-    for (iItems it = m_items.begin(); it != m_items.end(); it++)
+    for (iItems it = m_items.begin(); it != m_items.end(); ++it)
       (*it)->FreeMemory();
   }
   // and recalculate the layout
@@ -1206,7 +1206,7 @@ int CGUIBaseContainer::GetCurrentPage() const
   return GetOffset() / m_itemsPerPage + 1;
 }
 
-void CGUIBaseContainer::GetCacheOffsets(int &cacheBefore, int &cacheAfter)
+void CGUIBaseContainer::GetCacheOffsets(int &cacheBefore, int &cacheAfter) const
 {
   if (m_scroller.IsScrollingDown())
   {
index 63d3c4f..f433e69 100644 (file)
@@ -161,7 +161,7 @@ protected:
                     // changing around)
 
   void UpdateScrollByLetter();
-  void GetCacheOffsets(int &cacheBefore, int &cacheAfter);
+  void GetCacheOffsets(int &cacheBefore, int &cacheAfter) const;
   int GetCacheCount() const { return m_cacheItems; };
   bool ScrollingDown() const { return m_scroller.IsScrollingDown(); };
   bool ScrollingUp() const { return m_scroller.IsScrollingUp(); };
index 2e4d3c1..7582fcf 100644 (file)
@@ -29,9 +29,8 @@ CGUIBorderedImage::CGUIBorderedImage(int parentID, int controlID, float posX, fl
 }
 
 CGUIBorderedImage::CGUIBorderedImage(const CGUIBorderedImage &right)
-: CGUIImage(right), m_borderImage(right.m_borderImage)
+: CGUIImage(right), m_borderImage(right.m_borderImage), m_borderSize(right.m_borderSize)
 {
-  m_borderSize = right.m_borderSize;
   ControlType = GUICONTROL_BORDEREDIMAGE;
 }
 
index ddbf2c1..1b6a2b6 100644 (file)
@@ -73,7 +73,7 @@ public:
   void PythonSetDisabledColor(color_t disabledColor);
 
   virtual void OnClick();
-  bool HasClickActions() { return m_clickActions.HasActionsMeetingCondition(); };
+  bool HasClickActions() const { return m_clickActions.HasActionsMeetingCondition(); };
 
   virtual bool UpdateColors();
 
index 29fea51..2810ba0 100644 (file)
@@ -55,27 +55,22 @@ public:
   // Assign an EventHandler (EventHandler's are derived from Event)
   GUIEvent<Cookie> &operator=(GUIEvent<Cookie> &aEvent)
   {
-    if (&aEvent)
+    if (&aEvent != this)
     {
       m_pInstance = aEvent.m_pInstance;
       m_pMethod = aEvent.m_pMethod;
     }
-    else
-    {
-      GUIEvent();
-    }
-
     return *this;
   }
 
   // Are the class instance and method pointers initialised?
-  bool HasAHandler()
+  bool HasAHandler() const
   {
     return (m_pInstance && m_pMethod);
   }
 
   // Execute the associated class method
-  void Fire(Cookie aCookie)
+  void Fire(Cookie aCookie) const
   {
     if (HasAHandler())
     {
@@ -136,27 +131,22 @@ public:
   // Assign a CallbackHandler (CallbackHandler's are derived from Callback)
   Callback<Result, Cookie> &operator=(Callback<Result, Cookie> &aCallback)
   {
-    if (&aCallback)
+    if (&aCallback != this)
     {
       m_pInstance = aCallback.m_pInstance;
       m_pMethod = aCallback.m_pMethod;
     }
-    else
-    {
-      Callback();
-    }
-
     return *this;
   }
 
   // Are the class instance and method pointers initialised?
-  bool HasAHandler()
+  bool HasAHandler() const
   {
     return (m_pInstance && m_pMethod);
   }
 
   // Execute the associated class method and return the result
-  Result Fire(Cookie aCookie)
+  Result Fire(Cookie aCookie) const
   {
     if (HasAHandler())
     {
index e7d1dd5..bf7bcbb 100644 (file)
@@ -29,8 +29,8 @@ CGUICheckMarkControl::CGUICheckMarkControl(int parentID, int controlID, float po
     , m_imgCheckMark(posX, posY, checkWidth, checkHeight, textureCheckMark)
     , m_imgCheckMarkNoFocus(posX, posY, checkWidth, checkHeight, textureCheckMarkNF)
     , m_label(posX, posY, width, height, labelInfo)
+    , m_strLabel("")
 {
-  m_strLabel = "";
   m_bSelected = false;
   m_label.GetLabelInfo().align |= XBFONT_CENTER_Y;
   ControlType = GUICONTROL_CHECKMARK;
index 1bfb020..9c58fa0 100644 (file)
@@ -30,7 +30,8 @@
 
 using namespace std;
 
-CGUIControl::CGUIControl()
+CGUIControl::CGUIControl() :
+  m_diffuseColor(0xffffffff)
 {
   m_hasProcessed = false;
   m_bHasFocus = false;
@@ -42,7 +43,6 @@ CGUIControl::CGUIControl()
   m_visibleCondition = 0;
   m_enableCondition = 0;
   m_enabled = true;
-  m_diffuseColor = 0xffffffff;
   m_posX = 0;
   m_posY = 0;
   m_width = 0;
@@ -58,7 +58,8 @@ CGUIControl::CGUIControl()
 }
 
 CGUIControl::CGUIControl(int parentID, int controlID, float posX, float posY, float width, float height)
-: m_hitRect(posX, posY, posX + width, posY + height)
+: m_hitRect(posX, posY, posX + width, posY + height),
+  m_diffuseColor(0xffffffff)
 {
   m_posX = posX;
   m_posY = posY;
@@ -69,7 +70,6 @@ CGUIControl::CGUIControl(int parentID, int controlID, float posX, float posY, fl
   m_parentID = parentID;
   m_visible = VISIBLE;
   m_visibleFromSkinCondition = true;
-  m_diffuseColor = 0xffffffff;
   m_forceHidden = false;
   m_visibleCondition = 0;
   m_enableCondition = 0;
@@ -229,7 +229,7 @@ bool CGUIControl::OnAction(const CAction &action)
   return false;
 }
 
-bool CGUIControl::Navigate(int direction)
+bool CGUIControl::Navigate(int direction) const
 {
   if (HasFocus())
   {
@@ -275,7 +275,7 @@ void CGUIControl::OnPrevControl()
   Navigate(ACTION_PREV_CONTROL);
 }
 
-bool CGUIControl::SendWindowMessage(CGUIMessage &message)
+bool CGUIControl::SendWindowMessage(CGUIMessage &message) const
 {
   CGUIWindow *pWindow = g_windowManager.GetWindow(GetParentID());
   if (pWindow)
index ee5fa3d..e81b7d4 100644 (file)
@@ -204,7 +204,7 @@ public:
   bool GetNavigationAction(int direction, CGUIAction& action) const;
   /*! \brief  Start navigating in given direction.
    */
-  bool Navigate(int direction);
+  bool Navigate(int direction) const;
   virtual void SetFocus(bool focus);
   virtual void SetWidth(float width);
   virtual void SetHeight(float height);
@@ -311,7 +311,7 @@ protected:
   virtual bool Animate(unsigned int currentTime);
   virtual bool CheckAnimation(ANIMATION_TYPE animType);
   void UpdateStates(ANIMATION_TYPE type, ANIMATION_PROCESS currentProcess, ANIMATION_STATE currentState);
-  bool SendWindowMessage(CGUIMessage &message);
+  bool SendWindowMessage(CGUIMessage &message) const;
 
   // navigation and actions
   CGUIAction m_actionLeft;
index d98db1a..383d9ca 100644 (file)
@@ -104,7 +104,7 @@ private:
   static CStdString GetType(const TiXmlElement *pControlNode);
   static bool GetConditionalVisibility(const TiXmlNode* control, CStdString &condition, CStdString &allowHiddenFocus);
   bool GetString(const TiXmlNode* pRootNode, const char* strTag, CStdString& strString);
-  bool GetFloatRange(const TiXmlNode* pRootNode, const char* strTag, float& iMinValue, float& iMaxValue, float& iIntervalValue);
-  bool GetIntRange(const TiXmlNode* pRootNode, const char* strTag, int& iMinValue, int& iMaxValue, int& iIntervalValue);
+  static bool GetFloatRange(const TiXmlNode* pRootNode, const char* strTag, float& iMinValue, float& iMaxValue, float& iIntervalValue);
+  static bool GetIntRange(const TiXmlNode* pRootNode, const char* strTag, int& iMinValue, int& iMaxValue, int& iIntervalValue);
 };
 #endif
index 52e00c6..ff260d9 100644 (file)
@@ -441,7 +441,7 @@ const CGUIControl* CGUIControlGroup::GetControl(int iControl) const
   if (first != m_lookup.end())
   {
     LookupMap::const_iterator last = m_lookup.upper_bound(iControl);
-    for (LookupMap::const_iterator i = first; i != last; i++)
+    for (LookupMap::const_iterator i = first; i != last; ++i)
     {
       CGUIControl *control = i->second;
       if (control->IsVisible())
@@ -531,7 +531,7 @@ void CGUIControlGroup::AddLookup(CGUIControl *control)
   if (control->IsGroup())
   { // first add all the subitems of this group (if they exist)
     const LookupMap map = ((CGUIControlGroup *)control)->GetLookup();
-    for (LookupMap::const_iterator i = map.begin(); i != map.end(); i++)
+    for (LookupMap::const_iterator i = map.begin(); i != map.end(); ++i)
       m_lookup.insert(m_lookup.upper_bound(i->first), make_pair(i->first, i->second));
   }
   if (control->GetID())
@@ -546,9 +546,9 @@ void CGUIControlGroup::RemoveLookup(CGUIControl *control)
   if (control->IsGroup())
   { // remove the group's lookup
     const LookupMap &map = ((CGUIControlGroup *)control)->GetLookup();
-    for (LookupMap::const_iterator i = map.begin(); i != map.end(); i++)
+    for (LookupMap::const_iterator i = map.begin(); i != map.end(); ++i)
     { // remove this control
-      for (LookupMap::iterator it = m_lookup.begin(); it != m_lookup.end(); it++)
+      for (LookupMap::iterator it = m_lookup.begin(); it != m_lookup.end(); ++it)
       {
         if (i->second == it->second)
         {
@@ -561,7 +561,7 @@ void CGUIControlGroup::RemoveLookup(CGUIControl *control)
   // remove the actual control
   if (control->GetID())
   {
-    for (LookupMap::iterator it = m_lookup.begin(); it != m_lookup.end(); it++)
+    for (LookupMap::iterator it = m_lookup.begin(); it != m_lookup.end(); ++it)
     {
       if (control == it->second)
       {
@@ -578,7 +578,7 @@ bool CGUIControlGroup::IsValidControl(const CGUIControl *control) const
 {
   if (control->GetID())
   {
-    for (LookupMap::const_iterator it = m_lookup.begin(); it != m_lookup.end(); it++)
+    for (LookupMap::const_iterator it = m_lookup.begin(); it != m_lookup.end(); ++it)
     {
       if (control == it->second)
         return true;
@@ -636,11 +636,11 @@ void CGUIControlGroup::ClearAll()
   // first remove from the lookup table
   if (m_parentControl)
   {
-    for (iControls it = m_children.begin(); it != m_children.end(); it++)
+    for (iControls it = m_children.begin(); it != m_children.end(); ++it)
       ((CGUIControlGroup *)m_parentControl)->RemoveLookup(*it);
   }
   // and delete all our children
-  for (iControls it = m_children.begin(); it != m_children.end(); it++)
+  for (iControls it = m_children.begin(); it != m_children.end(); ++it)
   {
     CGUIControl *control = *it;
     delete control;
index 2ae0537..b6e0120 100644 (file)
@@ -106,7 +106,7 @@ protected:
   typedef std::multimap<int, CGUIControl *> LookupMap;
   void AddLookup(CGUIControl *control);
   void RemoveLookup(CGUIControl *control);
-  const LookupMap &GetLookup() { return m_lookup; };
+  const LookupMap &GetLookup() const { return m_lookup; };
   LookupMap m_lookup;
 
   int  m_defaultControl;
index e35389c..7eb28ff 100644 (file)
@@ -78,7 +78,7 @@ public:
 
   void SetTextChangeActions(const CGUIAction& textChangeActions) { m_textChangeActions = textChangeActions; };
 
-  bool HasTextChangeActions() { return m_textChangeActions.HasActionsMeetingCondition(); };
+  bool HasTextChangeActions() const { return m_textChangeActions.HasActionsMeetingCondition(); };
 
 protected:
   virtual void ProcessText(unsigned int currentTime);
index fe056aa..642ebef 100644 (file)
 using namespace std;
 
 CGUIFadeLabelControl::CGUIFadeLabelControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, bool scrollOut, unsigned int timeToDelayAtEnd, bool resetOnLabelChange)
-    : CGUIControl(parentID, controlID, posX, posY, width, height), m_scrollInfo(50, labelInfo.offsetX, labelInfo.scrollSpeed)
+    : CGUIControl(parentID, controlID, posX, posY, width, height), m_label(labelInfo), m_scrollInfo(50, labelInfo.offsetX, labelInfo.scrollSpeed)
     , m_textLayout(labelInfo.font, false)
+    , m_fadeAnim(CAnimation::CreateFader(100, 0, timeToDelayAtEnd, 200))
 {
-  m_label = labelInfo;
   m_currentLabel = 0;
   ControlType = GUICONTROL_FADELABEL;
   m_scrollOut = scrollOut;
-  m_fadeAnim = CAnimation::CreateFader(100, 0, timeToDelayAtEnd, 200);
   m_fadeAnim.ApplyAnimation();
   m_lastLabel = -1;
   m_scrollSpeed = labelInfo.scrollSpeed;  // save it for later
@@ -39,14 +38,13 @@ CGUIFadeLabelControl::CGUIFadeLabelControl(int parentID, int controlID, float po
 }
 
 CGUIFadeLabelControl::CGUIFadeLabelControl(const CGUIFadeLabelControl &from)
-: CGUIControl(from), m_infoLabels(from.m_infoLabels), m_scrollInfo(from.m_scrollInfo), m_textLayout(from.m_textLayout)
+: CGUIControl(from), m_infoLabels(from.m_infoLabels), m_label(from.m_label), m_scrollInfo(from.m_scrollInfo), m_textLayout(from.m_textLayout), 
+  m_fadeAnim(from.m_fadeAnim)
 {
-  m_label = from.m_label;
   m_scrollOut = from.m_scrollOut;
   m_scrollSpeed = from.m_scrollSpeed;
   m_resetOnLabelChange = from.m_resetOnLabelChange;
 
-  m_fadeAnim = from.m_fadeAnim;
   m_fadeAnim.ApplyAnimation();
   m_currentLabel = 0;
   m_lastLabel = -1;
index bef2883..e09601b 100644 (file)
@@ -51,7 +51,7 @@ GUIFontManager::~GUIFontManager(void)
   Clear();
 }
 
-void GUIFontManager::RescaleFontSizeAndAspect(float *size, float *aspect, const RESOLUTION_INFO &sourceRes, bool preserveAspect) const
+void GUIFontManager::RescaleFontSizeAndAspect(float *size, float *aspect, const RESOLUTION_INFO &sourceRes, bool preserveAspect)
 {
   // set scaling resolution so that we can scale our font sizes correctly
   // as fonts aren't scaled at render time (due to aliasing) we must scale
@@ -243,12 +243,12 @@ void GUIFontManager::ReloadTTFFonts(void)
 
 void GUIFontManager::UnloadTTFFonts()
 {
-  for (vector<CGUIFontTTFBase*>::iterator i = m_vecFontFiles.begin(); i != m_vecFontFiles.end(); i++)
+  for (vector<CGUIFontTTFBase*>::iterator i = m_vecFontFiles.begin(); i != m_vecFontFiles.end(); ++i)
     delete (*i);
 
   m_vecFontFiles.clear();
 
-  for (vector<CGUIFont*>::iterator i = m_vecFonts.begin(); i != m_vecFonts.end(); i++)
+  for (vector<CGUIFont*>::iterator i = m_vecFonts.begin(); i != m_vecFonts.end(); ++i)
     (*i)->SetFont(NULL);
 }
 
index 774ff6c..a77f643 100644 (file)
@@ -76,7 +76,7 @@ public:
   void Clear();
   void FreeFontFile(CGUIFontTTFBase *pFont);
 
-  bool IsFontSetUnicode() { return m_fontsetUnicode; }
+  bool IsFontSetUnicode() const { return m_fontsetUnicode; }
   bool IsFontSetUnicode(const CStdString& strFontSet);
   bool GetFirstFontSetUnicode(CStdString& strFontSet);
 
@@ -86,7 +86,7 @@ public:
   static void SettingOptionsFontsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string &current);
 
 protected:
-  void RescaleFontSizeAndAspect(float *size, float *aspect, const RESOLUTION_INFO &sourceRes, bool preserveAspect) const;
+  static void RescaleFontSizeAndAspect(float *size, float *aspect, const RESOLUTION_INFO &sourceRes, bool preserveAspect);
   void LoadFonts(const TiXmlNode* fontNode);
   CGUIFontTTFBase* GetFontFile(const CStdString& strFontFile);
   bool OpenFontFile(CXBMCTinyXML& xmlDoc);
index 77c27fd..9c8e516 100644 (file)
@@ -112,13 +112,13 @@ public:
     return stroker;
   };
 
-  void ReleaseFont(FT_Face face)
+  static void ReleaseFont(FT_Face face)
   {
     assert(face);
     FT_Done_Face(face);
   };
   
-  void ReleaseStroker(FT_Stroker stroker)
+  static void ReleaseStroker(FT_Stroker stroker)
   {
     assert(stroker);
     FT_Stroker_Done(stroker);
@@ -353,7 +353,7 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors
     // first compute the size of the text to render in both characters and pixels
     unsigned int lineChars = 0;
     float linePixels = 0;
-    for (vecText::const_iterator pos = text.begin(); pos != text.end(); pos++)
+    for (vecText::const_iterator pos = text.begin(); pos != text.end(); ++pos)
     {
       Character *ch = GetCharacter(*pos);
       if (ch)
@@ -367,7 +367,7 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors
   }
   float cursorX = 0; // current position along the line
 
-  for (vecText::const_iterator pos = text.begin(); pos != text.end(); pos++)
+  for (vecText::const_iterator pos = text.begin(); pos != text.end(); ++pos)
   {
     // If starting text on a new line, determine justification effects
     // Get the current letter in the CStdString
@@ -486,10 +486,9 @@ CGUIFontTTFBase::Character* CGUIFontTTFBase::GetCharacter(character_t chr)
 
   int low = 0;
   int high = m_numChars - 1;
-  int mid;
   while (low <= high)
   {
-    mid = (low + high) >> 1;
+    int mid = (low + high) >> 1;
     if (ch > m_char[mid].letterAndStyle)
       low = mid + 1;
     else if (ch < m_char[mid].letterAndStyle)
index 0dafea4..9723a43 100644 (file)
@@ -118,7 +118,7 @@ protected:
 
   // modifying glyphs
   void EmboldenGlyph(FT_GlyphSlot slot);
-  void ObliqueGlyph(FT_GlyphSlot slot);
+  static void ObliqueGlyph(FT_GlyphSlot slot);
 
   CBaseTexture* m_texture;        // texture that holds our rendered characters (8bit alpha only)
 
@@ -169,6 +169,8 @@ protected:
   CStdString m_strFileName;
 
 private:
+  CGUIFontTTFBase(const CGUIFontTTFBase&);
+  CGUIFontTTFBase& operator=(const CGUIFontTTFBase&);
   int m_referenceCount;
 };
 
index 67174bc..e3eba24 100644 (file)
@@ -200,7 +200,6 @@ CBaseTexture* CGUIFontTTFDX::ReallocTexture(unsigned int& newHeight)
   }
 
   LPDIRECT3DSURFACE9 pSource, pTarget;
-  HRESULT hr;
   // There might be data to copy from the previous texture
   if ((newSpeedupTexture && m_speedupTexture) || (newTexture && m_texture))
   {
@@ -262,7 +261,7 @@ CBaseTexture* CGUIFontTTFDX::ReallocTexture(unsigned int& newHeight)
     const RECT rect = { 0, 0, m_textureWidth, m_textureHeight };
     const POINT point = { 0, 0 };
 
-    hr = g_Windowing.Get3DDevice()->UpdateSurface(pSource, &rect, pTarget, &point);
+    HRESULT hr = g_Windowing.Get3DDevice()->UpdateSurface(pSource, &rect, pTarget, &point);
     SAFE_RELEASE(pSource);
     SAFE_RELEASE(pTarget);
 
index 2a9df26..b96d65e 100644 (file)
@@ -37,9 +37,14 @@ CGUIImage::CGUIImage(int parentID, int controlID, float posX, float posY, float
 }
 
 CGUIImage::CGUIImage(const CGUIImage &left)
-    : CGUIControl(left), m_texture(left.m_texture)
+  : CGUIControl(left), 
+  m_image(left.m_image),
+  m_info(left.m_info),
+  m_texture(left.m_texture),
+  m_fadingTextures(),
+  m_currentTexture(),
+  m_currentFallback()
 {
-  m_info = left.m_info;
   m_crossFadeTime = left.m_crossFadeTime;
   // defaults
   m_currentFadeTime = 0;
@@ -122,7 +127,7 @@ void CGUIImage::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions
         if (!ProcessFading(*i, frameTime, currentTime))
           i = m_fadingTextures.erase(i);
         else
-          i++;
+          ++i;
       }
 
       if (m_texture.ReadyToRender() || m_texture.GetFileName().IsEmpty())
@@ -169,7 +174,7 @@ void CGUIImage::Render()
 {
   if (!IsVisible()) return;
 
-  for (vector<CFadingTexture *>::iterator itr = m_fadingTextures.begin(); itr != m_fadingTextures.end(); itr++)
+  for (vector<CFadingTexture *>::iterator itr = m_fadingTextures.begin(); itr != m_fadingTextures.end(); ++itr)
     (*itr)->m_texture->Render();
 
   m_texture.Render();
@@ -282,7 +287,7 @@ CRect CGUIImage::CalcRenderRegion() const
 {
   CRect region = m_texture.GetRenderRect();
 
-  for (vector<CFadingTexture *>::const_iterator itr = m_fadingTextures.begin(); itr != m_fadingTextures.end(); itr++)
+  for (vector<CFadingTexture *>::const_iterator itr = m_fadingTextures.begin(); itr != m_fadingTextures.end(); ++itr)
     region.Union( (*itr)->m_texture->GetRenderRect() );
 
   return CGUIControl::CalcRenderRegion().Intersect(region);
index 4ac6b7c..69b6506 100644 (file)
@@ -59,6 +59,10 @@ public:
     CGUITexture *m_texture;  ///< texture to fade out
     unsigned int m_fadeTime; ///< time to fade out (ms)
     bool         m_fading;   ///< whether we're fading out
+
+  private:
+    CFadingTexture(const CFadingTexture&);
+    CFadingTexture& operator=(const CFadingTexture&);
   };
 
   CGUIImage(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo& texture);
index 2f39eac..505c8c9 100644 (file)
@@ -67,14 +67,14 @@ CGUIInfoColor::CGUIInfoColor(uint32_t color)
   m_info = 0;
 }
 
-const CGUIInfoColor &CGUIInfoColor::operator=(color_t color)
+CGUIInfoColor &CGUIInfoColor::operator=(color_t color)
 {
   m_color = color;
   m_info = 0;
   return *this;
 }
 
-const CGUIInfoColor &CGUIInfoColor::operator=(const CGUIInfoColor &color)
+CGUIInfoColor &CGUIInfoColor::operator=(const CGUIInfoColor &color)
 {
   m_color = color.m_color;
   m_info = color.m_info;
index 728078c..80f7995 100644 (file)
@@ -54,8 +54,8 @@ class CGUIInfoColor
 public:
   CGUIInfoColor(color_t color = 0);
 
-  const CGUIInfoColor &operator=(const CGUIInfoColor &color);
-  const CGUIInfoColor &operator=(color_t color);
+  CGUIInfoColor& operator=(const CGUIInfoColor &color);
+  CGUIInfoColor& operator=(color_t color);
   operator color_t() const { return m_color; };
 
   bool Update();
index b9cabfb..ffc28c6 100644 (file)
@@ -223,12 +223,12 @@ bool CGUILabel::CheckAndCorrectOverlap(CGUILabel &label1, CGUILabel &label2)
   if (rect.Intersect(label2.m_renderRect).IsEmpty())
     return false; // nothing to do (though it could potentially encroach on the min_space requirement)
   
-  static const float min_space = 10;
   // overlap vertically and horizontally - check alignment
   CGUILabel &left = label1.m_renderRect.x1 <= label2.m_renderRect.x1 ? label1 : label2;
   CGUILabel &right = label1.m_renderRect.x1 <= label2.m_renderRect.x1 ? label2 : label1;
   if ((left.m_label.align & 3) == 0 && right.m_label.align & XBFONT_RIGHT)
   {
+    static const float min_space = 10;
     float chopPoint = (left.m_maxRect.x1 + left.GetMaxWidth() + right.m_maxRect.x2 - right.GetMaxWidth()) * 0.5f;
     // [1       [2...[2  1].|..........1]         2]
     // [1       [2.....[2   |      1]..1]         2]
index d3f34fd..bdd75c0 100644 (file)
@@ -234,7 +234,7 @@ bool CGUIListItem::IsSelected() const
   return m_bSelected;
 }
 
-const CGUIListItem& CGUIListItem::operator =(const CGUIListItem& item)
+CGUIListItem& CGUIListItem::operator =(const CGUIListItem& item)
 {
   if (&item == this) return * this;
   m_strLabel2 = item.m_strLabel2;
@@ -264,19 +264,19 @@ void CGUIListItem::Archive(CArchive &ar)
     ar << m_bSelected;
     ar << m_overlayIcon;
     ar << (int)m_mapProperties.size();
-    for (PropertyMap::const_iterator it = m_mapProperties.begin(); it != m_mapProperties.end(); it++)
+    for (PropertyMap::const_iterator it = m_mapProperties.begin(); it != m_mapProperties.end(); ++it)
     {
       ar << it->first;
       ar << it->second;
     }
     ar << (int)m_art.size();
-    for (ArtMap::const_iterator i = m_art.begin(); i != m_art.end(); i++)
+    for (ArtMap::const_iterator i = m_art.begin(); i != m_art.end(); ++i)
     {
       ar << i->first;
       ar << i->second;
     }
     ar << (int)m_artFallbacks.size();
-    for (ArtMap::const_iterator i = m_artFallbacks.begin(); i != m_artFallbacks.end(); i++)
+    for (ArtMap::const_iterator i = m_artFallbacks.begin(); i != m_artFallbacks.end(); ++i)
     {
       ar << i->first;
       ar << i->second;
@@ -332,11 +332,11 @@ void CGUIListItem::Serialize(CVariant &value)
   value["strIcon"] = m_strIcon;
   value["selected"] = m_bSelected;
 
-  for (PropertyMap::const_iterator it = m_mapProperties.begin(); it != m_mapProperties.end(); it++)
+  for (PropertyMap::const_iterator it = m_mapProperties.begin(); it != m_mapProperties.end(); ++it)
   {
     value["properties"][it->first] = it->second;
   }
-  for (ArtMap::const_iterator it = m_art.begin(); it != m_art.end(); it++)
+  for (ArtMap::const_iterator it = m_art.begin(); it != m_art.end(); ++it)
     value["art"][it->first] = it->second;
 }
 
index 940d9aa..5b8e04a 100644 (file)
@@ -63,7 +63,7 @@ public:
   virtual ~CGUIListItem(void);
   virtual CGUIListItem *Clone() const { return new CGUIListItem(*this); };
 
-  const CGUIListItem& operator =(const CGUIListItem& item);
+  CGUIListItem& operator =(const CGUIListItem& item);
 
   virtual void SetLabel(const CStdString& strLabel);
   const CStdString& GetLabel() const;
@@ -169,7 +169,7 @@ public:
   void Serialize(CVariant& value);
 
   bool       HasProperty(const CStdString &strKey) const;
-  bool       HasProperties() const { return m_mapProperties.size() > 0; };
+  bool       HasProperties() const { return !m_mapProperties.empty(); };
   void       ClearProperty(const CStdString &strKey);
 
   CVariant   GetProperty(const CStdString &strKey) const;
index f2a7775..e63a99d 100644 (file)
@@ -24,8 +24,8 @@
 CGUIListLabel::CGUIListLabel(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, const CGUIInfoLabel &info, bool alwaysScroll)
     : CGUIControl(parentID, controlID, posX, posY, width, height)
     , m_label(posX, posY, width, height, labelInfo, alwaysScroll ? CGUILabel::OVER_FLOW_SCROLL : CGUILabel::OVER_FLOW_TRUNCATE)
+    , m_info(info)
 {
-  m_info = info;
   m_alwaysScroll = alwaysScroll;
   // TODO: Remove this "correction"
   if (labelInfo.align & XBFONT_RIGHT)
index 34c075a..56efa8b 100644 (file)
@@ -101,7 +101,7 @@ int CGUIMessage::GetSenderId() const
 }
 
 
-const CGUIMessage& CGUIMessage::operator = (const CGUIMessage& msg)
+CGUIMessage& CGUIMessage::operator = (const CGUIMessage& msg)
 {
   if (this == &msg) return * this;
 
index 5467cbd..2b76ad0 100644 (file)
@@ -305,7 +305,7 @@ public:
   CGUIMessage(int msg, int senderID, int controlID, int param1, int param2, const CGUIListItemPtr &item);
   CGUIMessage(const CGUIMessage& msg);
   virtual ~CGUIMessage(void);
-  const CGUIMessage& operator = (const CGUIMessage& msg);
+  CGUIMessage& operator = (const CGUIMessage& msg);
 
   int GetControlId() const ;
   int GetMessage() const;
index 1e5b8e3..ecfdbb7 100644 (file)
@@ -49,9 +49,8 @@ CGUIMultiImage::CGUIMultiImage(int parentID, int controlID, float posX, float po
 }
 
 CGUIMultiImage::CGUIMultiImage(const CGUIMultiImage &from)
-: CGUIControl(from), m_image(from.m_image)
+  : CGUIControl(from), m_texturePath(), m_imageTimer(), m_files(), m_image(from.m_image)
 {
-  m_texturePath = from.m_texturePath;
   m_timePerImage = from.m_timePerImage;
   m_timeToPauseAtEnd = from.m_timeToPauseAtEnd;
   m_randomized = from.m_randomized;
index aec616f..9287909 100644 (file)
@@ -39,10 +39,10 @@ CGUIMultiSelectTextControl::CSelectableString::CSelectableString(CGUIFont *font,
 
 CGUIMultiSelectTextControl::CGUIMultiSelectTextControl(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo& textureFocus, const CTextureInfo& textureNoFocus, const CLabelInfo& labelInfo, const CGUIInfoLabel &content)
     : CGUIControl(parentID, controlID, posX, posY, width, height)
+    , m_label(labelInfo)
+    , m_info(content)
     , m_button(parentID, controlID, posX, posY, width, height, textureFocus, textureNoFocus, labelInfo)
 {
-  m_info = content;
-  m_label = labelInfo;
   m_selectedItem = 0;
   m_offset = 0;
   m_totalWidth = 0;
index e79cbd7..b68e08b 100644 (file)
@@ -31,12 +31,12 @@ using namespace std;
 
 CGUIRSSControl::CGUIRSSControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, const CGUIInfoColor &channelColor, const CGUIInfoColor &headlineColor, CStdString& strRSSTags)
 : CGUIControl(parentID, controlID, posX, posY, width, height),
-  m_scrollInfo(0,0,labelInfo.scrollSpeed,"")
+  m_label(labelInfo),
+  m_channelColor(channelColor),
+  m_headlineColor(headlineColor),
+  m_scrollInfo(0,0,labelInfo.scrollSpeed,""),
+  m_dirty(true)
 {
-  m_label = labelInfo;
-  m_headlineColor = headlineColor;
-  m_channelColor = channelColor;
-
   m_strRSSTags = strRSSTags;
 
   m_pReader = NULL;
@@ -47,11 +47,16 @@ CGUIRSSControl::CGUIRSSControl(int parentID, int controlID, float posX, float po
 }
 
 CGUIRSSControl::CGUIRSSControl(const CGUIRSSControl &from)
-: CGUIControl(from),m_scrollInfo(from.m_scrollInfo), m_dirty(true)
+  : CGUIControl(from),
+  m_feed(),
+  m_label(from.m_label),
+  m_channelColor(from.m_channelColor),
+  m_headlineColor(from.m_headlineColor),
+  m_vecUrls(),
+  m_vecIntervals(),
+  m_scrollInfo(from.m_scrollInfo),
+  m_dirty(true)
 {
-  m_label = from.m_label;
-  m_headlineColor = from.m_headlineColor;
-  m_channelColor = from.m_channelColor;
   m_strRSSTags = from.m_strRSSTags;
   m_pReader = NULL;
   m_rtl = from.m_rtl;
index 4d20850..d96d789 100644 (file)
@@ -72,7 +72,7 @@ public:
   virtual bool OnMessage(CGUIMessage& message);
   bool ProcessSelector(CGUITexture &nib, unsigned int currentTime, float fScaleY, RangeSelector selector);
   void SetRangeSelection(bool rangeSelection);
-  bool GetRangeSelection() { return m_rangeSelection; }
+  bool GetRangeSelection() const { return m_rangeSelection; }
   void SetRangeSelector(RangeSelector selector);
   void SwitchRangeSelector();
   void SetInfo(int iInfo);
index 1672408..46c8697 100644 (file)
@@ -410,12 +410,12 @@ void CGUISpinControl::Process(unsigned int currentTime, CDirtyRegionList &dirtyr
 
   changed |= m_label.SetText(text);
 
-  const float space = 5;
   float textWidth = m_label.GetTextWidth() + 2 * m_label.GetLabelInfo().offsetX;
   // Position the arrows
   bool arrowsOnRight(0 != (m_label.GetLabelInfo().align & (XBFONT_RIGHT | XBFONT_CENTER_X)));
   if (!arrowsOnRight)
   {
+    const float space = 5;
     changed |= m_imgspinDownFocus.SetPosition(m_posX + textWidth + space, m_posY);
     changed |= m_imgspinDown.SetPosition(m_posX + textWidth + space, m_posY);
     changed |= m_imgspinUpFocus.SetPosition(m_posX + textWidth + space + m_imgspinDown.GetWidth(), m_posY);
index 6fd8adc..7e47ce6 100644 (file)
@@ -90,7 +90,7 @@ CGUIStaticItem::CGUIStaticItem(const TiXmlElement *item, int parentID) : CFileIt
     
 void CGUIStaticItem::UpdateProperties(int contextWindow)
 {
-  for (InfoVector::const_iterator i = m_info.begin(); i != m_info.end(); i++)
+  for (InfoVector::const_iterator i = m_info.begin(); i != m_info.end(); ++i)
   {
     const CGUIInfoLabel &info = i->first;
     const CStdString &name = i->second;
index e63e8ef..ec7b6c2 100644 (file)
@@ -29,6 +29,7 @@ CGUITextBox::CGUITextBox(int parentID, int controlID, float posX, float posY, fl
                          const CLabelInfo& labelInfo, int scrollTime)
     : CGUIControl(parentID, controlID, posX, posY, width, height)
     , CGUITextLayout(labelInfo.font, true)
+    , m_label(labelInfo)
 {
   m_offset = 0;
   m_scrollOffset = 0;
@@ -44,7 +45,6 @@ CGUITextBox::CGUITextBox(int parentID, int controlID, float posX, float posY, fl
   m_autoScrollDelay = 3000;
   m_autoScrollDelayTime = 0;
   m_autoScrollRepeatAnim = NULL;
-  m_label = labelInfo;
 }
 
 CGUITextBox::CGUITextBox(const CGUITextBox &from)
index 103242b..652a3ab 100644 (file)
@@ -81,7 +81,7 @@ void CGUITextLayout::Render(float x, float y, float angle, color_t color, color_
     alignment &= ~XBFONT_CENTER_Y;
   }
   m_font->Begin();
-  for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); i++)
+  for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); ++i)
   {
     const CGUIString &string = *i;
     uint32_t align = alignment;
@@ -137,7 +137,7 @@ void CGUITextLayout::RenderScrolling(float x, float y, float angle, color_t colo
   //       any difference to the smoothness of scrolling though which will be
   //       jumpy with this sort of thing.  It's not exactly a well used situation
   //       though, so this hack is probably OK.
-  for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); i++)
+  for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); ++i)
   {
     const CGUIString &string = *i;
     m_font->DrawScrollingText(x, y, m_colors, shadowColor, string.m_text, alignment, maxWidth, scrollInfo);
@@ -169,7 +169,7 @@ void CGUITextLayout::RenderOutline(float x, float y, color_t color, color_t outl
     // adjust so the baselines of the fonts align
     float by = y + m_font->GetTextBaseLine() - m_borderFont->GetTextBaseLine();
     m_borderFont->Begin();
-    for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); i++)
+    for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); ++i)
     {
       const CGUIString &string = *i;
       uint32_t align = alignment;
@@ -201,7 +201,7 @@ void CGUITextLayout::RenderOutline(float x, float y, color_t color, color_t outl
     m_colors[0] = color;
 
   m_font->Begin();
-  for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); i++)
+  for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); ++i)
   {
     const CGUIString &string = *i;
     uint32_t align = alignment;
@@ -507,7 +507,7 @@ void CGUITextLayout::WrapText(const vecText &text, float maxWidth)
             // skip over spaces
             pos = lastSpace;
             while (pos != line.m_text.end() && IsSpace(*pos))
-              pos++;
+              ++pos;
             curLine.clear();
             lastSpaceInLine = 0;
             lastSpace = line.m_text.begin();
@@ -518,7 +518,7 @@ void CGUITextLayout::WrapText(const vecText &text, float maxWidth)
         lastSpaceInLine = curLine.size();
       }
       curLine.push_back(letter);
-      pos++;
+      ++pos;
     }
     // now add whatever we have left to the string
     float width = m_font->GetTextWidth(curLine);
@@ -562,7 +562,7 @@ void CGUITextLayout::LineBreakText(const vecText &text, vector<CGUIString> &line
       lines.push_back(string);
       lineStart = pos + 1;
     }
-    pos++;
+    ++pos;
   }
   // handle the last line if non-empty
   if (lineStart < text.end() && (nMaxLines <= 0 || lines.size() < (size_t)nMaxLines))
@@ -584,7 +584,7 @@ void CGUITextLayout::CalcTextExtent()
   m_textHeight = 0;
   if (!m_font) return;
 
-  for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); i++)
+  for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); ++i)
   {
     const CGUIString &string = *i;
     float w = m_font->GetTextWidth(string.m_text);
@@ -597,7 +597,7 @@ void CGUITextLayout::CalcTextExtent()
 unsigned int CGUITextLayout::GetTextLength() const
 {
   unsigned int length = 0;
-  for (vector<CGUIString>::const_iterator i = m_lines.begin(); i != m_lines.end(); i++)
+  for (vector<CGUIString>::const_iterator i = m_lines.begin(); i != m_lines.end(); ++i)
     length += i->m_text.size();
   return length;
 }
index 5146a28..bc2bdfe 100644 (file)
@@ -113,8 +113,8 @@ public:
 protected:
   void LineBreakText(const vecText &text, std::vector<CGUIString> &lines);
   void WrapText(const vecText &text, float maxWidth);
-  void BidiTransform(std::vector<CGUIString> &lines, bool forceLTRReadingOrder);
-  CStdStringW BidiFlip(const CStdStringW &text, bool forceLTRReadingOrder);
+  static void BidiTransform(std::vector<CGUIString> &lines, bool forceLTRReadingOrder);
+  static CStdStringW BidiFlip(const CStdStringW &text, bool forceLTRReadingOrder);
   void CalcTextExtent();
 
   // our text to render
index 78ded2a..68c9c5c 100644 (file)
@@ -51,13 +51,12 @@ CTextureInfo& CTextureInfo::operator=(const CTextureInfo &right)
   return *this;
 }
 
-CGUITextureBase::CGUITextureBase(float posX, float posY, float width, float height, const CTextureInfo& texture)
+CGUITextureBase::CGUITextureBase(float posX, float posY, float width, float height, const CTextureInfo& texture) :
+  m_height(height), m_info(texture)
 {
   m_posX = posX;
   m_posY = posY;
   m_width = width;
-  m_height = height;
-  m_info = texture;
 
   // defaults
   m_visible = true;
@@ -86,18 +85,18 @@ CGUITextureBase::CGUITextureBase(float posX, float posY, float width, float heig
   m_invalid = true;
 }
 
-CGUITextureBase::CGUITextureBase(const CGUITextureBase &right)
+CGUITextureBase::CGUITextureBase(const CGUITextureBase &right) :
+  m_height(right.m_height),
+  m_alpha(right.m_alpha),
+  m_info(right.m_info),
+  m_aspect(right.m_aspect)
 {
   m_posX = right.m_posX;
   m_posY = right.m_posY;
   m_width = right.m_width;
-  m_height = right.m_height;
-  m_info = right.m_info;
 
   m_visible = right.m_visible;
   m_diffuseColor = right.m_diffuseColor;
-  m_alpha = right.m_alpha;
-  m_aspect = right.m_aspect;
 
   m_allocateDynamically = right.m_allocateDynamically;
 
index 0c0f718..5a37d42 100644 (file)
@@ -127,7 +127,7 @@ protected:
   bool AllocateOnDemand();
   bool UpdateAnimFrame();
   void Render(float left, float top, float bottom, float right, float u1, float v1, float u2, float v2, float u3, float v3);
-  void OrientateTexture(CRect &rect, float width, float height, int orientation);
+  static void OrientateTexture(CRect &rect, float width, float height, int orientation);
 
   // functions that our implementation classes handle
   virtual void Allocate() {}; ///< called after our textures have been allocated
index 9fe6f7a..d213b36 100644 (file)
@@ -42,7 +42,7 @@ CGUIVisualisationControl::CGUIVisualisationControl(int parentID, int controlID,
 }
 
 CGUIVisualisationControl::CGUIVisualisationControl(const CGUIVisualisationControl &from)
-: CGUIRenderingControl(from), m_bAttemptedLoad(false)
+  : CGUIRenderingControl(from), m_bAttemptedLoad(false), m_addon()
 {
   ControlType = GUICONTROL_VISUALISATION;
 }
index 0928287..a1f894b 100644 (file)
@@ -584,7 +584,6 @@ bool CGUIWindow::OnMessage(CGUIMessage& message)
         CLog::Log(LOGDEBUG, "Unfocus WindowID: %i, ControlID: %i",GetID(), control->GetID());
       }
       return true;
-    break;
     }
 
   case GUI_MSG_SELCHANGED:
@@ -1073,7 +1072,7 @@ void CGUIWindow::SetID(int id)
 
 bool CGUIWindow::HasID(int controlID) const
 {
-  for (std::vector<int>::const_iterator it = m_idRange.begin(); it != m_idRange.end() ; it++)
+  for (std::vector<int>::const_iterator it = m_idRange.begin(); it != m_idRange.end() ; ++it)
   {
     if (controlID == *it)
       return true;
index a2eaadd..e9cf5e6 100644 (file)
@@ -89,7 +89,7 @@ bool CGUIWindowManager::SendMessage(CGUIMessage& message)
       dialog->OnMessage(message);
     }
 
-    for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); it++)
+    for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); ++it)
     {
       CGUIWindow *pWindow = (*it).second;
       pWindow->OnMessage(message);
@@ -187,7 +187,7 @@ void CGUIWindowManager::Add(CGUIWindow* pWindow)
   // push back all the windows if there are more than one covered by this class
   CSingleLock lock(g_graphicsContext);
   const vector<int>& idRange = pWindow->GetIDRange();
-  for (vector<int>::const_iterator idIt = idRange.begin(); idIt != idRange.end() ; idIt++)
+  for (vector<int>::const_iterator idIt = idRange.begin(); idIt != idRange.end() ; ++idIt)
   {
     WindowMap::iterator it = m_mapWindows.find(*idIt);
     if (it != m_mapWindows.end())
@@ -227,7 +227,7 @@ void CGUIWindowManager::Remove(int id)
       if(*it2 == it->second)
         it2 = m_activeDialogs.erase(it2);
       else
-        it2++;
+        ++it2;
     }
 
     m_mapWindows.erase(it);
@@ -423,7 +423,7 @@ void CGUIWindowManager::ActivateWindow_Internal(int iWindowID, const vector<CStd
   // as all messages done in WINDOW_INIT will want to be sent to the new
   // topmost window).  If we are swapping windows, we pop the old window
   // off the history stack
-  if (swappingWindows && m_windowHistory.size())
+  if (swappingWindows && !m_windowHistory.empty())
     m_windowHistory.pop();
   AddToWindowHistory(iWindowID);
 
@@ -435,7 +435,7 @@ void CGUIWindowManager::ActivateWindow_Internal(int iWindowID, const vector<CStd
 //  g_infoManager.SetPreviousWindow(WINDOW_INVALID);
 }
 
-void CGUIWindowManager::CloseDialogs(bool forceClose)
+void CGUIWindowManager::CloseDialogs(bool forceClose) const
 {
   CSingleLock lock(g_graphicsContext);
   while (m_activeDialogs.size() > 0)
@@ -445,7 +445,7 @@ void CGUIWindowManager::CloseDialogs(bool forceClose)
   }
 }
 
-bool CGUIWindowManager::OnAction(const CAction &action)
+bool CGUIWindowManager::OnAction(const CAction &action) const
 {
   CSingleLock lock(g_graphicsContext);
   unsigned int topMost = m_activeDialogs.size();
@@ -504,14 +504,14 @@ void CGUIWindowManager::Process(unsigned int currentTime)
     pWindow->DoProcess(currentTime, dirtyregions);
 
   // process all dialogs - visibility may change etc.
-  for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); it++)
+  for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); ++it)
   {
     CGUIWindow *pWindow = (*it).second;
     if (pWindow && pWindow->IsDialog())
       pWindow->DoProcess(currentTime, dirtyregions);
   }
 
-  for (CDirtyRegionList::iterator itr = dirtyregions.begin(); itr != dirtyregions.end(); itr++)
+  for (CDirtyRegionList::iterator itr = dirtyregions.begin(); itr != dirtyregions.end(); ++itr)
     m_tracker.MarkDirtyRegion(*itr);
 }
 
@@ -525,7 +525,7 @@ void CGUIWindowManager::MarkDirty(const CRect& rect)
   m_tracker.MarkDirtyRegion(rect);
 }
 
-void CGUIWindowManager::RenderPass()
+void CGUIWindowManager::RenderPass() const
 {
   CGUIWindow* pWindow = GetWindow(GetActiveWindow());
   if (pWindow)
@@ -569,7 +569,7 @@ bool CGUIWindowManager::Render()
   }
   else
   {
-    for (CDirtyRegionList::const_iterator i = dirtyRegions.begin(); i != dirtyRegions.end(); i++)
+    for (CDirtyRegionList::const_iterator i = dirtyRegions.begin(); i != dirtyRegions.end(); ++i)
     {
       if (i->IsEmpty())
         continue;
@@ -585,9 +585,9 @@ bool CGUIWindowManager::Render()
   {
     g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false);
     const CDirtyRegionList &markedRegions  = m_tracker.GetMarkedRegions(); 
-    for (CDirtyRegionList::const_iterator i = markedRegions.begin(); i != markedRegions.end(); i++)
+    for (CDirtyRegionList::const_iterator i = markedRegions.begin(); i != markedRegions.end(); ++i)
       CGUITexture::DrawQuad(*i, 0x0fff0000);
-    for (CDirtyRegionList::const_iterator i = dirtyRegions.begin(); i != dirtyRegions.end(); i++)
+    for (CDirtyRegionList::const_iterator i = dirtyRegions.begin(); i != dirtyRegions.end(); ++i)
       CGUITexture::DrawQuad(*i, 0x4c00ff00);
   }
 
@@ -619,7 +619,7 @@ void CGUIWindowManager::FrameMove()
   if(m_iNested == 0)
   {
     // delete any windows queued for deletion
-    for(iDialog it = m_deleteWindows.begin(); it != m_deleteWindows.end(); it++)
+    for(iDialog it = m_deleteWindows.begin(); it != m_deleteWindows.end(); ++it)
     {
       // Free any window resources
       (*it)->FreeResources(true);
@@ -675,7 +675,7 @@ void CGUIWindowManager::SetCallback(IWindowManagerCallback& callback)
 void CGUIWindowManager::DeInitialize()
 {
   CSingleLock lock(g_graphicsContext);
-  for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); it++)
+  for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); ++it)
   {
     CGUIWindow* pWindow = (*it).second;
     if (IsWindowActive(it->first))
@@ -798,7 +798,7 @@ void CGUIWindowManager::DispatchThreadMessages()
 
   CSingleLock lock(m_critSection);
 
-  for(int msgCount = m_vecThreadMessages.size(); m_vecThreadMessages.size() > 0 && msgCount > 0; --msgCount)
+  for(int msgCount = m_vecThreadMessages.size(); !m_vecThreadMessages.empty() && msgCount > 0; --msgCount)
   {
     // pop up one message per time to make messages be processed by order.
     // this will ensure rule No.2 & No.3
@@ -912,7 +912,7 @@ bool CGUIWindowManager::IsWindowVisible(const CStdString &xmlFile) const
 void CGUIWindowManager::LoadNotOnDemandWindows()
 {
   CSingleLock lock(g_graphicsContext);
-  for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); it++)
+  for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); ++it)
   {
     CGUIWindow *pWindow = (*it).second;
     if (pWindow->GetLoadType() == CGUIWindow::LOAD_ON_GUI_INIT)
@@ -926,7 +926,7 @@ void CGUIWindowManager::LoadNotOnDemandWindows()
 void CGUIWindowManager::UnloadNotOnDemandWindows()
 {
   CSingleLock lock(g_graphicsContext);
-  for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); it++)
+  for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); ++it)
   {
     CGUIWindow *pWindow = (*it).second;
     if (pWindow->GetLoadType() == CGUIWindow::LOAD_ON_GUI_INIT ||
@@ -963,7 +963,7 @@ void CGUIWindowManager::AddToWindowHistory(int newWindowID)
   // and if so, pop all the other windows off the stack so that we
   // always have a predictable "Back" behaviour for each window
   stack<int> historySave = m_windowHistory;
-  while (historySave.size())
+  while (!historySave.empty())
   {
     if (historySave.top() == newWindowID)
       break;
@@ -1023,7 +1023,7 @@ bool CGUIWindowManager::IsWindowTopMost(const CStdString &xmlFile) const
 
 void CGUIWindowManager::ClearWindowHistory()
 {
-  while (m_windowHistory.size())
+  while (!m_windowHistory.empty())
     m_windowHistory.pop();
 }
 
index bea2bc1..70d9b9a 100644 (file)
@@ -62,12 +62,12 @@ public:
   void ActivateWindow(int iWindowID, const std::vector<CStdString>& params, bool swappingWindows = false);
   void PreviousWindow();
 
-  void CloseDialogs(bool forceClose = false);
+  void CloseDialogs(bool forceClose = false) const;
 
   // OnAction() runs through our active dialogs and windows and sends the message
   // off to the callbacks (application, python, playlist player) and to the
   // currently focused window(s).  Returns true only if the message is handled.
-  bool OnAction(const CAction &action);
+  bool OnAction(const CAction &action) const;
 
   /*! \brief Process active controls allowing them to animate before rendering.
    */
@@ -142,7 +142,7 @@ public:
   void DumpTextureUse();
 #endif
 private:
-  void RenderPass();
+  void RenderPass() const;
 
   void LoadNotOnDemandWindows();
   void UnloadNotOnDemandWindows();
index 0c2ee8c..736fee3 100644 (file)
@@ -86,7 +86,7 @@ void CGraphicContext::OnSettingChanged(const CSetting *setting)
 
 void CGraphicContext::SetOrigin(float x, float y)
 {
-  if (m_origins.size())
+  if (!m_origins.empty())
     m_origins.push(CPoint(x,y) + m_origins.top());
   else
     m_origins.push(CPoint(x,y));
@@ -96,7 +96,7 @@ void CGraphicContext::SetOrigin(float x, float y)
 
 void CGraphicContext::RestoreOrigin()
 {
-  if (m_origins.size())
+  if (!m_origins.empty())
     m_origins.pop();
   RemoveTransform();
 }
@@ -105,13 +105,13 @@ void CGraphicContext::RestoreOrigin()
 bool CGraphicContext::SetClipRegion(float x, float y, float w, float h)
 { // transform from our origin
   CPoint origin;
-  if (m_origins.size())
+  if (!m_origins.empty())
     origin = m_origins.top();
 
   // ok, now intersect with our old clip region
   CRect rect(x, y, x + w, y + h);
   rect += origin;
-  if (m_clipRegions.size())
+  if (!m_clipRegions.empty())
   {
     // intersect with original clip region
     rect.Intersect(m_clipRegions.top());
@@ -128,7 +128,7 @@ bool CGraphicContext::SetClipRegion(float x, float y, float w, float h)
 
 void CGraphicContext::RestoreClipRegion()
 {
-  if (m_clipRegions.size())
+  if (!m_clipRegions.empty())
     m_clipRegions.pop();
 
   // here we could reset the hardware clipping, if applicable
@@ -138,12 +138,12 @@ void CGraphicContext::ClipRect(CRect &vertex, CRect &texture, CRect *texture2)
 {
   // this is the software clipping routine.  If the graphics hardware is set to do the clipping
   // (eg via SetClipPlane in D3D for instance) then this routine is unneeded.
-  if (m_clipRegions.size())
+  if (!m_clipRegions.empty())
   {
     // take a copy of the vertex rectangle and intersect
     // it with our clip region (moved to the same coordinate system)
     CRect clipRegion(m_clipRegions.top());
-    if (m_origins.size())
+    if (!m_origins.empty())
       clipRegion -= m_origins.top();
     CRect original(vertex);
     vertex.Intersect(clipRegion);
@@ -795,10 +795,10 @@ void CGraphicContext::SetScalingResolution(const RESOLUTION_INFO &res, bool need
   }
 
   // reset our origin and camera
-  while (m_origins.size())
+  while (!m_origins.empty())
     m_origins.pop();
   m_origins.push(CPoint(0, 0));
-  while (m_cameras.size())
+  while (!m_cameras.empty())
     m_cameras.pop();
   m_cameras.push(CPoint(0.5f*m_iScreenWidth, 0.5f*m_iScreenHeight));
 
@@ -828,7 +828,7 @@ void CGraphicContext::SetStereoView(RENDER_STEREO_VIEW view)
 {
   m_stereoView = view;
 
-  while(m_viewStack.size())
+  while(!m_viewStack.empty())
     m_viewStack.pop();
 
   CRect viewport(0.0f, 0.0f, (float)m_iScreenWidth, (float)m_iScreenHeight);
@@ -858,7 +858,7 @@ void CGraphicContext::SetCameraPosition(const CPoint &camera)
   // offset the camera from our current location (this is in XML coordinates) and scale it up to
   // the screen resolution
   CPoint cam(camera);
-  if (m_origins.size())
+  if (!m_origins.empty())
     cam += m_origins.top();
 
   cam.x *= (float)m_iScreenWidth / m_windowResolution.iWidth;
@@ -980,7 +980,7 @@ bool CGraphicContext::ToggleFullScreenRoot ()
     {
       /* we need to trick renderer that we are fullscreen already so it gives us a valid value */
       m_bFullScreenRoot = true;
-      newRes = g_renderManager.GetResolution();
+      uiRes = g_renderManager.GetResolution();
       m_bFullScreenRoot = false;
     }
 #endif
index fadb49f..3c0e339 100644 (file)
@@ -288,12 +288,16 @@ bool CJpegIO::Open(const CStdString &texturePath, unsigned int minx, unsigned in
       if (!free_space)
       { // (re)alloc
         m_inputBuffSize += chunksize;
-        m_inputBuff = (unsigned char *)realloc(m_inputBuff, m_inputBuffSize);
-        if (!m_inputBuff)
+        unsigned char* new_buf = (unsigned char *)realloc(m_inputBuff, m_inputBuffSize);
+        if (!new_buf)
         {
           CLog::Log(LOGERROR, "%s unable to allocate buffer of size %u", __FUNCTION__, m_inputBuffSize);
+          free(m_inputBuff);
           return false;
         }
+        else
+          m_inputBuff = new_buf;
+
         free_space = chunksize;
         chunksize = std::min(chunksize*2, maxchunksize);
       }
@@ -490,7 +494,7 @@ bool CJpegIO::CreateThumbnailFromSurface(unsigned char* buffer, unsigned int wid
   long unsigned int outBufSize = width * height;
   unsigned char* result;
   unsigned char* src = buffer;
-  unsigned char* rgbbuf, *src2, *dst2;
+  unsigned char* rgbbuf;
 
   if(buffer == NULL)
   {
@@ -516,8 +520,8 @@ bool CJpegIO::CreateThumbnailFromSurface(unsigned char* buffer, unsigned int wid
     unsigned char* dst = rgbbuf;
     for (unsigned int y = 0; y < height; y++)
     {
-      dst2 = dst;
-      src2 = src;
+      unsigned char* dst2 = dst;
+      unsigned char* src2 = src;
       for (unsigned int x = 0; x < width; x++, src2 += 4)
       {
         *dst2++ = src2[2];
@@ -742,7 +746,7 @@ bool CJpegIO::CreateThumbnailFromSurface(unsigned char* bufferin, unsigned int w
   JSAMPROW row_pointer[1];
   long unsigned int outBufSize = width * height;
   unsigned char* src = bufferin;
-  unsigned char* rgbbuf, *src2, *dst2;
+  unsigned char* rgbbuf;
 
   if(bufferin == NULL)
   {
@@ -768,8 +772,9 @@ bool CJpegIO::CreateThumbnailFromSurface(unsigned char* bufferin, unsigned int w
     unsigned char* dst = rgbbuf;
     for (unsigned int y = 0; y < height; y++)
     {
-      dst2 = dst;
-      src2 = src;
+
+      unsigned char* dst2 = dst;
+      unsigned char* src2 = src;
       for (unsigned int x = 0; x < width; x++, src2 += 4)
       {
         *dst2++ = src2[2];
index b420606..8129062 100644 (file)
@@ -40,7 +40,7 @@ public:
   bool           Read(unsigned char* buffer, unsigned int bufSize, unsigned int minx, unsigned int miny);
   bool           CreateThumbnail(const CStdString& sourceFile, const CStdString& destFile, int minx, int miny, bool rotateExif);
   bool           CreateThumbnailFromMemory(unsigned char* buffer, unsigned int bufSize, const CStdString& destFile, unsigned int minx, unsigned int miny);
-  bool           CreateThumbnailFromSurface(unsigned char* buffer, unsigned int width, unsigned int height, unsigned int format, unsigned int pitch, const CStdString& destFile);
+  static bool           CreateThumbnailFromSurface(unsigned char* buffer, unsigned int width, unsigned int height, unsigned int format, unsigned int pitch, const CStdString& destFile);
   void           Close();
   // methods for the imagefactory
   virtual bool   Decode(const unsigned char *pixels, unsigned int pitch, unsigned int format);
@@ -52,7 +52,7 @@ public:
 protected:
   static  void   jpeg_error_exit(j_common_ptr cinfo);
 
-  unsigned int   GetExifOrientation(unsigned char* exif_data, unsigned int exif_data_size);
+  static unsigned int   GetExifOrientation(unsigned char* exif_data, unsigned int exif_data_size);
 
   unsigned char  *m_inputBuff;
   unsigned int   m_inputBuffSize;
index 68c7840..2a798b8 100644 (file)
@@ -87,7 +87,7 @@ void CKey::Reset()
   m_held = 0;
 }
 
-const CKey& CKey::operator=(const CKey& key)
+CKey& CKey::operator=(const CKey& key)
 {
   if (&key == this) return * this;
   m_leftTrigger  = key.m_leftTrigger;
index 3bb2621..902798e 100644 (file)
@@ -470,7 +470,7 @@ public:
   CKey(const CKey& key);
 
   virtual ~CKey(void);
-  const CKey& operator=(const CKey& key);
+  CKey& operator=(const CKey& key);
   uint8_t GetLeftTrigger() const;
   uint8_t GetRightTrigger() const;
   float GetLeftThumbX() const;
index 5f978b1..e27656a 100644 (file)
@@ -93,7 +93,7 @@ protected:
    */
   bool LoadXML(const CStdString &filename, CStdString &encoding, uint32_t offset = 0);
 
-  CStdString ToUTF8(const CStdString &encoding, const CStdString &str);
+  static CStdString ToUTF8(const CStdString &encoding, const CStdString &str);
   std::map<uint32_t, LocStr> m_strings;
   typedef std::map<uint32_t, LocStr>::const_iterator ciStrings;
   typedef std::map<uint32_t, LocStr>::iterator       iStrings;
index 4a012dd..f4be9be 100644 (file)
@@ -51,13 +51,13 @@ public:
   void MultMatrixf(const GLfloat *matrix);
   void LookAt(GLfloat eyex, GLfloat eyey, GLfloat eyez, GLfloat centerx, GLfloat centery, GLfloat centerz, GLfloat upx, GLfloat upy, GLfloat upz);
   void PrintMatrix(void);
-  bool Project(GLfloat objx, GLfloat objy, GLfloat objz, const GLfloat modelMatrix[16], const GLfloat projMatrix[16], const GLint viewport[4], GLfloat* winx, GLfloat* winy, GLfloat* winz);
+  static bool Project(GLfloat objx, GLfloat objy, GLfloat objz, const GLfloat modelMatrix[16], const GLfloat projMatrix[16], const GLint viewport[4], GLfloat* winx, GLfloat* winy, GLfloat* winz);
 
 protected:
 
   struct MatrixWrapper 
   {
-    MatrixWrapper(){};
+    MatrixWrapper(){ memset(&m_values, 0, sizeof(m_values)); };
     MatrixWrapper( const float values[16]) { memcpy(m_values,values,sizeof(m_values)); }
     MatrixWrapper( const MatrixWrapper &rhs ) { memcpy(m_values, rhs.m_values, sizeof(m_values)); }
     MatrixWrapper &operator=( const MatrixWrapper &rhs ) { memcpy(m_values, rhs.m_values, sizeof(m_values)); return *this;}
index 7dbda95..08be14e 100644 (file)
@@ -116,9 +116,10 @@ public:
   {
     return iWidth * fPixelRatio / iHeight;
   }
-  RESOLUTION_INFO(const RESOLUTION_INFO& res)
+  RESOLUTION_INFO(const RESOLUTION_INFO& res) :
+    Overscan(res.Overscan)
   {
-    Overscan = res.Overscan; bFullScreen = res.bFullScreen;
+    bFullScreen = res.bFullScreen;
     iScreen = res.iScreen; iWidth = res.iWidth; iHeight = res.iHeight;
     iScreenWidth = res.iScreenWidth; iScreenHeight = res.iScreenHeight;
     iSubtitles = res.iSubtitles; dwFlags = res.dwFlags;
index 099d3e5..3283164 100644 (file)
@@ -46,7 +46,7 @@ namespace Shaders {
     virtual GLuint Handle() = 0;
     virtual void SetSource(const string& src) { m_source = src; }
     virtual bool LoadSource(const string& filename, const string& prefix = "");
-    bool OK() { return m_compiled; }
+    bool OK() const { return m_compiled; }
 
   protected:
     string m_source;
@@ -150,7 +150,7 @@ namespace Shaders {
     virtual void Disable() = 0;
 
     // returns true if shader is compiled and linked
-    bool OK() { return m_ok; }
+    bool OK() const { return m_ok; }
 
     // free resources
     virtual void Free() {}
@@ -189,13 +189,15 @@ namespace Shaders {
     : virtual public CShaderProgram
   {
   public:
-    CGLSLShaderProgram()
+    CGLSLShaderProgram() : 
+      m_validated(false)
       {
         m_pFP = new CGLSLPixelShader();
         m_pVP = new CGLSLVertexShader();
       }
     CGLSLShaderProgram(const std::string& vert
-                     , const std::string& frag)
+                     , const std::string& frag) :
+      m_validated(false)
       {
         m_pFP = new CGLSLPixelShader();
         m_pFP->LoadSource(frag);
index eac7cdc..ec7f5d0 100644 (file)
@@ -349,13 +349,12 @@ void CStereoscopicsManager::OnPlaybackStarted(void)
       RENDER_STEREO_MODE preferred = GetPreferredPlaybackMode();
       RENDER_STEREO_MODE playing   = GetStereoModeOfPlayingVideo();
 
-      int idx_preferred = -1
-        , idx_playing   = -1
-        , idx_mono      = -1
-        , idx_select    = -1;
+      int idx_playing   = -1
+        , idx_mono      = -1;
+        
 
       // add choices
-      idx_preferred = pDlgSelect->Add( g_localizeStrings.Get(36530)
+      int idx_preferred = pDlgSelect->Add( g_localizeStrings.Get(36530)
                                      + " ("
                                      + GetLabelForStereoMode(preferred)
                                      + ")");
@@ -370,7 +369,7 @@ void CStereoscopicsManager::OnPlaybackStarted(void)
                                     + GetLabelForStereoMode(playing)
                                     + ")");
 
-      idx_select = pDlgSelect->Add( g_localizeStrings.Get(36531) ); // other / select
+      int idx_select = pDlgSelect->Add( g_localizeStrings.Get(36531) ); // other / select
 
       pDlgSelect->DoModal();
 
index 7d9355e..be3244e 100644 (file)
@@ -311,7 +311,6 @@ bool CBaseTexture::LoadFromFileInternal(const CStdString& texturePath, unsigned
   if(!LoadIImage(pImage, (unsigned char *) inputBuff, inputBuffSize, width, height, autoRotate))
   {
     delete pImage;
-    pImage = NULL;
     pImage = ImageFactory::CreateFallbackLoader(texturePath);
     if(!LoadIImage(pImage, (unsigned char *) inputBuff, inputBuffSize, width, height))
     {
@@ -339,7 +338,6 @@ bool CBaseTexture::LoadFromFileInMem(unsigned char* buffer, size_t size, const s
   if(!LoadIImage(pImage, buffer, size, width, height))
   {
     delete pImage;
-    pImage = NULL;
     pImage = ImageFactory::CreateFallbackLoader(mimeType);
     if(!LoadIImage(pImage, buffer, size, width, height))
     {
index 3239179..01ae547 100644 (file)
@@ -101,7 +101,7 @@ public:
   void ClampToEdge();
 
   static unsigned int PadPow2(unsigned int x);
-  bool SwapBlueRed(unsigned char *pixels, unsigned int height, unsigned int pitch, unsigned int elements = 4, unsigned int offset=0);
+  static bool SwapBlueRed(unsigned char *pixels, unsigned int height, unsigned int pitch, unsigned int elements = 4, unsigned int offset=0);
 
 private:
   // no copy constructor
index 6d798c7..0f20b65 100644 (file)
@@ -58,10 +58,14 @@ public:
   CAutoBuffer() { p = 0; }
   explicit CAutoBuffer(size_t s) { p = (BYTE*)malloc(s); }
   ~CAutoBuffer() { free(p); }
-operator BYTE*() { return p; }
+operator BYTE*() const { return p; }
   void Set(BYTE* buf) { free(p); p = buf; }
   bool Resize(size_t s);
 void Release() { p = 0; }
+
+private:
+  CAutoBuffer(const CAutoBuffer&);
+  CAutoBuffer& operator=(const CAutoBuffer&);
 };
 
 bool CAutoBuffer::Resize(size_t s)
@@ -91,7 +95,7 @@ public:
   CAutoTexBuffer() { p = 0; }
   explicit CAutoTexBuffer(size_t s) { p = (BYTE*)XPhysicalAlloc(s, MAXULONG_PTR, 128, PAGE_READWRITE); }
   ~CAutoTexBuffer() { if (p) XPhysicalFree(p); }
-operator BYTE*() { return p; }
+operator BYTE*() const { return p; }
   BYTE* Set(BYTE* buf) { if (p) XPhysicalFree(p); return p = buf; }
 void Release() { p = 0; }
 };
@@ -257,7 +261,7 @@ void CTextureBundleXPR::GetTexturesFromPath(const CStdString &path, std::vector<
     testPath += "\\";
   int testLength = testPath.GetLength();
   std::map<CStdString, FileHeader_t>::iterator it;
-  for (it = m_FileHeaders.begin(); it != m_FileHeaders.end(); it++)
+  for (it = m_FileHeaders.begin(); it != m_FileHeaders.end(); ++it)
   {
     if (it->first.Left(testLength).Equals(testPath))
       textures.push_back(it->first);
index cb375be..18257d5 100644 (file)
@@ -225,7 +225,7 @@ CGUITextureManager::~CGUITextureManager(void)
 /************************************************************************/
 /*                                                                      */
 /************************************************************************/
-bool CGUITextureManager::CanLoad(const CStdString &texturePath) const
+bool CGUITextureManager::CanLoad(const CStdString &texturePath)
 {
   if (texturePath == "-")
     return false;
@@ -299,7 +299,7 @@ const CTextureArray& CGUITextureManager::Load(const CStdString& strTextureName,
     return emptyTexture;
   }
 
-  for (ilistUnused i = m_unusedTextures.begin(); i != m_unusedTextures.end(); i++)
+  for (ilistUnused i = m_unusedTextures.begin(); i != m_unusedTextures.end(); ++i)
   {
     CTextureMap* pMap = i->first;
     if (pMap->GetName() == strTextureName)
@@ -473,7 +473,7 @@ void CGUITextureManager::FreeUnusedTextures(unsigned int timeDelay)
       i = m_unusedTextures.erase(i);
     }
     else
-      i++;
+      ++i;
   }
 
 #if defined(HAS_GL) || defined(HAS_GLES)
index 8f9939f..33a33bf 100644 (file)
@@ -108,7 +108,7 @@ public:
   virtual ~CGUITextureManager(void);
 
   bool HasTexture(const CStdString &textureName, CStdString *path = NULL, int *bundle = NULL, int *size = NULL);
-  bool CanLoad(const CStdString &texturePath) const; ///< Returns true if the texture manager can load this texture
+  static bool CanLoad(const CStdString &texturePath); ///< Returns true if the texture manager can load this texture
   const CTextureArray& Load(const CStdString& strTextureName, bool checkBundleOnly = false);
   void ReleaseTexture(const CStdString& strTextureName);
   void Cleanup();
index 32c5e44..140b9a6 100644 (file)
@@ -267,7 +267,7 @@ public:
     return easeOut(time, start, change, duration);
   }
 protected:
-  float easeOut(float time, float start, float change, float duration)
+  static float easeOut(float time, float start, float change, float duration)
   {
     time /= duration;
     if (time < (1/2.75)) {
@@ -313,7 +313,7 @@ protected:
   float _a;
   float _p;
 
-  float easeIn(float time, float start, float change, float duration)
+  float easeIn(float time, float start, float change, float duration) const
   {
     float s=0;
     float a=_a;
@@ -339,7 +339,7 @@ protected:
     return -(a * pow(2.0f, 10*time) * sin((time * duration - s) * (2 * M_PI) / p )) + start;
   }
 
-  float easeOut(float time, float start, float change, float duration)
+  float easeOut(float time, float start, float change, float duration) const
   {
     float s=0;
     float a=_a;
@@ -364,7 +364,7 @@ protected:
     return (a * pow(2.0f, -10*time) * sin((time * duration - s) * (2 * M_PI) / p )) + change + start;
   }
 
-  float easeInOut(float time, float start, float change, float duration)
+  float easeInOut(float time, float start, float change, float duration) const
   {
     float s=0;
     float a=_a;
index e4cc526..6bd8318 100644 (file)
@@ -61,7 +61,7 @@ CAnimEffect::CAnimEffect(const CAnimEffect &src)
   *this = src;
 }
 
-const CAnimEffect &CAnimEffect::operator=(const CAnimEffect &src)
+CAnimEffect& CAnimEffect::operator=(const CAnimEffect &src)
 {
   if (&src == this) return *this;
 
@@ -248,12 +248,11 @@ void CRotateEffect::ApplyEffect(float offset, const CPoint &center)
     m_matrix.SetZRotation(((m_endAngle - m_startAngle)*offset + m_startAngle) * degree_to_radian, m_center.x, m_center.y, g_graphicsContext.GetScalingPixelRatio());
 }
 
-CZoomEffect::CZoomEffect(const TiXmlElement *node, const CRect &rect) : CAnimEffect(node, EFFECT_TYPE_ZOOM)
+CZoomEffect::CZoomEffect(const TiXmlElement *node, const CRect &rect) : CAnimEffect(node, EFFECT_TYPE_ZOOM), m_center(CPoint(0,0))
 {
   // effect defaults
   m_startX = m_startY = 100;
   m_endX = m_endY = 100;
-  m_center = CPoint(0,0);
   m_autoCenter = false;
 
   float startPosX = rect.x1;
@@ -385,7 +384,7 @@ CAnimation::~CAnimation()
   m_effects.clear();
 }
 
-const CAnimation &CAnimation::operator =(const CAnimation &src)
+CAnimation &CAnimation::operator =(const CAnimation &src)
 {
   if (this == &src) return *this; // same
   m_type = src.m_type;
@@ -721,7 +720,7 @@ CScroller::CScroller(const CScroller& right)
   *this = right;
 }
 
-const CScroller &CScroller::operator=(const CScroller &right)
+CScroller& CScroller::operator=(const CScroller &right)
 {
   if (&right == this) return *this;
 
index 5d352c0..0d44455 100644 (file)
@@ -56,7 +56,7 @@ public:
   CAnimEffect(const CAnimEffect &src);
 
   virtual ~CAnimEffect();
-  const CAnimEffect &operator=(const CAnimEffect &src);
+  CAnimEffect& operator=(const CAnimEffect &src);
 
   void Calculate(unsigned int time, const CPoint &center);
   void ApplyState(ANIMATION_STATE state, const CPoint &center);
@@ -148,7 +148,7 @@ public:
 
   virtual ~CAnimation();
 
-  const CAnimation &operator=(const CAnimation &src);
+  CAnimation& operator=(const CAnimation &src);
 
   static CAnimation CreateFader(float start, float end, unsigned int delay, unsigned int length, ANIMATION_TYPE type = ANIM_TYPE_NONE);
 
@@ -216,7 +216,7 @@ class CScroller
 public:
   CScroller(unsigned int duration = 200, boost::shared_ptr<Tweener> tweener = boost::shared_ptr<Tweener>());
   CScroller(const CScroller& right);
-  const CScroller &operator=(const CScroller &src);
+  CScroller& operator=(const CScroller &src);
   ~CScroller();
 
   /**
index 0fa8a28..84f29c6 100644 (file)
@@ -64,12 +64,12 @@ public:
    */
   virtual void ReleaseThumbnailBuffer() {return;}
 
-  unsigned int Width()              { return m_width; }
-  unsigned int Height()             { return m_height; }
-  unsigned int originalWidth()      { return m_originalWidth; }
-  unsigned int originalHeight()     { return m_originalHeight; }
-  unsigned int Orientation()        { return m_orientation; }
-  bool hasAlpha()                   { return m_hasAlpha; }
+  unsigned int Width() const              { return m_width; }
+  unsigned int Height() const             { return m_height; }
+  unsigned int originalWidth() const      { return m_originalWidth; }
+  unsigned int originalHeight() const     { return m_originalHeight; }
+  unsigned int Orientation() const        { return m_orientation; }
+  bool hasAlpha() const                   { return m_hasAlpha; }
 
 protected: