fix cpp bug

pull/3553/head
LDOUBLEV 2021-08-05 06:05:51 +00:00
parent 8868d06867
commit 4df8a2aedc
1 changed files with 9 additions and 3 deletions

View File

@ -21,12 +21,18 @@ std::vector<std::string> OCRConfig::split(const std::string &str,
std::vector<std::string> res;
if ("" == str)
return res;
char *strs = new char[str.length() + 1];
int strlen = str.length() + 1;
chars *strs = new char[strlen];
std::strcpy(strs, str.c_str());
char *d = new char[delim.length() + 1];
int delimlen = delim.length() + 1;
char *d = new char[delimlen];
std::strcpy(d, delim.c_str());
delete[] strs;
delete[] d;
char *p = std::strtok(strs, d);
while (p) {
std::string s = p;
@ -61,4 +67,4 @@ void OCRConfig::PrintConfigInfo() {
std::cout << "=======End of Paddle OCR inference config======" << std::endl;
}
} // namespace PaddleOCR
} // namespace PaddleOCR