Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

cbProject::GetFilesCount returns alway 396197132

(1/1)

roxlu:
Hi,
I'm working on a plugin which needs to check what files are in a project. I want to use cbproject::GetFilesCount but this returns an incorrect number. Someone knows why?



--- Code: ---void ProjectAnalyzer::analyze(cbProject* pProject) {
if (!pProject) return;
Manager::Get()->GetLogManager()->Log(_T("Project title:" ) +pProject->GetTitle());
int files = pProject->GetFilesCount();
Manager::Get()->GetLogManager()->Log(_T("files count..") +wxString::Format(_T("%i"), pProject->GetFilesCount()));
Manager::Get()->GetLogManager()->Log(_T("files count..") +wxString::Format(_T("%i"), files));
ProjectFile* project_file = pProject->GetFile(0);
if (project_file != NULL) {
Manager::Get()->GetLogManager()->Log(_T("file 0: ") +project_file->GetBaseName());
}
}
--- End code ---

roxlu

stahta01:

--- Quote from: roxlu on August 01, 2009, 08:12:34 pm ---
--- Code: --- int files = pProject->GetFilesCount();

--- End code ---

--- End quote ---

I suggest trying unsigned int and see if symptom change.


--- Code: --- unsigned int files = pProject->GetFilesCount();

--- End code ---

roxlu:
wow, didnt expect such a quick response! Thanks.

Though it didn't work. :(

update: Hmm, linking against svn build does not work, but agains 8.02 does work.
(both with and w/o the unsigned btw)

roxlu

Jenna:
If the project is valid it should work anyway.

cbProject::GetFileCount() returns an int, but as I just saw the internally used filelist (declared with WX_DECLARE_LIST) uses size_t as return-value (at least in wxWidgets 2.8.10), so it might lead to an error if you have really very, very much files in a project.

Nevertheless it works here (actual trunk), if I use project-managers GetActiveProject() to fetch a project, no difference if it is a small test-project (12 files ) or a larger one (linux-kernel as test-project with more than 21000 files).

Navigation

[0] Message Index

Go to full version