----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

Hi,
I haven't yet gotten gcc to work as the compiler, but based on the initial
attempts I made to install JServ, I think there might be a bug in jserv_mmap.c.

AIX 4.2 and IRIX 6.5
Apache 1.3.9 with DSO
JServ 1.1b3

The compiler fails in the same places on both platforms.  The particular lines
in jserv_mmap.c are:

void jserv_setalive(jserv_config *cfg, jserv_host *cur) {
        /* we do not override admin commands (state=SHUTDOWN*) */
        return jserv_changestate(cfg, cur, "-", '+');
}

void jserv_setdead(jserv_config *cfg, jserv_host *cur) {
        /* we do not override admin commands (state=SHUTDOWN*) */
        return jserv_changestate(cfg, cur, "+", '-');
}

The compilers complain about these two routines because they are declared void,
but appear to return a value.  It is true that jserv_changestate itself returns
void, so really a void *is* being returned.  Maybe the gcc compiler is smarter
about this.  Splitting these these lines to read:

  jserv_changestate(cfg, cur, "-", '+');
    or
  jserv_changestate(cfg, cur, "+", '-');

  return;

allows them to compile.


The other place the compiler fails is in jserv_getnext:

ShmHost * jserv_getnext_host(ShmHost *shmhost) {
    struct shared_host *host;
    int nbcurr;
    host = (struct shared_host *)_host;
    nbcurr = 0;

    while  (nbcurr < _hdr->nb ) {
        if ((int)shmhost->opaque == nbcurr) {
            strncpy(shmhost->name, host->name, sizeof(shmhost->name)-1);
            shmhost->state =  host->state;
            shmhost->ip = host->hostaddr;
            shmhost->port= host->port;

/**** The line below fails ****/

            (int)shmhost->opaque += 1;
            return shmhost;
        }
        nbcurr++;
        host++;
    }
    return 0;
}

Maybe I need to brush up on my pointers, but I think this may be an error.
opaque is defined as "unsigned char *".  Casting the pointer to an int doesn't
look right.  If I remove the casting, it compiles, but then my question is, are
you trying to increment the pointer (opaque itself) or increment the value
opaque points to?  In the latter case, the pointer should be de-referenced
first.  And since there are no other conflicting types on this line, why does
it need to be cast at all?

I'll shut up now.
Ross

-- 
Ross Druker                                      Rohm and Haas Co.
[EMAIL PROTECTED]                             Spring House, PA
"Forgive me my nonsense as I also forgive the    (215) 619-5475
nonsense of others who think they talk sense." -- Robert Frost
The opinions expressed are mine and not those of Rohm and Haas Company.


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to