Skip to content

Commit

Permalink
Fix varsize array for Microsoft compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
tfmorris committed Feb 17, 2016
1 parent e028274 commit 809bbd9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions api/baseapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1379,14 +1379,14 @@ static void AddBaselineCoordsTohOCR(const PageIterator *it,
}

static void AddIdTohOCR(STRING* hocr_str, const std::string base, int num1, int num2) {
unsigned long bufsize = base.length() + 2 * kMaxIntSize;
char id_buffer[bufsize];
const unsigned long BUFSIZE = 64;
char id_buffer[BUFSIZE];
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 {
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_buffer;
*hocr_str += "'";
Expand Down

0 comments on commit 809bbd9

Please sign in to comment.