Branch: Tag:

2003-01-20

2003-01-20 18:01:50 by Martin Nilsson <mani@lysator.liu.se>

strlen -> sizeof

Rev: bin/fake_dynamic_load.pike:1.6
Rev: bin/httpd.pike:1.5
Rev: bin/install.pike:1.109
Rev: bin/mkpeep.pike:1.30
Rev: bin/tarfilter.pike:1.4
Rev: bin/test_pike.pike:1.80
Rev: bin/unbug:1.10
Rev: lib/modules/ADT.pmod/struct.pike:1.11
Rev: lib/modules/Audio.pmod/Format.pmod/module.pmod:1.6
Rev: lib/modules/Calendar.pmod/Events.pmod:1.13
Rev: lib/modules/Calendar.pmod/Time.pmod:1.22
Rev: lib/modules/Calendar.pmod/Timezone.pmod:1.27
Rev: lib/modules/Calendar.pmod/YMD.pmod:1.48
Rev: lib/modules/Calendar.pmod/mkrules.pike:1.7
Rev: lib/modules/Colors.pmod:1.13
Rev: lib/modules/Crypto/_rsa.pike:1.7
Rev: lib/modules/Crypto/des3.pike:1.8
Rev: lib/modules/Crypto/dsa.pike:1.12
Rev: lib/modules/Crypto/hmac.pike:1.9
Rev: lib/modules/Crypto/randomness.pmod:1.24
Rev: lib/modules/Crypto/rsa.pike:1.32
Rev: lib/modules/Filesystem.pmod/System.pike:1.14
Rev: lib/modules/Filesystem.pmod/Tar.pmod:1.19
Rev: lib/modules/GTKSupport.pmod/MenuFactory.pmod:1.8
Rev: lib/modules/Getopt.pmod:1.26
Rev: lib/modules/Languages.pmod/PLIS.pmod:1.15
Rev: lib/modules/Locale.pmod/module.pmod:1.16
Rev: lib/modules/MIME.pmod/module.pmod:1.6
Rev: lib/modules/Parser.pmod/C.pmod:1.38
Rev: lib/modules/Parser.pmod/XML.pmod/DOM.pmod:1.10
Rev: lib/modules/Parser.pmod/XML.pmod/NSTree.pmod:1.7
Rev: lib/modules/Parser.pmod/XML.pmod/Tree.pmod:1.25
Rev: lib/modules/Process.pmod:1.38
Rev: lib/modules/Protocols.pmod/DNS.pmod:1.71
Rev: lib/modules/Protocols.pmod/HTTP.pmod/Query.pike:1.48
Rev: lib/modules/Protocols.pmod/HTTP.pmod/Server.pmod/Request.pike:1.15
Rev: lib/modules/Protocols.pmod/IMAP.pmod/parse_line.pike:1.26
Rev: lib/modules/Protocols.pmod/IMAP.pmod/server.pike:1.15
Rev: lib/modules/Protocols.pmod/IMAP.pmod/types.pmod:1.28
Rev: lib/modules/Protocols.pmod/IRC.pmod/Error.pmod:1.4
Rev: lib/modules/Protocols.pmod/IRC.pmod/Raw.pike:1.7
Rev: lib/modules/Protocols.pmod/Ident.pmod:1.10
Rev: lib/modules/Protocols.pmod/LDAP.pmod/protocol.pike:1.9
Rev: lib/modules/Protocols.pmod/Line.pmod:1.21
Rev: lib/modules/Protocols.pmod/LysKOM.pmod/Helper.pmod:1.7
Rev: lib/modules/Protocols.pmod/LysKOM.pmod/Raw.pike:1.14
Rev: lib/modules/Protocols.pmod/NNTP.pmod:1.11
Rev: lib/modules/Protocols.pmod/TELNET.pmod:1.19
Rev: lib/modules/Protocols.pmod/X.pmod/KeySyms.pmod:1.3
Rev: lib/modules/Protocols.pmod/X.pmod/Requests.pmod:1.32
Rev: lib/modules/Protocols.pmod/X.pmod/Xlib.pmod:1.48
Rev: lib/modules/Protocols.pmod/X.pmod/_Xlib.pmod:1.18
Rev: lib/modules/Remote.pmod/connection.pike:1.25
Rev: lib/modules/SSL.pmod/cipher.pike:1.21
Rev: lib/modules/SSL.pmod/connection.pike:1.24
Rev: lib/modules/SSL.pmod/handshake.pike:1.30
Rev: lib/modules/SSL.pmod/https.pike:1.13
Rev: lib/modules/SSL.pmod/packet.pike:1.12
Rev: lib/modules/SSL.pmod/session.pike:1.21
Rev: lib/modules/SSL.pmod/sslfile.pike:1.51
Rev: lib/modules/SSL.pmod/state.pike:1.15
Rev: lib/modules/Sql.pmod/postgres.pike:1.19
Rev: lib/modules/Standards.pmod/ASN1.pmod/Encode.pmod:1.9
Rev: lib/modules/Standards.pmod/ASN1.pmod/Types.pmod:1.21
Rev: lib/modules/Standards.pmod/EXIF.pmod:1.16
Rev: lib/modules/Standards.pmod/ID3.pmod:1.8
Rev: lib/modules/Standards.pmod/PKCS.pmod/PFX.pmod:1.7
Rev: lib/modules/Standards.pmod/PKCS.pmod/Signature.pmod:1.7
Rev: lib/modules/Stdio.pmod/Readline.pike:1.44
Rev: lib/modules/Stdio.pmod/Terminfo.pmod:1.14
Rev: lib/modules/Stdio.pmod/module.pmod:1.163
Rev: lib/modules/String.pmod/Elite.pmod:1.3
Rev: lib/modules/String.pmod/module.pmod:1.10
Rev: lib/modules/Tools.pmod/AutoDoc.pmod/CExtractor.pmod:1.25
Rev: lib/modules/Tools.pmod/AutoDoc.pmod/DocParser.pmod:1.54
Rev: lib/modules/Tools.pmod/AutoDoc.pmod/MirarDocParser.pike:1.19
Rev: lib/modules/Tools.pmod/AutoDoc.pmod/PikeExtractor.pmod:1.30
Rev: lib/modules/Tools.pmod/AutoDoc.pmod/PikeParser.pike:1.32
Rev: lib/modules/Tools.pmod/AutoDoc.pmod/ProcessXML.pmod:1.51
Rev: lib/modules/Tools.pmod/PEM.pmod:1.9
Rev: lib/modules/Tools.pmod/Shoot.pmod/module.pmod:1.6
Rev: lib/modules/Tools.pmod/Standalone.pmod/assemble_autodoc.pike:1.25
Rev: lib/modules/Tools.pmod/X509.pmod:1.17
Rev: lib/modules/Tools.pmod/_PEM.pmod:1.5
Rev: lib/modules/Tools.pmod/sed.pmod:1.5
Rev: lib/modules/Web.pmod/Crawler.pmod:1.14
Rev: lib/modules/_Image.pmod/Fonts.pmod:1.10
Rev: lib/modules/_Image.pmod/module.pmod:1.32
Rev: lib/modules/_Image_XCF.pmod:1.20
Rev: lib/modules/_Image_XPM.pmod:1.13
Rev: src/modules/Gz/flushtest.pike:1.3
Rev: src/modules/HTTPLoop/test.pike:1.3
Rev: src/modules/HTTPLoop/wwwserver.pike:1.5
Rev: src/modules/_Charset/module.pmod.in:1.28
Rev: src/modules/files/socktest.pike:1.21
Rev: src/post_modules/GTK/new_build_pgtk.pike:1.22
Rev: src/post_modules/GTK/output/doc-pikeref.pike:1.13
Rev: src/post_modules/GTK/output/few.pike:1.2
Rev: src/post_modules/GTK/output/split.pike:1.11
Rev: src/post_modules/Unicode/make_canonicals.pike:1.2
Rev: src/post_modules/Unicode/make_decompose.pike:1.4
Rev: src/post_modules/Unicode/make_wordbits.pike:1.2
Rev: src/post_modules/Unicode/test.pike:1.6

1: - // $Id: DNS.pmod,v 1.70 2002/12/23 18:59:54 grubba Exp $ + // $Id: DNS.pmod,v 1.71 2003/01/20 17:44:00 nilsson Exp $   // Not yet finished -- Fredrik Hubinette      //! Domain Name System
100:   {    string mklabel(string s)    { -  if(strlen(s)>63) +  if(sizeof(s)>63)    error("Too long component in domain name.\n"); -  return sprintf("%c%s",strlen(s),s); +  return sprintf("%c%s",sizeof(s),s);    }       static private string mkname(string|array(string) labels, int pos,
119:    if(pos<0x4000)    comp[n]=pos;    string l = mklabel(labels[0]); -  return l + mkname(labels[1..], pos+strlen(l), comp); +  return l + mkname(labels[1..], pos+sizeof(l), comp);    }    }   
145:    case T_MX:    return sprintf("%2c", entry->preference)+mkname(entry->mx, pos+2, c);    case T_HINFO: -  return sprintf("%1c%s%1c%s", strlen(entry->cpu||""), entry->cpu||"", -  strlen(entry->os||""), entry->os||""); +  return sprintf("%1c%s%1c%s", sizeof(entry->cpu||""), entry->cpu||"", +  sizeof(entry->os||""), entry->os||"");    case T_MINFO:    string rmailbx = mkname(entry->rmailbx, pos, c); -  return rmailbx + mkname(entry->emailbx, pos+strlen(rmailbx), c); +  return rmailbx + mkname(entry->emailbx, pos+sizeof(rmailbx), c);    case T_SRV:    return sprintf("%2c%2c%2c", entry->priority, entry->weight, entry->port) +    mkname(entry->target||"", pos+6, c);
158:    return sprintf("%@1c", (array(int))((entry->a||"0.0.0.0")/".")[0..3]);    case T_SOA:    string mname = mkname(entry->mname, pos, c); -  return mname + mkname(entry->rname, pos+strlen(mname), c) + +  return mname + mkname(entry->rname, pos+sizeof(mname), c) +    sprintf("%4c%4c%4c%4c%4c", entry->serial, entry->refresh,    entry->retry, entry->expire, entry->minimum);    case T_TXT:    return Array.map(stringp(entry->txt)? ({entry->txt}):(entry->txt||({})),    lambda(string t) { -  return sprintf("%1c%s", strlen(t), t); +  return sprintf("%1c%s", sizeof(t), t);    })*"";    default:    return "";
178:    foreach(entries, mapping entry) {    string e = mkname(entry->name, pos, comp)+    sprintf("%2c%2c%4c", entry->type, entry->cl, entry->ttl); -  pos += strlen(e)+2; +  pos += sizeof(e)+2;    string rd = entry->rdata || mkrdata(entry, pos, comp); -  res += e + sprintf("%2c", strlen(rd)) + rd; -  pos += strlen(rd); +  res += e + sprintf("%2c", sizeof(rd)) + rd; +  pos += sizeof(rd);    }    return res;    }
202:    mapping(string:int) c = ([]);    if(qd)    foreach(qd, mapping _qd) -  r += mkname(_qd->name, strlen(r), c) + +  r += mkname(_qd->name, sizeof(r), c) +    sprintf("%2c%2c", _qd->type, _qd->cl);    if(an) -  r+=encode_entries(an, strlen(r), c); +  r+=encode_entries(an, sizeof(r), c);    if(ns) -  r+=encode_entries(ns, strlen(r), c); +  r+=encode_entries(ns, sizeof(r), c);    if(ar) -  r+=encode_entries(ar, strlen(r), c); +  r+=encode_entries(ar, sizeof(r), c);    return r;    }   
301:    array decode_entries(string s,int num, array(int) next)    {    array(string) ret=({}); -  for(int e=0;e<num && next[0]<strlen(s);e++) +  for(int e=0;e<num && next[0]<sizeof(s);e++)    {    mapping m=([]);    m->name=decode_domain(s,next);
402:    m->ad=(m->c2>>5)&1;    m->ra=(m->c2>>7)&1;    -  m->length=strlen(s); +  m->length=sizeof(s);       array(string) tmp=({});    int e;