===================================================================
@@ -1638,10 +1638,10 @@
union
{
- FILE* _M_file;
- mt19937 _M_mt;
+ void* _M_file;
+ mt19937 _M_mt;
+ };
};
- };
/* @} */ // group random_generators
===================================================================
@@ -36,7 +36,6 @@
#else
#include <cmath>
-#include <cstdio> // For FILE
#include <cstdlib>
#include <string>
#include <iosfwd>
===================================================================
@@ -30,6 +30,8 @@
# include <cpuid.h>
#endif
+#include <cstdio>
+
#ifdef _GLIBCXX_HAVE_UNISTD_H
# include <unistd.h>
#endif
@@ -102,7 +104,7 @@
std::__throw_runtime_error(__N("random_device::"
"random_device(const std::string&)"));
- _M_file = std::fopen(fname, "rb");
+ _M_file = reinterpret_cast<void*>(std::fopen(fname, "rb"));
if (! _M_file)
goto fail;
}
@@ -117,7 +119,7 @@
random_device::_M_fini()
{
if (_M_file)
- std::fclose(_M_file);
+ std::fclose(reinterpret_cast<FILE*>(_M_file));
}
random_device::result_type
@@ -130,10 +132,11 @@
result_type __ret;
#ifdef _GLIBCXX_HAVE_UNISTD_H
- read(fileno(_M_file), reinterpret_cast<void*>(&__ret), sizeof(result_type));
+ read(fileno(reinterpret_cast<FILE*>(_M_file)),
+ reinterpret_cast<void*>(&__ret), sizeof(result_type));
#else
std::fread(reinterpret_cast<void*>(&__ret), sizeof(result_type),
- 1, _M_file);
+ 1, reinterpret_cast<FILE*>(_M_file));
#endif
return __ret;
}