trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DaveBirdsall <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #590: JIRA TRAFODION-2099 Add support for b...
Date Mon, 11 Jul 2016 20:47:23 GMT
Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/590#discussion_r70333760
  
    --- Diff: core/sql/common/str.cpp ---
    @@ -997,19 +997,40 @@ Lng32 str_decode(void *tgt, Lng32 tgtMaxLen, const char *src, Lng32
srcLen)
       return length;
     }
     
    -// Strips leading and trailing blanks. src will contain a NULL after the
    +// Strips leading and/or trailing blanks. src will contain a NULL after the
     // end of the first non-blank character.The length of the "stripped" string
    -// is returned in len
    -
    -void str_strip_blanks(char *src , Lng32 &len)
    +// is returned in len.
    +// Returns pointer to the start of string after leading blanks.
    +char * str_strip_blanks(char *src , Lng32 &len, 
    +                        NABoolean stripLeading,
    +                        NABoolean stripTrailing
    +                        )
     {
    +  if (! src)
    +    return NULL;
    +
       len = str_len(src)-1;
    -  while ((len >= 0) && (src[len] == ' '))
    -    len--;
    +  if (len <= 0)
    +    return src;
    --- End diff --
    
    This doesn't look right to me. Suppose the input string is 'a'. Then wouldn't str_len('a')
be 1? And wouldn't len get zero? Seems like the returned len value should be one.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message