@@ -305,11 +305,11 @@ void octree_read_batch_cpu(int n_paths, char** paths, int n_threads, octree* gri
305
305
// for(int path_idx = 0; path_idx < n_paths; ++path_idx) {
306
306
// printf(" path: '%s'\n", paths[path_idx]);
307
307
// }
308
-
308
+
309
309
// determine necessary memory
310
310
ot_size_t n;
311
- ot_size_t n_leafs[ n_paths] ;
312
- ot_size_t n_blocks[ n_paths] ;
311
+ std::vector< ot_size_t > n_leafs ( n_paths) ;
312
+ std::vector< ot_size_t > n_blocks ( n_paths) ;
313
313
314
314
FILE* fp = fopen (paths[0 ], " rb" );
315
315
int magic_number = -1 ;
@@ -323,7 +323,7 @@ void octree_read_batch_cpu(int n_paths, char** paths, int n_threads, octree* gri
323
323
sfread (&(grid_h->grid_height ), sizeof (ot_size_t ), 1 , fp);
324
324
sfread (&(grid_h->grid_width ), sizeof (ot_size_t ), 1 , fp);
325
325
sfread (&(grid_h->feature_size ), sizeof (ot_size_t ), 1 , fp);
326
- sfread (n_leafs, sizeof (ot_size_t ), 1 , fp);
326
+ sfread (n_leafs. data () , sizeof (ot_size_t ), 1 , fp);
327
327
n_blocks[0 ] = n * grid_h->grid_depth * grid_h->grid_height * grid_h->grid_width ;
328
328
fclose (fp);
329
329
@@ -347,7 +347,7 @@ void octree_read_batch_cpu(int n_paths, char** paths, int n_threads, octree* gri
347
347
sfread (&(tmp_grid_height), sizeof (ot_size_t ), 1 , fp);
348
348
sfread (&(tmp_grid_width), sizeof (ot_size_t ), 1 , fp);
349
349
sfread (&(tmp_feature_size), sizeof (ot_size_t ), 1 , fp);
350
- sfread (n_leafs + path_idx, sizeof (ot_size_t ), 1 , fp);
350
+ sfread (n_leafs. data () + path_idx, sizeof (ot_size_t ), 1 , fp);
351
351
fclose (fp);
352
352
353
353
n += tmp_n;
@@ -419,7 +419,7 @@ void dense_read_prealloc_batch_cpu(int n_paths, char** paths, int n_threads, int
419
419
offset *= dims[dim_idx];
420
420
}
421
421
422
- int dims_single[ n_dim] ;
422
+ std::vector< int > dims_single ( n_dim) ;
423
423
dims_single[0 ] = 1 ;
424
424
for (int dim_idx = 1 ; dim_idx < n_dim; ++dim_idx) {
425
425
dims_single[dim_idx] = dims[dim_idx];
@@ -430,7 +430,7 @@ void dense_read_prealloc_batch_cpu(int n_paths, char** paths, int n_threads, int
430
430
#endif
431
431
#pragma omp parallel for
432
432
for (int path_idx = 0 ; path_idx < n_paths; ++path_idx) {
433
- dense_read_prealloc_cpu (paths[path_idx], n_dim, dims_single, data + path_idx * offset);
433
+ dense_read_prealloc_cpu (paths[path_idx], n_dim, dims_single. data () , data + path_idx * offset);
434
434
}
435
435
}
436
436
0 commit comments