diff options
25 files changed, 255 insertions, 150 deletions
diff --git a/config/usrp_libusb.m4 b/config/usrp_libusb.m4 index a434d379d..cc3410f41 100644 --- a/config/usrp_libusb.m4 +++ b/config/usrp_libusb.m4 @@ -24,28 +24,43 @@ dnl Boston, MA 02110-1301, USA. AC_DEFUN([USRP_LIBUSB], [ - dnl Use PKGCONFIG to check for packages first, then check to - dnl make sure the USB_* variables work (whether from PKGCONFIG - dnl or overridden by the user) - - dnl do not use LDFLAGS, since PKGCONFIG will provide everything + dnl do not use LDFLAGS, except on Windows saved_LDFLAGS=${LDFLAGS} - LDFLAGS= - LIBUSB_PKG_CONFIG_NAME= + case "$host_os" in + cygwin* | mingw*) + ;; + *) + LDFLAGS= + ;; + esac - dnl loop over various possible 'libusb' PKGCONFIG names, and choose - dnl the first one that meets both the user's selection (via - dnl configure flags) as well as what is installed + dnl this variable is set in usrp/usrp.pc.in as a requirement + dnl for libusrp; it is OK to be empty. + LIBUSB_PKG_CONFIG_NAME= - dnl create the list of libusb PKGCONFIG modules to test + dnl for Windows (cygin, mingw), do not use PKGCONFIG since LIBUSB + dnl does not install a .pc file. For all other OSs, use + dnl PKGCONFIG to check for various package names first. libusb_list='' - if test x$1 = xyes; then - dnl libusb-1.0 was requested; just test for it - libusb_list="libusb-1.0" - else - dnl test for legacy libusb only - libusb_list="libusb libusb-legacy" - fi + case "$host_os" in + cygwin* | mingw*) + libusb_list='libusb' + ;; + *) + dnl create the list of libusb PKGCONFIG modules to test + if test x$1 = xyes; then + dnl libusb-1.0 was requested; just test for it + libusb_list="libusb-1.0" + else + dnl test for legacy libusb only + libusb_list="libusb libusb-legacy" + fi + ;; + esac + + dnl loop over various possible 'libusb' names, and + dnl choose the first one that meets both the user's selection + dnl (via configure flags) as well as what is installed for libusb_name in ${libusb_list}; do dnl clear internal variables libusbok=no @@ -54,31 +69,45 @@ AC_DEFUN([USRP_LIBUSB], [ usb_lib_func='' usb_lib_name='' - dnl start checks - AC_MSG_NOTICE([Checking for LIBUSB version '${libusb_name}']) - if test ${libusb_name} = "libusb-1.0"; then - dnl see if the pkgconfig module is available - PKG_CHECK_MODULES(USB, ${libusb_name}, [ - libusbok=yes - have_libusb1=yes - usb_header='libusb-1.0/libusb.h' - usb_lib_func='libusb_bulk_transfer' - ], [libusbok=no]) - else - dnl see if the pkgconfig module is available - PKG_CHECK_MODULES(USB, ${libusb_name}, [ - libusbok=yes + case "$host_os" in + cygwin* | mingw*) + USB_INCLUDEDIR= + USB_INCLUDES= + USB_LIBS=-lusb usb_header='usb.h' usb_lib_func='usb_bulk_write' - ], [libusbok=no]) - fi + libusbok=yes + ;; + *) + dnl start checks + AC_MSG_NOTICE([Checking for LIBUSB version '${libusb_name}']) + if test ${libusb_name} = "libusb-1.0"; then + dnl see if the pkgconfig module is available + PKG_CHECK_MODULES(USB, ${libusb_name}, [ + libusbok=yes + have_libusb1=yes + usb_header='libusb-1.0/libusb.h' + usb_lib_func='libusb_bulk_transfer' + ], [libusbok=no]) + else + dnl see if the pkgconfig module is available + PKG_CHECK_MODULES(USB, ${libusb_name}, [ + libusbok=yes + usb_header='usb.h' + usb_lib_func='usb_bulk_write' + ], [libusbok=no]) + fi + ;; + esac if test $libusbok = yes; then - dnl PKGCONFIG found a version of LIBUSB. + dnl PKGCONFIG found a version of LIBUSB, or the info was + dnl provided by the user, or the OS is Windows. + dnl Check it to make sure it meets enough criteria: dnl Verify that $usb_header is a valid header. If so, then dnl verify that $usb_lib_func can be found in the library dnl $usb_lib_name. if so, verify that the symbol 'usb_debug' is - dnl found in the library. + dnl found in the library if not using Windows. dnl Check for the header. Similar to AC_CHECK_HEADERS, dnl but doesn't append to known \#defines. @@ -135,28 +164,43 @@ AC_DEFUN([USRP_LIBUSB], [ if test $libusbok = yes; then if test ${libusb_name} != "libusb-1.0"; then dnl PKGCONFIG found a legacy version of libusb; make sure the - dnl variable _usb_debug is available in the found library - AC_LANG_PUSH(C) - save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$USB_INCLUDES" - save_LIBS="$LIBS" - LIBS="$USB_LIBS" - AC_MSG_CHECKING([$libusb_name for symbol usb_debug in library $usb_lib_name]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ - extern int usb_debug;]], - [[usb_debug = 0;]])], - [libusbok=yes],[libusbok=no]) - AC_MSG_RESULT([$libusbok]) - LIBS="$save_LIBS" - CPPFLAGS="$save_CPPFLAGS" - AC_LANG_POP(C) + dnl variable _usb_debug is available in the found library. + dnl Do not test on Windows, since that symbol is not defined. + case "$host_os" in + cygwin* | mingw*) + ;; + *) + AC_LANG_PUSH(C) + save_CPPFLAGS="$CPPFLAGS" + if test x$USB_INCLUDEDIR != x; then + CPPFLAGS="$USB_INCLUDES" + fi + save_LIBS="$LIBS" + LIBS="$USB_LIBS" + AC_MSG_CHECKING([$libusb_name for symbol usb_debug in library $usb_lib_name]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + extern int usb_debug;]], + [[usb_debug = 0;]])], + [libusbok=yes],[libusbok=no]) + AC_MSG_RESULT([$libusbok]) + LIBS="$save_LIBS" + CPPFLAGS="$save_CPPFLAGS" + AC_LANG_POP(C) + ;; + esac fi fi fi fi dnl if everything checks out OK, finish up if test $libusbok = yes; then - LIBUSB_PKG_CONFIG_NAME="${libusb_name}" + case "$host_os" in + cygwin* | mingw*) + ;; + *) + LIBUSB_PKG_CONFIG_NAME="${libusb_name}" + ;; + esac break else dnl something wasn't found in this LIBUSB version. @@ -173,7 +217,9 @@ AC_DEFUN([USRP_LIBUSB], [ dnl final error checking, mostly to create #define's AC_LANG_PUSH(C) save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$USB_INCLUDES" + if test x$USB_INCLUDEDIR != x; then + CPPFLAGS="$USB_INCLUDES" + fi dnl Check for the header. AC_CHECK_HEADERS([$usb_header], [], [libusbok=no]) CPPFLAGS="$save_CPPFLAGS" @@ -185,18 +231,20 @@ AC_DEFUN([USRP_LIBUSB], [ dnl check for the library (again) AC_LANG_PUSH(C) save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$USB_INCLUDES" + if test x$USB_INCLUDEDIR != x; then + CPPFLAGS="$USB_INCLUDES" + fi save_LIBS="$LIBS" LIBS="$USB_LIBS" AC_CHECK_LIB([$usb_lib_name], [$usb_lib_func], [], [ libusbok=no AC_MSG_RESULT([USRP requires library '$usb_lib_name' with function '$usb_lib_func', which was either not found or was not usable. See http://www.libusb.org])]) - case "$host_os" in - cygwin* | mingw*) - USB_LIBS="$LIBS" - ;; - *) ;; - esac +# case "$host_os" in +# cygwin* | mingw*) +# USB_LIBS="$LIBS" +# ;; +# *) ;; +# esac LIBS="$save_LIBS" CPPFLAGS="$save_CPPFLAGS" AC_LANG_POP(C) diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc index 399632003..59b76a6f0 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc +++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc @@ -71,7 +71,7 @@ gr_pfb_arb_resampler_ccf::gr_pfb_arb_resampler_ccf (float rate, // Create an FIR filter for each channel and zero out the taps std::vector<float> vtaps(0, d_int_rate); - for(int i = 0; i < d_int_rate; i++) { + for(unsigned int i = 0; i < d_int_rate; i++) { d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps); d_diff_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps); } @@ -97,8 +97,6 @@ gr_pfb_arb_resampler_ccf::create_taps (const std::vector<float> &newtaps, std::vector< std::vector<float> > &ourtaps, std::vector<gr_fir_ccf*> &ourfilter) { - int i,j; - unsigned int ntaps = newtaps.size(); d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_int_rate); @@ -114,10 +112,10 @@ gr_pfb_arb_resampler_ccf::create_taps (const std::vector<float> &newtaps, } // Partition the filter - for(i = 0; i < d_int_rate; i++) { + for(unsigned int i = 0; i < d_int_rate; i++) { // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out ourtaps[d_int_rate-1-i] = std::vector<float>(d_taps_per_filter, 0); - for(j = 0; j < d_taps_per_filter; j++) { + for(unsigned int j = 0; j < d_taps_per_filter; j++) { ourtaps[d_int_rate - 1 - i][j] = tmp_taps[i + j*d_int_rate]; } @@ -173,7 +171,8 @@ gr_pfb_arb_resampler_ccf::general_work (int noutput_items, return 0; // history requirements may have changed. } - int i = 0, j, count = d_start_index; + int i = 0, count = d_start_index; + unsigned int j; gr_complex o0, o1; // Restore the last filter position diff --git a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc index 8a0ad1c4c..e20bc38bb 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc +++ b/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc @@ -132,7 +132,7 @@ gr_pfb_interpolator_ccf::work (int noutput_items, int i = 0, count = 0; while(i < noutput_items) { - for(int j = 0; j < d_rate; j++) { + for(unsigned int j = 0; j < d_rate; j++) { out[i] = d_filters[j]->filter(&in[count]); i++; } diff --git a/gnuradio-core/src/lib/filter/gr_sincos.c b/gnuradio-core/src/lib/filter/gr_sincos.c index 240a84852..57b26b22f 100644 --- a/gnuradio-core/src/lib/filter/gr_sincos.c +++ b/gnuradio-core/src/lib/filter/gr_sincos.c @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -24,7 +24,9 @@ #include "config.h" #endif +#ifndef _GNU_SOURCE #define _GNU_SOURCE // ask for GNU extensions if available +#endif #include <gr_sincos.h> #include <math.h> diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir.h b/gnuradio-core/src/lib/filter/gr_single_pole_iir.h index bd59e53ac..da919b35c 100644 --- a/gnuradio-core/src/lib/filter/gr_single_pole_iir.h +++ b/gnuradio-core/src/lib/filter/gr_single_pole_iir.h @@ -71,12 +71,12 @@ public: d_prev_output = 0; } - tap_type prev_output () { return d_prev_output; } + o_type prev_output () { return d_prev_output; } protected: tap_type d_alpha; tap_type d_one_minus_alpha; - tap_type d_prev_output; + o_type d_prev_output; }; @@ -87,7 +87,7 @@ template<class o_type, class i_type, class tap_type> o_type gr_single_pole_iir<o_type, i_type, tap_type>::filter (const i_type input) { - tap_type output; + o_type output; output = d_alpha * input + d_one_minus_alpha * d_prev_output; d_prev_output = output; diff --git a/gnuradio-core/src/lib/general/gr_circular_file.cc b/gnuradio-core/src/lib/general/gr_circular_file.cc index 468b49a10..c9222597a 100644 --- a/gnuradio-core/src/lib/general/gr_circular_file.cc +++ b/gnuradio-core/src/lib/general/gr_circular_file.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002 Free Software Foundation, Inc. + * Copyright 2002,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -66,7 +66,10 @@ gr_circular_file::gr_circular_file (const char *filename, exit (1); } #ifdef HAVE_MMAP /* FIXME */ - ftruncate (d_fd, size + HEADER_SIZE); + if(ftruncate (d_fd, size + HEADER_SIZE) != 0) { + perror (filename); + exit (1); + } #endif } else { diff --git a/gnuradio-core/src/lib/general/gr_float_to_complex.cc b/gnuradio-core/src/lib/general/gr_float_to_complex.cc index 89ef18869..a392abd06 100644 --- a/gnuradio-core/src/lib/general/gr_float_to_complex.cc +++ b/gnuradio-core/src/lib/general/gr_float_to_complex.cc @@ -52,12 +52,12 @@ gr_float_to_complex::work (int noutput_items, switch (input_items.size ()){ case 1: - for (int j = 0; j < noutput_items*d_vlen; j++) + for (size_t j = 0; j < noutput_items*d_vlen; j++) out[j] = gr_complex (r[j], 0); break; case 2: - for (int j = 0; j < noutput_items*d_vlen; j++) + for (size_t j = 0; j < noutput_items*d_vlen; j++) out[j] = gr_complex (r[j], i[j]); break; diff --git a/gnuradio-core/src/lib/general/gr_skiphead.cc b/gnuradio-core/src/lib/general/gr_skiphead.cc index ea7e9405f..1670eb7cf 100644 --- a/gnuradio-core/src/lib/general/gr_skiphead.cc +++ b/gnuradio-core/src/lib/general/gr_skiphead.cc @@ -27,7 +27,7 @@ #include <gr_io_signature.h> #include <string.h> -gr_skiphead::gr_skiphead (size_t itemsize, size_t nitems_to_skip) +gr_skiphead::gr_skiphead (size_t itemsize, uint64_t nitems_to_skip) : gr_block ("skiphead", gr_make_io_signature(1, 1, itemsize), gr_make_io_signature(1, 1, itemsize)), @@ -36,7 +36,7 @@ gr_skiphead::gr_skiphead (size_t itemsize, size_t nitems_to_skip) } gr_skiphead_sptr -gr_make_skiphead (size_t itemsize, size_t nitems_to_skip) +gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip) { return gnuradio::get_initial_sptr(new gr_skiphead (itemsize, nitems_to_skip)); } @@ -55,11 +55,11 @@ gr_skiphead::general_work(int noutput_items, while (ii < ninput_items){ - long long ni_total = ii + d_nitems; // total items processed so far + uint64_t ni_total = ii + d_nitems; // total items processed so far if (ni_total < d_nitems_to_skip){ // need to skip some more int n_to_skip = (int) std::min(d_nitems_to_skip - ni_total, - (long long)(ninput_items - ii)); + (uint64_t)(ninput_items - ii)); ii += n_to_skip; } diff --git a/gnuradio-core/src/lib/general/gr_skiphead.h b/gnuradio-core/src/lib/general/gr_skiphead.h index 965feff9b..933c126e3 100644 --- a/gnuradio-core/src/lib/general/gr_skiphead.h +++ b/gnuradio-core/src/lib/general/gr_skiphead.h @@ -39,11 +39,11 @@ typedef boost::shared_ptr<gr_skiphead> gr_skiphead_sptr; class gr_skiphead : public gr_block { - friend gr_skiphead_sptr gr_make_skiphead (size_t itemsize, size_t nitems_to_skip); - gr_skiphead (size_t itemsize, size_t nitems_to_skip); + friend gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip); + gr_skiphead (size_t itemsize, uint64_t nitems_to_skip); - long long d_nitems_to_skip; - long long d_nitems; // total items seen + uint64_t d_nitems_to_skip; + uint64_t d_nitems; // total items seen public: @@ -54,7 +54,7 @@ class gr_skiphead : public gr_block }; gr_skiphead_sptr -gr_make_skiphead (size_t itemsize, size_t nitems_to_skip); +gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip); #endif /* INCLUDED_GR_SKIPHEAD_H */ diff --git a/gnuradio-core/src/lib/general/gr_skiphead.i b/gnuradio-core/src/lib/general/gr_skiphead.i index 52c0808f0..45cbd0437 100644 --- a/gnuradio-core/src/lib/general/gr_skiphead.i +++ b/gnuradio-core/src/lib/general/gr_skiphead.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005,2007 Free Software Foundation, Inc. + * Copyright 2005,2007,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -22,9 +22,9 @@ GR_SWIG_BLOCK_MAGIC(gr,skiphead); -gr_skiphead_sptr gr_make_skiphead (size_t itemsize, size_t nitems_to_skip); +gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip); class gr_skiphead : public gr_block { - friend gr_skiphead_sptr gr_make_skiphead (size_t itemsize, size_t nitems_to_skip); - gr_skiphead (size_t itemsize, size_t nitems_to_skip); + friend gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip); + gr_skiphead (size_t itemsize, uint64_t nitems_to_skip); }; diff --git a/gnuradio-core/src/lib/gengen/gr_add_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_add_XX.cc.t index 58a25325a..0e8b23ee1 100644 --- a/gnuradio-core/src/lib/gengen/gr_add_XX.cc.t +++ b/gnuradio-core/src/lib/gengen/gr_add_XX.cc.t @@ -52,7 +52,7 @@ int int ninputs = input_items.size (); - for (int i = 0; i < noutput_items*d_vlen; i++){ + for (size_t i = 0; i < noutput_items*d_vlen; i++){ @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i]; for (int j = 1; j < ninputs; j++) acc += ((@I_TYPE@ *) input_items[j])[i]; diff --git a/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t index 1200145fa..ea245b57b 100644 --- a/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t +++ b/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t @@ -53,13 +53,13 @@ int int ninputs = input_items.size (); if (ninputs == 1){ // compute reciprocal - for (int i = 0; i < noutput_items*d_vlen; i++) + for (size_t i = 0; i < noutput_items*d_vlen; i++) *optr++ = (@O_TYPE@) ((@O_TYPE@) 1 / ((@I_TYPE@ *) input_items[0])[i]); } else { - for (int i = 0; i < noutput_items*d_vlen; i++){ + for (size_t i = 0; i < noutput_items*d_vlen; i++){ @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i]; for (int j = 1; j < ninputs; j++) acc /= ((@I_TYPE@ *) input_items[j])[i]; diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t index 13ec0c8b3..5d270c763 100644 --- a/gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t +++ b/gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t @@ -52,7 +52,7 @@ int int ninputs = input_items.size (); - for (int i = 0; i < noutput_items*d_vlen; i++){ + for (size_t i = 0; i < noutput_items*d_vlen; i++){ @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i]; for (int j = 1; j < ninputs; j++) acc *= ((@I_TYPE@ *) input_items[j])[i]; diff --git a/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t index f0ed75217..1dcdf81ad 100644 --- a/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t +++ b/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t @@ -53,12 +53,12 @@ int int ninputs = input_items.size (); if (ninputs == 1){ // negate - for (int i = 0; i < noutput_items*d_vlen; i++) + for (size_t i = 0; i < noutput_items*d_vlen; i++) *optr++ = (@O_TYPE@) -((@I_TYPE@ *) input_items[0])[i]; } else { - for (int i = 0; i < noutput_items*d_vlen; i++){ + for (size_t i = 0; i < noutput_items*d_vlen; i++){ @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i]; for (int j = 1; j < ninputs; j++) acc -= ((@I_TYPE@ *) input_items[j])[i]; diff --git a/gnuradio-core/src/lib/runtime/gr_preferences.cc b/gnuradio-core/src/lib/runtime/gr_preferences.cc index e0be2db62..5f7412248 100644 --- a/gnuradio-core/src/lib/runtime/gr_preferences.cc +++ b/gnuradio-core/src/lib/runtime/gr_preferences.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003 Free Software Foundation, Inc. + * Copyright 2003,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -77,11 +77,20 @@ gr_preferences::get (const char *key) static char buf[1024]; FILE *fp = fopen (pathname (key), "r"); - if (fp == 0) + if (fp == 0) { + perror (pathname (key)); return 0; + } memset (buf, 0, sizeof (buf)); - fread (buf, 1, sizeof (buf) - 1, fp); + size_t ret = fread (buf, 1, sizeof (buf) - 1, fp); + if(ret == 0) { + if(ferror(fp) != 0) { + perror (pathname (key)); + fclose (fp); + return 0; + } + } fclose (fp); return buf; } @@ -97,6 +106,13 @@ gr_preferences::set (const char *key, const char *value) return; } - fwrite (value, 1, strlen (value), fp); + size_t ret = fwrite (value, 1, strlen (value), fp); + if(ret == 0) { + if(ferror(fp) != 0) { + perror (pathname (key)); + fclose (fp); + return; + } + } fclose (fp); }; diff --git a/gnuradio-core/src/lib/swig/gnuradio.i b/gnuradio-core/src/lib/swig/gnuradio.i index 275467c0e..b29a1e395 100644 --- a/gnuradio-core/src/lib/swig/gnuradio.i +++ b/gnuradio-core/src/lib/swig/gnuradio.i @@ -48,6 +48,8 @@ typedef std::complex<float> gr_complex; typedef std::complex<double> gr_complexd; +typedef unsigned long long uint64_t; +typedef long long int64_t; // instantiate the required template specializations diff --git a/gr-audio-jack/src/audio_jack_sink.cc b/gr-audio-jack/src/audio_jack_sink.cc index 6e39135c9..f28fddc34 100644 --- a/gr-audio-jack/src/audio_jack_sink.cc +++ b/gr-audio-jack/src/audio_jack_sink.cc @@ -105,12 +105,17 @@ audio_jack_sink::audio_jack_sink (int sampling_rate, d_nunderuns (0) { #ifndef NO_PTHREAD - pthread_cond_init(&d_ringbuffer_ready, NULL);; - pthread_mutex_init(&d_jack_process_lock, NULL); + pthread_cond_init(&d_ringbuffer_ready, NULL);; + pthread_mutex_init(&d_jack_process_lock, NULL); #endif - + // try to become a client of the JACK server - if ((d_jack_client = jack_client_new (d_device_name.c_str ())) == 0) { + jack_options_t options = JackNullOption; + jack_status_t status; + const char *server_name = NULL; + if ((d_jack_client = jack_client_open (d_device_name.c_str (), + options, &status, + server_name)) == NULL) { fprintf (stderr, "audio_jack_sink[%s]: jack server not running?\n", d_device_name.c_str()); throw std::runtime_error ("audio_jack_sink"); diff --git a/gr-audio-jack/src/audio_jack_source.cc b/gr-audio-jack/src/audio_jack_source.cc index ca3df51d7..a92e970f5 100644 --- a/gr-audio-jack/src/audio_jack_source.cc +++ b/gr-audio-jack/src/audio_jack_source.cc @@ -110,7 +110,12 @@ audio_jack_source::audio_jack_source (int sampling_rate, #endif // try to become a client of the JACK server - if ((d_jack_client = jack_client_new (d_device_name.c_str ())) == 0) { + jack_options_t options = JackNullOption; + jack_status_t status; + const char *server_name = NULL; + if ((d_jack_client = jack_client_open (d_device_name.c_str (), + options, &status, + server_name)) == NULL) { fprintf (stderr, "audio_jack_source[%s]: jack server not running?\n", d_device_name.c_str()); throw std::runtime_error ("audio_jack_source"); diff --git a/gr-audio-portaudio/src/audio_portaudio_sink.cc b/gr-audio-portaudio/src/audio_portaudio_sink.cc index 9a3baf40e..64e64ccf4 100644 --- a/gr-audio-portaudio/src/audio_portaudio_sink.cc +++ b/gr-audio-portaudio/src/audio_portaudio_sink.cc @@ -102,7 +102,10 @@ portaudio_sink_callback (const void *inputBuffer, else { // underrun self->d_nunderuns++; - ::write(2, "aU", 2); // FIXME change to non-blocking call + ssize_t r = ::write(2, "aU", 2); // FIXME change to non-blocking call + if(r == -1) { + perror("audio_portaudio_source::portaudio_source_callback write error to stderr."); + } // FIXME we should transfer what we've got and pad the rest memset(outputBuffer, 0, nreqd_samples * sizeof(sample_t)); diff --git a/gr-audio-portaudio/src/audio_portaudio_source.cc b/gr-audio-portaudio/src/audio_portaudio_source.cc index 23801a8bf..e508fda22 100644 --- a/gr-audio-portaudio/src/audio_portaudio_source.cc +++ b/gr-audio-portaudio/src/audio_portaudio_source.cc @@ -105,7 +105,10 @@ portaudio_source_callback (const void *inputBuffer, else { // overrun self->d_noverruns++; - ::write(2, "aO", 2); // FIXME change to non-blocking call + ssize_t r = ::write(2, "aO", 2); // FIXME change to non-blocking call + if(r == -1) { + perror("audio_portaudio_source::portaudio_source_callback write error to stderr."); + } self->d_ringbuffer_ready = false; self->d_ringbuffer_cond.notify_one(); // Tell the sink to get going! diff --git a/gr-msdd6000/src/msdd_rs_source_simple.cc b/gr-msdd6000/src/msdd_rs_source_simple.cc index c44808f51..70e692d83 100644 --- a/gr-msdd6000/src/msdd_rs_source_simple.cc +++ b/gr-msdd6000/src/msdd_rs_source_simple.cc @@ -64,7 +64,10 @@ msdd_rs_source_simple::work (int noutput_items, /* Read a buffer out -- looking at UDP payload at this point.*/ rcv->read( &buffer[0], BUF_LEN ); - int seq = *((int*) &buffer[2]); + //int seq = *((int*) &buffer[2]); + int seq; + memcpy(&seq, &buffer[2], 4*sizeof(char)); + char type = buffer[0]; //printf("Sequence %d\n",seq); diff --git a/gr-msdd6000/src/msdd_source_simple.cc b/gr-msdd6000/src/msdd_source_simple.cc index 076a305f1..20b15c43d 100644 --- a/gr-msdd6000/src/msdd_source_simple.cc +++ b/gr-msdd6000/src/msdd_source_simple.cc @@ -64,7 +64,9 @@ msdd_source_simple::work (int noutput_items, char buffer[BUF_LEN]; rcv->read( &buffer[0], BUF_LEN ); - int seq = *((int*) &buffer[2]); + //int seq = *((int*) &buffer[2]); + int seq; + memcpy(&seq, &buffer[2], 4*sizeof(char)); if(d_lastseq == -MSDD_COMPLEX_SAMPLES_PER_PACKET){ // not started case diff --git a/gr-trellis/src/lib/fsm.cc b/gr-trellis/src/lib/fsm.cc index c65b13456..5950b56b9 100644 --- a/gr-trellis/src/lib/fsm.cc +++ b/gr-trellis/src/lib/fsm.cc @@ -86,16 +86,30 @@ fsm::fsm(const char *name) if((fsmfile=fopen(name,"r"))==NULL) throw std::runtime_error ("fsm::fsm(const char *name): file open error\n"); //printf("file open error in fsm()\n"); + + if(fscanf(fsmfile,"%d %d %d\n",&d_I,&d_S,&d_O) == EOF) { + if(ferror(fsmfile) != 0) + throw std::runtime_error ("fsm::fsm(const char *name): file read error\n"); + } - fscanf(fsmfile,"%d %d %d\n",&d_I,&d_S,&d_O); d_NS.resize(d_I*d_S); d_OS.resize(d_I*d_S); for(int i=0;i<d_S;i++) { - for(int j=0;j<d_I;j++) fscanf(fsmfile,"%d",&(d_NS[i*d_I+j])); + for(int j=0;j<d_I;j++) { + if(fscanf(fsmfile,"%d",&(d_NS[i*d_I+j])) == EOF) { + if(ferror(fsmfile) != 0) + throw std::runtime_error ("fsm::fsm(const char *name): file read error\n"); + } + } } for(int i=0;i<d_S;i++) { - for(int j=0;j<d_I;j++) fscanf(fsmfile,"%d",&(d_OS[i*d_I+j])); + for(int j=0;j<d_I;j++) { + if(fscanf(fsmfile,"%d",&(d_OS[i*d_I+j])) == EOF) { + if(ferror(fsmfile) != 0) + throw std::runtime_error ("fsm::fsm(const char *name): file read error\n"); + } + } } generate_PS_PI(); diff --git a/gr-trellis/src/lib/interleaver.cc b/gr-trellis/src/lib/interleaver.cc index 077416f80..ff15eeadc 100644 --- a/gr-trellis/src/lib/interleaver.cc +++ b/gr-trellis/src/lib/interleaver.cc @@ -75,11 +75,20 @@ interleaver::interleaver(const char *name) throw std::runtime_error ("file open error in interleaver()"); //printf("file open error in interleaver()\n"); - fscanf(interleaverfile,"%d\n",&d_K); + if(fscanf(interleaverfile,"%d\n",&d_K) == EOF) { + if(ferror(interleaverfile) != 0) + throw std::runtime_error ("interleaver::interleaver(const char *name): file read error\n"); + } + d_INTER.resize(d_K); d_DEINTER.resize(d_K); - for(int i=0;i<d_K;i++) fscanf(interleaverfile,"%d",&(d_INTER[i])); + for(int i=0;i<d_K;i++) { + if(fscanf(interleaverfile,"%d",&(d_INTER[i])) == EOF) { + if(ferror(interleaverfile) != 0) + throw std::runtime_error ("interleaver::interleaver(const char *name): file read error\n"); + } + } // generate DEINTER table for(int i=0;i<d_K;i++) { diff --git a/usrp/doc/Doxyfile.in b/usrp/doc/Doxyfile.in index 5043b1471..33c5bcf03 100644 --- a/usrp/doc/Doxyfile.in +++ b/usrp/doc/Doxyfile.in @@ -73,16 +73,6 @@ CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English -# This tag can be used to specify the encoding used in the generated output. -# The encoding is not always determined by the language that is chosen, -# but also whether or not the output is meant for Windows or non-Windows users. -# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES -# forces the Windows encoding (this is the default for the Windows binary), -# whereas setting the tag to NO uses a Unix-style encoding (the default for -# all platforms other than Windows). - -USE_WINDOWS_ENCODING = NO - # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). @@ -167,13 +157,6 @@ JAVADOC_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO -# If the DETAILS_AT_TOP tag is set to YES then Doxygen -# will output the detailed description near the top, like JavaDoc. -# If set to NO, the detailed description appears after the member -# documentation. - -DETAILS_AT_TOP = YES - # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. @@ -1118,32 +1101,40 @@ DOT_PATH = DOTFILE_DIRS = -# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. -MAX_DOT_GRAPH_WIDTH = 1024 +DOT_GRAPH_MAX_NODES = 50 -# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. -MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 0 -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes that -# lay further from the root node will be omitted. Note that setting this option to -# 1 or 2 may greatly reduce the computation time needed for large code bases. Also -# note that a graph may be further truncated if the graph's image dimensions are -# not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT). -# If 0 is used for the depth value (the default), the graph is not depth-constrained. +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). -MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and |