- GUI RPC: more replacement of std::string

svn path=/trunk/boinc/; revision=20889
This commit is contained in:
David Anderson 2010-03-13 04:40:37 +00:00
parent 9d21389844
commit 3452bbbc87
10 changed files with 63 additions and 43 deletions

View File

@ -1930,3 +1930,20 @@ David 12 Mar 2010
db/
db_base.cpp
David 12 Mar 2010
- GUI RPC: more replacement of std::string
clientgui/
sg_ViewTagPage.cpp
DlgItemProperties.cpp
ViewWork.cpp
db/
schema.sql
schema_locality.sql
sched/
credit_test.cpp
lib/
gui_rpc_client_print.cpp
gui_rpc_client_ops.cpp
gui_rpc_client.h

View File

@ -356,16 +356,16 @@ wxString CDlgItemProperties::FormatApplicationName(RESULT* result ) {
APP_VERSION* avp = state_result->avp;
if (!avp) return strBuffer;
if (app->user_friendly_name.size()) {
strAppBuffer = wxString(state_result->app->user_friendly_name.c_str(), wxConvUTF8);
if (strlen(app->user_friendly_name)) {
strAppBuffer = wxString(state_result->app->user_friendly_name, wxConvUTF8);
} else {
strAppBuffer = wxString(state_result->avp->app_name.c_str(), wxConvUTF8);
strAppBuffer = wxString(state_result->avp->app_name, wxConvUTF8);
}
if (avp->plan_class.size()) {
if (strlen(avp->plan_class)) {
strClassBuffer.Printf(
wxT(" (%s)"),
wxString(avp->plan_class.c_str(), wxConvUTF8).c_str()
wxString(avp->plan_class, wxConvUTF8).c_str()
);
}

View File

@ -937,16 +937,16 @@ void CViewWork::GetDocApplicationName(wxInt32 item, wxString& strBuffer) const {
APP_VERSION* avp = state_result->avp;
if (!avp) return;
if (app->user_friendly_name.size()) {
strAppBuffer = HtmlEntityDecode(wxString(state_result->app->user_friendly_name.c_str(), wxConvUTF8));
if (strlen(app->user_friendly_name)) {
strAppBuffer = HtmlEntityDecode(wxString(state_result->app->user_friendly_name, wxConvUTF8));
} else {
strAppBuffer = HtmlEntityDecode(wxString(state_result->avp->app_name.c_str(), wxConvUTF8));
strAppBuffer = HtmlEntityDecode(wxString(state_result->avp->app_name, wxConvUTF8));
}
if (avp->plan_class.size()) {
if (strlen(avp->plan_class)) {
strClassBuffer.Printf(
wxT(" (%s)"),
wxString(avp->plan_class.c_str(), wxConvUTF8).c_str()
wxString(avp->plan_class, wxConvUTF8).c_str()
);
}

View File

@ -114,10 +114,10 @@ void CViewTabPage::CreatePage()
resState = pDoc->state.lookup_result(resultWU->project_url, resultWU->name);
if(resState){
projName = wxString(resState->project->project_name.c_str(), wxConvUTF8 );
if (resState->app->user_friendly_name.size()) {
projectFrName = wxString(resState->app->user_friendly_name.c_str(), wxConvUTF8);
if (strlen(resState->app->user_friendly_name)) {
projectFrName = wxString(resState->app->user_friendly_name, wxConvUTF8);
} else {
projectFrName = wxString(resState->avp->app_name.c_str(), wxConvUTF8);
projectFrName = wxString(resState->avp->app_name, wxConvUTF8);
}
} else {
projName = wxString("Not Available", wxConvUTF8 );
@ -198,7 +198,7 @@ void CViewTabPage::LoadSlideShow(std::vector<wxBitmap> *vSlideShow) {
char resolvedFile[512];
wxBitmap* btmpSlideShow;
for(int i=0; i<99; i++) {
sprintf(file, "%s/slideshow_%s_%02d", urlDirectory, result->app->name.c_str(), i);
sprintf(file, "%s/slideshow_%s_%02d", urlDirectory, result->app->name, i);
if(boinc_resolve_filename(file, resolvedFile, sizeof(resolvedFile)) == 0){
btmpSlideShow = new wxBitmap();
if ( btmpSlideShow->LoadFile(wxString(resolvedFile,wxConvUTF8), wxBITMAP_TYPE_ANY) ) {
@ -723,7 +723,7 @@ void WorkunitNotebook::AddTab(RESULT* result) {
pDoc->ForceCacheUpdate();
return;
}
wxString appShortName = wxString(resState->app->name.c_str(), wxConvUTF8 );
wxString appShortName = wxString(resState->app->name, wxConvUTF8 );
// Do not update screen at this point
Freeze();
std::string index = " ";

View File

@ -626,14 +626,12 @@ create table state_counts (
create table host_app_version (
host_id; integer not null,
app_version_id integer not null,
vnpfc_n double not null,
vnpfc_sum double not null,
vnpfc_avg double not null,
pfc_n double not null,
pfc_avg double not null,
et_n double not null,
et_sum double not null,
et_avg double not null,
et_var double not null,
et_sum_sq double not null,
et_q double not null,
host_scale_time double not null,
scale_probation tinyint not null,
error_rate double not null,

View File

@ -41,3 +41,6 @@ alter table sched_trigger
add index(work_available),
add index(no_work_available),
add index(working_set_removal);
alter table workunit
add index (fileset_id);

View File

@ -171,8 +171,8 @@ public:
class APP {
public:
std::string name;
std::string user_friendly_name;
char name[256];
char user_friendly_name[256];
PROJECT* project;
APP();
@ -185,9 +185,9 @@ public:
class APP_VERSION {
public:
std::string app_name;
char app_name[256];
int version_num;
std::string plan_class;
char plan_class[64];
APP* app;
PROJECT* project;
@ -201,8 +201,8 @@ public:
class WORKUNIT {
public:
std::string name;
std::string app_name;
char name[256];
char app_name[256];
int version_num; // backwards compat
double rsc_fpops_est;
double rsc_fpops_bound;
@ -369,7 +369,7 @@ public:
~CC_STATE();
PROJECT* lookup_project(char* url);
APP* lookup_app(PROJECT*, std::string&);
APP* lookup_app(PROJECT*, char* name);
APP_VERSION* lookup_app_version(PROJECT*, APP*, int, char* plan_class);
APP_VERSION* lookup_app_version_old(PROJECT*, APP*, int);
WORKUNIT* lookup_wu(PROJECT*, char* name);

View File

@ -339,14 +339,15 @@ int APP::parse(MIOFILE& in) {
char buf[256];
while (in.fgets(buf, 256)) {
if (match_tag(buf, "</app>")) return 0;
if (parse_str(buf, "<name>", name)) continue;
if (parse_str(buf, "<user_friendly_name>", user_friendly_name)) continue;
if (parse_str(buf, "<name>", name, sizeof(name))) continue;
if (parse_str(buf, "<user_friendly_name>", user_friendly_name, sizeof(user_friendly_name))) continue;
}
return ERR_XML_PARSE;
}
void APP::clear() {
name.clear();
strcpy(name, "");
strcpy(user_friendly_name, "");
project = NULL;
}
@ -362,15 +363,16 @@ int APP_VERSION::parse(MIOFILE& in) {
char buf[256];
while (in.fgets(buf, 256)) {
if (match_tag(buf, "</app_version>")) return 0;
if (parse_str(buf, "<app_name>", app_name)) continue;
if (parse_str(buf, "<plan_class>", plan_class)) continue;
if (parse_str(buf, "<app_name>", app_name, sizeof(app_name))) continue;
if (parse_str(buf, "<plan_class>", plan_class, sizeof(plan_class))) continue;
if (parse_int(buf, "<version_num>", version_num)) continue;
}
return ERR_XML_PARSE;
}
void APP_VERSION::clear() {
app_name.clear();
strcpy(app_name, "");
strcpy(plan_class, "");
version_num = 0;
app = NULL;
project = NULL;
@ -388,8 +390,8 @@ int WORKUNIT::parse(MIOFILE& in) {
char buf[256];
while (in.fgets(buf, 256)) {
if (match_tag(buf, "</workunit>")) return 0;
if (parse_str(buf, "<name>", name)) continue;
if (parse_str(buf, "<app_name>", app_name)) continue;
if (parse_str(buf, "<name>", name, sizeof(name))) continue;
if (parse_str(buf, "<app_name>", app_name, sizeof(app_name))) continue;
if (parse_int(buf, "<version_num>", version_num)) continue;
if (parse_double(buf, "<rsc_fpops_est>", rsc_fpops_est)) continue;
if (parse_double(buf, "<rsc_fpops_bound>", rsc_fpops_bound)) continue;
@ -400,8 +402,8 @@ int WORKUNIT::parse(MIOFILE& in) {
}
void WORKUNIT::clear() {
name.clear();
app_name.clear();
strcpy(name, "");
strcpy(app_name, "");
version_num = 0;
rsc_fpops_est = 0;
rsc_fpops_bound = 0;
@ -725,11 +727,11 @@ PROJECT* CC_STATE::lookup_project(char* url) {
return 0;
}
APP* CC_STATE::lookup_app(PROJECT* project, string& str) {
APP* CC_STATE::lookup_app(PROJECT* project, char* name) {
unsigned int i;
for (i=0; i<apps.size(); i++) {
if (apps[i]->project != project) continue;
if (apps[i]->name == str) return apps[i];
if (!strcmp(apps[i]->name, name)) return apps[i];
}
return 0;
}

View File

@ -92,18 +92,18 @@ void PROJECT::print() {
}
void APP::print() {
printf(" name: %s\n", name.c_str());
printf(" name: %s\n", name);
printf(" Project: %s\n", project->project_name.c_str());
}
void APP_VERSION::print() {
printf(" application: %s\n", app->name.c_str());
printf(" application: %s\n", app->name);
printf(" version: %.2f\n", version_num/100.0);
printf(" project: %s\n", project->project_name.c_str());
}
void WORKUNIT::print() {
printf(" name: %s\n", name.c_str());
printf(" name: %s\n", name);
printf(" FP estimate: %f\n", rsc_fpops_est);
printf(" FP bound: %f\n", rsc_fpops_bound);
printf(" memory bound: %f\n", rsc_memory_bound);

View File

@ -27,7 +27,7 @@
struct HOST_APP_VERSION {
int host_id;
int app_version_id; // 0 unknown, -1 anon platform
int app_version_id; // 0 unknown, -1/-2/-3 anon platform
int app_id; // if unknown or anon platform
AVERAGE pfc;
AVERAGE et;