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