lib: fix parsing RESULT from GUI RPC reply

fixes managing older clients
This commit is contained in:
Juha Sointusalo 2016-03-24 22:45:32 +02:00
parent 644c567e32
commit dde9573d64
2 changed files with 28 additions and 4 deletions

View File

@ -400,7 +400,10 @@ struct CC_STATE {
APP_VERSION* lookup_app_version(PROJECT*, APP*,
char* platform, int vnum, char* plan_class
);
APP_VERSION* lookup_app_version_old(PROJECT*, APP*, int);
APP_VERSION* lookup_app_version(PROJECT*, APP*,
int vnum, char* plan_class
);
APP_VERSION* lookup_app_version(PROJECT*, APP*, int vnum);
WORKUNIT* lookup_wu(PROJECT*, const char* name);
RESULT* lookup_result(PROJECT*, const char* name);
RESULT* lookup_result(const char* url, const char* name);

View File

@ -703,6 +703,7 @@ void RESULT::clear() {
version_num = 0;
safe_strcpy(plan_class, "");
safe_strcpy(project_url, "");
safe_strcpy(platform, "");
safe_strcpy(graphics_exec_path, "");
safe_strcpy(web_graphics_url, "");
safe_strcpy(remote_desktop_addr, "");
@ -973,13 +974,18 @@ int CC_STATE::parse(XML_PARSER& xp) {
}
result->app = result->wup->app;
APP_VERSION* avp;
if (result->version_num) {
if (strlen(result->platform)) {
avp = lookup_app_version(
project, result->app,
result->platform, result->version_num, result->plan_class
);
} else if (result->version_num) {
avp = lookup_app_version(
project, result->app,
result->version_num, result->plan_class
);
} else {
avp = lookup_app_version_old(
avp = lookup_app_version(
project, result->app, result->wup->version_num
);
}
@ -1077,7 +1083,22 @@ APP_VERSION* CC_STATE::lookup_app_version(
return 0;
}
APP_VERSION* CC_STATE::lookup_app_version_old(
APP_VERSION* CC_STATE::lookup_app_version(
PROJECT* project, APP* app,
int version_num, char* plan_class
) {
unsigned int i;
for (i=0; i<app_versions.size(); i++) {
if (app_versions[i]->project != project) continue;
if (app_versions[i]->app != app) continue;
if (app_versions[i]->version_num != version_num) continue;
if (strcmp(app_versions[i]->plan_class, plan_class)) continue;
return app_versions[i];
}
return 0;
}
APP_VERSION* CC_STATE::lookup_app_version(
PROJECT* project, APP* app, int version_num
) {
unsigned int i;