[casacore] r21596 committed - Use iostream instead of format to avoid problems with long long on 32-...

3 views
Skip to first unread message

casa...@googlecode.com

unread,
Mar 30, 2015, 6:43:16 AM3/30/15
to casacor...@googlegroups.com
Revision: 21596
Author: gervandiepen
Date: Mon Mar 30 10:42:56 2015 UTC
Log: Use iostream instead of format to avoid problems with long long
on 32-bit

https://code.google.com/p/casacore/source/detail?r=21596

Modified:
/branches/nov14/casa/IO/MemoryIO.cc
/branches/nov14/casa/IO/test/tAipsIO.cc

=======================================
--- /branches/nov14/casa/IO/MemoryIO.cc Wed Dec 10 08:06:42 2014 UTC
+++ /branches/nov14/casa/IO/MemoryIO.cc Mon Mar 30 10:42:56 2015 UTC
@@ -29,6 +29,8 @@
#include <casacore/casa/IO/MemoryIO.h>
#include <casacore/casa/Utilities/Assert.h>
#include <casacore/casa/Exceptions/Error.h>
+#include <iostream>
+#include <sstream>
#include <cstring> //# for memcpy with gcc-4.3

namespace casacore { //# NAMESPACE CASACORE - BEGIN
@@ -136,16 +138,20 @@
memcpy (buf, itsBuffer + itsPosition, bytesRead);
itsPosition += bytesLeft;
if (throwException) {
- String m = String::format ("MemoryIO::read - incorrect number of
bytes read:\n"
- " size=%u, used=%lld, pos=%lld,
left=%lld",
- size, itsUsed, itsPosition, bytesLeft);
- throw (AipsError (m));
+ std::ostringstream oss;
+ oss << "MemoryIO::read - incorrect number of bytes read: "
+ << std::endl
+ << " size=" << size << ", used=" << itsUsed
+ << ", pos=" << itsPosition << ", left=" << bytesLeft;
+ throw AipsError (oss.str());
}
} else {
- String m = String::format ("MemoryIO::read - buffer position is
invalid:\n"
- " size=%u, used=%lld, pos=%lld,
left=%lld",
- size, itsUsed, itsPosition, bytesLeft);
- throw (AipsError (m));
+ std::ostringstream oss;
+ oss << "MemoryIO::read - buffer position is invalid:"
+ << std::endl
+ << " size=" << size << ", used=" << itsUsed
+ << ", pos=" << itsPosition << ", left=" << bytesLeft;
+ throw AipsError (oss.str());
}
}
return bytesRead;
=======================================
--- /branches/nov14/casa/IO/test/tAipsIO.cc Tue Mar 24 14:43:31 2015 UTC
+++ /branches/nov14/casa/IO/test/tAipsIO.cc Mon Mar 30 10:42:56 2015 UTC
@@ -31,7 +31,6 @@
#include <casacore/casa/IO/MemoryIO.h>
#include <casacore/casa/IO/RawIO.h>
#include <casacore/casa/IO/MultiFile.h>
-#include <casacore/casa/IO/MultiHDF5.h>
#include <casacore/casa/BasicSL/Complex.h>
#include <casacore/casa/BasicSL/String.h>
#include <casacore/casa/Exceptions/Error.h>
Reply all
Reply to author
Forward
0 new messages