diff --git a/checkin_notes b/checkin_notes index f73bdb0b72..f45ccd0c7c 100644 --- a/checkin_notes +++ b/checkin_notes @@ -1884,3 +1884,32 @@ Rom 12 Mar 2010 properly. + +David 12 Mar 2010 + - GUI RPC: in the structures used in the C++ interface to GUI RPC, + change various std::string to char[n], to improve performance. + + NOTE: std::string should ONLY be used in cases where there is + no a priori limit on string length. + If there's a limit (e.g. because the string originates in + a fixed-size database field) always use char[n]. + + clientgui/ + sg_StatImageLoader.cpp + BOINCBaseView.cpp + sg_StatImageLoader.h + sg_ViewTabPage.h + sg_ProjectsComponent.cpp + sg_ViewTabPage.cpp + MainDocument.h + MainDocument.cpp + ViewStatistics.cpp + DlgItemProperties.cpp + ViewWork.cpp + ViewProjects.cpp + lib/ + gui_rpc_client_print.cpp + gui_rpc_client_ops.cpp + gui_rpc_client.h + client/ + boinc_cmd.cpp diff --git a/client/boinc_cmd.cpp b/client/boinc_cmd.cpp index 16c1e2e92e..adb3dd12e4 100644 --- a/client/boinc_cmd.cpp +++ b/client/boinc_cmd.cpp @@ -241,9 +241,9 @@ int main(int argc, char** argv) { } else if (!strcmp(cmd, "--task")) { RESULT result; char* project_url = next_arg(argc, argv, i); - result.project_url = project_url; + strcpy(result.project_url, project_url); char* name = next_arg(argc, argv, i); - result.name = name; + strcpy(result.name, name); char* op = next_arg(argc, argv, i); if (!strcmp(op, "suspend")) { retval = rpc.result_op(result, "suspend"); @@ -264,7 +264,7 @@ int main(int argc, char** argv) { } } else if (!strcmp(cmd, "--project")) { PROJECT project; - project.master_url = next_arg(argc, argv, i); + strcpy(project.master_url, next_arg(argc, argv, i)); canonicalize_master_url(project.master_url); char* op = next_arg(argc, argv, i); if (!strcmp(op, "reset")) { @@ -529,7 +529,7 @@ int main(int argc, char** argv) { vectorprojects; while (i < argc) { PROJECT proj; - proj.master_url = string(next_arg(argc, argv, i)); + strcpy(proj.master_url, next_arg(argc, argv, i)); int std = atoi(next_arg(argc, argv, i)); proj.cpu_short_term_debt = std; proj.cuda_short_term_debt = std; diff --git a/clientgui/BOINCBaseView.cpp b/clientgui/BOINCBaseView.cpp index 633ea996b5..566d151ae8 100644 --- a/clientgui/BOINCBaseView.cpp +++ b/clientgui/BOINCBaseView.cpp @@ -777,7 +777,7 @@ void CBOINCBaseView::UpdateWebsiteSelection(long lControlGroup, PROJECT* project pItem = new CTaskItem( wxString(project->project_name.c_str(), wxConvUTF8), wxT(""), - wxString(project->master_url.c_str(), wxConvUTF8), + wxString(project->master_url, wxConvUTF8), ID_TASK_PROJECT_WEB_PROJDEF_MIN ); pGroup->m_Tasks.push_back(pItem); diff --git a/clientgui/DlgItemProperties.cpp b/clientgui/DlgItemProperties.cpp index dfbde36982..c5e0a9a43d 100755 --- a/clientgui/DlgItemProperties.cpp +++ b/clientgui/DlgItemProperties.cpp @@ -184,7 +184,7 @@ void CDlgItemProperties::renderInfos(PROJECT* project_in) { std::string tname; tp->get_name(tname); wxString t1(wxString(tname.c_str(),wxConvUTF8)); - if(t1.IsSameAs(wxString(projectname.c_str(),wxConvUTF8)) || t1.IsSameAs(wxString(project->master_url.c_str(),wxConvUTF8))) { + if(t1.IsSameAs(wxString(projectname.c_str(),wxConvUTF8)) || t1.IsSameAs(wxString(project->master_url, wxConvUTF8))) { diskusage =tp->disk_usage; break; } @@ -195,7 +195,7 @@ void CDlgItemProperties::renderInfos(PROJECT* project_in) { SetTitle(wxTitle); //layout controls addSection(_("General")); - addProperty(_("Master URL"),wxString(project->master_url.c_str(),wxConvUTF8)); + addProperty(_("Master URL"),wxString(project->master_url, wxConvUTF8)); addProperty(_("User name"),wxString(project->user_name.c_str(),wxConvUTF8)); addProperty(_("Team name"),wxString(project->team_name.c_str(),wxConvUTF8)); addProperty(_("Resource share"),wxString::Format(wxT("%0.0f"),project->resource_share)); @@ -268,11 +268,11 @@ void CDlgItemProperties::renderInfos(PROJECT* project_in) { void CDlgItemProperties::renderInfos(RESULT* result) { wxDateTime dt; wxString wxTitle = _("Properties of task "); - wxTitle.append(wxString(result->name.c_str(),wxConvUTF8)); + wxTitle.append(wxString(result->name, wxConvUTF8)); SetTitle(wxTitle); addProperty(_("Application"), FormatApplicationName(result)); - addProperty(_("Workunit name"),wxString(result->wu_name.c_str(),wxConvUTF8)); + addProperty(_("Workunit name"),wxString(result->wu_name, wxConvUTF8)); addProperty(_("State"), FormatStatus(result)); if (result->received_time) { dt.Set((time_t)result->received_time); @@ -280,8 +280,8 @@ void CDlgItemProperties::renderInfos(RESULT* result) { } dt.Set((time_t)result->report_deadline); addProperty(_("Report deadline"), dt.Format()); - if (result->resources.size()) { - addProperty(_("Resources"), wxString(result->resources.c_str(), wxConvUTF8)); + if (strlen(result->resources)) { + addProperty(_("Resources"), wxString(result->resources, wxConvUTF8)); } if (result->active_task) { addProperty(_("CPU time at last checkpoint"), FormatTime(result->checkpoint_cpu_time)); diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp index c96c386704..b8f2ed75db 100644 --- a/clientgui/MainDocument.cpp +++ b/clientgui/MainDocument.cpp @@ -1271,7 +1271,7 @@ PROJECT* CMainDocument::project(const wxString& projectname) { PROJECT* tp = state.projects[i]; wxString t1(tp->project_name.c_str(), wxConvUTF8); if(t1.IsSameAs(projectname)) return tp; - wxString t2(tp->master_url.c_str(), wxConvUTF8); + wxString t2(tp->master_url, wxConvUTF8); if(t2.IsSameAs(projectname)) return tp; } return NULL; @@ -1521,9 +1521,9 @@ RESULT* CMainDocument::result(const wxString& name, const wxString& project_url) //iterating over the vector and find the right result for(unsigned int i=0; i< results.results.size();i++) { RESULT* tResult = results.results.at(i); - wxString resname(tResult->name.c_str(),wxConvUTF8); + wxString resname(tResult->name, wxConvUTF8); if(resname.IsSameAs(name)){ - wxString resurl(tResult->project_url.c_str(),wxConvUTF8); + wxString resurl(tResult->project_url, wxConvUTF8); if(resurl.IsSameAs(project_url)){ pResult = tResult; break; @@ -1552,10 +1552,10 @@ int CMainDocument::GetWorkCount() { } -int CMainDocument::WorkSuspend(std::string& strProjectURL, std::string& strName) { +int CMainDocument::WorkSuspend(char* url, char* name) { int iRetVal = 0; - RESULT* pStateResult = state.lookup_result(strProjectURL, strName); + RESULT* pStateResult = state.lookup_result(url, name); if (pStateResult) { iRetVal = rpc.result_op((*pStateResult), "suspend"); } else { @@ -1566,10 +1566,10 @@ int CMainDocument::WorkSuspend(std::string& strProjectURL, std::string& strName) } -int CMainDocument::WorkResume(std::string& strProjectURL, std::string& strName) { +int CMainDocument::WorkResume(char* url, char* name) { int iRetVal = 0; - RESULT* pStateResult = state.lookup_result(strProjectURL, strName); + RESULT* pStateResult = state.lookup_result(url, name); if (pStateResult) { iRetVal = rpc.result_op((*pStateResult), "resume"); } else { @@ -1720,7 +1720,7 @@ int CMainDocument::WorkShowGraphics(RESULT* result) { int iRetVal = 0; - if (!result->graphics_exec_path.empty()) { + if (strlen(result->graphics_exec_path)) { // V6 Graphics RUNNING_GFX_APP gfx_app; RUNNING_GFX_APP* previous_gfx_app; @@ -1732,7 +1732,7 @@ int CMainDocument::WorkShowGraphics(RESULT* result) int id; #endif - p = strrchr((char*)result->slot_path.c_str(), '/'); + p = strrchr((char*)result->slot_path, '/'); if (!p) return ERR_INVALID_PARAM; slot = atoi(p+1); @@ -1761,13 +1761,13 @@ int CMainDocument::WorkShowGraphics(RESULT* result) // exits with "RegisterProcess failed (error = -50)" unless // we pass its full path twice in the argument list to execv. // - argv[1] = (char *)result->graphics_exec_path.c_str(); - argv[2] = (char *)result->graphics_exec_path.c_str(); + argv[1] = (char *)result->graphics_exec_path; + argv[2] = (char *)result->graphics_exec_path; argv[3] = 0; if (g_use_sandbox) { iRetVal = run_program( - result->slot_path.c_str(), + result->slot_path, "../../switcher/switcher", 3, argv, @@ -1776,8 +1776,8 @@ int CMainDocument::WorkShowGraphics(RESULT* result) ); } else { iRetVal = run_program( - result->slot_path.c_str(), - result->graphics_exec_path.c_str(), + result->slot_path, + result->graphics_exec_path, 1, &argv[2], 0, @@ -1819,8 +1819,8 @@ int CMainDocument::WorkShowGraphics(RESULT* result) strcpy(di.display, (const char*)wxGetApp().m_strDefaultDisplay.mb_str()); iRetVal = rpc.show_graphics( - result->project_url.c_str(), - result->name.c_str(), + result->project_url, + result->name, MODE_WINDOW, di ); @@ -1830,10 +1830,10 @@ int CMainDocument::WorkShowGraphics(RESULT* result) } -int CMainDocument::WorkAbort(std::string& strProjectURL, std::string& strName) { +int CMainDocument::WorkAbort(char* url, char* name) { int iRetVal = 0; - RESULT* pStateResult = state.lookup_result(strProjectURL, strName); + RESULT* pStateResult = state.lookup_result(url, name); if (pStateResult) { iRetVal = rpc.result_op((*pStateResult), "abort"); } else { diff --git a/clientgui/MainDocument.h b/clientgui/MainDocument.h index 9928c28a5e..ed22a05e9e 100644 --- a/clientgui/MainDocument.h +++ b/clientgui/MainDocument.h @@ -278,19 +278,10 @@ public: int GetWorkCount(); - int WorkSuspend( - std::string& strProjectURL, - std::string& strName - ); - int WorkResume( - std::string& strProjectURL, - std::string& strName - ); + int WorkSuspend(char* url, char* name); + int WorkResume(char* url, char* name); int WorkShowGraphics(RESULT* result); - int WorkAbort( - std::string& strProjectURL, - std::string& strName - ); + int WorkAbort(char* url, char* name); CC_STATE* GetState() { return &state; }; diff --git a/clientgui/ViewProjects.cpp b/clientgui/ViewProjects.cpp index d1a1023568..4da9a36fc2 100644 --- a/clientgui/ViewProjects.cpp +++ b/clientgui/ViewProjects.cpp @@ -1110,7 +1110,7 @@ void CViewProjects::GetDocProjectURL(wxInt32 item, wxString& strBuffer) const { } if (project) { - strBuffer = wxString(project->master_url.c_str(), wxConvUTF8); + strBuffer = wxString(project->master_url, wxConvUTF8); } else { strBuffer = wxEmptyString; } diff --git a/clientgui/ViewStatistics.cpp b/clientgui/ViewStatistics.cpp index 9c7e6d9698..c8039de84a 100644 --- a/clientgui/ViewStatistics.cpp +++ b/clientgui/ViewStatistics.cpp @@ -578,7 +578,7 @@ void CPaintStatistics::DrawLegend(wxDC &dc, PROJECTS* proj, CMainDocument* pDoc, y0 = wxCoord(m_WorkSpace_Y_start + ((double)(count - m_Legend_Shift) + 0.5) * m_Legend_dY + double(buffer_y1) + radius1); if (x0 < 0) x0 = 0; if (y0 < 0) y0 = 0; - if ((SelProj >= 0) || (!(m_HideProjectStatistic.count( wxString( (*i)->master_url.c_str(),wxConvUTF8 ) )))){ + if ((SelProj >= 0) || (!(m_HideProjectStatistic.count( wxString( (*i)->master_url, wxConvUTF8 ) )))){ myDrawPoint(dc, int(x0), int(y0), graphColour, typePoint ,m_GraphPointWidth); dc.SetFont(m_font_bold); }else { @@ -1153,10 +1153,10 @@ void CPaintStatistics::DrawAll(wxDC &dc) { for (std::vector::const_iterator i = proj->projects.begin(); i != proj->projects.end(); ++i) { ++count; if (m_ViewHideProjectStatistic == count){ - s = m_HideProjectStatistic.find( wxString((*i)->master_url.c_str(),wxConvUTF8) ); + s = m_HideProjectStatistic.find( wxString((*i)->master_url, wxConvUTF8) ); if (s != m_HideProjectStatistic.end()){ m_HideProjectStatistic.erase(s); - }else m_HideProjectStatistic.insert( wxString((*i)->master_url.c_str(),wxConvUTF8) ); + }else m_HideProjectStatistic.insert( wxString((*i)->master_url, wxConvUTF8) ); break; } } @@ -1171,7 +1171,7 @@ void CPaintStatistics::DrawAll(wxDC &dc) { //How many rows/colums? int nb_proj_show = 0; for (std::vector::const_iterator i = proj->projects.begin(); i != proj->projects.end(); ++i) { - if (!(m_HideProjectStatistic.count( wxString((*i)->master_url.c_str(),wxConvUTF8) ))){ + if (!(m_HideProjectStatistic.count( wxString((*i)->master_url, wxConvUTF8) ))){ ++nb_proj_show; } } @@ -1201,13 +1201,13 @@ void CPaintStatistics::DrawAll(wxDC &dc) { double min_val_x_all = 10e32, max_val_x_all = 0; for (std::vector::const_iterator i = proj->projects.begin(); i != proj->projects.end(); ++i) { - if (!(m_HideProjectStatistic.count( wxString((*i)->master_url.c_str(),wxConvUTF8) ))){ + if (!(m_HideProjectStatistic.count( wxString((*i)->master_url, wxConvUTF8) ))){ MinMaxDayCredit(i, min_val_y_all, max_val_y_all, min_val_x_all, max_val_x_all, m_SelectedStatistic, false); } } for (std::vector::const_iterator i = proj->projects.begin(); i != proj->projects.end(); ++i) { - if (!(m_HideProjectStatistic.count( wxString((*i)->master_url.c_str(),wxConvUTF8) ))){ + if (!(m_HideProjectStatistic.count( wxString((*i)->master_url, wxConvUTF8) ))){ //Find minimum/maximum value double min_val_y = 10e32, max_val_y = 0; double min_val_x = 10e32, max_val_x = 0; @@ -1326,10 +1326,10 @@ void CPaintStatistics::DrawAll(wxDC &dc) { for (std::vector::const_iterator i = proj->projects.begin(); i != proj->projects.end(); ++i) { ++count; if (m_ViewHideProjectStatistic == count){ - s = m_HideProjectStatistic.find( wxString((*i)->master_url.c_str(),wxConvUTF8) ); + s = m_HideProjectStatistic.find( wxString((*i)->master_url, wxConvUTF8) ); if (s != m_HideProjectStatistic.end()){ m_HideProjectStatistic.erase(s); - }else m_HideProjectStatistic.insert( wxString((*i)->master_url.c_str(),wxConvUTF8) ); + }else m_HideProjectStatistic.insert( wxString((*i)->master_url, wxConvUTF8) ); break; } } @@ -1349,7 +1349,7 @@ void CPaintStatistics::DrawAll(wxDC &dc) { if (m_Zoom_Auto){ for (std::vector::const_iterator i = proj->projects.begin(); i != proj->projects.end(); ++i) { - if (!(m_HideProjectStatistic.count( wxString((*i)->master_url.c_str(),wxConvUTF8) ))){ + if (!(m_HideProjectStatistic.count( wxString((*i)->master_url, wxConvUTF8) ))){ MinMaxDayCredit(i, min_val_y, max_val_y, min_val_x, max_val_x, m_SelectedStatistic, false); } } @@ -1375,7 +1375,7 @@ void CPaintStatistics::DrawAll(wxDC &dc) { int count = -1; for (std::vector::const_iterator i = proj->projects.begin(); i != proj->projects.end(); ++i) { ++count; - if (!(m_HideProjectStatistic.count( wxString((*i)->master_url.c_str(),wxConvUTF8) ))){ + if (!(m_HideProjectStatistic.count( wxString((*i)->master_url, wxConvUTF8) ))){ wxColour graphColour = wxColour(0,0,0); int typePoint = 0; getTypePoint(typePoint,count); diff --git a/clientgui/ViewWork.cpp b/clientgui/ViewWork.cpp index e15c3e4c82..b8cfb75d74 100644 --- a/clientgui/ViewWork.cpp +++ b/clientgui/ViewWork.cpp @@ -749,7 +749,7 @@ void CViewWork::UpdateSelection() { // Disable Show Graphics button if any selected task can't display graphics if (((!result->supports_graphics) || pDoc->GetState()->executing_as_daemon) - && result->graphics_exec_path.empty() + && !strlen(result->graphics_exec_path) ) { enableShowGraphics = false; } @@ -965,7 +965,7 @@ void CViewWork::GetDocName(wxInt32 item, wxString& strBuffer) const { RESULT* result = wxGetApp().GetDocument()->result(item); if (result) { - strBuffer = wxString(result->name.c_str(), wxConvUTF8); + strBuffer = wxString(result->name, wxConvUTF8); } } @@ -1077,7 +1077,7 @@ void CViewWork::GetDocReportDeadline(wxInt32 item, time_t& time) const { RESULT* result = wxGetApp().GetDocument()->result(item); if (result) { - time = result->report_deadline; + time = (time_t)result->report_deadline; } else { time = (time_t)0; } @@ -1153,8 +1153,8 @@ void CViewWork::GetDocStatus(wxInt32 item, wxString& strBuffer) const { if (status.task_suspend_reason & SUSPEND_REASON_EXCLUSIVE_APP_RUNNING) { strBuffer += _(" - an exclusive app is running"); } - if (result->resources.size()) { - strBuffer += wxString(wxT(" (")) + wxString(result->resources.c_str(), wxConvUTF8) + wxString(wxT(")")); + if (strlen(result->resources)) { + strBuffer += wxString(wxT(" (")) + wxString(result->resources, wxConvUTF8) + wxString(wxT(")")); } } else if (result->active_task) { if (result->too_large) { @@ -1178,8 +1178,8 @@ void CViewWork::GetDocStatus(wxInt32 item, wxString& strBuffer) const { } else if (result->scheduler_state == CPU_SCHED_UNINITIALIZED) { strBuffer += _("Ready to start"); } - if (result->resources.size()) { - strBuffer += wxString(wxT(" (")) + wxString(result->resources.c_str(), wxConvUTF8) + wxString(wxT(")")); + if (strlen(result->resources)) { + strBuffer += wxString(wxT(" (")) + wxString(result->resources, wxConvUTF8) + wxString(wxT(")")); } } else { strBuffer += _("Ready to start"); @@ -1245,7 +1245,7 @@ void CViewWork::GetDocProjectURL(wxInt32 item, wxString& strBuffer) const { RESULT* result = wxGetApp().GetDocument()->result(item); if (result) { - strBuffer = wxString(result->project_url.c_str(), wxConvUTF8); + strBuffer = wxString(result->project_url, wxConvUTF8); } } diff --git a/clientgui/sg_ProjectsComponent.cpp b/clientgui/sg_ProjectsComponent.cpp index 4409702f6b..6afef613b3 100644 --- a/clientgui/sg_ProjectsComponent.cpp +++ b/clientgui/sg_ProjectsComponent.cpp @@ -310,7 +310,7 @@ void CProjectsComponent::UpdateProjectArray() { bool found = false; std::vector::iterator j; for(j=m_statProjects.begin(); j < m_statProjects.end(); j++) { - if ( project->master_url == (*j)->m_prjUrl ) { + if (!strcmp(project->master_url, (*j)->project_url)) { found = true; break; } @@ -327,7 +327,7 @@ void CProjectsComponent::UpdateProjectArray() { PROJECT* project = NULL; std::vector::iterator i; for(i=m_statProjects.begin(); i < m_statProjects.end(); i++) { - project = pDoc->state.lookup_project((*i)->m_prjUrl); + project = pDoc->state.lookup_project((*i)->project_url); if ( project == NULL ) { (*i)->Show(false); delete (*i); diff --git a/clientgui/sg_StatImageLoader.cpp b/clientgui/sg_StatImageLoader.cpp index 404877b100..cc45e0fc92 100644 --- a/clientgui/sg_StatImageLoader.cpp +++ b/clientgui/sg_StatImageLoader.cpp @@ -48,10 +48,10 @@ BEGIN_EVENT_TABLE(StatImageLoader, wxWindow) EVT_MENU(WEBSITE_URL_MENU_ID_REMOVE_PROJECT,StatImageLoader::OnMenuLinkClicked) END_EVENT_TABLE() -StatImageLoader::StatImageLoader(wxWindow* parent, std::string url) : +StatImageLoader::StatImageLoader(wxWindow* parent, char* url) : wxWindow(parent, wxID_ANY, wxDefaultPosition, wxSize(40,40), wxNO_BORDER) { - m_prjUrl = url; + strcpy(project_url, url); project_files_downloaded_time = 1; project_last_rpc_time = 1; BuildUserStatToolTip(); @@ -95,7 +95,7 @@ void StatImageLoader::BuildUserStatToolTip() { wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - PROJECT* project = pDoc->state.lookup_project(m_prjUrl); + PROJECT* project = pDoc->state.lookup_project(project_url); strBuffer.Printf( _("%s. Work done by %s: %0.2f"), @@ -120,7 +120,7 @@ void StatImageLoader::AddMenuItems() wxASSERT(pSkinSimple); wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple)); #endif - PROJECT* project = pDoc->state.lookup_project(m_prjUrl); + PROJECT* project = pDoc->state.lookup_project(project_url); urlCount = project->gui_urls.size(); // Add the home page link @@ -171,10 +171,10 @@ void StatImageLoader::OnMenuLinkClicked(wxCommandEvent& event) //call detach project function OnProjectDetach(); } else if (menuIDevt == WEBSITE_URL_MENU_ID_HOMEPAGE ) { - wxLaunchDefaultBrowser(wxString(m_prjUrl.c_str(),wxConvUTF8)); + wxLaunchDefaultBrowser(wxString(project_url, wxConvUTF8)); } else{ int menuId = menuIDevt - WEBSITE_URL_MENU_ID; - PROJECT* project = pDoc->state.lookup_project(m_prjUrl); + PROJECT* project = pDoc->state.lookup_project(project_url); project->gui_urls[menuId].name.c_str(); wxLaunchDefaultBrowser(wxString(project->gui_urls[menuId].url.c_str(),wxConvUTF8)); @@ -202,7 +202,7 @@ void StatImageLoader::OnProjectDetach() { for(int m = 0; m < prjCount; m++){ PROJECT* project = pDoc->project(m); project->get_name(strProjectName); - if(project->master_url == m_prjUrl){ + if(!strcmp(project->master_url, project_url)){ indexOfProj = m; break; } @@ -236,8 +236,8 @@ void StatImageLoader::LoadStatIcon(wxBitmap& image) { std::string StatImageLoader::GetProjectIconLoc() { char urlDirectory[256]; CMainDocument* pDoc = wxGetApp().GetDocument(); - PROJECT* project = pDoc->state.lookup_project(m_prjUrl); - url_to_project_dir((char*)project->master_url.c_str() ,urlDirectory); + PROJECT* project = pDoc->state.lookup_project(project_url); + url_to_project_dir(project->master_url, urlDirectory); return (std::string)urlDirectory + "/stat_icon"; } @@ -280,7 +280,7 @@ void StatImageLoader::ReloadProjectSpecificIcon() { void StatImageLoader::UpdateInterface() { CMainDocument* pDoc = wxGetApp().GetDocument(); - PROJECT* project = pDoc->state.lookup_project(m_prjUrl); + PROJECT* project = pDoc->state.lookup_project(project_url); // Check to see if we need to reload the stat icon if ( project > NULL && project->project_files_downloaded_time > project_files_downloaded_time ) { diff --git a/clientgui/sg_StatImageLoader.h b/clientgui/sg_StatImageLoader.h index 8b22d0ed14..836259fb0a 100644 --- a/clientgui/sg_StatImageLoader.h +++ b/clientgui/sg_StatImageLoader.h @@ -26,12 +26,9 @@ class StatImageLoader : public wxWindow { public: - //members wxMenu *statPopUpMenu; - //Skin Class - std::string m_prjUrl; - /// Constructors - StatImageLoader(wxWindow* parent, std::string url); + char project_url[256]; + StatImageLoader(wxWindow* parent, char* url); ~StatImageLoader(); void LoadImage(); void OnMenuLinkClicked(wxCommandEvent& event); @@ -43,7 +40,6 @@ public: private: - //private memb wxBitmap Bitmap; std::string projectIcon; int numReloadTries; diff --git a/clientgui/sg_ViewTabPage.cpp b/clientgui/sg_ViewTabPage.cpp index bbf0c9cc06..c844222c6d 100644 --- a/clientgui/sg_ViewTabPage.cpp +++ b/clientgui/sg_ViewTabPage.cpp @@ -74,13 +74,15 @@ bool isRunning(RESULT* result) { CViewTabPage::CViewTabPage() {} -CViewTabPage::CViewTabPage(WorkunitNotebook* parent,RESULT* result,std::string name,std::string url) : +CViewTabPage::CViewTabPage( + WorkunitNotebook* parent,RESULT* result, std::string name, char* url +) : wxPanel(parent, -1, wxDefaultPosition, wxSize(370,330), wxNO_BORDER) { wxASSERT(parent); m_name = name; isAlive = true; - m_prjUrl = url; + strcpy(project_url, url); m_hasGraphic = false; resultWU = result; //create page @@ -129,7 +131,7 @@ void CViewTabPage::CreatePage() spacerLine->Create(this,-1,wxPoint(20,36),wxSize(305,1)); //My Progress - wrkUnitName = wxString(resultWU->name.c_str(),wxConvUTF8); + wrkUnitName = wxString(resultWU->name, wxConvUTF8); //Main Gauge gaugeWUMain=new CProgressBar(this,wxPoint(20,282)); gaugeWUMain->SetValue(floor(resultWU->fraction_done * 100000)/1000); @@ -141,7 +143,7 @@ void CViewTabPage::CreatePage() FormatCPUTime(resultWU, elapsedTimeValue); FormatTimeToCompletion(resultWU, timeRemainingValue); // show graphic button - if (resultWU->supports_graphics || !resultWU->graphics_exec_path.empty()) { + if (resultWU->supports_graphics || strlen(resultWU->graphics_exec_path)) { m_hasGraphic = true; } int status = ComputeState(); @@ -191,7 +193,7 @@ void CViewTabPage::LoadSlideShow(std::vector *vSlideShow) { RESULT* result = pDoc->state.lookup_result(resultWU->project_url, resultWU->name); // If result not found then return if ( result <= 0 ) return; - url_to_project_dir((char *) result->project->master_url.c_str() ,urlDirectory); + url_to_project_dir(result->project->master_url, urlDirectory); char file[512]; char resolvedFile[512]; wxBitmap* btmpSlideShow; @@ -289,7 +291,7 @@ void CViewTabPage::UpdateInterface() // check to see if we can display graphics bool changed = false; - if ((resultWU->supports_graphics || !resultWU->graphics_exec_path.empty()) && isRunning(resultWU) ) { + if ((resultWU->supports_graphics || strlen(resultWU->graphics_exec_path)) && isRunning(resultWU) ) { if ( !m_hasGraphic ) { changed = true; } @@ -716,7 +718,7 @@ void WorkunitNotebook::AddTab(RESULT* result) { RESULT* resState = NULL; std::string projUrl = result->project_url; std::string nme = result->name; - resState = pDoc->state.lookup_result(projUrl, nme); + resState = pDoc->state.lookup_result(result->project_url, result->name); if(!resState){ pDoc->ForceCacheUpdate(); return; @@ -726,7 +728,7 @@ void WorkunitNotebook::AddTab(RESULT* result) { Freeze(); std::string index = " "; appShortName += wxString(index.c_str(), wxConvUTF8 ); - CViewTabPage *wTab = new CViewTabPage(this,result,nme,projUrl); + CViewTabPage *wTab = new CViewTabPage(this, result, nme, result->project_url); AddPage(wTab, appShortName, true); if(isRunning(resState) ){ diff --git a/clientgui/sg_ViewTabPage.h b/clientgui/sg_ViewTabPage.h index 65498ee393..4acb35c2b1 100644 --- a/clientgui/sg_ViewTabPage.h +++ b/clientgui/sg_ViewTabPage.h @@ -85,7 +85,7 @@ public: CViewTabPage(); CViewTabPage( - WorkunitNotebook* parent, RESULT* result, std::string name,std::string url + WorkunitNotebook* parent, RESULT* result, std::string name, char* url ); ~CViewTabPage(); @@ -112,7 +112,7 @@ protected: //tab identifier std::string m_name; - std::string m_prjUrl; + char project_url[256]; bool m_hasGraphic; wxInt32 FormatCPUTime( RESULT* rslt, wxString& strBuffer ) const; diff --git a/doc/index.php b/doc/index.php index 16dfa46287..7041808f93 100644 --- a/doc/index.php +++ b/doc/index.php @@ -215,6 +215,7 @@ function language_form() { ."