Roxen.git / server / etc / modules / RXML.pmod / utils.pmod

version» Context lines:

Roxen.git/server/etc/modules/RXML.pmod/utils.pmod:1:   //! Things that belong elsewhere but can't lie there for various silly   //! reasons. Everything here is considered internal and not part of   //! the RXML.pmod API.   //!   //! E.g. one reason is to avoid circular references in the parser   //! objects when the callbacks are defined in them.   //!   //! Created 2000-01-21 by Martin Stjernholm   //! - //! $Id: utils.pmod,v 1.33 2006/08/22 12:21:35 mast Exp $ + //! $Id: utils.pmod,v 1.34 2008/09/28 12:10:07 mast Exp $      constant is_RXML_encodable = 1;      #ifdef RXML_ENCODE_DEBUG   string _sprintf() {return "RXML.utils.pmod";}   #endif      constant short_format_length = 40;      final string format_short (mixed val, void|int length)
Roxen.git/server/etc/modules/RXML.pmod/utils.pmod:45:    for (int i = 0; i < sizeof (ind);) {    format_val (ind[i]);    res += ": ";    if (sizeof (res) >= length) throw (0);    format_val (val[ind[i]]);    if (++i < sizeof (ind)) res += ", ";    if (sizeof (res) >= length) throw (0);    }    res += "])";    } -  else { -  if (stringp (val) && sizeof (val) > length - sizeof (res)) { +  else if (stringp (val)) { +  if (sizeof (val) > length - sizeof (res)) {    sscanf (val, "%[ \t\n\r]", string lead);    if (sizeof (lead) > sizeof ("/.../") && sizeof (lead) < sizeof (val))    val = val[sizeof (lead)..], res += "/.../";    if (sizeof (val) > length - sizeof (res)) { -  res += sprintf ("%O", val[..length - sizeof (res) - 1]); +  res += sprintf ("%q", val[..length - sizeof (res) - 1]);    throw (0);    }    } -  res += sprintf ("%O", val); +  res += sprintf ("%q", val);    } -  +  else +  res += sprintf ("%O", val);    };       mixed err = catch {    format_val (val);    return res;    };    if (err) throw (err);    return res + "/.../";   }