-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Description
Environment
- Tesseract Version: 4.0 and newer
- Commit Number:
- Platform: issue is independent of the platform
Current Behavior:
In the C API, the function int TessBaseAPIInit1()
accepts a list of configuration files with the parameters char **configs, int configs_size
. Although configs
is used read-only, it is not correctly const-qualified, which is annoying for me as a user because I have to use const_cast.
char * configs[1];
configs[0] = const_cast<char *>(strConfigFile.c_str());
int r = TessBaseAPIInit1(h, strTessdata.c_str(), "eng", OEM_DEFAULT, configs, 1);
Expected Behavior:
TessBaseAPIInit1
should accept an array of const char pointers.
Suggested Fix:
Change the signature from
TESS_API int TessBaseAPIInit1(TessBaseAPI *handle, const char *datapath, const char *language, TessOcrEngineMode oem, char **configs, int configs_size);
to
TESS_API int TessBaseAPIInit1(TessBaseAPI *handle, const char *datapath, const char *language, TessOcrEngineMode oem, const char **configs, int configs_size);
The implementation is the same because the function does not modify the array of strings.