File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 1
1
#include "Mode.h"
2
2
#include <string.h>
3
3
4
+ #ifdef NDEBUG
5
+ #include <stdio.h>
6
+ #include <stdlib.h>
7
+ #endif
4
8
5
9
const ModeData MODES [] = {
6
10
[IMAGING_MODE_UNKNOWN ] = {"" },
@@ -39,6 +43,11 @@ const ModeID findModeID(const char * const name) {
39
43
return IMAGING_MODE_UNKNOWN ;
40
44
}
41
45
for (size_t i = 0 ; i < sizeof (MODES ) / sizeof (* MODES ); i ++ ) {
46
+ #ifdef NDEBUG
47
+ if (MODES [i ].name == NULL ) {
48
+ fprintf (stderr , "Mode ID %zu is not defined.\n" , (size_t )i );
49
+ } else
50
+ #endif
42
51
if (strcmp (MODES [i ].name , name ) == 0 ) {
43
52
return (ModeID )i ;
44
53
}
@@ -238,6 +247,11 @@ const RawModeID findRawModeID(const char * const name) {
238
247
return IMAGING_RAWMODE_UNKNOWN ;
239
248
}
240
249
for (size_t i = 0 ; i < sizeof (RAWMODES ) / sizeof (* RAWMODES ); i ++ ) {
250
+ #ifdef NDEBUG
251
+ if (RAWMODES [i ].name == NULL ) {
252
+ fprintf (stderr , "Rawmode ID %zu is not defined.\n" , (size_t )i );
253
+ } else
254
+ #endif
241
255
if (strcmp (RAWMODES [i ].name , name ) == 0 ) {
242
256
return (RawModeID )i ;
243
257
}
You can’t perform that action at this time.
0 commit comments