int inflate_trees_bits(int[] c,  // 19 code lengths
                         int[] bb, // bits tree desired/actual depth
                         int[] tb, // bits tree result
                         int[] hp, // space for trees
                         ZStream z // for messages
                         ){
    int result;
    initWorkArea(19);
    hn[0]=0;
    result = huft_build(c, 0, 19, 19, null, null, tb, bb, hp, hn, v);

    if(result == Z_DATA_ERROR){
      z.msg = "oversubscribed dynamic bit lengths tree";
    }
    else if(result == Z_BUF_ERROR || bb[0] == 0){
      z.msg = "incomplete dynamic bit lengths tree";
      result = Z_DATA_ERROR;
    }
    return result;
  }