trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: November 2012

Re: [trinity-devel] katapult: warning: comparison with string literal

From: Darrell Anderson <humanreadable@...>
Date: Thu, 1 Nov 2012 17:24:49 -0700 (PDT)
> Somebody please review the proposed patch:
> 
> ======================================
> diff -urN
> katapult/katapult/plugins/catalogs/documentcatalog/documentcatalog.cpp
> katapult.new/katapult/plugins/catalogs/documentcatalog/documentcatalog.cpp
> ---
> katapult/katapult/plugins/catalogs/documentcatalog/documentcatalog.cpp 
> 2012-09-14 17:40:04.000000000 -0500
> +++
> katapult.new/katapult/plugins/catalogs/documentcatalog/documentcatalog.cpp 
> 2012-11-01 11:27:44.000000000 -0500
> @@ -173,7 +173,7 @@
>       if(files.count() > 0)
>       {
>         newStatus |= S_HasResults;
> -       if(files.count() > 1 || files.at(0)->className() == "Directory")
> +       if(files.count() > 1 || strcmp(files.at(0)->className(), "Directory"))
>           newStatus |= S_Multiple;
>       } else
>         newStatus |= S_NoResults;
> ======================================



Based upon my previous post, I'm thinking this is the correct patch for katapult:


======================================
diff -urN katapult/katapult/plugins/catalogs/documentcatalog/documentcatalog.cpp katapult.new/katapult/plugins/catalogs/documentcatalog/documentcatalog.cpp
--- katapult/katapult/plugins/catalogs/documentcatalog/documentcatalog.cpp  2012-09-14 17:40:04.000000000 -0500
+++ katapult.new/katapult/plugins/catalogs/documentcatalog/documentcatalog.cpp  2012-11-01 11:27:44.000000000 -0500
@@ -173,7 +173,7 @@
      if(files.count() > 0)
      {
        newStatus |= S_HasResults;
-       if(files.count() > 1 || files.at(0)->className() == "Directory")
+       if(files.count() > 1 || ( strcmp(files.at(0)->className(), "Directory") == 0 ) )
          newStatus |= S_Multiple;
      } else
        newStatus |= S_NoResults;
======================================



Comments appreciated!

Darrell