解决websdk在linux上编译不过的问题

This commit is contained in:
luoliangyi 2022-06-14 18:43:40 +08:00
parent 2e85eb7f21
commit 5dede65275
4 changed files with 33 additions and 10 deletions

View File

@ -13,6 +13,7 @@
#include <setjmp.h> #include <setjmp.h>
#include <malloc.h> #include <malloc.h>
#include <stdarg.h> #include <stdarg.h>
#include <ctype.h>
#if defined(HG_CMP_MSC) #if defined(HG_CMP_MSC)
#include <windows.h> #include <windows.h>

View File

@ -278,7 +278,7 @@ void CvxText::GetStringLocation(const HGChar* text, HGUInt fontSize, HGBool bold
#endif #endif
HGInt origin = 0; HGInt origin = 0;
HGInt minY = MAXINT, maxY = MININT; HGInt minY = INT_MAX, maxY = INT_MIN;
int i = 0; int i = 0;
#if defined(HG_CMP_MSC) #if defined(HG_CMP_MSC)
@ -403,7 +403,7 @@ void CvxText::DrawChar(HGImage image, HGUInt wc, HGInt x, HGInt y, HGColor color
int32_t xOffset = (int32_t)imgLeft + x + (int32_t)j; int32_t xOffset = (int32_t)imgLeft + x + (int32_t)j;
int32_t yOffset = (int32_t)imgTop + y + (int32_t)i; int32_t yOffset = (int32_t)imgTop + y + (int32_t)i;
if (xOffset >= (int32_t)imgLeft && xOffset < (int32_t)imgRight if (xOffset >= (int32_t)imgLeft && xOffset < (int32_t)imgRight
&& yOffset >= (int32_t)imgTop && yOffset < (int32_t)imgBottom) && yOffset >= (int32_t)imgTop && yOffset < (int32_t)imgBottom)
{ {
uint8_t *p = m_face->glyph->bitmap.buffer + m_face->glyph->bitmap.pitch * i + j; uint8_t *p = m_face->glyph->bitmap.buffer + m_face->glyph->bitmap.pitch * i + j;

View File

@ -952,7 +952,7 @@ namespace ver_2
fontParam.strikeout = fontStrikeout; fontParam.strikeout = fontStrikeout;
HGColor color = HG_MAKECOLOR(r, g, b, textOpacity); HGColor color = HG_MAKECOLOR(r, g, b, textOpacity);
if (HGBASE_ERR_OK == HGBase_SetImageROI(image, &roi) if (HGBASE_ERR_OK == HGBase_SetImageROI(image, &roi)
&& HGBASE_ERR_OK == HGImgProc_AddImageWatermark(image, text.c_str(), color, posType, && HGBASE_ERR_OK == HGImgProc_AddImageWatermark(image, text.c_str(), color, posType,
locationX, locationY, &fontParam)) locationX, locationY, &fontParam))
{ {
@ -2797,7 +2797,7 @@ namespace ver_2
break; break;
#else #else
struct stat buf; struct stat buf;
int result = stat(lineContent, &buf); int result = stat(filePath, &buf);
if (0 != result) if (0 != result)
break; break;
#endif #endif
@ -3580,7 +3580,7 @@ namespace ver_2
void ManagerV2::ClearBindFolder() void ManagerV2::ClearBindFolder()
{ {
assert(!m_bindFolder.empty()); assert(!m_bindFolder.empty());
#if defined(HG_CMP_MSC)
char szFind[MAX_PATH]; char szFind[MAX_PATH];
sprintf(szFind, "%s*.*", m_bindFolder.c_str()); sprintf(szFind, "%s*.*", m_bindFolder.c_str());
@ -3601,6 +3601,8 @@ namespace ver_2
} while (FindNextFileA(hFind, &FindFileData)); } while (FindNextFileA(hFind, &FindFileData));
FindClose(hFind); FindClose(hFind);
#else
#endif
} }
void ManagerV2::UpdateBindFolder() void ManagerV2::UpdateBindFolder()
@ -3654,7 +3656,11 @@ namespace ver_2
sprintf(fileName, fmt, m_bindFolder.c_str(), m_bindNameBase + tables[i].idx, tables[i].format.c_str()); sprintf(fileName, fmt, m_bindFolder.c_str(), m_bindNameBase + tables[i].idx, tables[i].format.c_str());
char destName[256]; char destName[256];
sprintf(destName, fmt, m_bindFolder.c_str(), m_bindNameBase + tables[i].idx + 1, tables[i].format.c_str()); sprintf(destName, fmt, m_bindFolder.c_str(), m_bindNameBase + tables[i].idx + 1, tables[i].format.c_str());
#if defined(HG_CMP_MSC)
MoveFileA(fileName, destName); MoveFileA(fileName, destName);
#else
rename(fileName, destName);
#endif
} }
} }
@ -3663,7 +3669,7 @@ namespace ver_2
SaveToFile(imgData, imgSize, fileName); SaveToFile(imgData, imgSize, fileName);
} }
void ManagerV2::ModifyBindFolderImage(const std::vector<BatchTableInfo>& tables, int imageIndex, const std::string imgFmt, void ManagerV2::ModifyBindFolderImage(const std::vector<BatchTableInfo>& tables, int imageIndex, const std::string imgFmt,
const HGByte* imgData, HGUInt imgSize) const HGByte* imgData, HGUInt imgSize)
{ {
assert(!m_bindFolder.empty()); assert(!m_bindFolder.empty());
@ -3736,7 +3742,11 @@ namespace ver_2
sprintf(fileName, fmt, m_bindFolder.c_str(), m_bindNameBase + tables[i].idx, tables[i].format.c_str()); sprintf(fileName, fmt, m_bindFolder.c_str(), m_bindNameBase + tables[i].idx, tables[i].format.c_str());
char destName[256]; char destName[256];
sprintf(destName, fmt, m_bindFolder.c_str(), m_bindNameBase + tables[i].idx - value, tables[i].format.c_str()); sprintf(destName, fmt, m_bindFolder.c_str(), m_bindNameBase + tables[i].idx - value, tables[i].format.c_str());
MoveFileA(fileName, destName); #if defined(HG_CMP_MSC)
MoveFileA(fileName, destName);
#else
rename(fileName, destName);
#endif
} }
} }
} }
@ -3763,17 +3773,29 @@ namespace ver_2
sprintf(fileName1, fmt, m_bindFolder.c_str(), m_bindNameBase + imageIndex1, format1.c_str()); sprintf(fileName1, fmt, m_bindFolder.c_str(), m_bindNameBase + imageIndex1, format1.c_str());
char TmpFileName[256]; char TmpFileName[256];
sprintf(TmpFileName, "%sTemp", m_bindFolder.c_str()); sprintf(TmpFileName, "%sTemp", m_bindFolder.c_str());
MoveFileA(fileName1, TmpFileName); #if defined(HG_CMP_MSC)
MoveFileA(fileName1, TmpFileName);
#else
rename(fileName1, TmpFileName);
#endif
char fileName2[256]; char fileName2[256];
sprintf(fileName2, fmt, m_bindFolder.c_str(), m_bindNameBase + imageIndex2, format2.c_str()); sprintf(fileName2, fmt, m_bindFolder.c_str(), m_bindNameBase + imageIndex2, format2.c_str());
char fileName2Dest[256]; char fileName2Dest[256];
sprintf(fileName2Dest, fmt, m_bindFolder.c_str(), m_bindNameBase + imageIndex1, format2.c_str()); sprintf(fileName2Dest, fmt, m_bindFolder.c_str(), m_bindNameBase + imageIndex1, format2.c_str());
MoveFileA(fileName2, fileName2Dest); #if defined(HG_CMP_MSC)
MoveFileA(fileName2, fileName2Dest);
#else
rename(fileName2, fileName2Dest);
#endif
char fileName1Dest[256]; char fileName1Dest[256];
sprintf(fileName1Dest, fmt, m_bindFolder.c_str(), m_bindNameBase + imageIndex2, format1.c_str()); sprintf(fileName1Dest, fmt, m_bindFolder.c_str(), m_bindNameBase + imageIndex2, format1.c_str());
MoveFileA(TmpFileName, fileName1Dest); #if defined(HG_CMP_MSC)
MoveFileA(TmpFileName, fileName1Dest);
#else
rename(TmpFileName, fileName1Dest);
#endif
} }
void ManagerV2::ClearBindFolderImageList(const std::vector<BatchTableInfo>& tables) void ManagerV2::ClearBindFolderImageList(const std::vector<BatchTableInfo>& tables)