mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-03 00:49:01 +08:00
Fix varsize array for Microsoft compiler
This commit is contained in:
parent
473c30fa87
commit
c3ad0de69b
@ -1379,14 +1379,14 @@ static void AddBaselineCoordsTohOCR(const PageIterator *it,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void AddIdTohOCR(STRING* hocr_str, const std::string base, int num1, int num2) {
|
static void AddIdTohOCR(STRING* hocr_str, const std::string base, int num1, int num2) {
|
||||||
unsigned long bufsize = base.length() + 2 * kMaxIntSize;
|
const unsigned long BUFSIZE = 64;
|
||||||
char id_buffer[bufsize];
|
char id_buffer[BUFSIZE];
|
||||||
if (num2 >= 0) {
|
if (num2 >= 0) {
|
||||||
snprintf(id_buffer, bufsize - 1, "%s_%d_%d", base.c_str(), num1, num2);
|
snprintf(id_buffer, BUFSIZE - 1, "%s_%d_%d", base.c_str(), num1, num2);
|
||||||
} else {
|
} else {
|
||||||
snprintf(id_buffer, bufsize - 1, "%s_%d", base.c_str(), num1);
|
snprintf(id_buffer, BUFSIZE - 1, "%s_%d", base.c_str(), num1);
|
||||||
}
|
}
|
||||||
id_buffer[bufsize - 1] = '\0';
|
id_buffer[BUFSIZE - 1] = '\0';
|
||||||
*hocr_str += " id='";
|
*hocr_str += " id='";
|
||||||
*hocr_str += id_buffer;
|
*hocr_str += id_buffer;
|
||||||
*hocr_str += "'";
|
*hocr_str += "'";
|
||||||
|
Loading…
Reference in New Issue
Block a user