countof macro might be indicated http://msdn.microsoft.com/en-us/library/ms175773%28v=vs.80%29.aspx
On Fri, Mar 16, 2012 at 12:27 PM, Aleksey Bragin <[email protected]> wrote: > On 16.03.2012 17:49, victor martinez wrote: > > Example 4. ReactOS project. Incorrect calculation of a string length ( vbe.c > 57 ) > > static const PCHAR Nv11Board = "NV11 (GeForce2) Board"; > static const PCHAR Nv11Chip = "Chip Rev B2"; > static const PCHAR Nv11Vendor = "NVidia Corporation"; > BOOLEAN > IsVesaBiosOk(...) > { > ... > if (!(strncmp(Vendor, Nv11Vendor, sizeof(Nv11Vendor))) && > !(strncmp(Product, Nv11Board, sizeof(Nv11Board))) && > !(strncmp(Revision, Nv11Chip, sizeof(Nv11Chip))) && > (OemRevision == 0x311)) > ... > } > > Reason: The error here is this: the sizeof() operator, absolutely > inappropriate in this situation, is used to calculate string lengths. The > sizeof() operator actually calculates the pointer size instead of the number > of bytes in a string. > > In this case Abragin said this is not a bug. > > I said it is, but you left IRC too early. Rafal really confirmed by testing. > > [17:31] <@rafalh> abragin, vicmarcal sizeof returns 4 for me > [17:32] <@abragin> then it should be defined as > [17:32] <@rafalh> it would work for l static const CHAR Nv11Board[] > [17:32] <@abragin> static const CHAR Nv11Board[] = "NV11 (GeForce2) Board"; > [17:33] <@abragin> yeah > > > _______________________________________________ > Ros-dev mailing list > [email protected] > http://www.reactos.org/mailman/listinfo/ros-dev _______________________________________________ Ros-dev mailing list [email protected] http://www.reactos.org/mailman/listinfo/ros-dev
