BOOL WINAPI CrashCallback(LPVOID lpvState) { CString sLogFile = GetAppDir() + _T("\\dummy.log"); CString sIniFile = GetAppDir() + _T("\\dummy.ini"); #ifdef TEST_DEPRECATED_FUNCS AddFile(lpvState, sLogFile, _T("Dummy Log File")); AddFile(lpvState, sLogFile, _T("Dummy INI File")); #else lpvState; int nResult = crAddFile2(sLogFile, NULL, _T("Dummy Log File"), CR_AF_MAKE_FILE_COPY); ATLASSERT(nResult==0); nResult = crAddFile(sIniFile, _T("Dummy INI File")); ATLASSERT(nResult==0); nResult = crAddScreenshot(CR_AS_MAIN_WINDOW); ATLASSERT(nResult==0); nResult = crAddProperty(_T("VideoCard"),_T("nVidia GeForce 9800")); ATLASSERT(nResult==0); #endif return TRUE; }
// Pass a null terminated list of files to use. // All files are optional, but at least one file must be found. // The name searcher looks backwards, so a later file does override all earlier ones. // Also adds GWA files if they exist. bool FileCache::InitMultipleFiles(const char *const*filenames) { CONS_Printf("Loading resource files...\n"); bool result = true; for ( ; *filenames != NULL; filenames++) { const char *curfile = *filenames; if (AddFile(curfile) == -1) result = false; // try finding corresponding GWA file (GL-nodes data) string gwafile(curfile); // Try lower case. gwafile.replace(gwafile.length()-3, 3, "gwa"); if (AddFile(gwafile.c_str(), true) == -1) { // not found, try upper case gwafile.replace(gwafile.length()-3, 3, "GWA"); if (AddFile(gwafile.c_str(), true) == -1) { // CONS_Printf(" No GL information for file %s.\n", curfile); continue; // not found } } CONS_Printf(" Added GL information from file %s.\n", gwafile.c_str()); } if (vfiles.size() == 0) I_Error("FileCache::InitMultipleFiles: no files found"); // result = false : at least one file was missing return result; }
void ProjectExistingFile(void) { PROJECTITEM *data = GetItemInfo(prjSelectedItem); if (data && (data->type == PJ_PROJ || data->type == PJ_FOLDER)) { OPENFILENAME ofn; if (OpenFileDialog(&ofn, data->realName, hwndProject, FALSE, TRUE, szNewFileFilter, "Open existing file")) { char *path = ofn.lpstrFile; if (path[strlen(path)+1]) // multiselect { char buf[MAX_PATH]; char *q = path + strlen(path) + 1; while (*q) { sprintf(buf, "%s\\%s", path, q); AddFile(data, buf, TRUE); q += strlen(q) + 1; } } else { AddFile(data, path, TRUE); } } } }
void Walk(boost::filesystem::path p, unsigned short int top, std::string prefix, file_list& files) { boost::filesystem::directory_iterator end; if(!boost::filesystem::exists(p)) { std::cerr << "Could not open " << p.string() << std::endl; return; } top = AddFile(p, top, prefix, files); for(boost::filesystem::directory_iterator it(p); it != end; ++it) { if(!boost::filesystem::is_directory(it->status())) AddFile(it->path(), top, prefix, files); else { char* dirname; dirname = new char[strlen(it->path().string().c_str())+2]; strcpy(dirname, it->path().string().c_str()); Walk(dirname, top, prefix, files); delete[] dirname; } } }
void ProjectWindow::AddNewFile(BString name, bool create_pair) { BMessage msg(M_ADD_FILES); DPath projfile(fProject->GetPath().GetFolder()); projfile << name; entry_ref ref = gFileFactory.CreateSourceFile(projfile.GetFolder(), projfile.GetFileName(), create_pair ? SOURCEFILE_PAIR : 0); if (!ref.name || strlen(ref.name) == 0) return; AddFile(ref); if (fSourceControl) fSourceControl->AddToRepository(projfile.GetFullPath()); msg.AddRef("refs",&ref); if (create_pair && fSourceControl) { entry_ref partnerRef = GetPartnerRef(ref); DPath partnerPath(partnerRef); fSourceControl->AddToRepository(projfile.GetFullPath()); msg.AddRef("refs",&partnerRef); if (!gDontManageHeaders) AddFile(partnerRef); fSourceControl->AddToRepository(partnerPath.GetFullPath()); } be_app->PostMessage(&msg); }
void CPackagePage::OnAddFile() { CFileDialog dlg( TRUE, NULL, NULL, OFN_HIDEREADONLY|OFN_ALLOWMULTISELECT|OFN_ENABLESIZING, _T("All Files|*.*||"), this ); const DWORD nFilesSize = 81920; LPTSTR szFiles = new TCHAR [ nFilesSize ]; ZeroMemory( szFiles, nFilesSize * sizeof( TCHAR ) ); dlg.m_ofn.lpstrFile = szFiles; dlg.m_ofn.nMaxFile = nFilesSize; if ( dlg.DoModal() == IDOK ) { CWaitCursor wc; CString strFolder = szFiles; LPCTSTR pszFile = szFiles + strFolder.GetLength() + 1; if ( *pszFile ) { for ( strFolder += '\\' ; *pszFile ; ) { AddFile( strFolder + pszFile ); pszFile += _tcslen( pszFile ) + 1; } } else { AddFile( strFolder ); } } delete [] szFiles; }
int LibMain::Run(int argc, char **argv) { Utils::banner(argv[0]); CmdSwitchFile internalConfig(SwitchParser); std::string configName = Utils::QualifiedFile(argv[0], ".cfg"); std::fstream configTest(configName.c_str(), std::ios::in); if (!configTest.fail()) { configTest.close(); if (!internalConfig.Parse(configName.c_str())) Utils::fatal("Corrupt configuration file"); } if (!SwitchParser.Parse(&argc, argv)) { Utils::usage(argv[0], usageText); } if (argc < 2 && File.GetCount() < 3) { Utils::usage(argv[0], usageText); } // setup ObjString outputFile = argv[1]; size_t n = outputFile.find_last_of('.'); if (n == std::string::npos || (n != outputFile.size()-1 && outputFile[n+1] != 'l')) { outputFile += ".l"; } LibManager librarian(outputFile, caseSensitiveSwitch.GetValue()); if (librarian.IsOpen()) if (!librarian.LoadLibrary()) { std::cout << outputFile.c_str() << " is not a library" << std::endl; return 1; } for (int i= 2; i < argc; i++) AddFile(librarian, argv[i]); for (int i = 1; i < File.GetCount(); i++) AddFile(librarian, File.GetValue()[i]); for (CmdFiles::FileNameIterator it = addFiles.FileNameBegin(); it != addFiles.FileNameEnd(); ++it) { librarian.AddFile(*(*it)); } for (CmdFiles::FileNameIterator it = replaceFiles.FileNameBegin(); it != replaceFiles.FileNameEnd(); ++it) { librarian.ReplaceFile(*(*it)); } if (modified) if (!librarian.SaveLibrary()) { std::cout << "Error writing library file" << std::endl; return 1; } return 0; }
bool CNotAddedFilesDlg::AddFile(LPCTSTR szFileName, UINT nResourceString) { CString strMessage; if (!strMessage.LoadString(nResourceString)) { ASSERT(false); return AddFile(szFileName, _T("???")); } else return AddFile(szFileName, strMessage); }
void CMainWnd::AddFile2(LPTSTR pszPath, LPTSTR pszFile, LPTSTR pszTitle) { if (IsValidStream(pszFile)) { AddFile(pszFile, pszTitle); return; } TCHAR szFile[MAX_PATH]; wsprintf(szFile, _T("%s\\%s"), pszPath, pszFile); AddFile(szFile, pszTitle); }
// Generate //------------------------------------------------------------------------------ bool ToolManifest::Generate( const Node * mainExecutable, const Dependencies & dependencies ) { m_Files.Clear(); m_TimeStamp = 0; m_Files.SetCapacity( 1 + dependencies.GetSize() ); // unify "main executable" and "extra files" // (loads contents of file into memory, and creates hashes) if ( !AddFile( mainExecutable ) ) { return false; // AddFile will have emitted error } for ( size_t i=0; i<dependencies.GetSize(); ++i ) { const FileNode & n = *( dependencies[ i ].GetNode()->CastTo< FileNode >() ); if ( !AddFile( &n ) ) { return false; // AddFile will have emitted error } } // create a hash for the whole tool chain const size_t numFiles( m_Files.GetSize() ); const size_t memSize( numFiles * sizeof( uint32_t ) * 2 ); uint32_t * mem = (uint32_t *)ALLOC( memSize ); uint32_t * pos = mem; for ( size_t i=0; i<numFiles; ++i ) { const File & f = m_Files[ i ]; // file contents *pos = f.m_Hash; ++pos; // file name & sub-path (relative to remote folder) AStackString<> relativePath; GetRemoteFilePath( (uint32_t)i, relativePath, false ); // false = don't use full path *pos = xxHash::Calc32( relativePath ); ++pos; } m_ToolId = xxHash::Calc64( mem, memSize ); FREE( mem ); // update time stamp (most recent file in manifest) for ( size_t i=0; i<numFiles; ++i ) { const File & f = m_Files[ i ]; ASSERT( f.m_TimeStamp ); // should have had an error before if the file was missing m_TimeStamp = Math::Max( m_TimeStamp, f.m_TimeStamp ); } return true; }
void SpringDebugReport::AddVFSFile( const wxString& fn, const wxString& id ) { wxString dir = sett().GetCurrentUsedDataDir() + wxFileName::GetPathSeparator(); AddFile( dir + fn, id ); return;//TODO: wtf is there a return here? wxArrayString res = usync().FindFilesVFS( fn ); if ( res.Count() > 0 ) { AddFile( res[0], id ); wxLogError( _T("SpringDebugReport: file found: "), res[0].c_str() ); } else wxLogError( _T("SpringDebugReport: file not found: "), fn.c_str() ); }
/* * Parse the command string contained in the current context. */ void CmdStringParse( OPT_STORAGE *cmdOpts, int *itemsParsed ) /***********************************************************/ { int ch; char * filename; for( ;; ) { /*** Find the start of the next item ***/ CmdScanWhitespace(); ch = GetCharContext(); if( ch == '\0' ) break; MarkPosContext(); /* mark start of switch */ /*** Handle switches, command files, and input files ***/ if( ch == '-' || ch == '/' ) { /* switch */ if( OPT_PROCESS( cmdOpts ) != 0 ) { cmd_line_error(); } } else if( ch == '@' ) { /* command file */ filename = CmdScanFileNameWithoutQuotes(); PushContext(); if( OpenFileContext( filename ) ) { FatalError( "Cannot open '%s'.", filename ); } FreeMem( filename ); CmdStringParse( cmdOpts, itemsParsed ); PopContext(); } else if( ch == '"' ) { /* quoted option or file name */ ch = GetCharContext(); if( ch == '-' ) { Quoted = 1; if( OPT_PROCESS( cmdOpts ) != 0 ) { cmd_line_error(); } } else { UngetCharContext(); UngetCharContext(); filename = CmdScanFileName(); AddFile( TYPE_DEFAULT_FILE, filename ); FreeMem( filename ); } } else { /* input file */ UngetCharContext(); filename = CmdScanFileName(); AddFile( TYPE_DEFAULT_FILE, filename ); FreeMem( filename ); } (*itemsParsed)++; } CloseContext(); }
/*** SetMarkFile - Change markfile * * Purpose: * * Changes to a new markfile. * * Input: * val - String after the 'markfile' switch * * Output: * * Returns Error string if error, NULL otherwise * * Notes: * * We: * * UNDONE:o Magically ensure that the current markfile is up to date and * saved to disk. This means, at the very least, that there * can be no dirty files. * * o Remove the current markfile from the file list. * * o Read in the new markfile. * * o Invalidate all current marks. This is just marking them * invalid in the PFILE. * * *************************************************************************/ char * SetMarkFile ( char *val ) { REGISTER PFILE pFile; buffer tmpval; pathbuf pathname; strcpy ((char *) tmpval, val); if (NULL == CanonFilename (tmpval, pathname)) { sprintf (buf, "'%s': name is malformed", tmpval); return buf; } if (!(pFile = FileNameToHandle (pathname, NULL))) { pFile = AddFile (pathname); } if (!TESTFLAG(FLAGS(pFile), REAL) && !FileRead (pathname, pFile, FALSE)) { RemoveFile (pFile); sprintf (buf, "'%s' - %s", pathname, error()); return buf; } pFileMark = pFile; for (pFile = pFileHead; pFile; pFile = pFile->pFileNext) { if (!TESTFLAG(FLAGS(pFile), FAKE)) { RSETFLAG (FLAGS(pFile), VALMARKS); } } return NULL; }
unsigned short int AddFileAndParents(boost::filesystem::path p, unsigned short int parent, std::string prefix, file_list& files) { if(!boost::filesystem::exists(p)) { std::cerr << "Could not open " << p.string() << std::endl; return parent; } boost::filesystem::path base; for(boost::filesystem::path::iterator it = p.begin(); it != p.end(); ++it) { if(base.empty()) { base = *it; } else { std::string name = base.string() + "/" + it->string(); base = boost::filesystem::path(name); } parent = AddFile(base, parent, prefix, files); } return parent; }
std::unique_ptr<Project> JsonImporter::ImportProject(FileManager& fileManager, const filesystem::path& projectFile) { auto json = internal::ParseJsonFile(fileManager.GetFileSystem(), projectFile); if (internal::IsValidProject(json)) { auto project = std::make_unique<Project>(); project->SetName(json["project"]); project->SetFile(projectFile); for (auto& config : json["configs"]) { project->AddConfiguration(internal::ImportConfig(config)); } for (auto& filePath : json["files"]) { project->AddFile(fileManager.GetOrCreateFile(filePath)); } return project; } return nullptr; }
FileSourceZip::FileSourceZip(FileSourceFS &fs, const std::string &zipPath) : FileSource(zipPath), m_archive(0) { mz_zip_archive *zip = static_cast<mz_zip_archive*>(std::calloc(1, sizeof(mz_zip_archive))); FILE *file = fs.OpenReadStream(zipPath); if (!mz_zip_reader_init_file_stream(zip, file, 0)) { Output("FileSourceZip: unable to open '%s'\n", zipPath.c_str()); std::free(zip); return; } mz_zip_archive_file_stat zipStat; Uint32 numFiles = mz_zip_reader_get_num_files(zip); for (Uint32 i = 0; i < numFiles; i++) { if (mz_zip_reader_file_stat(zip, i, &zipStat)) { bool is_dir = mz_zip_reader_is_file_a_directory(zip, i); if (!mz_zip_reader_is_file_encrypted(zip, i)) { std::string fname = zipStat.m_filename; if ((fname.size() > 1) && (fname[fname.size()-1] == '/')) { fname.resize(fname.size() - 1); } AddFile(zipStat.m_filename, FileStat(i, zipStat.m_uncomp_size, MakeFileInfo(fname, is_dir ? FileInfo::FT_DIR : FileInfo::FT_FILE))); } } } m_archive = static_cast<void*>(zip); }
//============================================================================= // eFdd::ReadScl //----------------------------------------------------------------------------- bool eFdd::ReadScl(const void* data, size_t data_size) { if(data_size < 9) return false; const byte* buf = (const byte*)data; if(memcmp(data, "SINCLAIR", 8) || int(data_size) < 9 + (0x100 + 14)*buf[8]) return false; CreateTrd(); int size = 0; for(int i = 0; i < buf[8]; ++i) { size += buf[9 + 14 * i + 13]; } if(size > 2544) { eUdi::eTrack::eSector* s = GetSector(0, 0, 9); SectorDataW(s, 0xe5, size); // free sec UpdateCRC(s); } const byte* d = buf + 9 + 14 * buf[8]; for(int i = 0; i < buf[8]; ++i) { if(!AddFile(buf + 9 + 14*i, d)) return false; d += buf[9 + 14*i + 13]*0x100; } return true; }
void FWadCollection::InitMultipleFiles (TArray<FString> &filenames) { int numfiles; // open all the files, load headers, and count lumps DeleteAll(); numfiles = 0; for(unsigned i=0;i<filenames.Size(); i++) { int baselump = NumLumps; AddFile (filenames[i]); } NumLumps = LumpInfo.Size(); if (NumLumps == 0) { I_FatalError ("W_InitMultipleFiles: no files found"); } RenameNerve(); RenameSprites(); FixMacHexen(); // [RH] Set up hash table FirstLumpIndex = new uint32_t[NumLumps]; NextLumpIndex = new uint32_t[NumLumps]; FirstLumpIndex_FullName = new uint32_t[NumLumps]; NextLumpIndex_FullName = new uint32_t[NumLumps]; InitHashChains (); LumpInfo.ShrinkToFit(); Files.ShrinkToFit(); }
LRESULT UploadQueueFrame::onItemChanged(int /*idCtrl*/, LPNMHDR /* pnmh */, BOOL& /*bHandled*/) { HTREEITEM userNode = ctrlQueued.GetSelectedItem(); while(userNode) { ctrlList.DeleteAllItems(); UserItem* ui = reinterpret_cast<UserItem *>(ctrlQueued.GetItemData(userNode)); if(ui) { auto users = UploadManager::getInstance()->getUploadQueue(); auto it = find_if(users.begin(), users.end(), [&](const UserPtr& u) { return u == ui->u; }); if(it != users.end()) { ctrlList.SetRedraw(FALSE); ctrlQueued.SetRedraw(FALSE); for(auto i = it->files.cbegin(); i != it->files.cend(); ++i) { AddFile(*i); } ctrlList.resort(); ctrlList.SetRedraw(TRUE); ctrlQueued.SetRedraw(TRUE); ctrlQueued.Invalidate(); updateStatus(); return 0; } } else { LoadAll(); } userNode = ctrlQueued.GetNextSiblingItem(userNode); } return 0; }
void WaitingUsersFrame::LoadAll() { CLockRedraw<> l_lock_draw(m_ctrlList); CLockRedraw<true> l_lock_draw_q(ctrlQueued); HTREEITEM userNode = ctrlQueued.GetRootItem(); while (userNode) { delete reinterpret_cast<UserItem *>(ctrlQueued.GetItemData(userNode)); userNode = ctrlQueued.GetNextSiblingItem(userNode); } // TODO - delete m_ctrlList.DeleteAllItems(); ctrlQueued.DeleteAllItems(); UQFUsers.clear(); // Load queue { UploadManager::LockInstanceQueue lockedInstance; const auto& users = lockedInstance->getUploadQueueL(); UQFUsers.reserve(users.size()); for (auto uit = users.cbegin(); uit != users.cend(); ++uit) { UQFUsers.push_back(uit->getUser()); ctrlQueued.InsertItem(TVIF_PARAM | TVIF_TEXT, (uit->getUser()->getLastNickT() + _T(" - ") + Text::toT(uit->m_hintedUser.hint)).c_str(), 0, 0, 0, 0, (LPARAM)(new UserItem(uit->getUser())), TVI_ROOT, TVI_LAST); for (auto i = uit->m_waiting_files.cbegin(); i != uit->m_waiting_files.cend(); ++i) { AddFile(*i); } } } m_needsResort = true; // [!] IRainman opt. m_needsUpdateStatus = true; // [!] IRainman opt. }
//-------------------------------------------------------------------------------- bool CFileIndexSubSystem::ParseDirectory(CString sPath, CWriteLock& lock) { WIN32_FIND_DATA data; CFindFileHandle hand = ::FindFirstFile(sPath + "\\*.*", &data); if(! hand.IsValid()) return false; CFileIndexDirObject* pDir; CFileIndexFileObject* pFile; for(;;) { if(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if(data.cFileName[0] != '.') ParseDirectory(sPath + '\\' + data.cFileName, lock); } else AddFile(sPath, data.cFileName, pDir, pFile, lock); if(! ::FindNextFile(hand, &data)) break; } return true; }
void CVisionTestDlg::OnLoadimages() { char aryFileBuffer[ 16*1024 ]; unsigned int unBufferLen = 16*1024 ; memset( aryFileBuffer, 0, 16*1024 ); CFileDialog ldFile(TRUE, NULL, "", OFN_ALLOWMULTISELECT | OFN_ENABLESIZING , "Images (bmp, jpg, png)|*.bmp;*.jpg;*.png||"); // Set Buffer for the Filenames (this is only necessary because of Mulitselection) ldFile.m_ofn.lpstrFile = aryFileBuffer; ldFile.m_ofn.nMaxFile = unBufferLen; if (ldFile.DoModal() != IDOK) return; CString strPath, strFileName, strFileTitle, strFileExt; POSITION pos; // Clear the list ClearFiles(); // Pick all files and add the to the list pos = ldFile.GetStartPosition(); while (pos != NULL) { strPath = ldFile.GetNextPathName(pos); AddFile( strPath ); } }
void CBFileListTable::ParseFile ( const JString& fullName, const JPtrArray<JString>& allSuffixList, const time_t modTime, CBSymbolList* symbolList, CBCTree* cTree, CBJavaTree* javaTree ) { if (CBPrefsManager::FileMatchesSuffix(fullName, allSuffixList)) { const CBTextFileType fileType = (CBGetPrefsManager())->GetFileType(fullName); JFAID_t id; if (AddFile(fullName, fileType, modTime, &id)) { itsChangedDuringParseFlag = kJTrue; symbolList->FileChanged(fullName, fileType, id); cTree->FileChanged(fullName, fileType, id); javaTree->FileChanged(fullName, fileType, id); } } }
void parsedir(char *path) { WIN32_FIND_DATA fd; HANDLE handle; FILE *outfile = fopen("temp.dat","wb"); handle = FindFirstFile(path,&fd); do { if(strcmp(fd.cFileName,".") != 0 && strcmp(fd.cFileName,"..") != 0 && !(fd.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)) { if(!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { FILE *infile = NULL; char *temppath = (char*)calloc(strlen(path)+1,sizeof(char)); char *buffer = NULL; int len=0; strcpy(temppath,path); temppath[strlen(temppath)-1] = '\0'; chdir(temppath); AddFile(fd.cFileName); chdir(".."); free(temppath); } } } while(FindNextFile(handle,&fd)!=0); fclose(outfile); }
void FileList::AddFile(const char *filepath, const char *filename, FileListNodeContext context) { if (filepath == 0 || filename == 0) return; char *data; //std::fstream file; //file.open(filename, std::ios::in | std::ios::binary); FILE *fp = fopen(filepath, "rb"); if (fp == 0) return; fseek(fp, 0, SEEK_END); int length = ftell(fp); fseek(fp, 0, SEEK_SET); if (length > (int)((unsigned int) - 1 / 8)) { // If this assert hits, split up your file. You could also change BitSize_t in RakNetTypes.h to unsigned long long but this is not recommended for performance reasons RakAssert("Cannot add files over 536 MB" && 0); fclose(fp); return; } bool usedAlloca = false; if (length < MAX_ALLOCA_STACK_ALLOCATION) { data = (char*) alloca(length); usedAlloca = true; } else data = (char*) rakMalloc_Ex(length, __FILE__, __LINE__); fread(data, 1, length, fp); AddFile(filename, filepath, data, length, length, context); fclose(fp); if (usedAlloca == false) rakFree_Ex(data, __FILE__, __LINE__); }
bool ErrorReport::GetCrashDump(const fs::path & fileName) { #if ARX_PLATFORM == ARX_PLATFORM_WIN32 bool bHaveDump = false; if(fs::exists(m_pCrashInfo->miniDumpTmpFile)) { fs::path fullPath = m_ReportFolder / fileName; if(fs::rename(m_pCrashInfo->miniDumpTmpFile, fullPath)) { AddFile(fullPath); bHaveDump = true; } } return bHaveDump; #else // ARX_PLATFORM != ARX_PLATFORM_WIN32 ARX_UNUSED(fileName); // TODO: Write core dump to // fs::path fullPath = m_ReportFolder / fileName; return getCrashDescription(); #endif }
void MPanelItem::AddFlags(LPCTSTR asItem) { if (!asItem || !*asItem) return; size_t nLen = _tcslen(asItem); // Check first, may be flag already exists? if (pFlags) { TCHAR* psz = pFlags->item.cFileName; TCHAR* pszNext = _tcschr(psz, _T(',')); while (psz && *psz) { if (!pszNext) pszNext = psz + _tcslen(psz); if ((pszNext - psz) == nLen) { if (_tcsncmp(psz, asItem, nLen) == 0) return; // Этот флаг уже добавили } if (*pszNext != _T(',')) break; psz = pszNext+1; pszNext = _tcschr(psz, _T(',')); } _tcscat(pFlags->item.cFileName, _T(",")); _tcscat(pFlags->item.cFileName, asItem); pFlags->AddText(_T(",")); } else { pFlags = AddFile(asItem, 0); pFlags->isFlags = TRUE; } pFlags->AddText(asItem, -1, TRUE); }
unsigned int HTMLProject::AddLabel(const HTMLLabel *label) { int i; static unsigned int lastFile=0; if ( (i=FindLabel(label)) <0 ) { // construction du small label smallLabel *newLabel = new smallLabel; lastFile = AddFile(label->fname.String(),lastFile); newLabel->file = lastFile; newLabel->label = label->lname; /*// on cherche le bon endroit pour insérer le small label int p = labelList->CountItems(); if (p>1) { do p--; while ( (p>=1) && ((smallLabel*)labelList->ItemAt(p))->file > lastFile); } // p=0 est un lien spécial: celui de la page d'intro labelList->AddItem(newLabel,p); return (p); */ labelList->AddItem(newLabel); return(labelList->CountItems()-1); } else return (unsigned int)i; }
bool ErrorReport::Initialize() { // Create a shared memory object. m_SharedMemory = boost::interprocess::shared_memory_object(boost::interprocess::open_only, m_SharedMemoryName.toStdString().c_str(), boost::interprocess::read_write); // Map the whole shared memory in this process m_MemoryMappedRegion = boost::interprocess::mapped_region(m_SharedMemory, boost::interprocess::read_write); // Our SharedCrashInfo will be stored in this shared memory. m_pCrashInfo = (CrashInfo*)m_MemoryMappedRegion.get_address(); if(m_MemoryMappedRegion.get_size() != sizeof(CrashInfo)) { m_DetailedError = "The size of the memory mapped region does not match the size of the CrashInfo structure."; return false; } bool bMiscCrashInfo = GetMiscCrashInfo(); if(!bMiscCrashInfo) return false; // Add attached files from the report for(int i = 0; i < m_pCrashInfo->nbFilesAttached; i++) AddFile(m_pCrashInfo->attachedFiles[i]); m_ReportFolder = fs::path(m_pCrashInfo->crashReportFolder) / fs::path(m_CrashDateTime.toString("yyyy.MM.dd hh.mm.ss").toUtf8()); if(!fs::create_directories(m_ReportFolder)) { m_DetailedError = QString("Unable to create directory (%1) to store the crash report files.").arg(m_ReportFolder.string().c_str()); return false; } return true; }
ISoundInstance * CSoundManager2D::GetInstance(const char * c_pszFileName) { DWORD dwFileCRC = GetFileCRC(c_pszFileName); TSoundDataMap::iterator itor = ms_dataMap.find(dwFileCRC); CSoundData * pkSoundData; if (itor == ms_dataMap.end()) pkSoundData = AddFile(dwFileCRC, c_pszFileName); // CSoundBase::AddFile else pkSoundData = itor->second; assert(pkSoundData != NULL); static DWORD k = 0; DWORD start = k++; DWORD end = start + INSTANCE_MAX_COUNT; while (start < end) { CSoundInstance2D * pkInst = &ms_Instances[start % INSTANCE_MAX_COUNT]; if (pkInst->IsDone()) { if (!pkInst->SetSound(pkSoundData)) TraceError("CSoundManager2D::GetInstance (filename: %s)", c_pszFileName); return (pkInst); } ++start; } return NULL; }