]> git.ipfire.org Git - thirdparty/pdns.git/blobdiff - pdns/sillyrecords.cc
Merge pull request #7677 from rgacogne/dnsdist-logging-facility
[thirdparty/pdns.git] / pdns / sillyrecords.cc
index d4030ef26559dce0679e662e63a3f06a5d4c4fe9..334e3e19900afefe1c68a366f144c56fc19142d7 100644 (file)
@@ -319,15 +319,16 @@ string LOCRecordContent::getZoneRepresentation(bool noDot) const
 
   double remlat=60.0*(latitude-(int)latitude);
   double remlong=60.0*(longitude-(int)longitude);
-  char ret[80];
-  snprintf(ret,sizeof(ret)-1,"%d %d %2.03f %c %d %d %2.03f %c %.2fm %.2fm %.2fm %.2fm",
-           abs((int)latitude), abs((int) ((latitude-(int)latitude)*60)),
-           fabs((double)((remlat-(int)remlat)*60.0)),
-           latitude>0 ? 'N' : 'S',
-           abs((int)longitude), abs((int) ((longitude-(int)longitude)*60)),
-           fabs((double)((remlong-(int)remlong)*60.0)),
-           longitude>0 ? 'E' : 'W',
-           altitude, size, horizpre, vertpre);
+  static const boost::format fmt("%d %d %2.03f %c %d %d %2.03f %c %.2fm %.2fm %.2fm %.2fm");
+  std::string ret = boost::str(
+    boost::format(fmt)
+    % abs((int)latitude) % abs((int) ((latitude-(int)latitude)*60))
+    % fabs((double)((remlat-(int)remlat)*60.0)) % (latitude>0 ? 'N' : 'S')
+    % abs((int)longitude) % abs((int) ((longitude-(int)longitude)*60))
+    % fabs((double)((remlong-(int)remlong)*60.0)) % (longitude>0 ? 'E' : 'W')
+    % altitude % size
+    % horizpre % vertpre
+    );
 
   return ret;
 }