Hi,

gosmore fails to rebuild a pak file since the introduction of FWRITE
macro definition.  Reason:

fwrite(buf, elemsize, numelems, pak) returns the number of elems written.

fwrite (idx, fsize, 1, pak) will fail, if there is an empty file, in
this case fsize is 0.  fwrite is told to write 1 element of zero size.

FWRITE macro will then exit(1) since fwrite returned that 0 elems were
written - this does not match the intent to write 1 element.


Greetings,
cmuelle8

ps: on my system I also need to disable the setlocale() statement in
gosmore.cpp, else a pak rebuild will only produce garbage.  since this
intends to solve problems parsing nmea only, i suggest to _not_
setlocale() when in rebuild mode..

pps: there is many more stuff, e.g. in the nmea parsing, I'd like to
submit myself ;-)
Index: libgosm.cpp
===================================================================
--- libgosm.cpp (Revision 17900)
+++ libgosm.cpp (Arbeitskopie)
@@ -1545,8 +1553,8 @@
     fflush (groupf[i]);
     unsigned *idx = (unsigned *) mmap (NULL, fsize,
                                       PROT_READ | PROT_WRITE, MAP_SHARED, 
fileno (groupf[i]), 0);
-    qsort (idx, fsize / sizeof (*idx), sizeof (*idx), IdxCmp);
-    FWRITE (idx, fsize, 1, pak);
+    qsort  (idx, fsize / sizeof (*idx), sizeof (*idx), IdxCmp);
+    FWRITE (idx, sizeof (*idx), fsize / sizeof (*idx), pak);
 #if 0
     for (int j = 0; j < fsize / (int) sizeof (*idx); j++) {
       printf ("%.*s\n", strcspn (data + idx[j], "\n"), data + idx[j]);
_______________________________________________
dev mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/dev

Reply via email to