Change type of gr_head nitems parameter to unsigned long long.
authorEric Blossom <eb@comsec.com>
Tue, 8 Dec 2009 02:58:07 +0000 (18:58 -0800)
committerEric Blossom <eb@comsec.com>
Tue, 8 Dec 2009 02:58:07 +0000 (18:58 -0800)
Patch from Martin Braun <martin.braun@kit.edu> to support
nitems >= 2**32.

gnuradio-core/src/lib/general/gr_head.cc
gnuradio-core/src/lib/general/gr_head.h
gnuradio-core/src/lib/general/gr_head.i

index 01035ffcdac02ad0ef15641921b2f7850d564221..b52735c06eb39705ea08e78a68e6005474a5f035 100644 (file)
@@ -27,7 +27,7 @@
 #include <gr_io_signature.h>
 #include <string.h>
 
-gr_head::gr_head (size_t sizeof_stream_item, int nitems)
+gr_head::gr_head (size_t sizeof_stream_item, unsigned long long nitems)
   : gr_sync_block ("head",
                   gr_make_io_signature (1, 1, sizeof_stream_item),
                   gr_make_io_signature (1, 1, sizeof_stream_item)),
@@ -36,7 +36,7 @@ gr_head::gr_head (size_t sizeof_stream_item, int nitems)
 }
 
 gr_head_sptr
-gr_make_head (size_t sizeof_stream_item, int nitems)
+gr_make_head (size_t sizeof_stream_item, unsigned long long nitems)
 {
   return gnuradio::get_initial_sptr(new gr_head (sizeof_stream_item, nitems));
 }
@@ -49,7 +49,7 @@ gr_head::work (int noutput_items,
   if (d_ncopied_items >= d_nitems)
     return -1;                         // Done!
 
-  unsigned n = std::min (d_nitems - d_ncopied_items, noutput_items);
+  unsigned n = std::min (d_nitems - d_ncopied_items, (unsigned long long) noutput_items);
   
   if (n == 0)
     return 0;
index 430d5f8b9644df8ff7b5d06d98bdc3f88a15994c..f7eee10648e3f354455844272f8785ae9af6e571 100644 (file)
@@ -38,11 +38,11 @@ typedef boost::shared_ptr<gr_head> gr_head_sptr;
 
 class gr_head : public gr_sync_block
 {
-  friend gr_head_sptr gr_make_head (size_t sizeof_stream_item, int nitems);
-  gr_head (size_t sizeof_stream_item, int nitems);
+  friend gr_head_sptr gr_make_head (size_t sizeof_stream_item, unsigned long long nitems);
+  gr_head (size_t sizeof_stream_item, unsigned long long nitems);
 
-  int  d_nitems;
-  int  d_ncopied_items;
+  unsigned long long   d_nitems;
+  unsigned long long   d_ncopied_items;
 
  public:
   int work (int noutput_items,
@@ -53,7 +53,7 @@ class gr_head : public gr_sync_block
 };
 
 gr_head_sptr
-gr_make_head (size_t sizeof_stream_item, int nitems);
+gr_make_head (size_t sizeof_stream_item, unsigned long long nitems);
 
 
 #endif /* INCLUDED_GR_HEAD_H */
index 2a88b885f010dd041b69d48f58daf5a7e6bfcd0e..3aece9601c16a039a8cee0acba922550ad350279 100644 (file)
@@ -22,7 +22,7 @@
 
 GR_SWIG_BLOCK_MAGIC(gr,head);
 
-gr_head_sptr gr_make_head(size_t sizeof_stream_item, int nitems);
+gr_head_sptr gr_make_head(size_t sizeof_stream_item, unsigned long long nitems);
 
 class gr_head : public gr_block {
   gr_head();