Branch: Tag:

2003-09-01

2003-09-01 16:37:32 by Martin Nilsson <mani@lysator.liu.se>

Don't pretend return is a function.

Rev: lib/modules/Locale.pmod/Language.pmod/rus.pmod:1.2
Rev: lib/modules/Locale.pmod/Language.pmod/slv.pmod:1.2
Rev: lib/modules/Locale.pmod/Language.pmod/swe.pmod:1.2
Rev: lib/modules/Protocols.pmod/IMAP.pmod/requests.pmod:1.92
Rev: lib/modules/Protocols.pmod/IMAP.pmod/types.pmod:1.29
Rev: lib/modules/Protocols.pmod/LDAP.pmod/client.pike:1.50
Rev: lib/modules/Protocols.pmod/LDAP.pmod/protocol.pike:1.10
Rev: lib/modules/Protocols.pmod/SNMP.pmod/getcmd.pike:1.6
Rev: lib/modules/Protocols.pmod/SNMP.pmod/protocol.pike:1.12

2:      // LDAP client protocol implementation for Pike.   // - // $Id: protocol.pike,v 1.9 2003/01/20 17:44:01 nilsson Exp $ + // $Id: protocol.pike,v 1.10 2003/09/01 16:36:47 nilsson Exp $   //   // Honza Petrous, hop@unibase.cz   //
52:       //ldap_rem_errstr = errstr;    ldap_errno = errno; -  return(errno); +  return errno;    }       //!
60:    //!    //! @seealso    //! @[LDAP.protocol.error_string] -  int error_number() { return(ldap_errno); } +  int error_number() { return ldap_errno; }       //!    //! Returns error description of search result.    //!    //! @seealso    //! @[LDAP.protocol.error_number] -  string error_string() { return(ldap_errlist[ldap_errno]); } +  string error_string() { return ldap_errlist[ldap_errno]; }    -  array error() { return(({error_number(), error_string()})); } +  array error() { return ({error_number(), error_string()}); }          static void read_answer() {
85:    seterr (LDAP_TIMEOUT);    DWRITE_HI("protocol.read_anwer: ERROR: connection timeout.\n");    THROW(({"LDAP: connection timeout.\n",backtrace()})); -  //return(-ldap_errno); +  //return -ldap_errno;    return;    }    if (readbuf[0] != '0') {    seterr (LDAP_PROTOCOL_ERROR);    DWRITE_HI("protocol.read_anwer: ERROR: retv=<"+sprintf("%O",readbuf)+">\n");    THROW(({"LDAP: Protocol mismatch.\n",backtrace()})); -  //return(-ldap_errno); +  //return -ldap_errno;    return;    }    DWRITE(sprintf("protocol.read_anwer: sizeof = %d\n", sizeof(readbuf)));
103:    if (msglen == 0x80) { // RFC not allows unexplicitly defined length    seterr (LDAP_PROTOCOL_ERROR);    THROW(({"LDAP: Protocol mismatch.\n",backtrace()})); -  //return(-ldap_errno); +  //return -ldap_errno;    return;    }    ofs = (msglen & 0x7f) + 2;
113:    if (!s || (sizeof(s) < ix)) {    seterr (LDAP_PROTOCOL_ERROR);    THROW(({"LDAP: Protocol mismatch.\n",backtrace()})); -  //return(-ldap_errno); +  //return -ldap_errno;    return;    }    readbuf += s;
129:    if (!s || (sizeof(s) < ix)) {    seterr (LDAP_SERVER_DOWN);    THROW(({"LDAP: connection closed by server.\n",backtrace()})); -  //return(-ldap_errno); +  //return -ldap_errno;    return;    }    readbuf += s;
149:    string shlp;       if (sizeof(readbuf) < 3) -  return(0); // PDU have min. 3 bytes +  return 0; // PDU have min. 3 bytes       if (readbuf[0] != '0') -  return(1); // PDU has bad header -> forced execution +  return 1; // PDU has bad header -> forced execution       msglen = readbuf[1];    if (msglen & 0x80) { // > 0x7f    if (msglen == 0x80) -  return(1); // forced execution +  return 1; // forced execution    ofs = (msglen & 0x7f) + 2;    ix = ofs - sizeof(readbuf);    if(ix > 0) -  return(0); // incomplete PDU +  return 0; // incomplete PDU    msglen = 0;    shlp = reverse(readbuf[2..ofs]);    for (ix=0; ix<sizeof(shlp); ix++) {
170:    }    ix = (ofs + msglen) - sizeof(readbuf);    if(ix > 0) -  return(0); // incomplete PDU +  return 0; // incomplete PDU    -  return(1); +  return 1;    }       void create(object fd) {
208:    if (rv < 2) {    seterr (LDAP_SERVER_DOWN);    THROW(({"LDAP: connection closed by server.\n",backtrace()})); -  return(-ldap_errno); +  return -ldap_errno;    }    DWRITE(sprintf("protocol.do_op: write OK [%d bytes].\n",rv));    msgval = 0; msgid = 0;
220:    read_answer();    // now is all in 'readbuf'    -  return(readbuf); +  return readbuf;       }   
238:    seterr (LDAP_TIMEOUT);    DWRITE_HI("protocol.readmsg: ERROR: connection timeout.\n");    THROW(({"LDAP: connection timeout.\n",backtrace()})); -  return(-ldap_errno); +  return -ldap_errno;    }    if (!retv || (sizeof(retv) != 2) || (retv[0] != '0')) {    seterr (LDAP_PROTOCOL_ERROR);    DWRITE_HI("protocol.readmsg: ERROR: retv=<"+sprintf("%O",retv)+">\n");    THROW(({"LDAP: Protocol mismatch.\n",backtrace()})); -  return(-ldap_errno); +  return -ldap_errno;    }    DWRITE(sprintf("protocol.readmsg: sizeof = %d\n", sizeof(retv)));   
253:    if (msglen == 0x80) { // RFC not allows unexplicitly defined length    seterr (LDAP_PROTOCOL_ERROR);    THROW(({"LDAP: Protocol mismatch.\n",backtrace()})); -  return(-ldap_errno); +  return -ldap_errno;    }    s = ldapfd->read(msglen & 0x7f);    if (!s) {    seterr (LDAP_PROTOCOL_ERROR);    THROW(({"LDAP: Protocol mismatch.\n",backtrace()})); -  return(-ldap_errno); +  return -ldap_errno;    }    retv += s;    msglen = 0; // !!! RESTRICTION: 2^32 !!!
272:    if (!s | (sizeof(s) < msglen)) {    seterr (LDAP_SERVER_DOWN);    THROW(({"LDAP: connection closed by server.\n",backtrace()})); -  return(-ldap_errno); +  return -ldap_errno;    }    retv += s;    DWRITE(sprintf("protocol.readmsg: %s\n", .ldap_privates.ldap_der_decode(retv)->debug_string())); -  return (retv); +  return retv;    }       int writemsg(object msgop) {
304:    if (rv < 2) {    seterr (LDAP_SERVER_DOWN);    THROW(({"LDAP: connection closed by server.\n",backtrace()})); -  return(-ldap_errno); +  return -ldap_errno;    }    DWRITE(sprintf("protocol.writemsg: write OK [%d bytes].\n",rv));    msgval = 0; msgid = 0; -  return (msgnum); +  return msgnum;    }         #endif