NTSTATUS trick for NTTIME?

Volker Lendecke Volker.Lendecke at SerNet.DE
Thu Mar 10 02:30:24 MST 2011


On Thu, Mar 10, 2011 at 02:38:11PM +1100, tridge at samba.org wrote:
> There may be a simpler way to achieve what you want. If we add the
> -Wconversion warning to the developer flags then we will get a warning
> on mixing of time_t and NTTIME, where NTTIME is typedef to a uint64_t.
> 
> I wrote a little test here:
> 
>   http://git.samba.org/?p=tridge/junkcode.git;a=tree;f=nttime;
> 
> and I get these warnings from the test:
> 
>  nttime_test.c:25: warning: conversion to ‘time_t’ from ‘NTTIME’ may change the sign of the result
>  nttime_test.c:27: warning: conversion to ‘NTTIME’ from ‘time_t’ may change the sign of the result
>  nttime_test.c:33: warning: conversion to ‘NTTIME’ from ‘time_t’ may change the sign of the result
>  nttime_test.c:35: warning: conversion to ‘time_t’ from ‘NTTIME’ may change the sign of the result

Compiling with -Wconversion gives tons of warnings in S3. I
doubt that fixing all of them is less effort than using the
struct approach.

> I also think the structure approach may not win us as much as it does
> for NTSTATUS. The NTSTATUS type is mostly used as a return value, but
> NTTIME is often used as a pointer argument. When used as a pointer
> argument, you only get a warning, not a compile error, which means we
> aren't actually better off than we are with -Wconversion. For

Well, except that we get them as additional warnings instead
of having them hidden between hundreds of other warnings. To
be useful in development, I don't think relying on waf magic
in autobuild is good enough. The round-trip time there is
just too high. Doing some waf magic on top of the structure
approach is probably very worthwile too.

With best regards,

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen


More information about the samba-technical mailing list