diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-07-16 20:38:04 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-07-16 20:38:04 -0500 |
commit | e7ef2071e5f64e1a34201961592750a410060f1f (patch) | |
tree | 35bf14da99e4fdad4415cddbcb4a2f15d1c2538a /lib | |
parent | a0d24dbcfc9eb4f6caa6dc96f345183e3851f7af (diff) | |
download | ulab-e7ef2071e5f64e1a34201961592750a410060f1f.tar.gz ulab-e7ef2071e5f64e1a34201961592750a410060f1f.zip |
Streamline code and fix scope capture
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libtqtrla/src/tqtrla.cpp | 50 |
1 files changed, 4 insertions, 46 deletions
diff --git a/lib/libtqtrla/src/tqtrla.cpp b/lib/libtqtrla/src/tqtrla.cpp index b3fc1ec..711804e 100644 --- a/lib/libtqtrla/src/tqtrla.cpp +++ b/lib/libtqtrla/src/tqtrla.cpp @@ -326,30 +326,9 @@ TQDataStream &operator<<( TQDataStream &s, const TQFloatArray &data ) { TQ_UINT32 i; TQ_UINT32 count = data.count(); s << count; - - TQIODevice* dev = s.device(); - if (dev) { - // This uses the channel efficiently by writing all the data in one large block - TQBuffer ba; - ba.open(IO_ReadWrite); - TQDataStream ds(&ba); - ds.setPrintableData(s.isPrintableData()); - - for (i=0; i<count; i++) { - ds << data[i]; - } - - ba.close(); - TQByteArray buffer = ba.buffer(); - dev->writeBlock(buffer.data(), buffer.size()); - } - else { - // This uses the channel inefficiently by writing the data in byte-sized chunks - for (i=0; i<count; i++) { - s << data[i]; - } + for (i=0; i<count; i++) { + s << data[i]; } - return s; } @@ -368,30 +347,9 @@ TQDataStream &operator<<( TQDataStream &s, const TQDoubleArray &data ) { TQ_UINT32 i; TQ_UINT32 count = data.count(); s << count; - - TQIODevice* dev = s.device(); - if (dev) { - // This uses the channel efficiently by writing all the data in one large block - TQBuffer ba; - ba.open(IO_ReadWrite); - TQDataStream ds(&ba); - ds.setPrintableData(s.isPrintableData()); - - for (i=0; i<count; i++) { - ds << data[i]; - } - - ba.close(); - TQByteArray buffer = ba.buffer(); - dev->writeBlock(buffer.data(), buffer.size()); - } - else { - // This uses the channel inefficiently by writing the data in byte-sized chunks - for (i=0; i<count; i++) { - s << data[i]; - } + for (i=0; i<count; i++) { + s << data[i]; } - return s; } |