[GRASS-dev] v.in.dxf patch

Dear devs,
i noticed a strange behaviour of v.in.dxf while implementing
some new vector tests for the grass-test-suite.

v.in.dxf was not able to import dxf files created with v.out.dxf.
No error message was printed and v.in.dxf automatically removed
the created vector?!

I am not sure if this is a bug, because i have no "real" dxf data to test
this, but i have attached a patch which adds
* a error message before deleting the corrupted vector file
* a small if check -> which allows to import files created with v.out.dxf.

I will submit this patch to CVS in the next week if this is ok for you.

Best regards
Soeren

(attachments)

v.in.dxf_soeren_patch.diff (1010 Bytes)

Hi,

This is a bug and I've fixed it.

Thank you.
Huidae Cho

On Sun, Jul 02, 2006 at 09:16:00PM +0200, Soeren Gebbert wrote:

Dear devs,
i noticed a strange behaviour of v.in.dxf while implementing
some new vector tests for the grass-test-suite.

v.in.dxf was not able to import dxf files created with v.out.dxf.
No error message was printed and v.in.dxf automatically removed
the created vector?!

I am not sure if this is a bug, because i have no "real" dxf data to test
this, but i have attached a patch which adds
* a error message before deleting the corrupted vector file
* a small if check -> which allows to import files created with v.out.dxf.

I will submit this patch to CVS in the next week if this is ok for you.

Best regards
Soeren

Index: dxf_to_vect.c

RCS file: /home/grass/grassrepository/grass6/vector/v.in.dxf/dxf_to_vect.c,v
retrieving revision 1.16
diff -u -u -r1.16 dxf_to_vect.c
--- dxf_to_vect.c 8 Jun 2006 00:48:38 -0000 1.16
+++ dxf_to_vect.c 2 Jul 2006 18:41:13 -0000
@@ -81,6 +81,8 @@
     while ((code = dxf_get_code(dxf)) != 9) {
         if (code == -2) /* EOF */
       return -1;
+ if (code == 0) /* End of the header section */
+ break;
     }
       }

Index: main.c

RCS file: /home/grass/grassrepository/grass6/vector/v.in.dxf/main.c,v
retrieving revision 1.35
diff -u -u -r1.35 main.c
--- main.c 12 Jun 2006 05:42:40 -0000 1.35
+++ main.c 2 Jul 2006 18:41:13 -0000
@@ -179,6 +179,7 @@
       }
   }
   else {
+ G_warning("Something strange happened! The created vector is corrupted and will be deleted.");
       fprintf(stderr, "REMOVE [%s]\n", output);
       Vect_delete(output);
   }

_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev