@@ -53,13 +53,14 @@ APP_INIT_DATA::APP_INIT_DATA(const APP_INIT_DATA& a) {
53
53
54
54
APP_INIT_DATA &APP_INIT_DATA::operator =(const APP_INIT_DATA& a) {
55
55
if (this != &a) {
56
- copy (a);
56
+ copy (a);
57
57
}
58
58
return *this ;
59
59
}
60
60
61
61
void APP_INIT_DATA::copy (const APP_INIT_DATA& a) {
62
62
safe_strcpy (app_name, a.app_name );
63
+ safe_strcpy (plan_class, a.plan_class );
63
64
safe_strcpy (symstore, a.symstore );
64
65
safe_strcpy (acct_mgr_url, a.acct_mgr_url );
65
66
safe_strcpy (user_name, a.user_name );
@@ -138,8 +139,12 @@ int write_init_data_file(FILE* f, APP_INIT_DATA& ai) {
138
139
ai.teamid ,
139
140
ai.hostid
140
141
);
141
- if (strlen (ai.app_name )) {
142
- fprintf (f, " <app_name>%s</app_name>\n " , ai.app_name );
142
+ // some strings are always present;
143
+ // for others, print only if present
144
+
145
+ fprintf (f, " <app_name>%s</app_name>\n " , ai.app_name );
146
+ if (strlen (ai.plan_class )) {
147
+ fprintf (f, " <plan_class>%s</plan_class>\n " , ai.plan_class );
143
148
}
144
149
if (strlen (ai.symstore )) {
145
150
fprintf (f, " <symstore>%s</symstore>\n " , ai.symstore );
@@ -158,21 +163,11 @@ int write_init_data_file(FILE* f, APP_INIT_DATA& ai) {
158
163
xml_escape (ai.user_name , buf, sizeof (buf));
159
164
fprintf (f, " <user_name>%s</user_name>\n " , buf);
160
165
}
161
- if (strlen (ai.project_dir )) {
162
- fprintf (f, " <project_dir>%s</project_dir>\n " , ai.project_dir );
163
- }
164
- if (strlen (ai.boinc_dir )) {
165
- fprintf (f, " <boinc_dir>%s</boinc_dir>\n " , ai.boinc_dir );
166
- }
167
- if (strlen (ai.authenticator )) {
168
- fprintf (f, " <authenticator>%s</authenticator>\n " , ai.authenticator );
169
- }
170
- if (strlen (ai.wu_name )) {
171
- fprintf (f, " <wu_name>%s</wu_name>\n " , ai.wu_name );
172
- }
173
- if (strlen (ai.result_name )) {
174
- fprintf (f, " <result_name>%s</result_name>\n " , ai.result_name );
175
- }
166
+ fprintf (f, " <project_dir>%s</project_dir>\n " , ai.project_dir );
167
+ fprintf (f, " <boinc_dir>%s</boinc_dir>\n " , ai.boinc_dir );
168
+ fprintf (f, " <authenticator>%s</authenticator>\n " , ai.authenticator );
169
+ fprintf (f, " <wu_name>%s</wu_name>\n " , ai.wu_name );
170
+ fprintf (f, " <result_name>%s</result_name>\n " , ai.result_name );
176
171
#ifdef _WIN32
177
172
if (strlen (ai.shmem_seg_name )) {
178
173
fprintf (f, " <comm_obj_name>%s</comm_obj_name>\n " , ai.shmem_seg_name );
@@ -241,7 +236,9 @@ int write_init_data_file(FILE* f, APP_INIT_DATA& ai) {
241
236
MIOFILE mf;
242
237
mf.init_file (f);
243
238
ai.host_info .write (mf, true , true );
244
- ai.proxy_info .write (mf);
239
+ if (ai.proxy_info .using_proxy ()) {
240
+ ai.proxy_info .write (mf);
241
+ }
245
242
ai.global_prefs .write (mf);
246
243
for (unsigned int i=0 ; i<ai.app_files .size (); i++) {
247
244
fprintf (f, " <app_file>%s</app_file>\n " , ai.app_files [i].c_str ());
@@ -255,20 +252,21 @@ void APP_INIT_DATA::clear() {
255
252
minor_version = 0 ;
256
253
release = 0 ;
257
254
app_version = 0 ;
258
- safe_strcpy (app_name, " " );
259
- safe_strcpy (symstore, " " );
260
- safe_strcpy (acct_mgr_url, " " );
255
+ app_name[0 ] = 0 ;
256
+ plan_class[0 ] = 0 ;
257
+ symstore[0 ] = 0 ;
258
+ acct_mgr_url[0 ] = 0 ;
261
259
project_preferences = NULL ;
262
260
userid = 0 ;
263
261
teamid = 0 ;
264
262
hostid = 0 ;
265
- safe_strcpy ( user_name, " " ) ;
266
- safe_strcpy ( team_name, " " ) ;
267
- safe_strcpy ( project_dir, " " ) ;
268
- safe_strcpy ( boinc_dir, " " ) ;
269
- safe_strcpy ( wu_name, " " ) ;
270
- safe_strcpy ( result_name, " " ) ;
271
- safe_strcpy ( authenticator, " " ) ;
263
+ user_name[ 0 ] = 0 ;
264
+ team_name[ 0 ] = 0 ;
265
+ project_dir[ 0 ] = 0 ;
266
+ boinc_dir[ 0 ] = 0 ;
267
+ wu_name[ 0 ] = 0 ;
268
+ result_name[ 0 ] = 0 ;
269
+ authenticator[ 0 ] = 0 ;
272
270
slot = 0 ;
273
271
client_pid = 0 ;
274
272
user_total_credit = 0 ;
@@ -292,7 +290,7 @@ void APP_INIT_DATA::clear() {
292
290
checkpoint_period = 0 ;
293
291
// gpu_type is an empty string for client versions before 6.13.3 without this
294
292
// field or (on newer clients) if BOINC did not assign an OpenCL GPU to task.
295
- safe_strcpy ( gpu_type, " " ) ;
293
+ gpu_type[ 0 ] = 0 ;
296
294
// gpu_device_num < 0 for client versions before 6.13.3 without this field
297
295
// or (on newer clients) if BOINC did not assign an OpenCL GPU to task.
298
296
gpu_device_num = -1 ;
@@ -365,6 +363,7 @@ int parse_init_data_file(FILE* f, APP_INIT_DATA& ai) {
365
363
if (xp.parse_int (" release" , ai.release )) continue ;
366
364
if (xp.parse_int (" app_version" , ai.app_version )) continue ;
367
365
if (xp.parse_str (" app_name" , ai.app_name , sizeof (ai.app_name ))) continue ;
366
+ if (xp.parse_str (" plan_class" , ai.plan_class , sizeof (ai.plan_class ))) continue ;
368
367
if (xp.parse_str (" symstore" , ai.symstore , sizeof (ai.symstore ))) continue ;
369
368
if (xp.parse_str (" acct_mgr_url" , ai.acct_mgr_url , sizeof (ai.acct_mgr_url ))) continue ;
370
369
if (xp.parse_int (" userid" , ai.userid )) continue ;
0 commit comments