1
1

More type checking in pack and unpack

This commit was SVN r5209.
Этот коммит содержится в:
Josh Hursey 2005-04-07 19:18:55 +00:00
родитель 81f5165192
Коммит dd4f36b98f
10 изменённых файлов: 49 добавлений и 40 удалений

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

@ -80,7 +80,7 @@ int orte_gpr_base_pack_delete_entries(orte_buffer_t *cmd,
} }
/* pack number of tokens */ /* pack number of tokens */
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, (int*)&n, 1, ORTE_INT))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &n, 1, ORTE_SIZE))) {
return rc; return rc;
} }
@ -102,7 +102,7 @@ int orte_gpr_base_pack_delete_entries(orte_buffer_t *cmd,
} }
/* pack number of keys */ /* pack number of keys */
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, (int*)&n, 1, ORTE_INT))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &n, 1, ORTE_SIZE))) {
return rc; return rc;
} }

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

@ -60,7 +60,7 @@ int orte_gpr_base_pack_get(orte_buffer_t *cmd,
orte_gpr_cmd_flag_t command; orte_gpr_cmd_flag_t command;
char **ptr; char **ptr;
int rc; int rc;
int n; int32_t n;
command = ORTE_GPR_GET_CMD; command = ORTE_GPR_GET_CMD;
@ -86,7 +86,7 @@ int orte_gpr_base_pack_get(orte_buffer_t *cmd,
} }
/* pack number of tokens */ /* pack number of tokens */
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &n, 1, ORTE_INT))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &n, 1, ORTE_INT32))) {
return rc; return rc;
} }
@ -106,7 +106,7 @@ int orte_gpr_base_pack_get(orte_buffer_t *cmd,
} }
/* pack number of keys */ /* pack number of keys */
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &n, 1, ORTE_INT))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &n, 1, ORTE_INT32))) {
return rc; return rc;
} }

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

@ -77,7 +77,7 @@ int orte_gpr_base_unpack_decrement_value(orte_buffer_t *cmd, int *ret)
} }
n=1; n=1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(cmd, ret, &n, ORTE_INT32))) { if (ORTE_SUCCESS != (rc = orte_dps.unpack(cmd, ret, &n, ORTE_INT))) {
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
return rc; return rc;
} }

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

@ -63,7 +63,8 @@ int orte_gpr_base_unpack_put(orte_buffer_t *buffer, int *ret)
int orte_gpr_base_unpack_get(orte_buffer_t *buffer, int *ret, int *cnt, orte_gpr_value_t ***values) int orte_gpr_base_unpack_get(orte_buffer_t *buffer, int *ret, int *cnt, orte_gpr_value_t ***values)
{ {
orte_gpr_cmd_flag_t command; orte_gpr_cmd_flag_t command;
int rc, num; int rc;
int32_t num;
size_t n; size_t n;
n=1; n=1;
@ -78,7 +79,7 @@ int orte_gpr_base_unpack_get(orte_buffer_t *buffer, int *ret, int *cnt, orte_gpr
} }
/* find out how many values came back */ /* find out how many values came back */
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, &num, &n, ORTE_INT))) { if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, &num, &n, ORTE_INT32))) {
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
return rc; return rc;
} }

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

@ -37,7 +37,8 @@ int orte_gpr_replica_recv_increment_value_cmd(orte_buffer_t *cmd, orte_buffer_t
orte_gpr_replica_segment_t *seg=NULL; orte_gpr_replica_segment_t *seg=NULL;
orte_gpr_replica_itag_t *itags=NULL; orte_gpr_replica_itag_t *itags=NULL;
size_t n; size_t n;
int rc, ret; int rc;
int32_t ret;
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
@ -85,7 +86,7 @@ int orte_gpr_replica_recv_increment_value_cmd(orte_buffer_t *cmd, orte_buffer_t
} }
RETURN_ERROR: RETURN_ERROR:
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &ret, 1, ORTE_INT))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &ret, 1, ORTE_INT32))) {
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
return rc; return rc;
} }
@ -100,7 +101,8 @@ int orte_gpr_replica_recv_decrement_value_cmd(orte_buffer_t *cmd, orte_buffer_t
orte_gpr_replica_segment_t *seg=NULL; orte_gpr_replica_segment_t *seg=NULL;
orte_gpr_replica_itag_t *itags=NULL; orte_gpr_replica_itag_t *itags=NULL;
size_t n; size_t n;
int rc, ret; int rc;
int32_t ret;
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
@ -148,7 +150,7 @@ int orte_gpr_replica_recv_decrement_value_cmd(orte_buffer_t *cmd, orte_buffer_t
} }
RETURN_ERROR: RETURN_ERROR:
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &ret, 1, ORTE_INT))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &ret, 1, ORTE_INT32))) {
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
return rc; return rc;
} }

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

@ -36,7 +36,7 @@ int orte_gpr_replica_recv_cleanup_job_cmd(orte_buffer_t *input_buffer,
orte_gpr_cmd_flag_t command=ORTE_GPR_CLEANUP_JOB_CMD; orte_gpr_cmd_flag_t command=ORTE_GPR_CLEANUP_JOB_CMD;
orte_jobid_t jobid=0; orte_jobid_t jobid=0;
size_t n; size_t n;
int rc, ret; int32_t rc, ret;
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &command, 1, ORTE_GPR_CMD))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
@ -56,7 +56,7 @@ int orte_gpr_replica_recv_cleanup_job_cmd(orte_buffer_t *input_buffer,
} }
RETURN_ERROR: RETURN_ERROR:
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &ret, 1, ORTE_INT))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &ret, 1, ORTE_INT32))) {
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
return rc; return rc;
} }
@ -71,7 +71,7 @@ int orte_gpr_replica_recv_cleanup_proc_cmd(orte_buffer_t *input_buffer,
orte_gpr_cmd_flag_t command=ORTE_GPR_CLEANUP_PROC_CMD; orte_gpr_cmd_flag_t command=ORTE_GPR_CLEANUP_PROC_CMD;
orte_process_name_t proc; orte_process_name_t proc;
size_t n; size_t n;
int rc, ret; int32_t rc, ret;
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &command, 1, ORTE_GPR_CMD))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
@ -91,7 +91,7 @@ int orte_gpr_replica_recv_cleanup_proc_cmd(orte_buffer_t *input_buffer,
} }
RETURN_ERROR: RETURN_ERROR:
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &ret, 1, ORTE_INT))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &ret, 1, ORTE_INT32))) {
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
return rc; return rc;
} }

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

@ -40,7 +40,7 @@ int orte_gpr_replica_process_command_buffer(orte_buffer_t *input_buffer,
{ {
orte_buffer_t *answer; orte_buffer_t *answer;
orte_gpr_cmd_flag_t command; orte_gpr_cmd_flag_t command;
int rc, ret, rc2; int32_t ret, rc, rc2;
size_t n; size_t n;
bool compound_cmd=false; bool compound_cmd=false;
@ -309,7 +309,7 @@ int orte_gpr_replica_process_command_buffer(orte_buffer_t *input_buffer,
} }
ret = ORTE_SUCCESS; ret = ORTE_SUCCESS;
if (ORTE_SUCCESS != (rc = orte_dps.pack(*output_buffer, &ret, 1, ORTE_INT))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(*output_buffer, &ret, 1, ORTE_INT32))) {
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
goto RETURN_ERROR; goto RETURN_ERROR;
} }
@ -331,10 +331,10 @@ RETURN_ERROR:
ORTE_ERROR_LOG(rc2); ORTE_ERROR_LOG(rc2);
} }
if (ORTE_SUCCESS != ret) { if (ORTE_SUCCESS != ret) {
orte_dps.pack(answer, &ret, 1, ORTE_INT); orte_dps.pack(answer, &ret, 1, ORTE_INT32);
return rc; return rc;
} }
orte_dps.pack(answer, &rc, 1, ORTE_INT); orte_dps.pack(answer, &rc, 1, ORTE_INT32);
return rc; return rc;
} }

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

@ -36,7 +36,8 @@ int orte_gpr_replica_recv_delete_segment_cmd(orte_buffer_t *buffer, orte_buffer_
char *segment=NULL; char *segment=NULL;
orte_gpr_replica_segment_t *seg=NULL; orte_gpr_replica_segment_t *seg=NULL;
size_t n; size_t n;
int rc, ret; int rc;
int32_t ret;
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
@ -59,7 +60,7 @@ int orte_gpr_replica_recv_delete_segment_cmd(orte_buffer_t *buffer, orte_buffer_
} }
RETURN_ERROR: RETURN_ERROR:
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &ret, 1, ORTE_INT))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &ret, 1, ORTE_INT32))) {
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
return rc; return rc;
} }
@ -74,7 +75,8 @@ int orte_gpr_replica_recv_delete_entries_cmd(orte_buffer_t *buffer, orte_buffer_
orte_gpr_replica_itag_t *token_itags=NULL, *key_itags=NULL; orte_gpr_replica_itag_t *token_itags=NULL, *key_itags=NULL;
orte_gpr_replica_segment_t *seg=NULL; orte_gpr_replica_segment_t *seg=NULL;
char *segment=NULL, **tokens=NULL, **keys=NULL; char *segment=NULL, **tokens=NULL, **keys=NULL;
int num_tokens=0, num_keys=0, rc, i, ret; int32_t num_tokens=0, num_keys=0, ret;
int rc, i;
size_t n; size_t n;
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) {
@ -95,7 +97,7 @@ int orte_gpr_replica_recv_delete_entries_cmd(orte_buffer_t *buffer, orte_buffer_
} }
n = 1; n = 1;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(buffer, &num_tokens, &n, ORTE_INT))) { if (ORTE_SUCCESS != (ret = orte_dps.unpack(buffer, &num_tokens, &n, ORTE_INT32))) {
ORTE_ERROR_LOG(ret); ORTE_ERROR_LOG(ret);
goto RETURN_ERROR; goto RETURN_ERROR;
} }
@ -116,7 +118,7 @@ int orte_gpr_replica_recv_delete_entries_cmd(orte_buffer_t *buffer, orte_buffer_
} }
n = 1; n = 1;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(buffer, &num_keys, &n, ORTE_INT))) { if (ORTE_SUCCESS != (ret = orte_dps.unpack(buffer, &num_keys, &n, ORTE_INT32))) {
ORTE_ERROR_LOG(ret); ORTE_ERROR_LOG(ret);
goto RETURN_ERROR; goto RETURN_ERROR;
} }
@ -188,7 +190,7 @@ int orte_gpr_replica_recv_delete_entries_cmd(orte_buffer_t *buffer, orte_buffer_
free(key_itags); free(key_itags);
} }
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &ret, 1, ORTE_INT))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &ret, 1, ORTE_INT32))) {
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
return rc; return rc;
} }
@ -204,7 +206,8 @@ int orte_gpr_replica_recv_index_cmd(orte_buffer_t *buffer,
size_t n, cnt; size_t n, cnt;
orte_gpr_replica_segment_t *seg=NULL; orte_gpr_replica_segment_t *seg=NULL;
char *segment=NULL, **index=NULL; char *segment=NULL, **index=NULL;
int rc, ret; int rc;
int32_t ret;
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
@ -269,7 +272,7 @@ RETURN_PACK_ERROR:
free(index); free(index);
} }
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &ret, 1, ORTE_INT))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &ret, 1, ORTE_INT32))) {
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
return rc; return rc;
} }

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

@ -38,7 +38,8 @@ int orte_gpr_replica_recv_put_cmd(orte_buffer_t *buffer, orte_buffer_t *answer)
orte_gpr_replica_itag_t *itags=NULL; orte_gpr_replica_itag_t *itags=NULL;
orte_data_type_t type; orte_data_type_t type;
int8_t action_taken=0; int8_t action_taken=0;
int i=0, rc, ret; int i=0, rc;
int32_t ret;
size_t cnt; size_t cnt;
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) {
@ -125,7 +126,7 @@ int orte_gpr_replica_recv_put_cmd(orte_buffer_t *buffer, orte_buffer_t *answer)
free(values); free(values);
} }
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &ret, 1, ORTE_INT))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &ret, 1, ORTE_INT32))) {
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
return rc; return rc;
} }
@ -140,9 +141,9 @@ int orte_gpr_replica_recv_get_cmd(orte_buffer_t *input_buffer,
orte_gpr_addr_mode_t addr_mode; orte_gpr_addr_mode_t addr_mode;
orte_gpr_replica_segment_t *seg=NULL; orte_gpr_replica_segment_t *seg=NULL;
orte_gpr_replica_itag_t *tokentags=NULL, *keytags=NULL; orte_gpr_replica_itag_t *tokentags=NULL, *keytags=NULL;
int num_tokens=0, num_keys=0, rc, ret; int32_t num_tokens=0, num_keys=0, rc, ret, cnt=0;
char *segment=NULL, **tokens=NULL, **keys=NULL; char *segment=NULL, **tokens=NULL, **keys=NULL;
int i=0, cnt=0; int i=0;
size_t n; size_t n;
orte_gpr_value_t **values=NULL; orte_gpr_value_t **values=NULL;
@ -164,7 +165,7 @@ int orte_gpr_replica_recv_get_cmd(orte_buffer_t *input_buffer,
} }
n = 1; n = 1;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(input_buffer, &num_tokens, &n, ORTE_INT))) { if (ORTE_SUCCESS != (ret = orte_dps.unpack(input_buffer, &num_tokens, &n, ORTE_INT32))) {
ORTE_ERROR_LOG(ret); ORTE_ERROR_LOG(ret);
goto RETURN_ERROR; goto RETURN_ERROR;
} }
@ -187,7 +188,7 @@ int orte_gpr_replica_recv_get_cmd(orte_buffer_t *input_buffer,
} }
n = 1; n = 1;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(input_buffer, &num_keys, &n, ORTE_INT))) { if (ORTE_SUCCESS != (ret = orte_dps.unpack(input_buffer, &num_keys, &n, ORTE_INT32))) {
ORTE_ERROR_LOG(ret); ORTE_ERROR_LOG(ret);
goto RETURN_ERROR; goto RETURN_ERROR;
} }
@ -240,7 +241,7 @@ int orte_gpr_replica_recv_get_cmd(orte_buffer_t *input_buffer,
RETURN_ERROR: RETURN_ERROR:
/* pack the number of values */ /* pack the number of values */
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &cnt, 1, ORTE_INT))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &cnt, 1, ORTE_INT32))) {
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
ret = rc; ret = rc;
} }
@ -288,7 +289,7 @@ int orte_gpr_replica_recv_get_cmd(orte_buffer_t *input_buffer,
} }
/* pack response code */ /* pack response code */
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &ret, 1, ORTE_INT))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &ret, 1, ORTE_INT32))) {
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
} }

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

@ -39,7 +39,8 @@ int orte_gpr_replica_recv_subscribe_cmd(orte_process_name_t* sender,
orte_gpr_cmd_flag_t command=ORTE_GPR_SUBSCRIBE_CMD; orte_gpr_cmd_flag_t command=ORTE_GPR_SUBSCRIBE_CMD;
orte_data_type_t type; orte_data_type_t type;
orte_gpr_notify_id_t local_idtag=ORTE_GPR_NOTIFY_ID_MAX, idtag=ORTE_GPR_NOTIFY_ID_MAX; orte_gpr_notify_id_t local_idtag=ORTE_GPR_NOTIFY_ID_MAX, idtag=ORTE_GPR_NOTIFY_ID_MAX;
int rc, ret, num_subs, num_trigs; int32_t rc;
int ret, num_subs, num_trigs;
size_t n; size_t n;
orte_gpr_notify_action_t action; orte_gpr_notify_action_t action;
orte_gpr_value_t **trigs; orte_gpr_value_t **trigs;
@ -148,7 +149,7 @@ int orte_gpr_replica_recv_subscribe_cmd(orte_process_name_t* sender,
goto RETURN_ERROR; goto RETURN_ERROR;
} }
if (ORTE_SUCCESS != (ret = orte_dps.pack(output_buffer, &rc, 1, ORTE_INT))) { if (ORTE_SUCCESS != (ret = orte_dps.pack(output_buffer, &rc, 1, ORTE_INT32))) {
ORTE_ERROR_LOG(ret); ORTE_ERROR_LOG(ret);
return ret; return ret;
} }
@ -161,7 +162,8 @@ int orte_gpr_replica_recv_unsubscribe_cmd(orte_buffer_t *input_buffer,
{ {
orte_gpr_cmd_flag_t command=ORTE_GPR_UNSUBSCRIBE_CMD; orte_gpr_cmd_flag_t command=ORTE_GPR_UNSUBSCRIBE_CMD;
orte_gpr_notify_id_t sub_number=0; orte_gpr_notify_id_t sub_number=0;
int rc, ret; int rc;
int32_t ret;
size_t n; size_t n;
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &command, 1, ORTE_GPR_CMD))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &command, 1, ORTE_GPR_CMD))) {
@ -182,7 +184,7 @@ int orte_gpr_replica_recv_unsubscribe_cmd(orte_buffer_t *input_buffer,
} }
RETURN_ERROR: RETURN_ERROR:
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &ret, 1, ORTE_INT))) { if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &ret, 1, ORTE_INT32))) {
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
return rc; return rc;
} }