[GRASS5] r.in.bin error

Markus,

I have discovered a bug in the latest r.in.bin related to the new 3D region. Presumably the bug will show up in any program that does not first initialize the region. The r.in.bin the error is being produced from either G_adjust_Cell_head or G_set_window.

To correct the error I simply added the following to main.c ...

         if (endianTest.testByte[0] == 1) {
                 swapFlag = 1; /*true: little endian */
                 if (swap == 1) swapFlag = 0; /* Swapping enabled */
         } else {
                 swapFlag = 0;
                 if (swap == 1) swapFlag = 1; /* Swapping enabled */
         }

  + /* Get cuurent window */
  + G_get_window(&cellhd);

If you think this is the best way to fix the problem I can go ahead and commit to CVS.

Basicly any program that tries to write or align a window without first initializing it (get_window) runs the risk of the same error.

--
Bob

I have changed G_adjust_Cell_head3 to G_adjust_Cell_head in G_set_window. G_set_window is used only in 2D raster modules.
I think that 3D values must be se only if G_put_window is used.

Radim

Bob Covill wrote:

Markus,

I have discovered a bug in the latest r.in.bin related to the new 3D region. Presumably the bug will show up in any program that does not first initialize the region. The r.in.bin the error is being produced from either G_adjust_Cell_head or G_set_window.

To correct the error I simply added the following to main.c ...

        if (endianTest.testByte[0] == 1) {
                swapFlag = 1; /*true: little endian */
                if (swap == 1) swapFlag = 0; /* Swapping enabled */
        } else {
                swapFlag = 0;
                if (swap == 1) swapFlag = 1; /* Swapping enabled */
        }

+ /* Get cuurent window */
+ G_get_window(&cellhd);

If you think this is the best way to fix the problem I can go ahead and commit to CVS.

Basicly any program that tries to write or align a window without first initializing it (get_window) runs the risk of the same error.