[GRASS-SVN] r55628 - grass/branches/releasebranch_6_4/raster/r.random
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Apr 4 13:37:09 PDT 2013
Author: hamish
Date: 2013-04-04 13:37:09 -0700 (Thu, 04 Apr 2013)
New Revision: 55628
Modified:
grass/branches/releasebranch_6_4/raster/r.random/support.c
Log:
don't segfault on long map names (#800), G_command_history() (backport the rest of r48460 from devbr6)
Modified: grass/branches/releasebranch_6_4/raster/r.random/support.c
===================================================================
--- grass/branches/releasebranch_6_4/raster/r.random/support.c 2013-04-04 20:34:09 UTC (rev 55627)
+++ grass/branches/releasebranch_6_4/raster/r.random/support.c 2013-04-04 20:37:09 UTC (rev 55628)
@@ -39,15 +39,17 @@
/* write history for output raster */
if (G_read_history(theState->outraster, G_mapset(), &hist) >= 0) {
G_short_history(theState->outraster, "raster", &hist);
- sprintf(hist.datsrc_1, "Based on map <%s@%s>", inraster, mapset);
+ G_snprintf(hist.datsrc_1, RECORD_LEN, "Based on map <%s@%s>", inraster, mapset);
if (percent)
- sprintf(hist.datsrc_2,
+ G_snprintf(hist.datsrc_2, RECORD_LEN,
"Random points over %.2f percent of the base map <%s>",
percentage, inraster);
else
- sprintf(hist.datsrc_2,
+ G_snprintf(hist.datsrc_2, RECORD_LEN,
"%ld random points on the base map <%s@%s>",
theState->nRand, theState->inraster, theState->mapset);
+
+ G_command_history(&hist);
G_write_history(theState->outraster, &hist);
}
More information about the grass-commit
mailing list