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: JIRA TRAFODION-1873
Date Tue, 08 Mar 2016 23:18:09 GMT
Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/371#discussion_r55446597
  
    --- Diff: core/sql/exp/exp_datetime.cpp ---
    @@ -2337,6 +2430,50 @@ convertStrToMonth(char * value, char *result)
       return FALSE;
     }
     
    +static short convSrcDataToDst(Lng32 numSrcBytes, char* &srcData, 
    +                               Lng32 numTgtBytes, char *dstData,
    +                               const char * nextByte,
    +                               CollHeap * heap, ComDiagsArea** diagsArea)
    +{
    +  Lng32 src = 0;
    +  Lng32 val = 0;
    +  for (val = 0, src = 0; src < numSrcBytes && isDigit8859_1(*srcData); 
    +       src++, srcData++)
    +    val = val * 10 + (*srcData - '0');
    +  
    +  if (src < numSrcBytes) 
    +    {
    +      // string contains non-digit
    +      //
    +      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
    +      return -1;
    +    }
    +
    +  if (numTgtBytes == sizeof(Lng32))
    +    *(Lng32*)dstData = val;
    +  else if (numTgtBytes == sizeof(short))
    +    *(short*)dstData = val;
    +  else if (numTgtBytes == sizeof(char))
    +    *(char*)dstData = val;
    +  else 
    --- End diff --
    
    Never mind. Looks like we depend on the caller to make sure conditions are such that overflows
will not occur.


---
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