trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DaveBirdsall <...@git.apache.org>
Subject [GitHub] trafodion pull request #1632: [TRAFODION-3127] tochar enhancement
Date Tue, 10 Jul 2018 20:40:17 GMT
Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1632#discussion_r201484661
  
    --- Diff: core/sql/exp/exp_datetime.cpp ---
    @@ -3294,6 +3338,39 @@ convertMonthToStr(Lng32 value, char *&result, UInt32 width)
       result += width;
     }
     
    +static void
    +convertDayOfWeekToStr(Lng32 value, char *&result, NABoolean bAbbreviation, UInt32
width)
    +{
    +  const char* dayofweek[] =
    +  {
    +    "SUNDAY   ",
    +    "MONDAY   ",
    +    "TUESDAY  ",
    +    "WEDNESDAY",
    +    "THURSDAY ",
    +    "FRIDAY   ",
    +    "SATURDAY "
    +  };
    +
    +  const char* dayofweek_abb[] =
    +  {
    +    "SUN",
    +    "MON",
    +    "TUE",
    +    "WED",
    +    "THU",
    +    "FRI",
    +    "SAT"
    +  };
    +
    +  if (bAbbreviation)
    +    strcpy(result, dayofweek_abb[value-1]);
    +  else
    +    strcpy(result, dayofweek[value-1]);
    +  // Update result pointer to point to end of string.
    +  result += width;
    --- End diff --
    
    Why width instead of strlen(result)? (This is probably OK; I'm just curious.)


---

Mime
View raw message