Bladeren bron

Z991239-6443 #comment _snprintf 改造

80374374 4 maanden geleden
bovenliggende
commit
6b36b867b4

+ 2 - 1
Framework/libtoolkit/CMakeLists.txt

@@ -62,6 +62,7 @@ if(MSVC)
   target_compile_definitions(${MODULE_NAME} PRIVATE  "-DLIBTOOLKIT_EXPORTS")
   list(APPEND ${MODULE_PREFIX}_LIBS 
     dbghelp 
+    uuid
     ws2_32
     Winmm
     MsWSock # ioqueue
@@ -69,7 +70,7 @@ if(MSVC)
     winpr)
 
 else(MSVC)
-  list(APPEND ${MODULE_PREFIX}_LIBS ${PRIVATE_KEYWORD} winpr ${PRIVATE_KEYWORD} rt)
+  list(APPEND ${MODULE_PREFIX}_LIBS ${PRIVATE_KEYWORD} winpr ${PRIVATE_KEYWORD} rt ${PRIVATE_KEYWORD} uuid)
 endif(MSVC)
 
 set_target_properties(${MODULE_NAME} PROPERTIES DEBUG_POSTFIX "d")

+ 5 - 0
Framework/libtoolkit/strutil.c

@@ -15,6 +15,11 @@
 #include <winpr/string.h>
 #include <winpr/crt.h>
 #include "dbgutil.h"
+
+#ifndef _MSC_VER 
+#include "uuid/uuid.h"
+#endif //NOT _MSC_VER
+
 #pragma warning(disable : 4311)
 
 TOOLKIT_API const char *memstr(const char *buf, int n, const char *str)

+ 0 - 2
Module/mod_counterconnector/ConnectorFSM.h

@@ -12,8 +12,6 @@
 
 #ifdef _WIN32
 #include "resource.h"
-#else
-#include "uuid/uuid.h"
 #endif
 
 #include "http_callrouter.h"

+ 3 - 11
Module/mod_facetracking/mod_facetracking.cpp

@@ -10,19 +10,11 @@
 #include "fileutil.h"
 #include "EventCode.h"
 #include "../mod_mediacontroller/Event.h"
+#include <winpr/string.h>
 
 #ifndef MAX_LOG_LEN
 #define MAX_LOG_LEN 512
 #endif
-//TODO: CrossPlaform  [Gifur@2025730]
-#ifndef rvc_snprintf
-#ifdef RVC_OS_WIN
-#define rvc_snprintf _snprintf
-#else
-#define rvc_snprintf snprintf
-#endif // RVC_OS_WIN
-
-#endif // rvc_snprintf
 
 // 脸部跟踪&拍照 devel: 0x302
 
@@ -281,11 +273,11 @@ void CFaceTrackingEntity::GetFaceImgName(char* FaceName, uint32_t uLen)
 	{
 		if (((const char*)strCustomerID == NULL)||(_stricmp(strCustomerID,"N") == 0))
 		{
-			rvc_snprintf(FaceName, uLen,"%s%s%s_0", strPath.GetData(), SPLIT_SLASH_STR, strSessionID.GetData());
+			_snprintf(FaceName, uLen,"%s%s%s_0", strPath.GetData(), SPLIT_SLASH_STR, strSessionID.GetData());
 		}
 		else
 		{
-			rvc_snprintf(FaceName, uLen, "%s%s%s_%s", strPath.GetData(), SPLIT_SLASH_STR, strSessionID.GetData(), strCustomerID.GetData());
+			_snprintf(FaceName, uLen, "%s%s%s_%s", strPath.GetData(), SPLIT_SLASH_STR, strSessionID.GetData(), strCustomerID.GetData());
 		}
 		bIsSessionChange = false;
 		bIsCustomerChange = false;

+ 5 - 13
Module/mod_livenessdetection/RvcFaceVideo.cpp

@@ -3,15 +3,7 @@
 #include <stdio.h>
 #include <assert.h>
 #include <string.h>
-
-#ifndef rvc_snprintf
-#ifdef _WIN32
-#define rvc_snprintf _snprintf
-#else
-#define rvc_snprintf snprintf
-#endif // _WIN32
-
-#endif // rvc_snprintf
+#include <winpr/string.h>
 
 RvcFaceVideo::RvcFaceVideo(void)
 {
@@ -81,19 +73,19 @@ int RvcFaceVideo::InitVideoQueue(const char* strenvqueue, const char* stroptqueu
 	int iRet = -1;
 
 	if (NULL != strenvqueue){
-		rvc_snprintf(m_env_videoname, MAX_PATH, "%s", strenvqueue);
+		_snprintf(m_env_videoname, MAX_PATH, "%s", strenvqueue);
 	}
 
 	if (NULL != stroptqueue){
-		rvc_snprintf(m_opt_videoname, MAX_PATH, "%s", stroptqueue);
+		_snprintf(m_opt_videoname, MAX_PATH, "%s", stroptqueue);
 	}
 
 	if (NULL != strpreview_envqueue){
-		rvc_snprintf(m_preview_env_videoname, MAX_PATH, "%s", strpreview_envqueue);
+		_snprintf(m_preview_env_videoname, MAX_PATH, "%s", strpreview_envqueue);
 	}
 
 	if (NULL != strpreview_optqueue){
-		rvc_snprintf(m_preview_opt_videoname, MAX_PATH, "%s", strpreview_optqueue);
+		_snprintf(m_preview_opt_videoname, MAX_PATH, "%s", strpreview_optqueue);
 	}
 
 	if (strlen(m_env_videoname)){

+ 6 - 26
Module/mod_localmediaplay/mod_localmediaplay.cpp

@@ -8,6 +8,7 @@
 #include <stdint.h>
 #include "../mod_interactivecontrol/Event.h"
 #include "Event.h"
+#include <winpr/string.h>
 
 #ifndef RVC_MIN_LOCALPLAYER_TIME
 #define RVC_MIN_LOCALPLAYER_TIME 1
@@ -40,17 +41,6 @@ int removeOldTime = 1800;
 #define RVC_VIDEOPLAY_END_TIME "17:30:00"
 #endif // !RVC_VIDEOPLAY_END_TIME
 
-//TODO: CrossPlaform  [Gifur@2025730]
-#ifndef rvc_snprintf
-#ifdef RVC_OS_WIN
-#define rvc_snprintf _snprintf
-#else
-#define rvc_snprintf snprintf
-#endif // RVC_OS_WIN
-
-#endif // rvc_snprintf
-
-
 static uint32_t ConvertStereo2Mono(char* pDstBuf, const uint32_t uDstLen, char* pSrcBuf, uint32_t uSrcLen, uint32_t uBitDeepth)
 {
 	uint32_t uRet = 0;
@@ -502,7 +492,7 @@ void CLocalMediaPlayEntity::loadDefaultMedia(bool fNewVersion)
 
 			curImg.nFileCnt = 4;
 			for (int i = 0; i < curImg.nFileCnt; ++i) {
-				rvc_snprintf(curImg.strFileNames[i], MAX_PATH, "Ad0%s%d.jpg", SPLIT_SLASH_STR, i);
+				_snprintf(curImg.strFileNames[i], MAX_PATH, "Ad0%s%d.jpg", SPLIT_SLASH_STR, i);
 			}
 			m_defaultImg.push_back(curImg);
 #endif
@@ -518,7 +508,7 @@ void CLocalMediaPlayEntity::loadDefaultMedia(bool fNewVersion)
 			curImg1.nPlayInterval = 5000;
 			curImg1.nFileCnt = 4;
 			for (int i = 0; i < curImg1.nFileCnt; ++i) {
-				rvc_snprintf(curImg1.strFileNames[i], MAX_PATH, "Ad0%s%d.jpg", SPLIT_SLASH_STR, i);
+				_snprintf(curImg1.strFileNames[i], MAX_PATH, "Ad0%s%d.jpg", SPLIT_SLASH_STR, i);
 			}
 			m_defaultPic.push_back(curImg1);
 		}
@@ -538,7 +528,7 @@ void CLocalMediaPlayEntity::loadDefaultMedia(bool fNewVersion)
 			curImg.nFileCnt = 4;
 
 			for (int i = 0; i < curImg.nFileCnt; ++i) {
-				rvc_snprintf(curImg.strFileNames[i], MAX_PATH, "Ad1%s%d.jpg", SPLIT_SLASH_STR, i);
+				_snprintf(curImg.strFileNames[i], MAX_PATH, "Ad1%s%d.jpg", SPLIT_SLASH_STR, i);
 			}
 			m_defaultImg.push_back(curImg);
 #endif
@@ -554,7 +544,7 @@ void CLocalMediaPlayEntity::loadDefaultMedia(bool fNewVersion)
 			curImg1.nPlayInterval = 1000;
 			curImg1.nFileCnt = 4;
 			for (int i = 0; i < curImg1.nFileCnt; ++i) {
-				rvc_snprintf(curImg1.strFileNames[i], MAX_PATH, "Ad1%s%d.jpg", SPLIT_SLASH_STR, i);
+				_snprintf(curImg1.strFileNames[i], MAX_PATH, "Ad1%s%d.jpg", SPLIT_SLASH_STR, i);
 			}
 			m_defaultPic.push_back(curImg1);
 		}
@@ -1933,16 +1923,11 @@ void CLocalMediaPlayEntity::StartAudio(const char *pAudioNames)
 {
 	if (NULL != pAudioNames) {
 		char strAudios[MAX_PATH] = { 0 };
-		rvc_snprintf(strAudios, MAX_PATH, "%s", pAudioNames);
+		_snprintf(strAudios, MAX_PATH, "%s", pAudioNames);
 		const char* d = "|";
 		char* pName = NULL;
 		char* pdata = NULL;
-		//TODO: CrossPlaform  [Gifur@2025730]
-#ifdef RVC_OS_WIN
 		pName = strtok_s(strAudios, d, &pdata);
-#else
-		pName = strtok_r(strAudios, d, &pdata);
-#endif
 		while (pName) {
 			CSimpleStringA strAudioFileName = pName;
 			CSimpleStringA strAudioFullPath = m_AudioPath + strAudioFileName;
@@ -1950,12 +1935,7 @@ void CLocalMediaPlayEntity::StartAudio(const char *pAudioNames)
 				LogWarn(Severity_Low, Error_Debug, LOG_EVT_ADV_AUDIO_NOT_EXIST, CSimpleStringA::Format("audio file %s not exist!", strAudioFullPath.GetData()).GetData());
 				return;
 			}
-			//TODO: CrossPlaform  [Gifur@2025730]
-#ifdef RVC_OS_WIN
 			pName = strtok_s(NULL, d, &pdata);
-#else
-			pName = strtok_r(NULL, d, &pdata);
-#endif
 		}
 	}
 #ifdef RVC_OS_WIN

+ 5 - 4
Module/mod_sipphone/mod_sipphone.cpp

@@ -13,6 +13,7 @@
 #include "video_session.h"
 #include "../mod_counterconnector/Event.h"
 #include "../mod_evtconverter/Event.h"
+#include <winpr/string.h>
 
 #define EVT_CONVERTER	"EventConverter"
 
@@ -2088,10 +2089,10 @@ ErrorCodeEnum CSIPEntity::LoadConfig(endpoint_conf_t *conf)
 		table.AddEntryInt("video", "mtu", conf->mtu, 0);
 		Error = table.Load(spRootConfig);
 		if (Error == Error_Succeed) {
-			rvc_snprintf(conf->audio_handfree_in_dev, MAX_PATH, "%s", strHandFreeIn.GetData());
-			rvc_snprintf(conf->audio_handfree_out_dev, MAX_PATH, "%s", strHandFreeOut.GetData());
-			rvc_snprintf(conf->audio_pickup_in_dev, MAX_PATH, "%s", strPickupIn.GetData());
-			rvc_snprintf(conf->audio_pickup_out_dev, MAX_PATH, "%s", strPickupOut.GetData());
+			_snprintf(conf->audio_handfree_in_dev, MAX_PATH, "%s", strHandFreeIn.GetData());
+			_snprintf(conf->audio_handfree_out_dev, MAX_PATH, "%s", strHandFreeOut.GetData());
+			_snprintf(conf->audio_pickup_in_dev, MAX_PATH, "%s", strPickupIn.GetData());
+			_snprintf(conf->audio_pickup_out_dev, MAX_PATH, "%s", strPickupOut.GetData());
 
 			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s", generateAudioDspFlags(conf->audio_dsp).GetData());
 

+ 2 - 2
Module/mod_sipphone/video_render.cpp

@@ -189,7 +189,7 @@ static int rvc_getrxkimage(IplImage** personimage, IplImage** personmask)
 	int iret = -1;
 
 	char strPersonPath[MAX_PATH] = { 0 };
-	rvc_snprintf(strPersonPath, MAX_PATH, "./bin/rxk.jpg");
+	_snprintf(strPersonPath, MAX_PATH, "./bin/rxk.jpg");
 
 	if (ExistsFile(strPersonPath)) {
 		*personimage = cvLoadImage(strPersonPath);
@@ -370,7 +370,7 @@ static int rvc_get_agent_videoframe(video_frame** remote_frame)
 	int iret = -1;
 
 	char strImgPath[MAX_PATH] = { 0 };
-	rvc_snprintf(strImgPath, MAX_PATH, "%s", "./bin/agent.jpg");
+	_snprintf(strImgPath, MAX_PATH, "%s", "./bin/agent.jpg");
 	int irecord_video_frame_width = REC_COMMON_VIDEO_SNAPSHOT_PREVIEW_WIDTH;
 	int irecord_video_frame_heigt = REC_COMMON_VIDEO_SNAPSHOT_PREVIEW_HEIGHT;
 

+ 0 - 8
Module/mod_sipphone/video_render.h

@@ -13,14 +13,6 @@
 #define MAX_PATH 260
 #endif
 
-#ifndef rvc_snprintf
-#ifdef RVC_OS_WIN
-#define rvc_snprintf _snprintf
-#else
-#define rvc_snprintf snprintf
-#endif // RVC_OS_WIN
-#endif // rvc_snprintf
-
 enum eVideoRenderQueue {
 	ePreview_Queue,
 	eSnapshot_Queue