registrar: flat_app_info size was arch dependent.

copy each member of app_info instead.

Change-Id: Ica8d0a195b2dbaaf57d28f2fe2f7efd73c37b2c4
This commit is contained in:
Jérôme Duval 2018-03-17 15:50:39 +01:00
parent 7dba237f7f
commit 27bba9c3fe
3 changed files with 22 additions and 5 deletions

View File

@ -180,9 +180,15 @@ enum {
// a flat app_info -- to be found in B_REG_APP_INFO_TYPE message fields
struct flat_app_info {
app_info info;
thread_id thread;
team_id team;
port_id port;
uint32 flags;
dev_t ref_device;
ino_t ref_directory;
char signature[B_MIME_TYPE_LENGTH];
char ref_name[B_FILE_NAME_LENGTH + 1];
};
} _PACKED;
} // namespace BPrivate

View File

@ -101,8 +101,14 @@ find_message_app_info(BMessage* message, app_info* info)
// unflatten the flat info
if (error == B_OK) {
if (size == sizeof(flat_app_info)) {
memcpy(info, &flatInfo->info, sizeof(app_info));
info->thread = flatInfo->thread;
info->team = flatInfo->team;
info->port = flatInfo->port;
info->flags = flatInfo->flags;
info->ref.device = flatInfo->ref_device;
info->ref.directory = flatInfo->ref_directory;
info->ref.name = NULL;
memcpy(info->signature, flatInfo->signature, B_MIME_TYPE_LENGTH);
if (strlen(flatInfo->ref_name) > 0)
info->ref.set_name(flatInfo->ref_name);
} else

View File

@ -1629,10 +1629,15 @@ TRoster::_AddMessageAppInfo(BMessage* message, const app_info* info)
// An app_info is not completely flat. The entry_ref contains a string
// pointer. Therefore we flatten the info.
flat_app_info flatInfo;
flatInfo.info = *info;
flatInfo.thread = info->thread;
flatInfo.team = info->team;
flatInfo.port = info->port;
flatInfo.flags = info->flags;
flatInfo.ref_device = info->ref.device;
flatInfo.ref_directory = info->ref.directory;
memcpy(flatInfo.signature, info->signature, B_MIME_TYPE_LENGTH);
// set the ref name to NULL and copy it into the flat structure
flatInfo.info.ref.name = NULL;
flatInfo.ref_name[0] = '\0';
if (info->ref.name)
strcpy(flatInfo.ref_name, info->ref.name);