[tkined] Bug in tnmMapEvent.c

From: Pete Flugstad (pete_flugstad@icon-labs.com)
Date: Wed Oct 10 2001 - 15:03:38 MET DST


I never got any response, and the CVS tree does not have
a fix, so I'm trying again.

Okay, I built scotty for win32 (host is Windows 2000) and while
it's building, I'm going through and cleaning up some warnings the
VC++ 6.0 compiler spit out. Here's the compiler banner:

   Microsoft (R) 32-bit C/C++ Optimizing Compiler Version
                12.00.8168 for 80x86

I'm working with a snapshot from the scotty CVS tree from 7/13,
but nothing seems to have changed in that tree since then.

I used the binary installer from Scriptics to install Tcl 8.3.2
as D:\Tcl. I included the header files of course.

I've got a couple of warnings so far that I think need to be
addressed. First, it kept complaining about:

    .\..\tnm\generic\tnmInt.h(71) : warning C4273: 'stat' :
            inconsistent dll linkage. dllexport assumed.

This code is:

   EXTERN int
   TnmStat _ANSI_ARGS_((CONST char *path, struct stat *buf));

I believe this is related to the following #if, just above that:

   #if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 8 \
            && TCL_RELEASE_SERIAL > 2
   #define TnmStat TclStat
   #else
   #define TnmStat stat
   #endif

This #if fails, so TnmStat is #def'd to be "stat", which is
causing the warning above.

In looking through the Tcl header files, I find TclStat there, so
I'm guessing the #if should be:

   #if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 3 &&
TCL_RELEASE_SERIAL >= 2

at the very least? (What version was TclStat introduced?)

It also complains about various other minor things: signed/unsigned
comparisons, passing NULL and various other things that are mostly
innocuous. Is it worth your while to send these as well?

But, it did spit out a error about:

   .\..\tnm\generic\tnmMapEvent.c(580) : warning C4700: local variable
'interp'
    used without having been initialized

Sure enough, I look there and:

     Tcl_Interp *interp;

     if (!eventPtr->mapPtr || !eventPtr->mapPtr->interp) {
         return TCL_OK;
     }

     Tcl_Preserve(interp);
     interp = eventPtr->mapPtr->interp;

This has to be a bug. The order of the last two lines
needs to be reversed: interp needs to be assigned to before
it's passed to Tcl_Preserve.

Pete

--
!! This message is brought to you via the `tkined & scotty' mailing list.
!! Please do not reply to this message to unsubscribe. To subscribe or
!! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>.
!! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.



This archive was generated by hypermail 2b29 : Thu Jan 03 2002 - 14:56:27 MET