]> git.mxchange.org Git - simgear.git/blobdiff - simgear/bucket/newbucket.cxx
sprintf -> snprintf in bucket code.
[simgear.git] / simgear / bucket / newbucket.cxx
index bb373fed851ca45cc12bbee20155cf0fef25b433..0a2e542c3f706290728ee877a7e2a431a3faba31 100644 (file)
@@ -212,7 +212,7 @@ std::string SGBucket::gen_base_path() const {
        main_lat *= -1;
     }
 
-    sprintf(raw_path, "%c%03d%c%02d/%c%03d%c%02d", 
+    snprintf(raw_path, 256, "%c%03d%c%02d/%c%03d%c%02d", 
            hem, top_lon, pole, top_lat, 
            hem, main_lon, pole, main_lat);
 
@@ -345,4 +345,13 @@ void sgBucketDiff( const SGBucket& b1, const SGBucket& b2, int *dx, int *dy ) {
 #endif
 }
 
+void sgGetBuckets( const SGGeod& min, const SGGeod& max, std::vector<SGBucket>& list ) {
+    double lon, lat, span;
 
+    for (lat = min.getLatitudeDeg(); lat <= max.getLatitudeDeg(); lat += SG_BUCKET_SPAN) {
+        span = sg_bucket_span( lat );
+        for (lon = min.getLongitudeDeg(); lon <= max.getLongitudeDeg(); lon += span) {
+            list.push_back( SGBucket(lon , lat) );
+        }
+    }
+}