Branch: Tag:

2016-10-20

2016-10-20 09:54:18 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Standards.BSON: Fixed circular dependency.

This fixes failures loading the module when it had been partially dumped.

Fixes [Bug 7806].

5:    protected string data;    protected 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)    {    subtype = _subtype; -  if(subtype == .BINARY_OLD) +  if(subtype == BINARY_OLD)    {    if( !sscanf(data, "%-4H", data) )    throw(Error.Generic("old binary data length does not match actual data length.\n"));
30:       protected int _sizeof()    { -  if(subtype == .BINARY_OLD) +  if(subtype == BINARY_OLD)    return sizeof(data) + 4;    else    return sizeof(data);
42:    {    // the docs are a little sketchy about this, do we need to NULL    // terminate? -  if(subtype == .BINARY_OLD) +  if(subtype == BINARY_OLD)    return sprintf("%-4H", data);    else return data;    }    return UNDEFINED;    }