Skip to content

Commit

Permalink
Remove bad NDAttribute cases
Browse files Browse the repository at this point in the history
NDAttribute was being compared with NX attributes.
Not only did the code do nothing after the the comparison (it simply
fell to default case), this also risks breaking the compilation after new
additions to NDAttrDataType_t.

For example: NX_CHAR = 4, which is the same of NDAttrInt32.
Another example: after trying to add types to NDAttrDataType_t I got:

../ADApp/pluginSrc/NDFileNexus.cpp: In member function 'void NDFileNexus::constTextToDataType(char*, int, void*)':
../ADApp/pluginSrc/NDFileNexus.cpp:726:5: error: duplicate case value
     case NDAttrUndefined:
     ^~~~
../ADApp/pluginSrc/NDFileNexus.cpp:681:5: note: previously used here
     case NX_UINT8:
     ^~~~
  • Loading branch information
marcofilho committed Sep 20, 2024
1 parent 22d7871 commit 635cbb9
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions ADApp/pluginSrc/NDFileNexus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,6 @@ void * NDFileNexus::allocConstValue(int dataType, size_t length ) {
case NX_CHAR:
pValue = calloc( length + 1 , sizeof(char) );
break;
case NDAttrUndefined:
default:
pValue = NULL;
break;
Expand Down Expand Up @@ -724,7 +723,6 @@ void NDFileNexus::constTextToDataType(char *inText, int dataType, void *pValue)
((char *)pValue)[strlen(inText)] = '\0';
//sscanf((const char *)inText, "%s", (char *)pValue);
break;
case NDAttrUndefined:
default:
break;
}
Expand Down

0 comments on commit 635cbb9

Please sign in to comment.