void genTree() { printProc("Generating huffman tree... "); printStatus("DONE",2); int min1, min2, nd = charCount; while(hn>1) { min1 = extractRoot(), min2 = extractRoot(); freq[++nd] = freq[min1] + freq[min2]; insert(nd), parent[min1] = -nd, parent[min2] = nd; } parent[nd] = nd; }
bool VDirAdapter_Unix::findFile(const VString &strPath) { if (strPath.empty() || strPath == "") { return false; } extractRoot(strPath, m_strRoot); extractExt(strPath, m_strExt); m_pDir = opendir(m_strRoot.c_str()); m_bExtractName = false; return (m_pDir != NULL); }
bool VDirAdapter::findFile(const VString &strPath) { if (strPath.empty() || strPath == "") return false; #ifdef UNICODE WCHAR wszPath[512] = {0}; ::MultiByteToWideChar(CP_UTF8, 0, strPath.c_str(), strPath.length(), wszPath, sizeof(wszPath)); m_hFindFile = ::FindFirstFile(wszPath, &m_FindFileData); #else m_hFindFile = ::FindFirstFile(strPath.c_str(), &m_FindFileData); #endif extractRoot(strPath, m_strRoot); m_bExtractName = false; return (m_hFindFile != INVALID_HANDLE_VALUE); }