Minor tweaks to the pack/unpack routines
This commit was SVN r31954.
Этот коммит содержится в:
родитель
34cb137314
Коммит
ae5eec3e2f
@ -822,8 +822,12 @@ int opal_dss_pack_buffer_contents(opal_buffer_t *buffer, const void *src,
|
||||
return ret;
|
||||
}
|
||||
/* pack the bytes */
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_byte(buffer, ptr[i]->base_ptr, ptr[i]->bytes_used, OPAL_BYTE))) {
|
||||
return ret;
|
||||
if (0 < ptr[i]->bytes_used) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_byte(buffer, ptr[i]->base_ptr, ptr[i]->bytes_used, OPAL_BYTE))) {
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
ptr[i]->base_ptr = NULL;
|
||||
}
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
|
@ -1063,16 +1063,15 @@ int opal_dss_unpack_buffer_contents(opal_buffer_t *buffer, void *dest,
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_sizet(buffer, &nbytes, &m, OPAL_SIZE))) {
|
||||
return ret;
|
||||
}
|
||||
m = nbytes;
|
||||
/* setup the buffer's data region */
|
||||
if (0 < nbytes) {
|
||||
ptr[i]->base_ptr = (char*)malloc(nbytes);
|
||||
/* unpack the bytes */
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_byte(buffer, ptr[i]->base_ptr, &m, OPAL_BYTE))) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
/* unpack the bytes */
|
||||
m=nbytes;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_byte(buffer, ptr[i]->base_ptr, &m, OPAL_BYTE))) {
|
||||
return ret;
|
||||
}
|
||||
/* fill-in the metadata */
|
||||
ptr[i]->pack_ptr = ptr[i]->base_ptr + m;
|
||||
ptr[i]->unpack_ptr = ptr[i]->base_ptr;
|
||||
ptr[i]->bytes_allocated = nbytes;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user