谁能帮我看下代码?
// GDItestView.cpp : implementation of the CGDItestView class
//#include "stdafx.h"
#include "GDItest.h"
#include "GDItestDoc.h"
#include "GDItestView.h"
#include "InputDlg.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endiftypedef struct{
int weight;
int parent,lchild,rchild;
}HTNode, *HuffmanTree; //动态分配数组存储哈夫曼树
/////////////////////////////////////////////////////////////////////////////
// CGDItestViewIMPLEMENT_DYNCREATE(CGDItestView, CView)BEGIN_MESSAGE_MAP(CGDItestView, CView)
//{{AFX_MSG_MAP(CGDItestView)
ON_COMMAND(IDM_CESHI, OnCeshi)
ON_COMMAND(IDM_SAVE, OnSaveDlg)
ON_BN_CLICKED(IDC_SAVE, OnSave)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CGDItestView construction/destructionCGDItestView::CGDItestView()
{
// TODO: add construction code here
m_allnode = 0;
m_leafnum = 0;
i = 0;
GetClientRect(&rect); //获取客户区大小
}CGDItestView::~CGDItestView()
{}BOOL CGDItestView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
//  the CREATESTRUCT cs return CView::PreCreateWindow(cs);
}/////////////////////////////////////////////////////////////////////////////
// CGDItestView drawingvoid CGDItestView::OnDraw(CDC* pDC)
{
CGDItestDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}/////////////////////////////////////////////////////////////////////////////
// CGDItestView printingBOOL CGDItestView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}void CGDItestView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}void CGDItestView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}/////////////////////////////////////////////////////////////////////////////
// CGDItestView diagnostics#ifdef _DEBUG
void CGDItestView::AssertValid() const
{
CView::AssertValid();
}void CGDItestView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}CGDItestDoc* CGDItestView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CGDItestDoc)));
return (CGDItestDoc*)m_pDocument;
}
#endif //_DEBUG/////////////////////////////////////////////////////////////////////////////
// CGDItestView message handlersvoid CGDItestView::OnCeshi() //用作测试画笔、画刷等情况,此函数无其他意义
{
// TODO: Add your command handler code here
CClientDC dc(this);
CPen pen(PS_SOLID,5,RGB(255,0,0));
dc.SelectObject(&pen);
CBrush *pBrush=CBrush::FromHandle((HBRUSH)GetStockObject(NULL_BRUSH));
dc.SelectObject(pBrush);
dc.Ellipse(10,20,50,60);
CString str="15";

dc.TextOut(25,30,str);}void CGDItestView::OnSaveDlg() 
{
// TODO: Add your command handler code here
CInputDlg *pDlg = new CInputDlg();
pDlg->Create(IDD_SAVE,this);
pDlg->ShowWindow(SW_SHOW);
}void CGDItestView::OnSave() 
{
// TODO: Add your control notification handler code here
// static CInputDlg Dlg;
// m_leafnum = Dlg.leafnum;
// m_allnode = 2 * m_leafnum - 1; m_leafnum = this->GetDlgItemInt(IDC_LEAFNUM); //获取叶子数
m_allnode = 2 * m_leafnum - 1; //构成哈夫曼树节点总数
static HuffmanTree HT = (HuffmanTree)malloc((m_allnode + 1) * sizeof(HTNode)); //0号单元未用
// static HTNode *HT = new HTNode[(m_allnode + 1) * sizeof(HTNode)];
//初始化叶子结点
i++;
// HT[i].weight = Dlg.leafdata;
HT[i].weight = this->GetDlgItemInt(IDC_LEAFDATA);
HT[i].lchild = 0;
HT[i].rchild = 0;
HT[i].parent = 0;
//定义画笔、画刷绘图
CClientDC dc(this);
CPen pen(PS_SOLID,5,RGB(255,0,0));
dc.SelectObject(&pen);
CBrush *pBrush=CBrush::FromHandle((HBRUSH)GetStockObject(NULL_BRUSH));
dc.SelectObject(pBrush);
dc.Ellipse(rect.right / m_leafnum * (i - 1),rect.bottom - (rect.bottom / m_leafnum),rect.right / m_leafnum * i,rect.bottom);

CString str;
itoa(HT[i].weight,(char*)&str,10);
dc.TextOut(rect.right / m_leafnum * (i - 1)+(rect.right / m_leafnum) / 2,rect.bottom - (rect.bottom / m_leafnum)+(rect.bottom / m_leafnum) / 2,str); }