5.6.5   HIncrRL

HIncrRL (see figure 5.39) increases the value of the system parameter 'current_runlength_number' by 50%, not exceeding 2*(width+1)*height, where width and height are the dimensions of the largest image. These dimensions are accessible using get_system with 'width' and 'height' (see the Reference Manuals for details). Note, DEF_RL_LENGTH can also be increased using set_system.

As a consequence the procedures HAllocRL (this page), HAllocRLTmp (this page), and HAllocRLLocal (this page) allocate regions of increased size. Figure 5.41 shows an application of HIncrRL.

Note that HIncrRL is no macro, i.e., it does not check the result state of the underlying procedure using HCkP. Thus, you must call HCkP on HIncrRL yourself as shown in the example.

    Hrlregion   *region;
    Herror      err;
    HCkP(HAllocRLTmp(proc_handle, &region));
    do
    {
      /* Use HPGetURL instead of HGetURL, to perform explicit error handling. */
      err = HPGetURL(proc_handle, 1, region);
      if (err == H_ERR_WRRLN2)
      /* Number of chords too big, increase /*
      {
        HCkP(HFreeUpToTmp(proc_handle, region));
        HCkP(HIncrRL(proc_handle));
        HCkP(HAllocRLTmp(proc_handle, &region));
      }
      else if (err != H_MSG_OK)
      {
        HCkP(HFreeRLTmp(proc_handle, region));
        return err;
      }
    } while (err == H_ERR_WRRLN2);

Figure 5.42: Increasing memory allocated for regions.