[ros-dev] [ros-diffs] [jgardou] 54462: [RTL] - explicitly truncate some values, so it doesn't count as an error for compiler/MSVC runtime checker

Timo Kreuzer timo.kreuzer at web.de
Wed Nov 23 23:03:00 UTC 2011


That doesn't make much sense.
Whats the point of the LOWORD() macro, if not truncating it ?
Fix the macro if its broken.


Am 20.11.2011 20:45, schrieb jgardou at svn.reactos.org:
> Author: jgardou
> Date: Sun Nov 20 19:45:06 2011
> New Revision: 54462
>
> URL: http://svn.reactos.org/svn/reactos?rev=54462&view=rev
> Log:
> [RTL]
> - explicitly truncate some values, so it doesn't count as an error for compiler/MSVC runtime checker
>
> Modified:
>      trunk/reactos/lib/rtl/image.c
>
> Modified: trunk/reactos/lib/rtl/image.c
> URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/image.c?rev=54462&r1=54461&r2=54462&view=diff
> ==============================================================================
> --- trunk/reactos/lib/rtl/image.c [iso-8859-1] (original)
> +++ trunk/reactos/lib/rtl/image.c [iso-8859-1] Sun Nov 20 19:45:06 2011
> @@ -369,7 +369,7 @@
>   {
>       SHORT Offset;
>       USHORT Type;
> -    USHORT i;
> +    ULONG i;
>       PUSHORT ShortPtr;
>       PULONG LongPtr;
>       PULONGLONG LongLongPtr;
> @@ -379,7 +379,6 @@
>           Offset = SWAPW(*TypeOffset)&  0xFFF;
>           Type = SWAPW(*TypeOffset)>>  12;
>           ShortPtr = (PUSHORT)(RVA(Address, Offset));
> -
>           /*
>           * Don't relocate within the relocation section itself.
>           * GCC/LD generates sometimes relocation records for the relocation section.
> @@ -398,16 +397,16 @@
>               break;
>
>           case IMAGE_REL_BASED_HIGH:
> -            *ShortPtr = HIWORD(MAKELONG(0, *ShortPtr) + (LONG)Delta);
> +            *ShortPtr = HIWORD(MAKELONG(0, *ShortPtr) + (Delta&  0xFFFFFFFF));
>               break;
>
>           case IMAGE_REL_BASED_LOW:
> -            *ShortPtr = SWAPW(*ShortPtr) + LOWORD(Delta);
> +            *ShortPtr = SWAPW(*ShortPtr) + LOWORD(Delta&  0xFFFF);
>               break;
>
>           case IMAGE_REL_BASED_HIGHLOW:
>               LongPtr = (PULONG)RVA(Address, Offset);
> -            *LongPtr = SWAPD(*LongPtr) + (ULONG)Delta;
> +            *LongPtr = SWAPD(*LongPtr) + (Delta&  0xFFFFFFFF);
>               break;
>
>           case IMAGE_REL_BASED_DIR64:
>
>
>




More information about the Ros-dev mailing list