Fix signed/unsigned variables

This commit is contained in:
Stanisław Pitucha 2016-01-29 07:49:31 +11:00
parent a364ffec6e
commit 035353123d
19 changed files with 88 additions and 88 deletions

View File

@ -361,15 +361,15 @@ AppFrame::AppFrame() :
menu = new wxMenu;
#define NUM_RATES_DEFAULT 4
int desired_rates[NUM_RATES_DEFAULT] = { 48000, 44100, 96000, 192000 };
unsigned int desired_rates[NUM_RATES_DEFAULT] = { 48000, 44100, 96000, 192000 };
for (mdevices_i = outputDevices.begin(); mdevices_i != outputDevices.end(); mdevices_i++) {
int desired_rate = 0;
int desired_rank = NUM_RATES_DEFAULT + 1;
unsigned int desired_rate = 0;
unsigned int desired_rank = NUM_RATES_DEFAULT + 1;
for (std::vector<unsigned int>::iterator srate = mdevices_i->second.sampleRates.begin(); srate != mdevices_i->second.sampleRates.end();
srate++) {
for (i = 0; i < NUM_RATES_DEFAULT; i++) {
for (unsigned int i = 0; i < NUM_RATES_DEFAULT; i++) {
if (desired_rates[i] == (*srate)) {
if (desired_rank > i) {
desired_rank = i;
@ -670,7 +670,7 @@ void AppFrame::updateDeviceParams() {
void AppFrame::OnMenu(wxCommandEvent& event) {
if (event.GetId() >= wxID_RT_AUDIO_DEVICE && event.GetId() < wxID_RT_AUDIO_DEVICE + devices.size()) {
if (event.GetId() >= wxID_RT_AUDIO_DEVICE && event.GetId() < wxID_RT_AUDIO_DEVICE + (int)devices.size()) {
if (activeDemodulator) {
activeDemodulator->setOutputDevice(event.GetId() - wxID_RT_AUDIO_DEVICE);
activeDemodulator = NULL;
@ -775,7 +775,7 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
for (std::vector<SoapySDR::ArgInfo>::iterator arg_i = settingArgs.begin(); arg_i != settingArgs.end(); arg_i++) {
SoapySDR::ArgInfo &arg = (*arg_i);
if (arg.type == SoapySDR::ArgInfo::STRING && arg.options.size() && setIdx >= menuIdx && setIdx < menuIdx+arg.options.size()) {
if (arg.type == SoapySDR::ArgInfo::STRING && arg.options.size() && setIdx >= menuIdx && setIdx < menuIdx+(int)arg.options.size()) {
int optIdx = setIdx-menuIdx;
wxGetApp().getSDRThread()->writeSetting(arg.key, arg.options[optIdx]);
break;
@ -862,7 +862,7 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
break;
}
if (event.GetId() >= wxID_BANDWIDTH_BASE && event.GetId() < wxID_BANDWIDTH_BASE+sampleRates.size()) {
if (event.GetId() >= wxID_BANDWIDTH_BASE && event.GetId() < wxID_BANDWIDTH_BASE + (int)sampleRates.size()) {
wxGetApp().setSampleRate(sampleRates[event.GetId()-wxID_BANDWIDTH_BASE]);
}

View File

@ -96,7 +96,7 @@ std::string frequencyToStr(long long freq) {
long long strToFrequency(std::string freqStr) {
std::string filterStr = filterChars(freqStr, std::string("0123456789.MKGHmkgh"));
int numLen = filterStr.find_first_not_of("0123456789.");
size_t numLen = filterStr.find_first_not_of("0123456789.");
if (numLen == std::string::npos) {
numLen = freqStr.length();
@ -806,4 +806,4 @@ bool CubicSDR::rigIsActive() {
return (rigThread && !rigThread->isTerminated());
}
#endif
#endif

View File

@ -69,7 +69,7 @@ static int audioCallback(void *outputBuffer, void * /* inputBuffer */, unsigned
float peak = 0.0;
for (int j = 0; j < src->boundThreads.load()->size(); j++) {
for (size_t j = 0; j < src->boundThreads.load()->size(); j++) {
AudioThread *srcmix = (*(src->boundThreads.load()))[j];
if (srcmix->isTerminated() || !srcmix->inputQueue || srcmix->inputQueue->empty() || !srcmix->isActive()) {
continue;
@ -130,7 +130,7 @@ static int audioCallback(void *outputBuffer, void * /* inputBuffer */, unsigned
float mixPeak = srcmix->currentInput->peak * srcmix->gain;
if (srcmix->currentInput->channels == 1) {
for (int i = 0; i < nBufferFrames; i++) {
for (unsigned int i = 0; i < nBufferFrames; i++) {
if (srcmix->audioQueuePtr >= srcmix->currentInput->data.size()) {
srcmix->audioQueuePtr = 0;
if (srcmix->currentInput) {
@ -187,7 +187,7 @@ static int audioCallback(void *outputBuffer, void * /* inputBuffer */, unsigned
}
if (peak > 1.0) {
for (int i = 0; i < nBufferFrames * 2; i++) {
for (unsigned int i = 0; i < nBufferFrames * 2; i++) {
out[i] /= peak;
}
}
@ -262,7 +262,7 @@ void AudioThread::setSampleRate(int sampleRate) {
dac.stopStream();
dac.closeStream();
for (int j = 0; j < boundThreads.load()->size(); j++) {
for (size_t j = 0; j < boundThreads.load()->size(); j++) {
AudioThread *srcmix = (*(boundThreads.load()))[j];
srcmix->setSampleRate(sampleRate);
}

View File

@ -155,7 +155,7 @@ void DemodulatorPreThread::run() {
// std::lock_guard < std::mutex > lock(inp->m_mutex);
std::vector<liquid_float_complex> *data = &inp->data;
if (data->size() && (inp->sampleRate == currentSampleRate) && cModem && cModemKit) {
int bufSize = data->size();
size_t bufSize = data->size();
if (in_buf_data.size() != bufSize) {
if (in_buf_data.capacity() < bufSize) {
@ -185,7 +185,7 @@ void DemodulatorPreThread::run() {
DemodulatorThreadPostIQData *resamp = buffers.getBuffer();
int out_size = ceil((double) (bufSize) * iqResampleRatio) + 512;
size_t out_size = ceil((double) (bufSize) * iqResampleRatio) + 512;
if (resampledData.size() != out_size) {
if (resampledData.capacity() < out_size) {

View File

@ -166,7 +166,7 @@ void DemodulatorThread::run() {
ati_vis->sampleRate = inp->sampleRate;
ati_vis->inputRate = inp->sampleRate;
int num_vis = DEMOD_VIS_SIZE;
size_t num_vis = DEMOD_VIS_SIZE;
if (modemDigital) {
ati_vis->data.resize(inputData->size());
ati_vis->channels = 2;
@ -199,7 +199,7 @@ void DemodulatorThread::run() {
}
ati_vis->type = 1;
} else {
int numAudioWritten = ati->data.size();
size_t numAudioWritten = ati->data.size();
ati_vis->channels = 1;
std::vector<float> *demodOutData = (modemAnalog != nullptr)?modemAnalog->getDemodOutputData():nullptr;
if ((numAudioWritten > bufSize) || (demodOutData == nullptr)) {

View File

@ -7,7 +7,7 @@ WaterfallPanel::WaterfallPanel() : GLPanel(), fft_size(0), waterfall_lines(0), w
}
}
void WaterfallPanel::setup(int fft_size_in, int num_waterfall_lines_in) {
void WaterfallPanel::setup(unsigned int fft_size_in, int num_waterfall_lines_in) {
waterfall_lines = num_waterfall_lines_in;
fft_size = fft_size_in;
lines_buffered.store(0);
@ -34,9 +34,9 @@ void WaterfallPanel::refreshTheme() {
}
void WaterfallPanel::setPoints(std::vector<float> &points) {
int halfPts = points.size()/2;
size_t halfPts = points.size()/2;
if (halfPts == fft_size) {
for (int i = 0; i < fft_size; i++) {
for (unsigned int i = 0; i < fft_size; i++) {
this->points[i] = points[i*2+1];
}
} else {
@ -45,7 +45,7 @@ void WaterfallPanel::setPoints(std::vector<float> &points) {
}
void WaterfallPanel::step() {
int half_fft_size = fft_size / 2;
unsigned int half_fft_size = fft_size / 2;
if (!bufferInitialized.load()) {
delete waterfall_slice;
@ -67,7 +67,7 @@ void WaterfallPanel::step() {
waterfall_slice[i] = (unsigned char) floor(wv * 255.0);
}
int newBufSize = (half_fft_size*lines_buffered.load()+half_fft_size);
unsigned int newBufSize = (half_fft_size*lines_buffered.load()+half_fft_size);
if (lineBuffer[j].size() < newBufSize) {
lineBuffer[j].resize(newBufSize);
rLineBuffer[j].resize(newBufSize);

View File

@ -6,7 +6,7 @@
class WaterfallPanel : public GLPanel {
public:
WaterfallPanel();
void setup(int fft_size_in, int num_waterfall_lines_in);
void setup(unsigned int fft_size_in, int num_waterfall_lines_in);
void refreshTheme();
void setPoints(std::vector<float> &points);
void step();
@ -20,7 +20,7 @@ private:
GLuint waterfall[2];
int waterfall_ofs[2];
int fft_size;
unsigned int fft_size;
int waterfall_lines;
unsigned char *waterfall_slice;
std::vector<unsigned char> lineBuffer[2];

View File

@ -63,7 +63,7 @@ void ScopeVisualProcessor::process() {
if (!audioInputData) {
return;
}
int i, iMax = audioInputData->data.size();
size_t i, iMax = audioInputData->data.size();
if (!iMax) {
audioInputData->decRefCount();
return;
@ -191,7 +191,7 @@ void ScopeVisualProcessor::process() {
fft_floor_ma = fft_floor_ma + (fft_floor - fft_floor_ma) * 0.05;
fft_floor_maa = fft_floor_maa + (fft_floor_ma - fft_floor_maa) * 0.05;
int outSize = fftSize/2;
unsigned int outSize = fftSize/2;
if (renderData->sampleRate != renderData->inputRate) {
outSize = (int)floor((float)outSize * ((float)renderData->sampleRate/(float)renderData->inputRate));

View File

@ -36,9 +36,9 @@ protected:
float *fftInData;
fftwf_complex *fftwOutput;
fftwf_plan fftw_plan;
int fftSize;
unsigned int fftSize;
int desiredInputSize;
int maxScopeSamples;
unsigned int maxScopeSamples;
double fft_ceil_ma, fft_ceil_maa;
double fft_floor_ma, fft_floor_maa;

View File

@ -95,7 +95,7 @@ int SpectrumVisualProcessor::getDesiredInputSize() {
return desiredInputSize.load();
}
void SpectrumVisualProcessor::setup(int fftSize_in) {
void SpectrumVisualProcessor::setup(unsigned int fftSize_in) {
busy_run.lock();
fftSize = fftSize_in;
@ -139,7 +139,7 @@ void SpectrumVisualProcessor::setup(int fftSize_in) {
busy_run.unlock();
}
void SpectrumVisualProcessor::setFFTSize(int fftSize_in) {
void SpectrumVisualProcessor::setFFTSize(unsigned int fftSize_in) {
if (fftSize_in == fftSize) {
return;
}
@ -194,7 +194,7 @@ void SpectrumVisualProcessor::process() {
if (peakReset.load() != 0) {
peakReset--;
if (peakReset.load() == 0) {
for (int i = 0, iMax = fftSizeInternal; i < iMax; i++) {
for (unsigned int i = 0, iMax = fftSizeInternal; i < iMax; i++) {
fft_result_peak[i] = fft_floor_maa;
}
fft_ceil_peak = fft_floor_maa;
@ -224,7 +224,7 @@ void SpectrumVisualProcessor::process() {
resamplerRatio = (double) (resampleBw) / (double) iqData->sampleRate;
int desired_input_size = fftSizeInternal / resamplerRatio;
size_t desired_input_size = fftSizeInternal / resamplerRatio;
this->desiredInputSize.store(desired_input_size);
@ -246,7 +246,7 @@ void SpectrumVisualProcessor::process() {
if (lastBandwidth!=0) {
double binPerHz = double(lastBandwidth) / double(fftSizeInternal);
int numShift = floor(double(abs(freqDiff)) / binPerHz);
unsigned int numShift = floor(double(abs(freqDiff)) / binPerHz);
if (numShift < fftSizeInternal/2 && numShift) {
if (freqDiff > 0) {
@ -300,7 +300,7 @@ void SpectrumVisualProcessor::process() {
}
int out_size = ceil((double) (desired_input_size) * resamplerRatio) + 512;
unsigned int out_size = ceil((double) (desired_input_size) * resamplerRatio) + 512;
if (resampleBuffer.size() != out_size) {
if (resampleBuffer.capacity() < out_size) {
@ -312,16 +312,16 @@ void SpectrumVisualProcessor::process() {
msresamp_crcf_execute(resampler, &shiftBuffer[0], desired_input_size, &resampleBuffer[0], &num_written);
if (num_written < fftSizeInternal) {
for (int i = 0; i < num_written; i++) {
for (unsigned int i = 0; i < num_written; i++) {
fftInData[i][0] = resampleBuffer[i].real;
fftInData[i][1] = resampleBuffer[i].imag;
}
for (int i = num_written; i < fftSizeInternal; i++) {
for (unsigned int i = num_written; i < fftSizeInternal; i++) {
fftInData[i][0] = 0;
fftInData[i][1] = 0;
}
} else {
for (int i = 0; i < fftSizeInternal; i++) {
for (unsigned int i = 0; i < fftSizeInternal; i++) {
fftInData[i][0] = resampleBuffer[i].real;
fftInData[i][1] = resampleBuffer[i].imag;
}
@ -331,16 +331,16 @@ void SpectrumVisualProcessor::process() {
num_written = data->size();
if (data->size() < fftSizeInternal) {
for (int i = 0, iMax = data->size(); i < iMax; i++) {
for (size_t i = 0, iMax = data->size(); i < iMax; i++) {
fftInData[i][0] = (*data)[i].real;
fftInData[i][1] = (*data)[i].imag;
}
for (int i = data->size(); i < fftSizeInternal; i++) {
for (size_t i = data->size(); i < fftSizeInternal; i++) {
fftInData[i][0] = 0;
fftInData[i][1] = 0;
}
} else {
for (int i = 0; i < fftSizeInternal; i++) {
for (unsigned int i = 0; i < fftSizeInternal; i++) {
fftInData[i][0] = (*data)[i].real;
fftInData[i][1] = (*data)[i].imag;
}
@ -404,19 +404,19 @@ void SpectrumVisualProcessor::process() {
if (newResampler && lastView) {
if (bwDiff < 0) {
for (int i = 0, iMax = fftSizeInternal; i < iMax; i++) {
for (unsigned int i = 0, iMax = fftSizeInternal; i < iMax; i++) {
fft_result_temp[i] = fft_result_ma[(fftSizeInternal/4) + (i/2)];
}
for (int i = 0, iMax = fftSizeInternal; i < iMax; i++) {
for (unsigned int i = 0, iMax = fftSizeInternal; i < iMax; i++) {
fft_result_ma[i] = fft_result_temp[i];
fft_result_temp[i] = fft_result_maa[(fftSizeInternal/4) + (i/2)];
}
for (int i = 0, iMax = fftSizeInternal; i < iMax; i++) {
for (unsigned int i = 0, iMax = fftSizeInternal; i < iMax; i++) {
fft_result_maa[i] = fft_result_temp[i];
}
} else {
for (int i = 0, iMax = fftSizeInternal; i < iMax; i++) {
for (size_t i = 0, iMax = fftSizeInternal; i < iMax; i++) {
if (i < fftSizeInternal/4) {
fft_result_temp[i] = 0; // fft_result_ma[fftSizeInternal/4];
} else if (i >= fftSizeInternal - fftSizeInternal/4) {
@ -425,7 +425,7 @@ void SpectrumVisualProcessor::process() {
fft_result_temp[i] = fft_result_ma[(i-fftSizeInternal/4)*2];
}
}
for (int i = 0, iMax = fftSizeInternal; i < iMax; i++) {
for (unsigned int i = 0, iMax = fftSizeInternal; i < iMax; i++) {
fft_result_ma[i] = fft_result_temp[i];
if (i < fftSizeInternal/4) {
@ -436,7 +436,7 @@ void SpectrumVisualProcessor::process() {
fft_result_temp[i] = fft_result_maa[(i-fftSizeInternal/4)*2];
}
}
for (int i = 0, iMax = fftSizeInternal; i < iMax; i++) {
for (unsigned int i = 0, iMax = fftSizeInternal; i < iMax; i++) {
fft_result_maa[i] = fft_result_temp[i];
}
}
@ -494,7 +494,7 @@ void SpectrumVisualProcessor::process() {
visualAccum += visualRatio * double(SPECTRUM_VZM);
while (visualAccum >= 1.0) {
int idx = round(visualStart+i);
unsigned int idx = round(visualStart+i);
if (idx > 0 && idx < fftSizeInternal) {
acc += fft_result_maa[idx];
if (doPeak) {
@ -547,7 +547,7 @@ void SpectrumVisualProcessor::process() {
int numSteps = (fftEnd-fftStart);
int halfWay = fftStart+(numSteps/2);
if ((fftEnd+numSteps/2+1 < fftSize) && (fftStart-numSteps/2-1 >= 0) && (fftEnd > fftStart)) {
if ((fftEnd+numSteps/2+1 < (long long) fftSize) && (fftStart-numSteps/2-1 >= 0) && (fftEnd > fftStart)) {
int n = 1;
for (int i = fftStart; i < halfWay; i++) {
output->spectrum_points[i * 2 + 1] = output->spectrum_points[(fftStart - n) * 2 + 1];

View File

@ -42,8 +42,8 @@ public:
int getDesiredInputSize();
void setup(int fftSize);
void setFFTSize(int fftSize);
void setup(unsigned int fftSize);
void setFFTSize(unsigned int fftSize);
void setHideDC(bool hideDC);
void setScaleFactor(float sf);
@ -54,8 +54,8 @@ protected:
ReBuffer<SpectrumVisualData> outputBuffers;
std::atomic_bool is_view;
std::atomic_int fftSize, newFFTSize;
std::atomic_int fftSizeInternal;
std::atomic_uint fftSize, newFFTSize;
std::atomic_uint fftSizeInternal;
std::atomic_llong centerFreq;
std::atomic_long bandwidth;

View File

@ -178,7 +178,7 @@ std::vector<SDRDeviceInfo *> *SDREnumerator::enumerate_devices(std::string remot
results = SoapySDR::Device::enumerate();
}
int manualsIdx = results.size();
size_t manualsIdx = results.size();
std::vector<std::string> manualParams;
std::vector<bool> manualResult;
@ -265,7 +265,7 @@ std::vector<SDRDeviceInfo *> *SDREnumerator::enumerate_devices(std::string remot
for (ConfigSettings::const_iterator set_i = devSettings.begin(); set_i != devSettings.end(); set_i++) {
deviceArgs[set_i->first] = set_i->second;
}
for (int j = 0; j < settingsInfo.size(); j++) {
for (size_t j = 0; j < settingsInfo.size(); j++) {
if (deviceArgs.find(settingsInfo[j].key) != deviceArgs.end()) {
settingsInfo[j].value = deviceArgs[settingsInfo[j].key];
}

View File

@ -176,7 +176,7 @@ void SDRPostThread::run() {
data_in->decRefCount();
bool doUpdate = false;
for (int j = 0; j < nRunDemods; j++) {
for (size_t j = 0; j < nRunDemods; j++) {
DemodulatorInstance *demod = runDemods[j];
if (abs(frequency - demod->getFrequency()) > (sampleRate / 2)) {
doUpdate = true;
@ -214,8 +214,8 @@ void SDRPostThread::runSingleCH(SDRThreadIQData *data_in) {
doRefresh.store(true);
}
int dataSize = data_in->data.size();
int outSize = data_in->data.size();
size_t dataSize = data_in->data.size();
size_t outSize = data_in->data.size();
if (outSize > dataOut.capacity()) {
dataOut.reserve(outSize);
@ -234,7 +234,7 @@ void SDRPostThread::runSingleCH(SDRThreadIQData *data_in) {
doRefresh.store(false);
}
int refCount = nRunDemods;
size_t refCount = nRunDemods;
bool doIQDataOut = (iqDataOutQueue != NULL && !iqDataOutQueue->full());
bool doDemodVisOut = (nRunDemods && iqActiveDemodVisualQueue != NULL && !iqActiveDemodVisualQueue->full());
bool doVisOut = (iqVisualQueue != NULL && !iqVisualQueue->full());
@ -276,7 +276,7 @@ void SDRPostThread::runSingleCH(SDRThreadIQData *data_in) {
iqVisualQueue->push(demodDataOut);
}
for (int i = 0; i < nRunDemods; i++) {
for (size_t i = 0; i < nRunDemods; i++) {
runDemods[i]->getIQInputDataPipe()->push(demodDataOut);
}
}
@ -290,8 +290,8 @@ void SDRPostThread::runPFBCH(SDRThreadIQData *data_in) {
doRefresh.store(true);
}
int dataSize = data_in->data.size();
int outSize = data_in->data.size();
size_t dataSize = data_in->data.size();
size_t outSize = data_in->data.size();
if (outSize > dataOut.capacity()) {
dataOut.reserve(outSize);
@ -349,7 +349,7 @@ void SDRPostThread::runPFBCH(SDRThreadIQData *data_in) {
}
// Find nearest channel for each demodulator
for (int i = 0; i < nRunDemods; i++) {
for (size_t i = 0; i < nRunDemods; i++) {
DemodulatorInstance *demod = runDemods[i];
demodChannel[i] = getChannelAt(demod->getFrequency());
if (demod == activeDemod) {
@ -357,7 +357,7 @@ void SDRPostThread::runPFBCH(SDRThreadIQData *data_in) {
}
}
for (int i = 0; i < nRunDemods; i++) {
for (size_t i = 0; i < nRunDemods; i++) {
// cache channel usage refcounts
if (demodChannel[i] >= 0) {
demodChannelActive[demodChannel[i]]++;
@ -378,7 +378,7 @@ void SDRPostThread::runPFBCH(SDRThreadIQData *data_in) {
demodDataOut->sampleRate = chanBw;
// Calculate channel buffer size
int chanDataSize = (outSize/numChannels);
size_t chanDataSize = (outSize/numChannels);
if (demodDataOut->data.size() != chanDataSize) {
if (demodDataOut->data.capacity() < chanDataSize) {
@ -400,13 +400,13 @@ void SDRPostThread::runPFBCH(SDRThreadIQData *data_in) {
if (dcBuf.size() != chanDataSize) {
dcBuf.resize(chanDataSize);
}
for (int j = 0; j < chanDataSize; j++) {
for (size_t j = 0; j < chanDataSize; j++) {
dcBuf[j] = dataOut[idx];
idx += numChannels;
}
iirfilt_crcf_execute_block(dcFilter, &dcBuf[0], chanDataSize, &demodDataOut->data[0]);
} else {
for (int j = 0; j < chanDataSize; j++) {
for (size_t j = 0; j < chanDataSize; j++) {
demodDataOut->data[j] = dataOut[idx];
idx += numChannels;
}
@ -416,7 +416,7 @@ void SDRPostThread::runPFBCH(SDRThreadIQData *data_in) {
iqActiveDemodVisualQueue->push(demodDataOut);
}
for (int j = 0; j < nRunDemods; j++) {
for (size_t j = 0; j < nRunDemods; j++) {
if (demodChannel[j] == i) {
DemodulatorInstance *demod = runDemods[j];
demod->getIQInputDataPipe()->push(demodDataOut);
@ -424,4 +424,4 @@ void SDRPostThread::runPFBCH(SDRThreadIQData *data_in) {
}
}
}
}
}

View File

@ -43,7 +43,7 @@ private:
std::vector<long long> chanCenters;
long long chanBw;
int nRunDemods;
size_t nRunDemods;
std::vector<DemodulatorInstance *> runDemods;
std::vector<int> demodChannel;
std::vector<int> demodChannelActive;

View File

@ -127,7 +127,7 @@ void SDRThread::init() {
SoapySDR::ArgInfoList devSettings = deviceInfo.load()->getSettingsArgInfo();
if (devSettings.size()) {
for (int j = 0; j < settingsInfo.size(); j++) {
for (size_t j = 0; j < settingsInfo.size(); j++) {
if (settings.find(settingsInfo[j].key) != settings.end()) {
devSettings[j].value = settings[devSettings[j].key];
}

View File

@ -43,7 +43,7 @@ DataElement::~DataElement() {
}
}
void DataElement::data_init(long data_size_in) {
void DataElement::data_init(size_t data_size_in) {
if (data_val) {
delete data_val;
data_val = NULL;
@ -62,11 +62,11 @@ int DataElement::getDataType() {
return data_type;
}
long DataElement::getDataSize() {
size_t DataElement::getDataSize() {
return data_size;
}
int DataElement::getUnitSize() {
unsigned int DataElement::getUnitSize() {
return unit_size;
}
@ -170,7 +170,7 @@ return; \
int _compat[] = {__VA_ARGS__}; \
if (data_type != enumtype) { \
bool compat = false; \
for (int i = 0; i < sizeof(_compat)/sizeof(int); i++) { \
for (size_t i = 0; i < sizeof(_compat)/sizeof(int); i++) { \
if (_compat[i] == data_type) { \
compat = true; \
break; \
@ -213,7 +213,7 @@ return; \
int _compat[] = {__VA_ARGS__}; \
if (data_type != enumtype) { \
bool compat = false; \
for (int i = 0; i < sizeof(_compat)/sizeof(int); i++) { \
for (size_t i = 0; i < sizeof(_compat)/sizeof(int); i++) { \
if (_compat[i] == data_type) { \
compat = true; \
break; \
@ -275,7 +275,7 @@ void DataElement::get(string &str_in) throw (DataTypeMismatchException) {
}
void DataElement::get(vector<string> &strvect_in) throw (DataTypeMismatchException) {
long ptr;
size_t ptr;
if (!data_type)
return;
@ -313,7 +313,7 @@ if (!data_type || !unit_size) return; \
if (data_type != enumtype) { \
int _compat[] = {__VA_ARGS__}; \
bool compat = false; \
for (int i = 0; i < sizeof(_compat)/sizeof(int); i++) { \
for (size_t i = 0; i < sizeof(_compat)/sizeof(int); i++) { \
if (_compat[i] == data_type) { \
compat = true; \
break; \
@ -326,7 +326,7 @@ if (data_type != enumtype) { \
std::cout << "Warning, data type mismatch for vector<" #datatype ">; " #datatype " size " << sizeof(datatype) << " is less than unit size " << unit_size << "; possible loss of data."; \
} \
datatype temp_val; \
long ptr = 0; \
size_t ptr = 0; \
while (ptr < data_size) { \
temp_val = 0; \
memcpy(&temp_val, data_val + ptr, (unit_size > sizeof(datatype))?sizeof(datatype):unit_size); \

View File

@ -119,12 +119,12 @@ class DataElement
{
private:
int data_type;
long data_size;
int unit_size;
size_t data_size;
unsigned int unit_size;
char *data_val;
void data_init(long data_size_in);
void data_init(size_t data_size_in);
public:
DataElement();
@ -132,8 +132,8 @@ public:
int getDataType();
char *getDataPointer();
long getDataSize();
int getUnitSize();
size_t getDataSize();
unsigned int getUnitSize();
/* set overloads */
void set(const char &char_in);

View File

@ -49,7 +49,7 @@ WaterfallCanvas::WaterfallCanvas(wxWindow *parent, int *attribList) :
WaterfallCanvas::~WaterfallCanvas() {
}
void WaterfallCanvas::setup(int fft_size_in, int waterfall_lines_in) {
void WaterfallCanvas::setup(unsigned int fft_size_in, int waterfall_lines_in) {
if (fft_size == fft_size_in && waterfall_lines_in == waterfall_lines) {
return;
}
@ -60,7 +60,7 @@ void WaterfallCanvas::setup(int fft_size_in, int waterfall_lines_in) {
gTimer.start();
}
void WaterfallCanvas::setFFTSize(int fft_size_in) {
void WaterfallCanvas::setFFTSize(unsigned int fft_size_in) {
if (fft_size_in == fft_size) {
return;
}

View File

@ -19,8 +19,8 @@ public:
};
WaterfallCanvas(wxWindow *parent, int *attribList = NULL);
void setup(int fft_size_in, int waterfall_lines_in);
void setFFTSize(int fft_size_in);
void setup(unsigned int fft_size_in, int waterfall_lines_in);
void setFFTSize(unsigned int fft_size_in);
~WaterfallCanvas();
DragState getDragState();
@ -60,7 +60,7 @@ private:
DragState dragState;
DragState nextDragState;
int fft_size, new_fft_size;
unsigned int fft_size, new_fft_size;
int waterfall_lines;
int dragOfs;