Re: [CrystalSpace] #980: warnings returning false instead of zero when --enable-debug is used (fix included)

"CrystalSpace" <[email protected]> Wed, 26 Jun 2013 08:06:08 -0000
Newsgroups gmane.comp.graphics.crystalspace.tracker
Message-ID <[email protected]>
#980: warnings returning false instead of zero when --enable-debug is used (fix
included)
---------------------------+------------------------------------------------
 Reporter:  ralphcampbell  |       Owner:  jorrit
     Type:  defect         |      Status:  new   
 Priority:  minimal        |   Milestone:        
Component:  general        |     Version:  V2.1  
 Keywords:                 |  
---------------------------+------------------------------------------------
Description changed by sunshine:

Old description:

> I fixed a number of compiler warnings when --enable-debug is used.
> Just use "patch -p0 < diff" where diff is the code below to apply them.
>
> {{{
> Index: apps/tools/viewmesh/assetbase.h
> ===================================================================
> --- apps/tools/viewmesh/assetbase.h     (revision 39410)
> +++ apps/tools/viewmesh/assetbase.h     (working copy)
> @@ -185,7 +185,7 @@
>
>    virtual csPtr<iStringArray> GetEffectors() { return 0; }
>
> -  virtual iParticleEmitter* AddEmitter(uint type) { return false; }
> +  virtual iParticleEmitter* AddEmitter(uint type) { return 0; }
>
>    virtual bool DeleteEmitter(uint idx) { return false; }
>
> @@ -207,7 +207,7 @@
>    virtual bool SetEmitterPropValue(iParticleEmitter* emitter, uint id,
> csVector3& val) { return false; }
>    virtual bool SetEmitterPropValue(iParticleEmitter* emitter, uint id,
> csColor4& val) { return false; }
>
> -  virtual iParticleEffector* AddEffector(uint type) { return false; }
> +  virtual iParticleEffector* AddEffector(uint type) { return 0; }
>
>    virtual bool DeleteEffector(uint idx) { return false; }
>
> Index: plugins/csparser/csparser.cpp
> ===================================================================
> --- plugins/csparser/csparser.cpp       (revision 39410)
> +++ plugins/csparser/csparser.cpp       (working copy)
> @@ -1286,7 +1288,7 @@
>          {
>            csColor c;
>            if (!SyntaxService->ParseColor (child, c))
> -            return false;
> +            return 0;
>            sector->SetDynamicAmbientLight (c);
>          }
>          break;
> @@ -1479,7 +1482,7 @@
>            iRenderLoop* loop = ParseRenderLoop (child, set);
>            if (!loop)
>            {
> -            return false;
> +            return 0;
>            }
>            if (set)
>            {
> @@ -1661,7 +1664,7 @@
>          return 0;
>        case XMLTOKEN_KEY:
>          if (!ParseKey (child, pNode->QueryObject()))
> -          return false;
> +          return 0;
>          break;
>        case XMLTOKEN_POSITION:
>          if (!SyntaxService->ParseVector (child, pos))
> Index: plugins/mesh/animesh/persist/skeleton2/skeleton2ldr.cpp
> ===================================================================
> --- plugins/mesh/animesh/persist/skeleton2/skeleton2ldr.cpp     (revision
> 39410)
> +++ plugins/mesh/animesh/persist/skeleton2/skeleton2ldr.cpp     (working
> copy)
> @@ -514,7 +514,7 @@
>      if (!name)
>      {
>        synldr->ReportError (msgid, node, "No name set for animation");
> -      return false;
> +      return 0;
>      }
>
>      CS::Animation::iSkeletonAnimation* fact = packet->CreateAnimation
> (name);
> @@ -522,7 +522,7 @@
>      {
>        synldr->ReportError (msgid, node,
>          "Could not create animation, another animation with same name
> already exist");
> -      return false;
> +      return 0;
>      }
>
>      if (node->GetAttributeValueAsBool ("bindspace", false))
> Index: plugins/mesh/animesh/persist/standard/animeshldr.cpp
> ===================================================================
> --- plugins/mesh/animesh/persist/standard/animeshldr.cpp        (revision
> 39410)
> +++ plugins/mesh/animesh/persist/standard/animeshldr.cpp        (working
> copy)
> @@ -269,7 +269,7 @@
>             {
>               csRef<csShaderVariable> sv;
>               sv.AttachNew (new csShaderVariable);
> -             if (!synldr->ParseShaderVar (ldr_context, child2, *sv))
> return false;
> +             if (!synldr->ParseShaderVar (ldr_context, child2, *sv))
> return 0;
>               shadervars.Push (sv);
>               break;
>             }
> Index: plugins/mesh/protomesh/object/protomesh.cpp
> ===================================================================
> --- plugins/mesh/protomesh/object/protomesh.cpp (revision 39410)
> +++ plugins/mesh/protomesh/object/protomesh.cpp (working copy)
> @@ -141,7 +141,7 @@
>  {
>    n = 0;
>
> -  if (vis_cb) if (!vis_cb->BeforeDrawing (this, rview)) return false;
> +  if (vis_cb) if (!vis_cb->BeforeDrawing (this, rview)) return 0;
>
>    SetupObject ();
>
> Index: plugins/mesh/skeleton/persist/standard/skelldr.cpp
> ===================================================================
> --- plugins/mesh/skeleton/persist/standard/skelldr.cpp  (revision 39410)
> +++ plugins/mesh/skeleton/persist/standard/skelldr.cpp  (working copy)
> @@ -157,7 +157,7 @@
>            {
>              csVector3 v;
>              if (!SyntaxService->ParseVector (vector_node, v))
> -              return false;
> +              return 0;
>              bone->GetTransform ().SetOrigin (v);
>            }
>
> @@ -166,7 +166,7 @@
>            {
>              csMatrix3 m;
>              if (!SyntaxService->ParseMatrix (matrix_node, m))
> -              return false;
> +              return 0;
>              bone->GetTransform ().SetO2T (m);
>            }
>          }
> @@ -201,7 +201,7 @@
>              {
>                csVector3 v;
>                if (!SyntaxService->ParseVector (vector_node, v))
> -              return false;
> +              return 0;
>                socket_transform.SetOrigin (v);
>              }
>
> @@ -210,7 +210,7 @@
>              {
>                csMatrix3 m;
>                if (!SyntaxService->ParseMatrix (matrix_node, m))
> -              return false;
> +              return 0;
>                socket_transform.SetO2T (m);
>              }
>              socket->SetTransform(socket_transform);
> @@ -550,7 +550,7 @@
>            {
>            csVector3 v;
>            if (!SyntaxService->ParseVector (vector_node, v))
> -            return false;
> +            return 0;
>            key_transform.SetOrigin (v);
>            }
>
> @@ -559,7 +559,7 @@
>            {
>            csMatrix3 m;
>            if (!SyntaxService->ParseMatrix (matrix_node, m))
> -            return false;
> +            return 0;
>            key_transform.SetO2T (m);
>            }
>          }
> Index: plugins/mesh/watermesh/object/watermesh.cpp
> ===================================================================
> --- plugins/mesh/watermesh/object/watermesh.cpp (revision 39410)
> +++ plugins/mesh/watermesh/object/watermesh.cpp (working copy)
> @@ -363,7 +363,7 @@
>  {
>    n = 0;
>
> -  if (vis_cb) if (!vis_cb->BeforeDrawing (this, rview)) return false;
> +  if (vis_cb) if (!vis_cb->BeforeDrawing (this, rview)) return 0;
>
>    iCamera* camera = rview->GetCamera ();
>
> Index: plugins/terraformer/pagingformer/pagingformer.cpp
> ===================================================================
> --- plugins/terraformer/pagingformer/pagingformer.cpp   (revision 39410)
> +++ plugins/terraformer/pagingformer/pagingformer.cpp   (working copy)
> @@ -1159,7 +1159,7 @@
>    else
>    {
>      // Something we can't return was requested
> -    return false;
> +    return 0;
>    }
>  }
>
> Index: plugins/terraformer/simpleformer/simpleformer.cpp
> ===================================================================
> --- plugins/terraformer/simpleformer/simpleformer.cpp   (revision 39410)
> +++ plugins/terraformer/simpleformer/simpleformer.cpp   (working copy)
> @@ -1012,7 +1012,7 @@
>    else
>    {
>      // Something we can't return was requested
> -    return false;
> +    return 0;
>    }
>  }
>
> }}}

New description:

 I fixed a number of compiler warnings when `--enable-debug` is used.
 Just use "`patch -p0 < diff`" where ''diff'' is the code below to apply
 them.

 {{{
 #!diff
 Index: apps/tools/viewmesh/assetbase.h
 ===================================================================
 --- apps/tools/viewmesh/assetbase.h     (revision 39410)
 +++ apps/tools/viewmesh/assetbase.h     (working copy)
 @@ -185,7 +185,7 @@

    virtual csPtr<iStringArray> GetEffectors() { return 0; }

 -  virtual iParticleEmitter* AddEmitter(uint type) { return false; }
 +  virtual iParticleEmitter* AddEmitter(uint type) { return 0; }

    virtual bool DeleteEmitter(uint idx) { return false; }

 @@ -207,7 +207,7 @@
    virtual bool SetEmitterPropValue(iParticleEmitter* emitter, uint id,
 csVector3& val) { return false; }
    virtual bool SetEmitterPropValue(iParticleEmitter* emitter, uint id,
 csColor4& val) { return false; }

 -  virtual iParticleEffector* AddEffector(uint type) { return false; }
 +  virtual iParticleEffector* AddEffector(uint type) { return 0; }

    virtual bool DeleteEffector(uint idx) { return false; }

 Index: plugins/csparser/csparser.cpp
 ===================================================================
 --- plugins/csparser/csparser.cpp       (revision 39410)
 +++ plugins/csparser/csparser.cpp       (working copy)
 @@ -1286,7 +1288,7 @@
          {
            csColor c;
            if (!SyntaxService->ParseColor (child, c))
 -            return false;
 +            return 0;
            sector->SetDynamicAmbientLight (c);
          }
          break;
 @@ -1479,7 +1482,7 @@
            iRenderLoop* loop = ParseRenderLoop (child, set);
            if (!loop)
            {
 -            return false;
 +            return 0;
            }
            if (set)
            {
 @@ -1661,7 +1664,7 @@
          return 0;
        case XMLTOKEN_KEY:
          if (!ParseKey (child, pNode->QueryObject()))
 -          return false;
 +          return 0;
          break;
        case XMLTOKEN_POSITION:
          if (!SyntaxService->ParseVector (child, pos))
 Index: plugins/mesh/animesh/persist/skeleton2/skeleton2ldr.cpp
 ===================================================================
 --- plugins/mesh/animesh/persist/skeleton2/skeleton2ldr.cpp     (revision
 39410)
 +++ plugins/mesh/animesh/persist/skeleton2/skeleton2ldr.cpp     (working
 copy)
 @@ -514,7 +514,7 @@
      if (!name)
      {
        synldr->ReportError (msgid, node, "No name set for animation");
 -      return false;
 +      return 0;
      }

      CS::Animation::iSkeletonAnimation* fact = packet->CreateAnimation
 (name);
 @@ -522,7 +522,7 @@
      {
        synldr->ReportError (msgid, node,
          "Could not create animation, another animation with same name
 already exist");
 -      return false;
 +      return 0;
      }

      if (node->GetAttributeValueAsBool ("bindspace", false))
 Index: plugins/mesh/animesh/persist/standard/animeshldr.cpp
 ===================================================================
 --- plugins/mesh/animesh/persist/standard/animeshldr.cpp        (revision
 39410)
 +++ plugins/mesh/animesh/persist/standard/animeshldr.cpp        (working
 copy)
 @@ -269,7 +269,7 @@
             {
               csRef<csShaderVariable> sv;
               sv.AttachNew (new csShaderVariable);
 -             if (!synldr->ParseShaderVar (ldr_context, child2, *sv))
 return false;
 +             if (!synldr->ParseShaderVar (ldr_context, child2, *sv))
 return 0;
               shadervars.Push (sv);
               break;
             }
 Index: plugins/mesh/protomesh/object/protomesh.cpp
 ===================================================================
 --- plugins/mesh/protomesh/object/protomesh.cpp (revision 39410)
 +++ plugins/mesh/protomesh/object/protomesh.cpp (working copy)
 @@ -141,7 +141,7 @@
  {
    n = 0;

 -  if (vis_cb) if (!vis_cb->BeforeDrawing (this, rview)) return false;
 +  if (vis_cb) if (!vis_cb->BeforeDrawing (this, rview)) return 0;

    SetupObject ();

 Index: plugins/mesh/skeleton/persist/standard/skelldr.cpp
 ===================================================================
 --- plugins/mesh/skeleton/persist/standard/skelldr.cpp  (revision 39410)
 +++ plugins/mesh/skeleton/persist/standard/skelldr.cpp  (working copy)
 @@ -157,7 +157,7 @@
            {
              csVector3 v;
              if (!SyntaxService->ParseVector (vector_node, v))
 -              return false;
 +              return 0;
              bone->GetTransform ().SetOrigin (v);
            }

 @@ -166,7 +166,7 @@
            {
              csMatrix3 m;
              if (!SyntaxService->ParseMatrix (matrix_node, m))
 -              return false;
 +              return 0;
              bone->GetTransform ().SetO2T (m);
            }
          }
 @@ -201,7 +201,7 @@
              {
                csVector3 v;
                if (!SyntaxService->ParseVector (vector_node, v))
 -              return false;
 +              return 0;
                socket_transform.SetOrigin (v);
              }

 @@ -210,7 +210,7 @@
              {
                csMatrix3 m;
                if (!SyntaxService->ParseMatrix (matrix_node, m))
 -              return false;
 +              return 0;
                socket_transform.SetO2T (m);
              }
              socket->SetTransform(socket_transform);
 @@ -550,7 +550,7 @@
            {
            csVector3 v;
            if (!SyntaxService->ParseVector (vector_node, v))
 -            return false;
 +            return 0;
            key_transform.SetOrigin (v);
            }

 @@ -559,7 +559,7 @@
            {
            csMatrix3 m;
            if (!SyntaxService->ParseMatrix (matrix_node, m))
 -            return false;
 +            return 0;
            key_transform.SetO2T (m);
            }
          }
 Index: plugins/mesh/watermesh/object/watermesh.cpp
 ===================================================================
 --- plugins/mesh/watermesh/object/watermesh.cpp (revision 39410)
 +++ plugins/mesh/watermesh/object/watermesh.cpp (working copy)
 @@ -363,7 +363,7 @@
  {
    n = 0;

 -  if (vis_cb) if (!vis_cb->BeforeDrawing (this, rview)) return false;
 +  if (vis_cb) if (!vis_cb->BeforeDrawing (this, rview)) return 0;

    iCamera* camera = rview->GetCamera ();

 Index: plugins/terraformer/pagingformer/pagingformer.cpp
 ===================================================================
 --- plugins/terraformer/pagingformer/pagingformer.cpp   (revision 39410)
 +++ plugins/terraformer/pagingformer/pagingformer.cpp   (working copy)
 @@ -1159,7 +1159,7 @@
    else
    {
      // Something we can't return was requested
 -    return false;
 +    return 0;
    }
  }

 Index: plugins/terraformer/simpleformer/simpleformer.cpp
 ===================================================================
 --- plugins/terraformer/simpleformer/simpleformer.cpp   (revision 39410)
 +++ plugins/terraformer/simpleformer/simpleformer.cpp   (working copy)
 @@ -1012,7 +1012,7 @@
    else
    {
      // Something we can't return was requested
 -    return false;
 +    return 0;
    }
  }

 }}}

--

-- 
Ticket URL: <http://www.crystalspace3d.org/trac/CS/ticket/980#comment:1>
CrystalSpace <http://www.crystalspace3d.org/>
Free open-source 3D SDK.
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev