1
1

Santa's back! Fix all warnings about the deprecated usage of

stringWithCString as well as the casting issue between NSInteger and
%d. The first is solved by using stringWithUTF8String, which apparently
will always give the right answer (sic). The second is fixed as suggested
by Apple by casting the NSInteger (hint: which by definition is large
enough to hold a pointer) to a long and use %ld in the printf.

This commit was SVN r22317.
Этот коммит содержится в:
George Bosilca 2009-12-16 00:06:37 +00:00
родитель b3d3a8e7b3
Коммит a2310808f1

Просмотреть файл

@ -56,14 +56,14 @@
OBJ_CONSTRUCT(&state_mutex, opal_mutex_t); OBJ_CONSTRUCT(&state_mutex, opal_mutex_t);
if (NULL != password) { if (NULL != password) {
controller_password = [NSString stringWithCString: password]; controller_password = [NSString stringWithUTF8String: password];
} }
if (NULL != hostname) { if (NULL != hostname) {
controller_hostname = [NSString stringWithCString: hostname]; controller_hostname = [NSString stringWithUTF8String: hostname];
} }
cleanup = val; cleanup = val;
if (NULL != ortedname) { if (NULL != ortedname) {
orted = [NSString stringWithCString: ortedname]; orted = [NSString stringWithUTF8String: ortedname];
} }
active_xgrid_jobs = [NSMutableDictionary dictionary]; active_xgrid_jobs = [NSMutableDictionary dictionary];
@ -118,19 +118,19 @@
-(void) setOrtedAsCString: (char*) name -(void) setOrtedAsCString: (char*) name
{ {
orted = [NSString stringWithCString: name]; orted = [NSString stringWithUTF8String: name];
} }
-(void) setControllerPasswordAsCString: (char*) name -(void) setControllerPasswordAsCString: (char*) name
{ {
controller_password = [NSString stringWithCString: name]; controller_password = [NSString stringWithUTF8String: name];
} }
-(void) setControllerHostnameAsCString: (char*) password -(void) setControllerHostnameAsCString: (char*) password
{ {
controller_hostname = [NSString stringWithCString: password]; controller_hostname = [NSString stringWithUTF8String: password];
} }
@ -267,7 +267,7 @@
NSMutableDictionary *task = [NSMutableDictionary dictionary]; NSMutableDictionary *task = [NSMutableDictionary dictionary];
/* fill in applicaton to start */ /* fill in applicaton to start */
[task setObject: [NSString stringWithCString: orted_path] [task setObject: [NSString stringWithUTF8String: orted_path]
forKey: XGJobSpecificationCommandKey]; forKey: XGJobSpecificationCommandKey];
/* fill in task arguments */ /* fill in task arguments */
@ -281,11 +281,11 @@
opal_output(0, "orte_plm_rsh: unable to get daemon vpid as string"); opal_output(0, "orte_plm_rsh: unable to get daemon vpid as string");
goto cleanup; goto cleanup;
} }
[taskArguments addObject: [NSString stringWithCString: vpid_string]]; [taskArguments addObject: [NSString stringWithUTF8String: vpid_string]];
free(vpid_string); free(vpid_string);
[taskArguments addObject: @"--nodename"]; [taskArguments addObject: @"--nodename"];
[taskArguments addObject: [NSString stringWithCString: nodes[nnode]->name]]; [taskArguments addObject: [NSString stringWithUTF8String: nodes[nnode]->name]];
[task setObject: taskArguments forKey: XGJobSpecificationArgumentsKey]; [task setObject: taskArguments forKey: XGJobSpecificationArgumentsKey];
@ -393,8 +393,8 @@ cleanup:
-(void) connectionDidNotOpen:(XGConnection*) myConnection withError: (NSError*) error -(void) connectionDidNotOpen:(XGConnection*) myConnection withError: (NSError*) error
{ {
opal_output(orte_plm_globals.output, opal_output(orte_plm_globals.output,
"orte:plm:xgrid: Controller connection did not open: (%d) %s", "orte:plm:xgrid: Controller connection did not open: (%ld) %s",
[error code], (long)[error code],
[[error localizedDescription] UTF8String]); [[error localizedDescription] UTF8String]);
opal_condition_broadcast(&state_cond); opal_condition_broadcast(&state_cond);
} }
@ -411,13 +411,13 @@ cleanup:
case 530: case 530:
case 535: case 535:
opal_output(orte_plm_globals.output, opal_output(orte_plm_globals.output,
"orte:plm:xgrid: Connection to XGrid controller failed due to authentication error (%d):", "orte:plm:xgrid: Connection to XGrid controller failed due to authentication error (%ld):",
[[myConnection error] code]); (long)[[myConnection error] code]);
break; break;
default: default:
opal_output(orte_plm_globals.output, opal_output(orte_plm_globals.output,
"orte:plm:xgrid: Connection to XGrid controller unexpectedly closed: (%d) %s", "orte:plm:xgrid: Connection to XGrid controller unexpectedly closed: (%ld) %s",
[[myConnection error] code], (long)[[myConnection error] code],
[[[myConnection error] localizedDescription] UTF8String]); [[[myConnection error] localizedDescription] UTF8String]);
break; break;
} }
@ -443,7 +443,7 @@ cleanup:
/* Note that capacity is a starting capacity, not max */ /* Note that capacity is a starting capacity, not max */
NSMutableArray *ret = [NSMutableArray arrayWithCapacity: argc]; NSMutableArray *ret = [NSMutableArray arrayWithCapacity: argc];
for (i = 0 ; i < argc ; ++i) { for (i = 0 ; i < argc ; ++i) {
[ret addObject: [NSString stringWithCString: argv[i]]]; [ret addObject: [NSString stringWithUTF8String: argv[i]]];
} }
if (NULL != argv) opal_argv_free(argv); if (NULL != argv) opal_argv_free(argv);