Skip to content

Commit

Permalink
Passes unittests on older gcc
Browse files Browse the repository at this point in the history
  • Loading branch information
cpiker committed Mar 3, 2024
1 parent 90ad201 commit f9ed1d0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
2 changes: 2 additions & 0 deletions das2/codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -839,9 +839,11 @@ int DasCodec_decode(
/* or search of the end, parse, then run in the data */
case DASENC_TEXT|DASENC_VARSZ:
case DASENC_TEXT|DASENC_PARSE|DASENC_VARSZ:
{
int nValsDidRead = 0;
nBytesRead = _var_text_read(pThis, pBuf, nBufLen, nValsToRead, &nValsDidRead);
nValsToRead = nValsDidRead;
}

if(nBytesRead < 0 )
return nBytesRead;
Expand Down
19 changes: 14 additions & 5 deletions das2/property.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,14 @@ DasErrCode DasProp_init(
if((units == NULL) && (nStandard == DASPROP_DAS2) && (sType != NULL)){

int nUnitWord = 0;
if(strcasecmp(sType, "datum") == 0)
if((strcasecmp(sType, "datum") == 0)||(strcasecmp(sType, "time") == 0)
||(strcasecmp(sType, "datetime") == 0)
)
nUnitWord = 1;
else
if (strcasecmp(sType, "datumrange") == 0)
nUnitWord = 4;
if( (strcasecmp(sType, "datumrange") == 0)||(strcasecmp(sType, "timerange") == 0)
||(strcasecmp(sType, "datetimerange") == 0))
nUnitWord = 3;

if(nUnitWord > 0){
const char* pRead = sValue;
Expand Down Expand Up @@ -214,8 +217,14 @@ DasErrCode DasProp_init(
uFlags |= (DASPROP_DATETIME | DASPROP_RANGE);
else if( (strcasecmp(sType, "datum") == 0) && (sValue[0] != '\0'))
uFlags |= (DASPROP_REAL | DASPROP_SINGLE);
else if((strcasecmp(sType, "datumrange") == 0) && (sValue[0] != '\0'))
uFlags |= (DASPROP_REAL | DASPROP_RANGE);
else if((strcasecmp(sType, "datumrange") == 0) && (sValue[0] != '\0')){
/* Some time ranges have been listed as datum ranges, if you
* see units of 'UTC', make this a time range instead */
if(Units_haveCalRep(units))
uFlags |= (DASPROP_DATETIME | DASPROP_RANGE);
else
uFlags |= (DASPROP_REAL | DASPROP_RANGE);
}
else
return das_error(DASERR_PROP,
"Invalid property type '%s' for value '%s'", sName, sValue
Expand Down
12 changes: 7 additions & 5 deletions das2/value.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,11 +535,13 @@ DasErrCode das_value_fromStr(
case vtUnknown:
return das_error(DASERR_VALUE, "Cannot determine fill values for unknown types");

case vtText:
size_t nLen = strlen(sStr);
if(nLen <= nBufLen){
strncpy((char*)pBuf, sStr, nLen);
return DAS_OKAY;
case vtText:
{
size_t nLen = strlen(sStr);
if(nLen <= nBufLen){
strncpy((char*)pBuf, sStr, nLen);
return DAS_OKAY;
}
}
daslog_error_v(
"string value '%s' can't fit into %d byte buffer", sStr, nBufLen
Expand Down
2 changes: 1 addition & 1 deletion das2/variable.c
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ DasAry* DasConstant_subset(
return pAry;
}

bool DasConstant_degenerate(const DasVar* pBase, int)
bool DasConstant_degenerate(const DasVar* pBase, int iIdx)
{
return true;
}
Expand Down

0 comments on commit f9ed1d0

Please sign in to comment.