Commit f972d9be authored by ROOL's avatar ROOL 🤖
Browse files

Correct the Wimp message lengths

Detail:
  When message_COLOUR_PICKER_COLOUR_CHOICE or message_COLOUR_PICKER_COLOUR_CHANGED were sent the size of the Wimp message was set based on the model's private state structure size, rather than the extension field size.
  Update the message calculation to use the model's info_size value.
Admin:
  Discovered during Toolbox Unification bounty work.

Version 0.58. Tagged as 'Picker-0_58'
parent 9d9a9752
/* (0.57)
/* (0.58)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 0.57
#define Module_MajorVersion_CMHG 0.58
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 06 Feb 2021
#define Module_Date_CMHG 10 Apr 2021
#define Module_MajorVersion "0.57"
#define Module_Version 57
#define Module_MajorVersion "0.58"
#define Module_Version 58
#define Module_MinorVersion ""
#define Module_Date "06 Feb 2021"
#define Module_Date "10 Apr 2021"
#define Module_ApplicationDate "06-Feb-21"
#define Module_ApplicationDate "10-Apr-21"
#define Module_ComponentName "Picker"
#define Module_FullVersion "0.57"
#define Module_HelpVersion "0.57 (06 Feb 2021)"
#define Module_LibraryVersionInfo "0:57"
#define Module_FullVersion "0.58"
#define Module_HelpVersion "0.58 (10 Apr 2021)"
#define Module_LibraryVersionInfo "0:58"
......@@ -196,6 +196,7 @@ static os_error *Colour_Choice (dialogue_list l)
{ os_error *error = NULL;
colourpicker_message_colour_choice *colour_choice = NULL;
osbool none;
int size = l->model->model->info_size;
tracef ("Colour_Choice\n");
......@@ -204,7 +205,7 @@ static os_error *Colour_Choice (dialogue_list l)
goto finish;
if ((colour_choice = m_ALLOC (colourpicker_SIZEOF_MESSAGE_COLOUR_CHOICE
(l->colour->size/sizeof (int)))) == NULL)
(size/sizeof (int)))) == NULL)
{ error = riscos_error_lookup (os_GLOBAL_NO_MEM, "NoMem");
goto finish;
}
......@@ -212,18 +213,18 @@ static os_error *Colour_Choice (dialogue_list l)
colour_choice->d = (colourpicker_d) l;
colour_choice->flags = none? colourpicker_COLOUR_TRANSPARENT: NONE;
colour_choice->colour = l->colour->colour;
colour_choice->size = l->colour->size;
memcpy (colour_choice->info, l->colour->info, l->colour->size);
colour_choice->size = size;
memcpy (colour_choice->info, l->colour->info, size);
if ((error = task_send_user_message (l->parent->task, 0,
message_COLOUR_PICKER_COLOUR_CHOICE, colour_choice,
colourpicker_SIZEOF_MESSAGE_COLOUR_CHOICE
(l->colour->size/sizeof (int)))) != NULL)
(size/sizeof (int)))) != NULL)
goto finish;
finish:
m_FREE (colour_choice, colourpicker_SIZEOF_MESSAGE_COLOUR_CHOICE
(l->colour->size/sizeof (int)));
(size/sizeof (int)));
return error;
}
/*------------------------------------------------------------------------*/
......@@ -405,6 +406,7 @@ static os_error *Colour_Changed (dialogue_list l, osbool none, osbool dragging)
{ osbool suppress;
os_error *error = NULL;
colourpicker_message_colour_changed *colour_changed = NULL;
int size = l->model->model->info_size;
/*Keep 'None' flag up to date for dialogue_read*/
if (none)
......@@ -441,7 +443,7 @@ static os_error *Colour_Changed (dialogue_list l, osbool none, osbool dragging)
{ tracef ("Sending message_COLOUR_PICKER_COLOUR_CHANGED to task\n");
if ((colour_changed = m_ALLOC
(colourpicker_SIZEOF_MESSAGE_COLOUR_CHANGED
(l->colour->size/sizeof (int)))) == NULL)
(size/sizeof (int)))) == NULL)
{ error = riscos_error_lookup (os_GLOBAL_NO_MEM, "NoMem");
goto finish;
}
......@@ -451,13 +453,13 @@ static os_error *Colour_Changed (dialogue_list l, osbool none, osbool dragging)
(none? colourpicker_COLOUR_TRANSPARENT: NONE) |
(dragging? colourpicker_COLOUR_DRAGGING: NONE);
colour_changed->colour = l->colour->colour;
colour_changed->size = l->colour->size;
memcpy (colour_changed->info, l->colour->info, l->colour->size);
colour_changed->size = size;
memcpy (colour_changed->info, l->colour->info, size);
if ((error = task_send_user_message (l->parent->task, 0,
message_COLOUR_PICKER_COLOUR_CHANGED, colour_changed,
colourpicker_SIZEOF_MESSAGE_COLOUR_CHANGED
(l->colour->size/sizeof (int)))) != NULL)
(size/sizeof (int)))) != NULL)
goto finish;
}
else
......@@ -472,7 +474,7 @@ finish:
if (error != NULL)
tracef ("ERROR: %s (error 0x%X)\n" _ error->errmess _ error->errnum);
m_FREE (colour_changed, colourpicker_SIZEOF_MESSAGE_COLOUR_CHANGED
(l->colour->size/sizeof (int)));
(size/sizeof (int)));
return error;
}
/*------------------------------------------------------------------------*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment