[hamradio-commits] [gnss-sdr] 44/149: Fixing a couple of warnings

Carles Fernandez carles_fernandez-guest at moszumanska.debian.org
Sat Feb 6 19:43:00 UTC 2016


This is an automated email from the git hooks/post-receive script.

carles_fernandez-guest pushed a commit to branch next
in repository gnss-sdr.

commit f4584a12c130af9a5e434714ba5e414b293398df
Author: Carles Fernandez <carles.fernandez at gmail.com>
Date:   Mon Jan 11 11:32:41 2016 +0100

    Fixing a couple of warnings
    
    unused parameter '_chip_shift', comparison between signed and unsigned
    integers. Regular casts have been replaced by static casts.
---
 .../libs/galileo_e1_signal_processing.cc           | 30 +++++++++++-----------
 src/algorithms/libs/galileo_e1_signal_processing.h |  4 +--
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/algorithms/libs/galileo_e1_signal_processing.cc b/src/algorithms/libs/galileo_e1_signal_processing.cc
index 6d5790b..93fef2f 100644
--- a/src/algorithms/libs/galileo_e1_signal_processing.cc
+++ b/src/algorithms/libs/galileo_e1_signal_processing.cc
@@ -36,7 +36,7 @@
 #include "gnss_signal_processing.h"
 
 
-void galileo_e1_code_gen_int(int* _dest, char _Signal[3], signed int _prn, unsigned int _chip_shift)
+void galileo_e1_code_gen_int(int* _dest, char _Signal[3], signed int _prn)
 {
     std::string _galileo_signal = _Signal;
     signed int prn = _prn - 1;
@@ -76,16 +76,16 @@ void galileo_e1_code_gen_int(int* _dest, char _Signal[3], signed int _prn, unsig
 void galileo_e1_sinboc_11_gen(std::complex<float>* _dest, int* _prn, unsigned int _length_out)
 {
     const unsigned int _length_in = Galileo_E1_B_CODE_LENGTH_CHIPS;
-    unsigned int _period = (unsigned int) (_length_out / _length_in);
+    unsigned int _period = static_cast<unsigned int>( _length_out / _length_in );
     for (unsigned int i = 0; i < _length_in; i++)
         {
             for (unsigned int j = 0; j < (_period / 2); j++)
                 {
-                    _dest[i * _period + j] = std::complex<float>((float) _prn[i], 0.0);
+                    _dest[i * _period + j] = std::complex<float>(static_cast<float>(_prn[i]), 0.0);
                 }
             for (unsigned int j = (_period / 2); j < _period; j++)
                 {
-                    _dest[i * _period + j] = std::complex<float>((float) (- _prn[i]), 0.0);
+                    _dest[i * _period + j] = std::complex<float>(static_cast<float>(- _prn[i]), 0.0);
                 }
         }
 }
@@ -95,17 +95,17 @@ void galileo_e1_sinboc_11_gen(std::complex<float>* _dest, int* _prn, unsigned in
 void galileo_e1_sinboc_61_gen(std::complex<float>* _dest, int* _prn, unsigned int _length_out)
 {
     const unsigned int _length_in = Galileo_E1_B_CODE_LENGTH_CHIPS;
-    unsigned int _period = (unsigned int) (_length_out / _length_in);
+    unsigned int _period = static_cast<unsigned int>(_length_out / _length_in);
 
     for (unsigned int i = 0; i < _length_in; i++)
         {
             for (unsigned int j = 0; j < _period; j += 2)
                 {
-                    _dest[i * _period + j] = std::complex<float>((float) _prn[i], 0.0);
+                    _dest[i * _period + j] = std::complex<float>(static_cast<float>(_prn[i]), 0.0);
                 }
             for (unsigned int j = 1; j < _period; j += 2)
                 {
-                    _dest[i * _period + j] = std::complex<float>((float) (- _prn[i]), 0.0);
+                    _dest[i * _period + j] = std::complex<float>(static_cast<float>(- _prn[i]), 0.0);
                 }
         }
 }
@@ -154,15 +154,15 @@ void galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signa
     unsigned int _samplesPerCode;
     const int _codeFreqBasis = Galileo_E1_CODE_CHIP_RATE_HZ; //Hz
     unsigned int _codeLength = Galileo_E1_B_CODE_LENGTH_CHIPS;
-    int primary_code_E1_chips[(int)Galileo_E1_B_CODE_LENGTH_CHIPS];
-    _samplesPerCode = static_cast<unsigned int>( static_cast<double>(_fs) / (static_cast<double>(_codeFreqBasis )/ static_cast<double>(_codeLength)));
+    int primary_code_E1_chips[static_cast<int>(Galileo_E1_B_CODE_LENGTH_CHIPS)];
+    _samplesPerCode = static_cast<unsigned int>( static_cast<double>(_fs) / (static_cast<double>(_codeFreqBasis ) / static_cast<double>(_codeLength)));
     const int _samplesPerChip = (_cboc == true) ? 12 : 2;
 
-    const unsigned int delay = (((int)Galileo_E1_B_CODE_LENGTH_CHIPS - _chip_shift)
-                                % (int)Galileo_E1_B_CODE_LENGTH_CHIPS)
+    const unsigned int delay = ((static_cast<int>(Galileo_E1_B_CODE_LENGTH_CHIPS) - _chip_shift)
+                                % static_cast<int>(Galileo_E1_B_CODE_LENGTH_CHIPS))
                                 * _samplesPerCode / Galileo_E1_B_CODE_LENGTH_CHIPS;
 
-    galileo_e1_code_gen_int(primary_code_E1_chips, _Signal, _prn, 0); //generate Galileo E1 code, 1 sample per chip
+    galileo_e1_code_gen_int(primary_code_E1_chips, _Signal, _prn); //generate Galileo E1 code, 1 sample per chip
 
     std::complex<float>* _signal_E1;
 
@@ -193,10 +193,10 @@ void galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signa
     {
 
         std::complex<float>* _signal_E1C_secondary = new std::complex<float>
-                                                    [(int)Galileo_E1_C_SECONDARY_CODE_LENGTH
+                                                    [static_cast<int>(Galileo_E1_C_SECONDARY_CODE_LENGTH)
                                                     * _samplesPerCode];
 
-        for (unsigned int i = 0; i < (int)Galileo_E1_C_SECONDARY_CODE_LENGTH; i++)
+        for (unsigned int i = 0; i < static_cast<unsigned int>(Galileo_E1_C_SECONDARY_CODE_LENGTH); i++)
             {
                 for (unsigned k = 0; k < _samplesPerCode; k++)
                     {
@@ -206,7 +206,7 @@ void galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signa
                     }
             }
 
-        _samplesPerCode *= (int)Galileo_E1_C_SECONDARY_CODE_LENGTH;
+        _samplesPerCode *= static_cast<int>(Galileo_E1_C_SECONDARY_CODE_LENGTH);
 
         delete[] _signal_E1;
         _signal_E1 = _signal_E1C_secondary;
diff --git a/src/algorithms/libs/galileo_e1_signal_processing.h b/src/algorithms/libs/galileo_e1_signal_processing.h
index 28007e4..d7518ab 100644
--- a/src/algorithms/libs/galileo_e1_signal_processing.h
+++ b/src/algorithms/libs/galileo_e1_signal_processing.h
@@ -39,8 +39,8 @@
  * \brief This function generates Galileo E1 code (one sample per chip).
  *
  */
-void galileo_e1_code_gen_int(int* _dest, char _Signal[3], signed int _prn,
-        unsigned int _chip_shift);
+void galileo_e1_code_gen_int(int* _dest, char _Signal[3], signed int _prn);
+
 /*!
  * \brief This function generates Galileo E1 sinboc(1,1) code (minimum 2 samples per chip),
  * the _codeLength variable must be a multiple of 2*4092.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/gnss-sdr.git



More information about the pkg-hamradio-commits mailing list