pike.git / lib / modules / Standards.pmod / BSON.pmod / Binary.pike

version» Context lines:

pike.git/lib/modules/Standards.pmod/BSON.pmod/Binary.pike:1:   #pike __REAL_VERSION__       constant BSONBinary = 1;    -  protected string data; -  protected int subtype = 0x00; +  string data; +  int subtype = 0x00;       // NB: Code duplication from module.pmod to avoid circular dependencies.    private constant BINARY_OLD = 0x02;       //! -  protected void create(string _data, int|void _subtype) +  protected void create(string data, int|void subtype)    { -  subtype = _subtype; +  this::subtype = subtype; +  this::data = data;    if(subtype == BINARY_OLD)    { -  if( !sscanf(_data, "%-4H", data) ) +  if( !sscanf(data, "%-4H", data) )    throw(Error.Generic("old binary data length does not match actual data length.\n"));    } -  else -  data = _data; +     }       int get_subtype()    {    return subtype;    }       void set_subtype(int _subtype)    {    subtype = _subtype;
pike.git/lib/modules/Standards.pmod/BSON.pmod/Binary.pike:38:    else    return sizeof(data);    }       protected mixed cast(string type)    {    if(type == "string")    return data;    return UNDEFINED;    } +  +  protected string _sprintf(int t) +  { +  return t=='O' && sprintf("%O(0x%02x, %O)", this_program, subtype, data); +  }