@@ -19,15 +19,10 @@ bool HTTPTask_TaskPost_Image(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int
1919#else
2020 int nSDLen = 0 ;
2121 int nRVLen = 0 ;
22- XCHAR tszHTTPKey[64 ];
23- XCHAR tszHTTPVlu[64 ];
24- XCHAR* ptszSDBuffer = (XCHAR*)malloc (XENGINE_MEMORY_SIZE_MAX);
25- XCHAR* ptszRVBuffer = (XCHAR*)malloc (XENGINE_MEMORY_SIZE_MAX);
26-
27- memset (tszHTTPKey, ' \0 ' , sizeof (tszHTTPKey));
28- memset (tszHTTPVlu, ' \0 ' , sizeof (tszHTTPVlu));
29- memset (ptszSDBuffer, ' \0 ' , XENGINE_MEMORY_SIZE_MAX);
30- memset (ptszRVBuffer, ' \0 ' , XENGINE_MEMORY_SIZE_MAX);
22+ XCHAR tszHTTPKey[64 ] = {};
23+ XCHAR tszHTTPVlu[64 ] = {};
24+ CXEngine_MemoryPoolEx m_MemorySend (XENGINE_MEMORY_SIZE_MAX);
25+ CXEngine_MemoryPoolEx m_MemoryRecv (XENGINE_MEMORY_SIZE_MAX);
3126
3227 BaseLib_String_GetKeyValue ((*ppptszList)[1 ], " =" , tszHTTPKey, tszHTTPVlu);
3328 int nOPCode = _ttxoi (tszHTTPVlu);
@@ -49,17 +44,17 @@ bool HTTPTask_TaskPost_Image(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int
4944 int nListCount = 0 ;
5045 if (ModuleHelp_ImageGet_TextGet (lpszMsgBuffer, nMsgLen, &pptszListStr, &nListCount))
5146 {
52- ModuleProtocol_Packet_ImageText (ptszRVBuffer , &nRVLen, &pptszListStr, nListCount);
53- HttpProtocol_Server_SendMsgEx (xhHTTPPacket, ptszSDBuffer , &nSDLen, &st_HDRParam, ptszRVBuffer , nRVLen);
54- XEngine_Network_Send (lpszClientAddr, ptszSDBuffer , nSDLen);
47+ ModuleProtocol_Packet_ImageText (m_MemoryRecv. get () , &nRVLen, &pptszListStr, nListCount);
48+ HttpProtocol_Server_SendMsgEx (xhHTTPPacket, m_MemorySend. get () , &nSDLen, &st_HDRParam, m_MemoryRecv. get () , nRVLen);
49+ XEngine_Network_Send (lpszClientAddr, m_MemorySend. get () , nSDLen);
5550 BaseLib_Memory_Free ((XPPPMEM)&pptszListStr, nListCount);
5651 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X (" HTTP客户端:%s,请求获取识别图片文字成功,获取个数:%d" ), lpszClientAddr, nListCount);
5752 }
5853 else
5954 {
6055 st_HDRParam.nHttpCode = 501 ;
61- HttpProtocol_Server_SendMsgEx (xhHTTPPacket, ptszSDBuffer , &nSDLen, &st_HDRParam);
62- XEngine_Network_Send (lpszClientAddr, ptszSDBuffer , nSDLen);
56+ HttpProtocol_Server_SendMsgEx (xhHTTPPacket, m_MemorySend. get () , &nSDLen, &st_HDRParam);
57+ XEngine_Network_Send (lpszClientAddr, m_MemorySend. get () , nSDLen);
6358 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X (" HTTP客户端:%s,请求获取识别图片文字失败,错误:%lX" ), lpszClientAddr, ModuleHelp_GetLastError ());
6459 }
6560 }
@@ -70,16 +65,16 @@ bool HTTPTask_TaskPost_Image(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int
7065
7166 if (ModuleHelp_ImageGet_Attr (lpszMsgBuffer, nMsgLen, &st_BaseInfo, &st_ExtAttr))
7267 {
73- ModuleProtocol_Packet_ImageAttr (ptszRVBuffer , &nRVLen, &st_BaseInfo, &st_ExtAttr);
74- HttpProtocol_Server_SendMsgEx (xhHTTPPacket, ptszSDBuffer , &nSDLen, &st_HDRParam, ptszRVBuffer , nRVLen);
75- XEngine_Network_Send (lpszClientAddr, ptszSDBuffer , nSDLen);
68+ ModuleProtocol_Packet_ImageAttr (m_MemoryRecv. get () , &nRVLen, &st_BaseInfo, &st_ExtAttr);
69+ HttpProtocol_Server_SendMsgEx (xhHTTPPacket, m_MemorySend. get () , &nSDLen, &st_HDRParam, m_MemoryRecv. get () , nRVLen);
70+ XEngine_Network_Send (lpszClientAddr, m_MemorySend. get () , nSDLen);
7671 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X (" HTTP客户端:%s,请求获取图像信息成功,宽:%d,高:%d,通道:%d" ), lpszClientAddr, st_BaseInfo.nWidth , st_BaseInfo.nHeigth , st_BaseInfo.nChannel );
7772 }
7873 else
7974 {
8075 st_HDRParam.nHttpCode = 501 ;
81- HttpProtocol_Server_SendMsgEx (xhHTTPPacket, ptszSDBuffer , &nSDLen, &st_HDRParam);
82- XEngine_Network_Send (lpszClientAddr, ptszSDBuffer , nSDLen);
76+ HttpProtocol_Server_SendMsgEx (xhHTTPPacket, m_MemorySend. get () , &nSDLen, &st_HDRParam);
77+ XEngine_Network_Send (lpszClientAddr, m_MemorySend. get () , nSDLen);
8378 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X (" HTTP客户端:%s,请求获取图片属性失败,错误:%lX" ), lpszClientAddr, ModuleHelp_GetLastError ());
8479 }
8580 }
@@ -88,8 +83,8 @@ bool HTTPTask_TaskPost_Image(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int
8883 if (nListCount < 4 )
8984 {
9085 st_HDRParam.nHttpCode = 400 ;
91- HttpProtocol_Server_SendMsgEx (xhHTTPPacket, ptszSDBuffer , &nSDLen, &st_HDRParam);
92- XEngine_Network_Send (lpszClientAddr, ptszSDBuffer , nSDLen);
86+ HttpProtocol_Server_SendMsgEx (xhHTTPPacket, m_MemorySend. get () , &nSDLen, &st_HDRParam);
87+ XEngine_Network_Send (lpszClientAddr, m_MemorySend. get () , nSDLen);
9388 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X (" HTTP客户端:%s,请求设置图像数据失败,因为附加参数不正确,参数个数:%d" ), lpszClientAddr, nListCount);
9489 return false ;
9590 }
@@ -108,90 +103,86 @@ bool HTTPTask_TaskPost_Image(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int
108103 BaseLib_String_GetKeyValue ((*ppptszList)[4 ], " =" , tszHTTPKey, tszHTTPVlu);
109104 int nHeight = _ttxoi (tszHTTPVlu);
110105
111- if (ModuleHelp_ImageSet_Resolution (lpszMsgBuffer, nMsgLen, tszFileExt, ptszRVBuffer , &nRVLen, nWidth, nHeight))
106+ if (ModuleHelp_ImageSet_Resolution (lpszMsgBuffer, nMsgLen, tszFileExt, m_MemoryRecv. get () , &nRVLen, nWidth, nHeight))
112107 {
113- HttpProtocol_Server_SendMsgEx (xhHTTPPacket, ptszSDBuffer , &nSDLen, &st_HDRParam, ptszRVBuffer , nRVLen);
114- XEngine_Network_Send (lpszClientAddr, ptszSDBuffer , nSDLen);
108+ HttpProtocol_Server_SendMsgEx (xhHTTPPacket, m_MemorySend. get () , &nSDLen, &st_HDRParam, m_MemoryRecv. get () , nRVLen);
109+ XEngine_Network_Send (lpszClientAddr, m_MemorySend. get () , nSDLen);
115110 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X (" HTTP客户端:%s,请求设置图像分辨率成功,宽:%d,高:%d" ), lpszClientAddr, nWidth, nHeight);
116111 }
117112 else
118113 {
119114 st_HDRParam.nHttpCode = 501 ;
120- HttpProtocol_Server_SendMsgEx (xhHTTPPacket, ptszSDBuffer , &nSDLen, &st_HDRParam);
121- XEngine_Network_Send (lpszClientAddr, ptszSDBuffer , nSDLen);
115+ HttpProtocol_Server_SendMsgEx (xhHTTPPacket, m_MemorySend. get () , &nSDLen, &st_HDRParam);
116+ XEngine_Network_Send (lpszClientAddr, m_MemorySend. get () , nSDLen);
122117 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X (" HTTP客户端:%s,请求设置图像分辨率失败,错误:%lX" ), lpszClientAddr, ModuleHelp_GetLastError ());
123118 }
124119
125120 }
126121 else if (3 == nOPCode)
127122 {
128- if (ModuleHelp_ImageSet_ColorCvt (lpszMsgBuffer, nMsgLen, tszFileExt, ptszRVBuffer , &nRVLen, (ENUM_XENGINE_IMAGE_COLOR_INFO)nWidth))
123+ if (ModuleHelp_ImageSet_ColorCvt (lpszMsgBuffer, nMsgLen, tszFileExt, m_MemoryRecv. get () , &nRVLen, (ENUM_XENGINE_IMAGE_COLOR_INFO)nWidth))
129124 {
130- HttpProtocol_Server_SendMsgEx (xhHTTPPacket, ptszSDBuffer , &nSDLen, &st_HDRParam, ptszRVBuffer , nRVLen);
131- XEngine_Network_Send (lpszClientAddr, ptszSDBuffer , nSDLen);
125+ HttpProtocol_Server_SendMsgEx (xhHTTPPacket, m_MemorySend. get () , &nSDLen, &st_HDRParam, m_MemoryRecv. get () , nRVLen);
126+ XEngine_Network_Send (lpszClientAddr, m_MemorySend. get () , nSDLen);
132127 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X (" HTTP客户端:%s,请求设置图像颜色空间转换成功,转换的值:%d" ), lpszClientAddr, nWidth);
133128 }
134129 else
135130 {
136131 st_HDRParam.nHttpCode = 501 ;
137- HttpProtocol_Server_SendMsgEx (xhHTTPPacket, ptszSDBuffer , &nSDLen, &st_HDRParam);
138- XEngine_Network_Send (lpszClientAddr, ptszSDBuffer , nSDLen);
132+ HttpProtocol_Server_SendMsgEx (xhHTTPPacket, m_MemorySend. get () , &nSDLen, &st_HDRParam);
133+ XEngine_Network_Send (lpszClientAddr, m_MemorySend. get () , nSDLen);
139134 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X (" HTTP客户端:%s,请求设置图像颜色空间转换失败,错误:%lX" ), lpszClientAddr, ModuleHelp_GetLastError ());
140135 }
141136 }
142137 else if (4 == nOPCode)
143138 {
144- if (ModuleHelp_ImageSet_Flip (lpszMsgBuffer, nMsgLen, tszFileExt, ptszRVBuffer , &nRVLen, nWidth))
139+ if (ModuleHelp_ImageSet_Flip (lpszMsgBuffer, nMsgLen, tszFileExt, m_MemoryRecv. get () , &nRVLen, nWidth))
145140 {
146- HttpProtocol_Server_SendMsgEx (xhHTTPPacket, ptszSDBuffer , &nSDLen, &st_HDRParam, ptszRVBuffer , nRVLen);
147- XEngine_Network_Send (lpszClientAddr, ptszSDBuffer , nSDLen);
141+ HttpProtocol_Server_SendMsgEx (xhHTTPPacket, m_MemorySend. get () , &nSDLen, &st_HDRParam, m_MemoryRecv. get () , nRVLen);
142+ XEngine_Network_Send (lpszClientAddr, m_MemorySend. get () , nSDLen);
148143 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X (" HTTP客户端:%s,请求设置图像翻转成功,翻转的值:%d" ), lpszClientAddr, nWidth);
149144 }
150145 else
151146 {
152147 st_HDRParam.nHttpCode = 501 ;
153- HttpProtocol_Server_SendMsgEx (xhHTTPPacket, ptszSDBuffer , &nSDLen, &st_HDRParam);
154- XEngine_Network_Send (lpszClientAddr, ptszSDBuffer , nSDLen);
148+ HttpProtocol_Server_SendMsgEx (xhHTTPPacket, m_MemorySend. get () , &nSDLen, &st_HDRParam);
149+ XEngine_Network_Send (lpszClientAddr, m_MemorySend. get () , nSDLen);
155150 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X (" HTTP客户端:%s,请求设置图像翻转失败,错误:%lX" ), lpszClientAddr, ModuleHelp_GetLastError ());
156151 }
157152 }
158153 else if (5 == nOPCode)
159154 {
160- if (ModuleHelp_ImageSet_Ligth (lpszMsgBuffer, nMsgLen, tszFileExt, ptszRVBuffer , &nRVLen, nWidth))
155+ if (ModuleHelp_ImageSet_Ligth (lpszMsgBuffer, nMsgLen, tszFileExt, m_MemoryRecv. get () , &nRVLen, nWidth))
161156 {
162- HttpProtocol_Server_SendMsgEx (xhHTTPPacket, ptszSDBuffer , &nSDLen, &st_HDRParam, ptszRVBuffer , nRVLen);
163- XEngine_Network_Send (lpszClientAddr, ptszSDBuffer , nSDLen);
157+ HttpProtocol_Server_SendMsgEx (xhHTTPPacket, m_MemorySend. get () , &nSDLen, &st_HDRParam, m_MemoryRecv. get () , nRVLen);
158+ XEngine_Network_Send (lpszClientAddr, m_MemorySend. get () , nSDLen);
164159 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X (" HTTP客户端:%s,请求设置图像亮度,亮度的值:%d" ), lpszClientAddr, nWidth);
165160 }
166161 else
167162 {
168163 st_HDRParam.nHttpCode = 501 ;
169- HttpProtocol_Server_SendMsgEx (xhHTTPPacket, ptszSDBuffer , &nSDLen, &st_HDRParam);
170- XEngine_Network_Send (lpszClientAddr, ptszSDBuffer , nSDLen);
164+ HttpProtocol_Server_SendMsgEx (xhHTTPPacket, m_MemorySend. get () , &nSDLen, &st_HDRParam);
165+ XEngine_Network_Send (lpszClientAddr, m_MemorySend. get () , nSDLen);
171166 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X (" HTTP客户端:%s,请求设置图像亮度失败,错误:%lX" ), lpszClientAddr, ModuleHelp_GetLastError ());
172167 }
173168 }
174169 else if (6 == nOPCode)
175170 {
176- if (ModuleHelp_ImageSet_Level (lpszMsgBuffer, nMsgLen, tszFileExt, ptszRVBuffer , &nRVLen, nWidth))
171+ if (ModuleHelp_ImageSet_Level (lpszMsgBuffer, nMsgLen, tszFileExt, m_MemoryRecv. get () , &nRVLen, nWidth))
177172 {
178- HttpProtocol_Server_SendMsgEx (xhHTTPPacket, ptszSDBuffer , &nSDLen, &st_HDRParam, ptszRVBuffer , nRVLen);
179- XEngine_Network_Send (lpszClientAddr, ptszSDBuffer , nSDLen);
173+ HttpProtocol_Server_SendMsgEx (xhHTTPPacket, m_MemorySend. get () , &nSDLen, &st_HDRParam, m_MemoryRecv. get () , nRVLen);
174+ XEngine_Network_Send (lpszClientAddr, m_MemorySend. get () , nSDLen);
180175 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X (" HTTP客户端:%s,请求设置图像质量压缩值:%d" ), lpszClientAddr, nWidth);
181176 }
182177 else
183178 {
184179 st_HDRParam.nHttpCode = 501 ;
185- HttpProtocol_Server_SendMsgEx (xhHTTPPacket, ptszSDBuffer , &nSDLen, &st_HDRParam);
186- XEngine_Network_Send (lpszClientAddr, ptszSDBuffer , nSDLen);
180+ HttpProtocol_Server_SendMsgEx (xhHTTPPacket, m_MemorySend. get () , &nSDLen, &st_HDRParam);
181+ XEngine_Network_Send (lpszClientAddr, m_MemorySend. get () , nSDLen);
187182 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X (" HTTP客户端:%s,请求设置图像质量压缩失败,错误:%lX" ), lpszClientAddr, ModuleHelp_GetLastError ());
188183 }
189184 }
190185 }
191- free (ptszRVBuffer);
192- free (ptszSDBuffer);
193- ptszRVBuffer = NULL ;
194- ptszSDBuffer = NULL ;
195186#endif
196187 return true ;
197188}
0 commit comments