From d920aa4d927b434c2fb0694f1b0850e5d3238585 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 11 Dec 2018 01:56:25 +0100 Subject: [PATCH] Apply fixes by clang-tidy --- .../gps_l1_ca_pcps_opencl_acquisition.cc | 6 +-- .../pcps_opencl_acquisition_cc.cc | 13 ++--- .../pcps_opencl_acquisition_cc.h | 2 +- src/algorithms/libs/CMakeLists.txt | 5 -- src/algorithms/libs/opencl/fft_execute.cc | 40 +++++++-------- .../libs/opencl/fft_kernelstring.cc | 18 +++---- src/algorithms/libs/opencl/fft_setup.cc | 50 +++++++++---------- .../adapters/custom_udp_signal_source.cc | 3 +- .../adapters/osmosdr_signal_source.cc | 7 ++- .../adapters/osmosdr_signal_source.h | 3 +- .../adapters/plutosdr_signal_source.cc | 3 +- .../gr_complex_ip_packet_source.cc | 18 +++---- .../gr_complex_ip_packet_source.h | 8 +-- .../signal_source/libs/ad9361_manager.cc | 18 +++---- .../signal_source/libs/ad9361_manager.h | 18 +++---- .../signal_source/libs/fpga_switch.cc | 2 +- .../signal_source/libs/fpga_switch.h | 2 +- 17 files changed, 105 insertions(+), 111 deletions(-) diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.cc index 69fc037aa..1fd9b109f 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.cc @@ -220,7 +220,7 @@ void GpsL1CaPcpsOpenClAcquisition::set_local_code() { if (item_type_ == "gr_complex") { - std::complex* code = new std::complex[code_length_]; + auto* code = new std::complex[code_length_]; gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); @@ -261,9 +261,9 @@ float GpsL1CaPcpsOpenClAcquisition::calculate_threshold(float pfa) unsigned int ncells = vector_length_ * frequency_bins; double exponent = 1 / static_cast(ncells); double val = pow(1.0 - pfa, exponent); - double lambda = double(vector_length_); + auto lambda = double(vector_length_); boost::math::exponential_distribution mydist(lambda); - float threshold = static_cast(quantile(mydist, val)); + auto threshold = static_cast(quantile(mydist, val)); return threshold; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc index e968cb344..0c891e2eb 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc @@ -61,6 +61,7 @@ #include #include #include +#include using google::LogMessage; @@ -75,7 +76,7 @@ pcps_opencl_acquisition_cc_sptr pcps_make_opencl_acquisition_cc( { return pcps_opencl_acquisition_cc_sptr( new pcps_opencl_acquisition_cc(sampled_ms, max_dwells, doppler_max, fs_in, samples_per_ms, - samples_per_code, bit_transition_flag, dump, dump_filename)); + samples_per_code, bit_transition_flag, dump, std::move(dump_filename))); } @@ -140,7 +141,7 @@ pcps_opencl_acquisition_cc::pcps_opencl_acquisition_cc( // For dumping samples into a file d_dump = dump; - d_dump_filename = dump_filename; + d_dump_filename = std::move(dump_filename); } @@ -193,7 +194,7 @@ pcps_opencl_acquisition_cc::~pcps_opencl_acquisition_cc() } -int pcps_opencl_acquisition_cc::init_opencl_environment(std::string kernel_filename) +int pcps_opencl_acquisition_cc::init_opencl_environment(const std::string &kernel_filename) { //get all platforms (drivers) std::vector all_platforms; @@ -359,7 +360,7 @@ void pcps_opencl_acquisition_cc::set_local_code(std::complex *code) clFFT_ExecuteInterleaved((*d_cl_queue)(), d_cl_fft_plan, d_cl_fft_batch_size, clFFT_Forward, (*d_cl_buffer_2)(), (*d_cl_buffer_2)(), - 0, NULL, NULL); + 0, nullptr, nullptr); //Conjucate the local code cl::Kernel kernel = cl::Kernel(d_cl_program, "conj_vector"); @@ -562,7 +563,7 @@ void pcps_opencl_acquisition_cc::acquisition_core_opencl() clFFT_ExecuteInterleaved((*d_cl_queue)(), d_cl_fft_plan, d_cl_fft_batch_size, clFFT_Forward, (*d_cl_buffer_1)(), (*d_cl_buffer_2)(), - 0, NULL, NULL); + 0, nullptr, nullptr); // Multiply carrier wiped--off, Fourier transformed incoming signal // with the local FFT'd code reference @@ -576,7 +577,7 @@ void pcps_opencl_acquisition_cc::acquisition_core_opencl() // compute the inverse FFT clFFT_ExecuteInterleaved((*d_cl_queue)(), d_cl_fft_plan, d_cl_fft_batch_size, clFFT_Inverse, (*d_cl_buffer_2)(), (*d_cl_buffer_2)(), - 0, NULL, NULL); + 0, nullptr, nullptr); // Compute magnitude kernel = cl::Kernel(d_cl_program, "magnitude_squared"); diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.h index 3b2d2a277..cbb14b32e 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.h @@ -105,7 +105,7 @@ private: void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift, int doppler_offset); - int init_opencl_environment(std::string kernel_filename); + int init_opencl_environment(const std::string& kernel_filename); long d_fs_in; int d_samples_per_ms; diff --git a/src/algorithms/libs/CMakeLists.txt b/src/algorithms/libs/CMakeLists.txt index 9ef2da55c..0907ba030 100644 --- a/src/algorithms/libs/CMakeLists.txt +++ b/src/algorithms/libs/CMakeLists.txt @@ -86,11 +86,6 @@ if(OPENCL_FOUND) opencl/fft_setup.cc # Needs OpenCL opencl/fft_kernelstring.cc # Needs OpenCL ) - set(GNSS_SPLIBS_HEADERS ${GNSS_SPLIBS_HEADERS} - opencl/fft_execute.h # Needs OpenCL - opencl/fft_setup.h # Needs OpenCL - opencl/fft_kernelstring.h # Needs OpenCL - ) endif() include_directories( diff --git a/src/algorithms/libs/opencl/fft_execute.cc b/src/algorithms/libs/opencl/fft_execute.cc index 21688500a..23b2d1c83 100644 --- a/src/algorithms/libs/opencl/fft_execute.cc +++ b/src/algorithms/libs/opencl/fft_execute.cc @@ -48,9 +48,9 @@ #include "clFFT.h" #include "fft_internal.h" -#include -#include -#include +#include +#include +#include #define max(a, b) (((a) > (b)) ? (a) : (b)) #define min(a, b) (((a) < (b)) ? (a) : (b)) @@ -67,7 +67,7 @@ allocateTemporaryBufferInterleaved(cl_fft_plan *plan, cl_uint batchSize) if (plan->tempmemobj) clReleaseMemObject(plan->tempmemobj); - plan->tempmemobj = clCreateBuffer(plan->context, CL_MEM_READ_WRITE, tmpLength, NULL, &err); + plan->tempmemobj = clCreateBuffer(plan->context, CL_MEM_READ_WRITE, tmpLength, nullptr, &err); } return err; } @@ -88,8 +88,8 @@ allocateTemporaryBufferPlannar(cl_fft_plan *plan, cl_uint batchSize) if (plan->tempmemobj_imag) clReleaseMemObject(plan->tempmemobj_imag); - plan->tempmemobj_real = clCreateBuffer(plan->context, CL_MEM_READ_WRITE, tmpLength, NULL, &err); - plan->tempmemobj_imag = clCreateBuffer(plan->context, CL_MEM_READ_WRITE, tmpLength, NULL, &terr); + plan->tempmemobj_real = clCreateBuffer(plan->context, CL_MEM_READ_WRITE, tmpLength, nullptr, &err); + plan->tempmemobj_imag = clCreateBuffer(plan->context, CL_MEM_READ_WRITE, tmpLength, nullptr, &terr); err |= terr; } return err; @@ -126,7 +126,7 @@ clFFT_ExecuteInterleaved(cl_command_queue queue, clFFT_Plan Plan, cl_int batchSi cl_int num_events, cl_event *event_list, cl_event *event) { int s; - cl_fft_plan *plan = (cl_fft_plan *)Plan; + auto *plan = (cl_fft_plan *)Plan; if (plan->format != clFFT_InterleavedComplexFormat) return CL_INVALID_VALUE; @@ -180,7 +180,7 @@ clFFT_ExecuteInterleaved(cl_command_queue queue, clFFT_Plan Plan, cl_int batchSi err |= clSetKernelArg(kernelInfo->kernel, 2, sizeof(cl_int), &dir); err |= clSetKernelArg(kernelInfo->kernel, 3, sizeof(cl_int), &s); - err |= clEnqueueNDRangeKernel(queue, kernelInfo->kernel, 1, NULL, &gWorkItems, &lWorkItems, 0, NULL, NULL); + err |= clEnqueueNDRangeKernel(queue, kernelInfo->kernel, 1, nullptr, &gWorkItems, &lWorkItems, 0, nullptr, nullptr); if (err) return err; @@ -203,7 +203,7 @@ clFFT_ExecuteInterleaved(cl_command_queue queue, clFFT_Plan Plan, cl_int batchSi err |= clSetKernelArg(kernelInfo->kernel, 2, sizeof(cl_int), &dir); err |= clSetKernelArg(kernelInfo->kernel, 3, sizeof(cl_int), &s); - err |= clEnqueueNDRangeKernel(queue, kernelInfo->kernel, 1, NULL, &gWorkItems, &lWorkItems, 0, NULL, NULL); + err |= clEnqueueNDRangeKernel(queue, kernelInfo->kernel, 1, nullptr, &gWorkItems, &lWorkItems, 0, nullptr, nullptr); if (err) return err; @@ -223,7 +223,7 @@ clFFT_ExecutePlannar(cl_command_queue queue, clFFT_Plan Plan, cl_int batchSize, cl_int num_events, cl_event *event_list, cl_event *event) { int s; - cl_fft_plan *plan = (cl_fft_plan *)Plan; + auto *plan = (cl_fft_plan *)Plan; if (plan->format != clFFT_SplitComplexFormat) return CL_INVALID_VALUE; @@ -285,7 +285,7 @@ clFFT_ExecutePlannar(cl_command_queue queue, clFFT_Plan Plan, cl_int batchSize, err |= clSetKernelArg(kernelInfo->kernel, 4, sizeof(cl_int), &dir); err |= clSetKernelArg(kernelInfo->kernel, 5, sizeof(cl_int), &s); - err |= clEnqueueNDRangeKernel(queue, kernelInfo->kernel, 1, NULL, &gWorkItems, &lWorkItems, 0, NULL, NULL); + err |= clEnqueueNDRangeKernel(queue, kernelInfo->kernel, 1, nullptr, &gWorkItems, &lWorkItems, 0, nullptr, nullptr); if (err) return err; @@ -309,7 +309,7 @@ clFFT_ExecutePlannar(cl_command_queue queue, clFFT_Plan Plan, cl_int batchSize, err |= clSetKernelArg(kernelInfo->kernel, 4, sizeof(cl_int), &dir); err |= clSetKernelArg(kernelInfo->kernel, 5, sizeof(cl_int), &s); - err |= clEnqueueNDRangeKernel(queue, kernelInfo->kernel, 1, NULL, &gWorkItems, &lWorkItems, 0, NULL, NULL); + err |= clEnqueueNDRangeKernel(queue, kernelInfo->kernel, 1, nullptr, &gWorkItems, &lWorkItems, 0, nullptr, nullptr); if (err) return err; @@ -327,7 +327,7 @@ cl_int clFFT_1DTwistInterleaved(clFFT_Plan Plan, cl_command_queue queue, cl_mem array, unsigned numRows, unsigned numCols, unsigned startRow, unsigned rowsToProcess, clFFT_Direction dir) { - cl_fft_plan *plan = (cl_fft_plan *)Plan; + auto *plan = (cl_fft_plan *)Plan; unsigned int N = numRows * numCols; unsigned int nCols = numCols; @@ -337,12 +337,12 @@ clFFT_1DTwistInterleaved(clFFT_Plan Plan, cl_command_queue queue, cl_mem array, int err = 0; cl_device_id device_id; - err = clGetCommandQueueInfo(queue, CL_QUEUE_DEVICE, sizeof(cl_device_id), &device_id, NULL); + err = clGetCommandQueueInfo(queue, CL_QUEUE_DEVICE, sizeof(cl_device_id), &device_id, nullptr); if (err) return err; size_t gSize; - err = clGetKernelWorkGroupInfo(plan->twist_kernel, device_id, CL_KERNEL_WORK_GROUP_SIZE, sizeof(size_t), &gSize, NULL); + err = clGetKernelWorkGroupInfo(plan->twist_kernel, device_id, CL_KERNEL_WORK_GROUP_SIZE, sizeof(size_t), &gSize, nullptr); if (err) return err; @@ -357,7 +357,7 @@ clFFT_1DTwistInterleaved(clFFT_Plan Plan, cl_command_queue queue, cl_mem array, err |= clSetKernelArg(plan->twist_kernel, 4, sizeof(unsigned int), &rToProcess); err |= clSetKernelArg(plan->twist_kernel, 5, sizeof(int), &d); - err |= clEnqueueNDRangeKernel(queue, plan->twist_kernel, 1, NULL, numGlobalThreads, numLocalThreads, 0, NULL, NULL); + err |= clEnqueueNDRangeKernel(queue, plan->twist_kernel, 1, nullptr, numGlobalThreads, numLocalThreads, 0, nullptr, nullptr); return err; } @@ -366,7 +366,7 @@ cl_int clFFT_1DTwistPlannar(clFFT_Plan Plan, cl_command_queue queue, cl_mem array_real, cl_mem array_imag, unsigned numRows, unsigned numCols, unsigned startRow, unsigned rowsToProcess, clFFT_Direction dir) { - cl_fft_plan *plan = (cl_fft_plan *)Plan; + auto *plan = (cl_fft_plan *)Plan; unsigned int N = numRows * numCols; unsigned int nCols = numCols; @@ -376,12 +376,12 @@ clFFT_1DTwistPlannar(clFFT_Plan Plan, cl_command_queue queue, cl_mem array_real, int err = 0; cl_device_id device_id; - err = clGetCommandQueueInfo(queue, CL_QUEUE_DEVICE, sizeof(cl_device_id), &device_id, NULL); + err = clGetCommandQueueInfo(queue, CL_QUEUE_DEVICE, sizeof(cl_device_id), &device_id, nullptr); if (err) return err; size_t gSize; - err = clGetKernelWorkGroupInfo(plan->twist_kernel, device_id, CL_KERNEL_WORK_GROUP_SIZE, sizeof(size_t), &gSize, NULL); + err = clGetKernelWorkGroupInfo(plan->twist_kernel, device_id, CL_KERNEL_WORK_GROUP_SIZE, sizeof(size_t), &gSize, nullptr); if (err) return err; @@ -397,7 +397,7 @@ clFFT_1DTwistPlannar(clFFT_Plan Plan, cl_command_queue queue, cl_mem array_real, err |= clSetKernelArg(plan->twist_kernel, 5, sizeof(unsigned int), &rToProcess); err |= clSetKernelArg(plan->twist_kernel, 6, sizeof(int), &d); - err |= clEnqueueNDRangeKernel(queue, plan->twist_kernel, 1, NULL, numGlobalThreads, numLocalThreads, 0, NULL, NULL); + err |= clEnqueueNDRangeKernel(queue, plan->twist_kernel, 1, nullptr, numGlobalThreads, numLocalThreads, 0, nullptr, nullptr); return err; } diff --git a/src/algorithms/libs/opencl/fft_kernelstring.cc b/src/algorithms/libs/opencl/fft_kernelstring.cc index 8fec4f112..33b3109e8 100644 --- a/src/algorithms/libs/opencl/fft_kernelstring.cc +++ b/src/algorithms/libs/opencl/fft_kernelstring.cc @@ -48,13 +48,13 @@ #include "clFFT.h" #include "fft_internal.h" -#include +#include +#include +#include +#include +#include #include -#include #include -#include -#include -#include #include using namespace std; @@ -806,13 +806,13 @@ createLocalMemfftKernelString(cl_fft_plan *plan) kernelName = string("fft") + num2str(kCount); *kInfo = (cl_fft_kernel_info *)malloc(sizeof(cl_fft_kernel_info)); - (*kInfo)->kernel = 0; + (*kInfo)->kernel = nullptr; (*kInfo)->lmem_size = 0; (*kInfo)->num_workgroups = 0; (*kInfo)->num_workitems_per_workgroup = 0; (*kInfo)->dir = cl_fft_kernel_x; (*kInfo)->in_place_possible = 1; - (*kInfo)->next = NULL; + (*kInfo)->next = nullptr; (*kInfo)->kernel_name = (char *)malloc(sizeof(char) * (kernelName.size() + 1)); strcpy((*kInfo)->kernel_name, kernelName.c_str()); @@ -1015,7 +1015,7 @@ createGlobalFFTKernelString(cl_fft_plan *plan, int n, int BS, cl_fft_kernel_dir kernelName = string("fft") + num2str(kCount); *kInfo = (cl_fft_kernel_info *)malloc(sizeof(cl_fft_kernel_info)); - (*kInfo)->kernel = 0; + (*kInfo)->kernel = nullptr; if (R2 == 1) (*kInfo)->lmem_size = 0; else @@ -1033,7 +1033,7 @@ createGlobalFFTKernelString(cl_fft_plan *plan, int n, int BS, cl_fft_kernel_dir (*kInfo)->in_place_possible = 1; else (*kInfo)->in_place_possible = 0; - (*kInfo)->next = NULL; + (*kInfo)->next = nullptr; (*kInfo)->kernel_name = (char *)malloc(sizeof(char) * (kernelName.size() + 1)); strcpy((*kInfo)->kernel_name, kernelName.c_str()); diff --git a/src/algorithms/libs/opencl/fft_setup.cc b/src/algorithms/libs/opencl/fft_setup.cc index 9a4132b57..a56c05328 100644 --- a/src/algorithms/libs/opencl/fft_setup.cc +++ b/src/algorithms/libs/opencl/fft_setup.cc @@ -48,11 +48,11 @@ #include "fft_base_kernels.h" #include "fft_internal.h" +#include +#include #include #include #include -#include -#include #include #include #include @@ -128,37 +128,37 @@ destroy_plan(cl_fft_plan *Plan) kernel_info = tmp; } - Plan->kernel_info = NULL; + Plan->kernel_info = nullptr; if (Plan->kernel_string) { delete Plan->kernel_string; - Plan->kernel_string = NULL; + Plan->kernel_string = nullptr; } if (Plan->twist_kernel) { clReleaseKernel(Plan->twist_kernel); - Plan->twist_kernel = NULL; + Plan->twist_kernel = nullptr; } if (Plan->program) { clReleaseProgram(Plan->program); - Plan->program = NULL; + Plan->program = nullptr; } if (Plan->tempmemobj) { clReleaseMemObject(Plan->tempmemobj); - Plan->tempmemobj = NULL; + Plan->tempmemobj = nullptr; } if (Plan->tempmemobj_real) { clReleaseMemObject(Plan->tempmemobj_real); - Plan->tempmemobj_real = NULL; + Plan->tempmemobj_real = nullptr; } if (Plan->tempmemobj_imag) { clReleaseMemObject(Plan->tempmemobj_imag); - Plan->tempmemobj_imag = NULL; + Plan->tempmemobj_imag = nullptr; } } @@ -201,7 +201,7 @@ int getMaxKernelWorkGroupSize(cl_fft_plan *plan, unsigned int *max_wg_size, unsi cl_fft_kernel_info *kInfo = plan->kernel_info; while (kInfo) { - err = clGetKernelWorkGroupInfo(kInfo->kernel, devices[i], CL_KERNEL_WORK_GROUP_SIZE, sizeof(size_t), &wg_size, NULL); + err = clGetKernelWorkGroupInfo(kInfo->kernel, devices[i], CL_KERNEL_WORK_GROUP_SIZE, sizeof(size_t), &wg_size, nullptr); if (err != CL_SUCCESS) return -1; @@ -235,7 +235,7 @@ clFFT_CreatePlan(cl_context context, clFFT_Dim3 n, clFFT_Dimension dim, clFFT_Da int i; cl_int err; int isPow2 = 1; - cl_fft_plan *plan = NULL; + cl_fft_plan *plan = nullptr; ostringstream kString; int num_devices; int gpu_found = 0; @@ -265,15 +265,15 @@ clFFT_CreatePlan(cl_context context, clFFT_Dim3 n, clFFT_Dimension dim, clFFT_Da plan->n = n; plan->dim = dim; plan->format = dataFormat; - plan->kernel_info = 0; + plan->kernel_info = nullptr; plan->num_kernels = 0; - plan->twist_kernel = 0; - plan->program = 0; + plan->twist_kernel = nullptr; + plan->program = nullptr; plan->temp_buffer_needed = 0; plan->last_batch_size = 0; - plan->tempmemobj = 0; - plan->tempmemobj_real = 0; - plan->tempmemobj_imag = 0; + plan->tempmemobj = nullptr; + plan->tempmemobj_real = nullptr; + plan->tempmemobj_imag = nullptr; plan->max_localmem_fft_size = 2048; plan->max_work_item_per_workgroup = 256; plan->max_radix = 16; @@ -289,7 +289,7 @@ patch_kernel_source: getBlockConfigAndKernelString(plan); const char *source_str = plan->kernel_string->c_str(); - plan->program = clCreateProgramWithSource(context, 1, (const char **)&source_str, NULL, &err); + plan->program = clCreateProgramWithSource(context, 1, (const char **)&source_str, nullptr, &err); ERR_MACRO(err); err = clGetContextInfo(context, CL_CONTEXT_DEVICES, sizeof(devices), devices, &ret_size); @@ -299,28 +299,28 @@ patch_kernel_source: for (i = 0; i < num_devices; i++) { - err = clGetDeviceInfo(devices[i], CL_DEVICE_TYPE, sizeof(device_type), &device_type, NULL); + err = clGetDeviceInfo(devices[i], CL_DEVICE_TYPE, sizeof(device_type), &device_type, nullptr); ERR_MACRO(err); if (device_type == CL_DEVICE_TYPE_GPU) { gpu_found = 1; - err = clBuildProgram(plan->program, 1, &devices[i], "-cl-mad-enable", NULL, NULL); + err = clBuildProgram(plan->program, 1, &devices[i], "-cl-mad-enable", nullptr, nullptr); if (err != CL_SUCCESS) { char *build_log; char devicename[200]; size_t log_size; - err = clGetProgramBuildInfo(plan->program, devices[i], CL_PROGRAM_BUILD_LOG, 0, NULL, &log_size); + err = clGetProgramBuildInfo(plan->program, devices[i], CL_PROGRAM_BUILD_LOG, 0, nullptr, &log_size); ERR_MACRO(err); build_log = (char *)malloc(log_size + 1); - err = clGetProgramBuildInfo(plan->program, devices[i], CL_PROGRAM_BUILD_LOG, log_size, build_log, NULL); + err = clGetProgramBuildInfo(plan->program, devices[i], CL_PROGRAM_BUILD_LOG, log_size, build_log, nullptr); ERR_MACRO(err); - err = clGetDeviceInfo(devices[i], CL_DEVICE_NAME, sizeof(devicename), devicename, NULL); + err = clGetDeviceInfo(devices[i], CL_DEVICE_NAME, sizeof(devicename), devicename, nullptr); ERR_MACRO(err); fprintf(stdout, "FFT program build log on device %s\n", devicename); @@ -370,7 +370,7 @@ patch_kernel_source: void clFFT_DestroyPlan(clFFT_Plan plan) { - cl_fft_plan *Plan = (cl_fft_plan *)plan; + auto *Plan = (cl_fft_plan *)plan; if (Plan) { destroy_plan(Plan); @@ -388,7 +388,7 @@ void clFFT_DumpPlan(clFFT_Plan Plan, FILE *file) else out = file; - cl_fft_plan *plan = (cl_fft_plan *)Plan; + auto *plan = (cl_fft_plan *)Plan; cl_fft_kernel_info *kInfo = plan->kernel_info; while (kInfo) diff --git a/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc index c94859709..2f2e76ef3 100644 --- a/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc @@ -113,8 +113,7 @@ CustomUDPSignalSource::CustomUDPSignalSource(ConfigurationInterface* configurati } -CustomUDPSignalSource::~CustomUDPSignalSource() -= default; +CustomUDPSignalSource::~CustomUDPSignalSource() = default; void CustomUDPSignalSource::connect(gr::top_block_sptr top_block) diff --git a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc index 1aab48cff..80f52a290 100644 --- a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc @@ -69,7 +69,7 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration, if (item_type_ == "short") { - item_size_ = sizeof(short); + item_size_ = sizeof(int16_t); } else if (item_type_ == "gr_complex") { @@ -131,7 +131,7 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration, else { LOG(WARNING) << item_type_ << " unrecognized item type. Using short."; - item_size_ = sizeof(short); + item_size_ = sizeof(int16_t); } if (samples_ != 0) @@ -158,8 +158,7 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration, } -OsmosdrSignalSource::~OsmosdrSignalSource() -= default; +OsmosdrSignalSource::~OsmosdrSignalSource() = default; void OsmosdrSignalSource::driver_instance() diff --git a/src/algorithms/signal_source/adapters/osmosdr_signal_source.h b/src/algorithms/signal_source/adapters/osmosdr_signal_source.h index 7a820f8fd..15f38b2a3 100644 --- a/src/algorithms/signal_source/adapters/osmosdr_signal_source.h +++ b/src/algorithms/signal_source/adapters/osmosdr_signal_source.h @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -98,7 +99,7 @@ private: std::string item_type_; size_t item_size_; - long samples_; + int64_t samples_; bool dump_; std::string dump_filename_; diff --git a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc index 6465b72bd..5c4c71dd9 100644 --- a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc @@ -106,8 +106,7 @@ PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration } -PlutosdrSignalSource::~PlutosdrSignalSource() -= default; +PlutosdrSignalSource::~PlutosdrSignalSource() = default; void PlutosdrSignalSource::connect(gr::top_block_sptr top_block) diff --git a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc index c741dc19a..ba6a8ec3e 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc @@ -32,9 +32,9 @@ #include "gr_complex_ip_packet_source.h" #include +#include #include - const int FIFO_SIZE = 1472000; @@ -77,11 +77,11 @@ typedef struct gr_udp_header gr_complex_ip_packet_source::sptr gr_complex_ip_packet_source::make(std::string src_device, - const std::string& origin_address, + const std::string &origin_address, int udp_port, int udp_packet_size, int n_baseband_channels, - const std::string& wire_sample_type, + const std::string &wire_sample_type, size_t item_size, bool IQ_swap_) { @@ -100,11 +100,11 @@ gr_complex_ip_packet_source::make(std::string src_device, * The private constructor */ gr_complex_ip_packet_source::gr_complex_ip_packet_source(std::string src_device, - __attribute__((unused)) const std::string& origin_address, + __attribute__((unused)) const std::string &origin_address, int udp_port, int udp_packet_size, int n_baseband_channels, - const std::string& wire_sample_type, + const std::string &wire_sample_type, size_t item_size, bool IQ_swap_) : gr::sync_block("gr_complex_ip_packet_source", @@ -328,7 +328,7 @@ void gr_complex_ip_packet_source::demux_samples(gr_vector_void_star output_items switch (d_wire_sample_type) { case 1: // interleaved byte samples - for (auto & output_item : output_items) + for (auto &output_item : output_items) { real = fifo_buff[fifo_read_ptr++]; imag = fifo_buff[fifo_read_ptr++]; @@ -343,7 +343,7 @@ void gr_complex_ip_packet_source::demux_samples(gr_vector_void_star output_items } break; case 2: // 4-bit samples - for (auto & output_item : output_items) + for (auto &output_item : output_items) { tmp_char2 = fifo_buff[fifo_read_ptr] & 0x0F; if (tmp_char2 >= 8) @@ -391,7 +391,7 @@ int gr_complex_ip_packet_source::work(int noutput_items, boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function if (fifo_items == 0) return 0; - if (output_items.size() > static_cast(d_n_baseband_channels)) + if (output_items.size() > static_cast(d_n_baseband_channels)) { std::cout << "Configuration error: more baseband channels connected than the available in the UDP source\n"; exit(0); @@ -440,7 +440,7 @@ int gr_complex_ip_packet_source::work(int noutput_items, // update fifo items fifo_items = fifo_items - bytes_requested; - for (long unsigned int n = 0; n < output_items.size(); n++) + for (uint64_t n = 0; n < output_items.size(); n++) { produce(static_cast(n), num_samples_readed); } diff --git a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h index 2417534f7..d008e1314 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h +++ b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h @@ -84,19 +84,19 @@ private: public: typedef boost::shared_ptr sptr; static sptr make(std::string src_device, - const std::string& origin_address, + const std::string &origin_address, int udp_port, int udp_packet_size, int n_baseband_channels, - const std::string& wire_sample_type, + const std::string &wire_sample_type, size_t item_size, bool IQ_swap_); gr_complex_ip_packet_source(std::string src_device, - const std::string& origin_address, + const std::string &origin_address, int udp_port, int udp_packet_size, int n_baseband_channels, - const std::string& wire_sample_type, + const std::string &wire_sample_type, size_t item_size, bool IQ_swap_); ~gr_complex_ip_packet_source(); diff --git a/src/algorithms/signal_source/libs/ad9361_manager.cc b/src/algorithms/signal_source/libs/ad9361_manager.cc index e4d4b6db0..c1786ec08 100644 --- a/src/algorithms/signal_source/libs/ad9361_manager.cc +++ b/src/algorithms/signal_source/libs/ad9361_manager.cc @@ -179,9 +179,9 @@ bool cfg_ad9361_streaming_ch(struct iio_context *ctx, struct stream_cfg *cfg, en bool config_ad9361_rx_local(uint64_t bandwidth_, uint64_t sample_rate_, uint64_t freq_, - const std::string& rf_port_select_, - const std::string& gain_mode_rx1_, - const std::string& gain_mode_rx2_, + const std::string &rf_port_select_, + const std::string &gain_mode_rx1_, + const std::string &gain_mode_rx2_, double rf_gain_rx1_, double rf_gain_rx2_) @@ -291,13 +291,13 @@ bool config_ad9361_rx_local(uint64_t bandwidth_, } -bool config_ad9361_rx_remote(const std::string& remote_host, +bool config_ad9361_rx_remote(const std::string &remote_host, uint64_t bandwidth_, uint64_t sample_rate_, uint64_t freq_, - const std::string& rf_port_select_, - const std::string& gain_mode_rx1_, - const std::string& gain_mode_rx2_, + const std::string &rf_port_select_, + const std::string &gain_mode_rx1_, + const std::string &gain_mode_rx2_, double rf_gain_rx1_, double rf_gain_rx2_) { @@ -543,7 +543,7 @@ bool config_ad9361_lo_local(uint64_t bandwidth_, } -bool config_ad9361_lo_remote(const std::string& remote_host, +bool config_ad9361_lo_remote(const std::string &remote_host, uint64_t bandwidth_, uint64_t sample_rate_, uint64_t freq_rf_tx_hz_, @@ -680,7 +680,7 @@ bool config_ad9361_lo_remote(const std::string& remote_host, } -bool ad9361_disable_lo_remote(const std::string& remote_host) +bool ad9361_disable_lo_remote(const std::string &remote_host) { std::cout << "AD9361 Acquiring IIO REMOTE context in host " << remote_host << std::endl; struct iio_context *ctx; diff --git a/src/algorithms/signal_source/libs/ad9361_manager.h b/src/algorithms/signal_source/libs/ad9361_manager.h index ca34f375d..af4390ddb 100644 --- a/src/algorithms/signal_source/libs/ad9361_manager.h +++ b/src/algorithms/signal_source/libs/ad9361_manager.h @@ -92,19 +92,19 @@ bool cfg_ad9361_streaming_ch(struct iio_context *ctx, struct stream_cfg *cfg, en bool config_ad9361_rx_local(uint64_t bandwidth_, uint64_t sample_rate_, uint64_t freq_, - const std::string& rf_port_select_, - const std::string& gain_mode_rx1_, - const std::string& gain_mode_rx2_, + const std::string &rf_port_select_, + const std::string &gain_mode_rx1_, + const std::string &gain_mode_rx2_, double rf_gain_rx1_, double rf_gain_rx2_); -bool config_ad9361_rx_remote(const std::string& remote_host, +bool config_ad9361_rx_remote(const std::string &remote_host, uint64_t bandwidth_, uint64_t sample_rate_, uint64_t freq_, - const std::string& rf_port_select_, - const std::string& gain_mode_rx1_, - const std::string& gain_mode_rx2_, + const std::string &rf_port_select_, + const std::string &gain_mode_rx1_, + const std::string &gain_mode_rx2_, double rf_gain_rx1_, double rf_gain_rx2_); @@ -115,7 +115,7 @@ bool config_ad9361_lo_local(uint64_t bandwidth_, int64_t freq_dds_tx_hz_, double scale_dds_dbfs_); -bool config_ad9361_lo_remote(const std::string& remote_host, +bool config_ad9361_lo_remote(const std::string &remote_host, uint64_t bandwidth_, uint64_t sample_rate_, uint64_t freq_rf_tx_hz_, @@ -124,7 +124,7 @@ bool config_ad9361_lo_remote(const std::string& remote_host, double scale_dds_dbfs_); -bool ad9361_disable_lo_remote(const std::string& remote_host); +bool ad9361_disable_lo_remote(const std::string &remote_host); bool ad9361_disable_lo_local(); diff --git a/src/algorithms/signal_source/libs/fpga_switch.cc b/src/algorithms/signal_source/libs/fpga_switch.cc index d387831b1..71fd26eba 100644 --- a/src/algorithms/signal_source/libs/fpga_switch.cc +++ b/src/algorithms/signal_source/libs/fpga_switch.cc @@ -45,7 +45,7 @@ const size_t PAGE_SIZE = 0x10000; const unsigned int TEST_REGISTER_TRACK_WRITEVAL = 0x55AA; -fpga_switch::fpga_switch(const std::string& device_name) +fpga_switch::fpga_switch(const std::string &device_name) { if ((d_device_descriptor = open(device_name.c_str(), O_RDWR | O_SYNC)) == -1) { diff --git a/src/algorithms/signal_source/libs/fpga_switch.h b/src/algorithms/signal_source/libs/fpga_switch.h index ce3dff3ad..2ab67dbef 100644 --- a/src/algorithms/signal_source/libs/fpga_switch.h +++ b/src/algorithms/signal_source/libs/fpga_switch.h @@ -50,7 +50,7 @@ public: private: int d_device_descriptor; // driver descriptor - volatile unsigned *d_map_base; // driver memory map + volatile unsigned* d_map_base; // driver memory map // private functions unsigned fpga_switch_test_register(unsigned writeval);