Skip to content

Commit

Permalink
- GUI RPC: more replacement of std::string
Browse files Browse the repository at this point in the history
svn path=/trunk/boinc/; revision=20889
  • Loading branch information
davidpanderson committed Mar 13, 2010
1 parent 9d21389 commit 3452bbb
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 43 deletions.
17 changes: 17 additions & 0 deletions checkin_notes
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions clientgui/DlgItemProperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
}

Expand Down
10 changes: 5 additions & 5 deletions clientgui/ViewWork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
}

Expand Down
10 changes: 5 additions & 5 deletions clientgui/sg_ViewTabPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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) ) {
Expand Down Expand Up @@ -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 = " ";
Expand Down
8 changes: 3 additions & 5 deletions db/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions db/schema_locality.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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);
14 changes: 7 additions & 7 deletions lib/gui_rpc_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ class PROJECT {

class APP {
public:
std::string name;
std::string user_friendly_name;
char name[256];
char user_friendly_name[256];
PROJECT* project;

APP();
Expand All @@ -185,9 +185,9 @@ class APP {

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;

Expand All @@ -201,8 +201,8 @@ class APP_VERSION {

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;
Expand Down Expand Up @@ -369,7 +369,7 @@ class CC_STATE {
~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);
Expand Down
26 changes: 14 additions & 12 deletions lib/gui_rpc_client_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/gui_rpc_client_print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion sched/credit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3452bbb

Please sign in to comment.