Mobile (Android) orientations

Alex Tweedly alex at tweedly.net
Fri May 3 18:19:28 EDT 2013


OK, I know it's been a while since I looked seriously at C or C++ code, 
but .....

it looks to me as though this loops through all the lines in the array
when it finds a matching device it sets t_this_device to (presumably) true
if it gets an orientation_map line and t_this_device is true, then it 
uses the orient map

BUT
    it never exits the repeat loop early
  and
    it never resets t_this_device

So doesn't this (wrongly) use every subsequent orientation map ?

or does MCAndroidSetOrientationMap check if the map is already set, and 
do nothing ?
In which case, it's merely inefficient. not actually wrong.

Sigh. Must be time to figure out how to get a full copy of the source 
and revive those old memories.

-- Alex.



On 03/05/2013 22:15, monte at sweattechnologies.com wrote:
>> I'll try and poke around the engine to find this. If it doesn't work the
>> way I said I might submit a pull request to make it do that because it
>> makes sense...
> Here's the relevant code from the engine. As you can see it will match the
> first device line it can to the device then the first subsequent
> orientation_map line will be applied so you can have multiple device lines
> and a single orientation_map line.
>
> for (uint32_t i = 0; i < t_line_count; i++)
> 		{
> 			// check for CRLF line endings
> 			uint32_t t_line_length = MCCStringLength(t_lines[i]);
> 			if (t_line_length > 0 && t_lines[i][t_line_length - 1] == '\r')
> 				t_lines[i][t_line_length - 1] = '\0';
>
> 			if (MCCStringBeginsWith(t_lines[i], "device="))
> 			{
> 				t_this_device = (MCAndroidSignatureMatch(t_lines[i] + 7));
> 			}
> 			else if (t_this_device)
> 			{
> 				if (MCCStringBeginsWith(t_lines[i], "orientation_map="))
> 				{
> 					if
> (MCAndroidSetOrientationMap(s_device_configuration.orientation_map,
> t_lines[i] + 16))
> 						s_device_configuration.have_orientation_map = true;
> 				}
> 			}
> 		}
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list