首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ Builder >

C++BUILDER codeguard如何看

2012-08-31 
C++BUILDER codeguard怎么看查看codeguard提示的message如下:(cgl文件内容)2012/7/25 8:43:14 started a C

C++BUILDER codeguard怎么看
查看codeguard提示的message如下:(cgl文件内容)

2012/7/25 8:43:14 started a CodeGuard(tm) process: Project2.exe(5744) 
Resource type mismatch in process: Project2.exe(5744) - XBuffer.cpp#113
  a(n) object was expected.
  0x01799F60 Call to delete(0x01799F60)
  0x07C1D4F8 - XBuffer.cpp#113
  0x07C1D596 - XBuffer.cpp#136
  0x07BD6A11 - Comm\XClientSocket.cpp#292
  0x07BDF28F - Comm\XClient.cpp#265
  0x07BDF416 - Comm\XClient.cpp#323
  0x07BDD79E - DModule_Unit.cpp#256
  The object array (0x01799F60) [size: 4097 bytes] was created with new[]
  0x07C1D31C - XBuffer.cpp#20
  0x07BDE903 - Comm\XClient.cpp#11
  0x07BDD034 - DModule_Unit.cpp#45
  0x07BE037B - DLL_Quot.cpp#110
  0x00403D92 - Unit9.cpp#217
  0x502963E1

依次点击找到代码行(按照执行顺序):
new:
1.0x00403D92 - Unit9.cpp#217

  InitQuot()

2. 0x07BE037B - DLL_Quot.cpp#110

extern "C" __declspec(dllexport) void __stdcall InitQuot()
{
  if(QuotDModule == NULL)
  {
QuotDModule = new TQuotDModule(Application);//点击显示在这里
  }
}

3. 0x07BDD034 - DModule_Unit.cpp#45

__fastcall TQuotDModule::TQuotDModule(TComponent* Owner) : TDataModule(Owner)
{
m_pclClientHqxs = new XClient();//点击显示在这里
bQuotOK = false;
  ...
}

4. 0x07BDE903 - Comm\XClient.cpp#11
XClient.h包含
class XClient //需要知道类xclient中的函数功能
{
private:
  XClientSocket * m_pclSocket;
  tagMcPacket m_stAnswerPacket; // 应答包
  XBuffer m_clResult; // 应答包的结果包的缓冲
  tagDbfFieldStruct * m_pstField;
  int m_iRecordWidth;
  XMemDbf * m_pclDbf;
  WORD m_wTargetYyb;
  bool m_bCompress;
  bool m_bAutoReceiveAnswer; // 是否自动应答
  int m_iReceiveTimeout; // 接收超时
}
  XClient::XClient()
{
  m_pclSocket = NULL;
  m_pstField = NULL;
  m_pclDbf = NULL;
  m_wTargetYyb = 0xFFFF;
  m_bCompress = false;
  m_bAutoReceiveAnswer = true;
  m_iReceiveTimeout = 0;
}  

5. 0x07C1D31C - XBuffer.cpp#20

XBuffer::XBuffer()
{
m_cSplitChar = '|';

m_iBufLen = 4096;
m_szBuffer = new char[m_iBufLen + 1];//点击显示在这里
memset(m_szBuffer, 0, m_iBufLen + 1);
  ...
}

delete :

1. 0x07BDD79E - DModule_Unit.cpp#256
 
  m_pclClientHqxs->RunError();//点击显示在这里

2. 0x07BDF416 - Comm\XClient.cpp#323 

bool XClient::RunError(DWORD dwFuncNo, const char * szFormat, ...)
{
AnsiString strCommand;
va_list arg_ptr;
  va_start(arg_ptr, szFormat);
  int iLen = strCommand.vprintf(szFormat, arg_ptr);
va_end(arg_ptr);
bool bResult = __Run(dwFuncNo, strCommand.c_str(), iLen);//点击显示在这里
  ...
}

3.0x07BDF28F - Comm\XClient.cpp#265  
 

__Run()
{...
  bool bResult = m_pclSocket->SendRequest(m_clResult, dwFuncNo, szBuffer, iLen, m_bCompress, m_wTargetYyb);
...}

4. 0x07BD6A11 - Comm\XClientSocket.cpp#292
   
bool XClientSocket::SendRequest(XBuffer & clResult, DWORD dwFunction, const char * szData, DWORD 
dwDataLen, bool bCompress, WORD wTarget)
  {...
  clResult.Set((const char*)("0|请求发送成功|"));//点击显示在这里
  ....
  }
   
5. 0x07C1D596 - XBuffer.cpp#136

 bool XBuffer::Set(const char * szFormat, ...)
{
XString strBuffer;
va_list arg_ptr;

va_start(arg_ptr, szFormat);


strBuffer.XFormat(szFormat, arg_ptr);
va_end(arg_ptr);
return Set(XStringPtr(strBuffer), strBuffer.XLength());//点击显示在这里
}

6. 0x07C1D4F8 - XBuffer.cpp#113

bool XBuffer::Set(const char * szBuffer, int iLen)
{
if(iLen > m_iBufLen)
{
delete m_szBuffer;//点击显示在这里
m_szBuffer = new char[iLen + 1];
}

...
}

另外:xbuffer的析构函数中
XBuffer::~XBuffer()
{
if(m_szBuffer)
{
delete m_szBuffer;
m_szBuffer = NULL;
}

求助啊,我不知道这个文件怎么看啊,


[解决办法]

m_szBuffer = new char[iLen + 1];
delete[] m_szBuffer;//点击显示在这里
[解决办法]
没提示错误啊,只是记录一些操作罢了

热点排行