Re: [CrystalSpace] #992: Use csArrayItemNotFound in stringarray.h

"CrystalSpace" <[email protected]> Mon, 29 Jul 2013 18:07:21 -0000
Newsgroups gmane.comp.graphics.crystalspace.tracker
Message-ID <[email protected]>
#992: Use csArrayItemNotFound in stringarray.h
---------------------------+------------------------------------------------
 Reporter:  ralphcampbell  |       Owner:  jorrit
     Type:  task           |      Status:  new   
 Priority:  minimal        |   Milestone:        
Component:  general        |     Version:  V2.1  
 Keywords:                 |  
---------------------------+------------------------------------------------
Description changed by sunshine:

Old description:

> Just a style change, not a bug, but csArrayItemNotFound should be used
> instead of the actual value (size_t)-1.
> Also, a minor comment change since there is no `threshold` argument.
>
> {{{
> ===================================================================
> --- include/csutil/stringarray.h        (revision 39526)
> +++ include/csutil/stringarray.h        (working copy)
> @@ -71,7 +71,7 @@
>  public:
>    /**
>     * Initialize object to hold initially \c limit elements, and increase
> -   * storage by \c threshold each time the upper bound is exceeded.
> +   * storage by \c CapacityHandler each time the upper bound is
> exceeded.
>     */
>    StringArray (size_t limit = 0, const CapacityHandler& ch =
> CapacityHandler())
>         : superclass(limit, ch)
> @@ -176,7 +176,7 @@
>      for (size_t i = 0; i < this->GetSize (); i++)
>        if (! strcmp (this->Get (i), str))
>          return i;
> -    return (size_t)-1;
> +    return csArrayItemNotFound;
>    }
>
>    /**
> @@ -204,7 +204,7 @@
>      for (size_t i = 0; i < this->GetSize (); i++)
>        if (!csStrCaseCmp (this->Get (i), str))
>          return i;
> -    return (size_t)-1;
> +    return csArrayItemNotFound;
>    }
>
>    /**
> }}}

New description:

 Just a style change, not a bug, but `csArrayItemNotFound` should be used
 instead of the actual value `(size_t)-1`.
 Also, a minor comment change since there is no `threshold` argument.

 {{{
 #!diff
 ===================================================================
 --- include/csutil/stringarray.h        (revision 39526)
 +++ include/csutil/stringarray.h        (working copy)
 @@ -71,7 +71,7 @@
  public:
    /**
     * Initialize object to hold initially \c limit elements, and increase
 -   * storage by \c threshold each time the upper bound is exceeded.
 +   * storage by \c CapacityHandler each time the upper bound is exceeded.
     */
    StringArray (size_t limit = 0, const CapacityHandler& ch =
 CapacityHandler())
         : superclass(limit, ch)
 @@ -176,7 +176,7 @@
      for (size_t i = 0; i < this->GetSize (); i++)
        if (! strcmp (this->Get (i), str))
          return i;
 -    return (size_t)-1;
 +    return csArrayItemNotFound;
    }

    /**
 @@ -204,7 +204,7 @@
      for (size_t i = 0; i < this->GetSize (); i++)
        if (!csStrCaseCmp (this->Get (i), str))
          return i;
 -    return (size_t)-1;
 +    return csArrayItemNotFound;
    }

    /**
 }}}

--

-- 
Ticket URL: <http://www.crystalspace3d.org/trac/CS/ticket/992#comment:1>
CrystalSpace <http://www.crystalspace3d.org/>
Free open-source 3D SDK.
------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk