convert utf8

This commit is contained in:
2026-10-13 11:26:22 +08:00
parent 2a87652936
commit e3e967d81c
4 changed files with 197 additions and 197 deletions
+17 -17
View File
@@ -1,4 +1,4 @@
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include <vcl.h>
#include <Wininet.h>
#include <tchar.h>
@@ -134,11 +134,11 @@ DWORD WINAPI HttpProc(LPVOID args)
dwAllBytes = 0;
}
// 防止乱码的方法就是建立完变量立即清空
// 防止乱码的方法就是建立完变量立即清空
ZeroMemory(szBuffer, sizeof(szBuffer));
ZeroMemory(param->dataOut, param->sizeOut);
// 循环读取缓冲区内容直到结束
// 循环读取缓冲区内容直到结束
while( param->hRequest && InternetReadFile(param->hRequest, szBuffer, sizeof(szBuffer),
&dwByteRead) && dwByteRead > 0 ){
if( pos + dwByteRead > param->sizeOut ){
@@ -146,11 +146,11 @@ DWORD WINAPI HttpProc(LPVOID args)
return 0;
}
// 复制输出数据
// 复制输出数据
memcpy( param->dataOut+pos, szBuffer, dwByteRead );
pos += dwByteRead;
// 清空缓冲区以备下一次读取
// 清空缓冲区以备下一次读取
ZeroMemory(szBuffer, sizeof(szBuffer));
}
@@ -291,7 +291,7 @@ DWORD WINAPI UrlProc(LPVOID args)
ZeroMemory(szBuffer, sizeof(szBuffer));
ZeroMemory(param->dataOut, param->sizeOut);
// 循环读取缓冲区内容直到结束
// 循环读取缓冲区内容直到结束
while( param->hRequest && InternetReadFile(param->hRequest, szBuffer, 10240, &dwByteRead)
&& dwByteRead > 0){
if( pos + dwByteRead > param->sizeOut ){
@@ -299,11 +299,11 @@ DWORD WINAPI UrlProc(LPVOID args)
break;
}
// 复制输出数据
// 复制输出数据
memcpy( param->dataOut+pos, szBuffer, dwByteRead );
pos += dwByteRead;
// 清空缓冲区以备下一次读取
// 清空缓冲区以备下一次读取
ZeroMemory(szBuffer, 10240);
}
@@ -419,17 +419,17 @@ void __fastcall TAsynHttpThread::Execute()
WaitForSingleObject( hThread, 200 );
CloseHandle( hThread );
if( dwRet==WAIT_OBJECT_0 ){ //用户退出
if( dwRet==WAIT_OBJECT_0 ){ //用户退出
return;//errCode = ERROR_INTERNET_CANCEL;
}
else if( dwRet==WAIT_OBJECT_0+1 && param.errCode==0 ){ //线程正常退出
else if( dwRet==WAIT_OBJECT_0+1 && param.errCode==0 ){ //线程正常退出
m_sizeOut = param.sizeOut;
memcpy( m_dataOut, szReturn, m_sizeOut );
m_dataOut[m_sizeOut] = 0;
}
else if( dwRet==WAIT_TIMEOUT ) //超时
else if( dwRet==WAIT_TIMEOUT ) //超时
errCode = ERROR_INTERNET_TMOUT;
else if( param.errCode==0 )//出错了
else if( param.errCode==0 )//出错了
errCode = ERROR_INTERNET_UNKNOWN;
}
else
@@ -478,16 +478,16 @@ void __fastcall TAsynUrlThread::Execute()
WaitForSingleObject( hThread, 200 );
CloseHandle( hThread );
if( dwRet==WAIT_OBJECT_0 ){ //用户退出
if( dwRet==WAIT_OBJECT_0 ){ //用户退出
return;
}
else if( dwRet==WAIT_OBJECT_0+1 ){ //线程正常退出
else if( dwRet==WAIT_OBJECT_0+1 ){ //线程正常退出
m_szOut = param.sizeOut;
errCode = param.errCode;
}
else if( dwRet==WAIT_TIMEOUT ) //超时
else if( dwRet==WAIT_TIMEOUT ) //超时
errCode = ERROR_INTERNET_TMOUT;
else if( param.errCode==0 )//出错了
else if( param.errCode==0 )//出错了
errCode = ERROR_INTERNET_UNKNOWN;
}
else
@@ -562,7 +562,7 @@ void __fastcall TVeloThread::Execute()
}
}
if( sel<0 ){ //线程非正常退出
if( sel<0 ){ //线程非正常退出
sel = GetTickCount() % m_nWS;
if( m_sWebsite.Pos( m_websites[sel] ) )
sel = (sel+1) % m_nWS;