aboutsummaryrefslogtreecommitdiffstats
path: root/main/uclibc++/008-integer_width.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/uclibc++/008-integer_width.patch')
-rw-r--r--main/uclibc++/008-integer_width.patch314
1 files changed, 314 insertions, 0 deletions
diff --git a/main/uclibc++/008-integer_width.patch b/main/uclibc++/008-integer_width.patch
new file mode 100644
index 0000000000..c467e60114
--- /dev/null
+++ b/main/uclibc++/008-integer_width.patch
@@ -0,0 +1,314 @@
+Index: uClibc++-0.2.2/include/ostream
+===================================================================
+--- uClibc++-0.2.2/include/ostream (revision 708)
++++ uClibc++-0.2.2/include/ostream (revision 709)
+@@ -129,6 +129,18 @@
+ return *this;
+ }
+
++ _UCXXEXPORT void printout(const char_type* s, streamsize n)
++ {
++ int extra = ios::width() - n;
++ if ((ios::flags()&ios::adjustfield) == ios::right)
++ while (extra-- > 0)
++ put(ios::fill());
++ write(s, n);
++ if ((ios::flags()&ios::adjustfield) == ios::left)
++ while (extra-- > 0)
++ put(ios::fill());
++ }
++
+ protected:
+ basic_ostream(const basic_ostream<charT,traits> &){ }
+ basic_ostream<charT,traits> & operator=(const basic_ostream<charT,traits> &){ return *this; }
+@@ -142,15 +154,15 @@
+ sentry s(*this);
+ if( basic_ios<charT,traits>::flags() & ios_base::boolalpha){
+ if(n){
+- write("true", 4);
++ printout("true", 4);
+ }else{
+- write("false", 5);
++ printout("false", 5);
+ }
+ }else{
+ if(n){
+- write("1", 1);
++ printout("1", 1);
+ }else{
+- write("0", 1);
++ printout("0", 1);
+ }
+ }
+ if(basic_ios<charT,traits>::flags() & ios_base::unitbuf){
+@@ -219,7 +231,7 @@
+ template <class charT, class traits> _UCXXEXPORT basic_ostream<charT,traits>& basic_ostream<charT, traits>::operator<<(void* p){
+ sentry s(*this);
+ char buffer[20];
+- write(buffer, snprintf(buffer, 20, "%p", p) );
++ printout(buffer, snprintf(buffer, 20, "%p", p) );
+ if(basic_ios<charT,traits>::flags() & ios_base::unitbuf){
+ flush();
+ }
+@@ -356,7 +368,7 @@
+ operator<<(basic_ostream<charT,traits>& out, const charT* c)
+ {
+ typename basic_ostream<charT,traits>::sentry s(out);
+- out.write(c, traits::length(c) );
++ out.printout(c, traits::length(c) );
+ return out;
+ }
+
+@@ -364,7 +376,7 @@
+ operator<<(basic_ostream<charT,traits>& out, const char* c)
+ {
+ typename basic_ostream<charT,traits>::sentry s(out);
+- out.write(c, char_traits<char>::length(c) );
++ out.printout(c, char_traits<char>::length(c) );
+ return out;
+ }
+
+@@ -373,7 +385,7 @@
+ operator<<(basic_ostream<char,traits>& out, const char* c)
+ {
+ typename basic_ostream<char,traits>::sentry s(out);
+- out.write(c, traits::length(c));
++ out.printout(c, traits::length(c));
+ return out;
+ }
+
+@@ -389,7 +401,7 @@
+ temp[i] = out.widen(c[i]);
+ }
+
+- out.write(temp, numChars);
++ out.printout(temp, numChars);
+ return out;
+ }
+ #endif
+@@ -399,7 +411,7 @@
+ operator<<(basic_ostream<char,traits>& out, const signed char* c)
+ {
+ typename basic_ostream<char,traits>::sentry s(out);
+- out.write(reinterpret_cast<const char *>(c), traits::length( reinterpret_cast<const char *>(c)));
++ out.printout(reinterpret_cast<const char *>(c), traits::length( reinterpret_cast<const char *>(c)));
+ return out;
+ }
+
+@@ -407,7 +419,7 @@
+ operator<<(basic_ostream<char,traits>& out, const unsigned char* c)
+ {
+ typename basic_ostream<char,traits>::sentry s(out);
+- out.write(reinterpret_cast<const char *>(c), traits::length( reinterpret_cast<const char *>(c)));
++ out.printout(reinterpret_cast<const char *>(c), traits::length( reinterpret_cast<const char *>(c)));
+ return out;
+ }
+
+Index: uClibc++-0.2.2/include/ostream_helpers
+===================================================================
+--- uClibc++-0.2.2/include/ostream_helpers (revision 708)
++++ uClibc++-0.2.2/include/ostream_helpers (revision 709)
+@@ -88,7 +88,7 @@
+ }
+ }
+
+- stream.write(buffer, snprintf(buffer, 20, formatString, n) );
++ stream.printout(buffer, snprintf(buffer, 20, formatString, n) );
+
+ if(stream.flags() & ios_base::unitbuf){
+ stream.flush();
+@@ -135,7 +135,7 @@
+ }
+ }
+
+- stream.write(buffer, snprintf(buffer, 20, formatString, n));
++ stream.printout(buffer, snprintf(buffer, 20, formatString, n));
+ if(stream.flags() & ios_base::unitbuf){
+ stream.flush();
+ }
+@@ -182,7 +182,7 @@
+ }
+ }
+
+- stream.write(buffer, snprintf(buffer, 27, formatString, n) );
++ stream.printout(buffer, snprintf(buffer, 27, formatString, n) );
+
+ if(stream.flags() & ios_base::unitbuf){
+ stream.flush();
+@@ -228,7 +228,7 @@
+ }
+ }
+
+- stream.write(buffer, snprintf(buffer, 27, formatString, n) );
++ stream.printout(buffer, snprintf(buffer, 27, formatString, n) );
+
+ if(stream.flags() & ios_base::unitbuf){
+ stream.flush();
+@@ -256,7 +256,7 @@
+ } else {
+ length = snprintf(buffer, 32, "%*.*g",static_cast<int>(stream.width()),static_cast<int>(stream.precision()), f);
+ }
+- stream.write(buffer, length);
++ stream.printout(buffer, length);
+ if(stream.flags() & ios_base::unitbuf){
+ stream.flush();
+ }
+@@ -280,7 +280,7 @@
+ } else {
+ length = snprintf(buffer, 32, "%*.*Lg", static_cast<int>(stream.width()), static_cast<int>(stream.precision()), f);
+ }
+- stream.write(buffer, length);
++ stream.printout(buffer, length);
+ if(stream.flags() & ios_base::unitbuf){
+ stream.flush();
+ }
+@@ -295,25 +295,25 @@
+ {
+ wchar_t buffer[20];
+ if( stream.flags() & ios_base::dec){
+- stream.write(buffer, swprintf(buffer, 20, L"%ld", n));
++ stream.printout(buffer, swprintf(buffer, 20, L"%ld", n));
+ }else if( stream.flags() & ios_base::oct){
+ if( stream.flags() & ios_base::showbase){
+- stream.write(buffer, swprintf(buffer, 20, L"%#lo", n));
++ stream.printout(buffer, swprintf(buffer, 20, L"%#lo", n));
+ }else{
+- stream.write(buffer, swprintf(buffer, 20, L"%lo", n) );
++ stream.printout(buffer, swprintf(buffer, 20, L"%lo", n) );
+ }
+ }else if (stream.flags() & ios_base::hex){
+ if(stream.flags() & ios_base::showbase){
+ if(stream.flags() & ios_base::uppercase){
+- stream.write(buffer, swprintf(buffer, 20, L"%#lX", n) );
++ stream.printout(buffer, swprintf(buffer, 20, L"%#lX", n) );
+ }else{
+- stream.write(buffer, swprintf(buffer, 20, L"%#lx", n) );
++ stream.printout(buffer, swprintf(buffer, 20, L"%#lx", n) );
+ }
+ }else{
+ if(stream.flags() & ios_base::uppercase){
+- stream.write(buffer, swprintf(buffer, 20, L"%lX", n) );
++ stream.printout(buffer, swprintf(buffer, 20, L"%lX", n) );
+ }else{
+- stream.write(buffer, swprintf(buffer, 20, L"%lx", n) );
++ stream.printout(buffer, swprintf(buffer, 20, L"%lx", n) );
+ }
+ }
+ }
+@@ -329,25 +329,25 @@
+ {
+ wchar_t buffer[20];
+ if( stream.flags() & ios_base::dec){
+- stream.write(buffer, swprintf(buffer, 20, L"%lu", n));
++ stream.printout(buffer, swprintf(buffer, 20, L"%lu", n));
+ }else if( stream.flags() & ios_base::oct){
+ if( stream.flags() & ios_base::showbase){
+- stream.write(buffer, swprintf(buffer, 20, L"%#lo", n));
++ stream.printout(buffer, swprintf(buffer, 20, L"%#lo", n));
+ }else{
+- stream.write(buffer, swprintf(buffer, 20, L"%lo", n) );
++ stream.printout(buffer, swprintf(buffer, 20, L"%lo", n) );
+ }
+ }else if (stream.flags() & ios_base::hex){
+ if(stream.flags() & ios_base::showbase){
+ if(stream.flags() & ios_base::uppercase){
+- stream.write(buffer, swprintf(buffer, 20, L"%#lX", n) );
++ stream.printout(buffer, swprintf(buffer, 20, L"%#lX", n) );
+ }else{
+- stream.write(buffer, swprintf(buffer, 20, L"%#lx", n) );
++ stream.printout(buffer, swprintf(buffer, 20, L"%#lx", n) );
+ }
+ }else{
+ if(stream.flags() & ios_base::uppercase){
+- stream.write(buffer, swprintf(buffer, 20, L"%lX", n) );
++ stream.printout(buffer, swprintf(buffer, 20, L"%lX", n) );
+ }else{
+- stream.write(buffer, swprintf(buffer, 20, L"%lx", n) );
++ stream.printout(buffer, swprintf(buffer, 20, L"%lx", n) );
+ }
+ }
+ }
+@@ -365,25 +365,25 @@
+ {
+ wchar_t buffer[28];
+ if( stream.flags() & ios_base::dec){
+- stream.write(buffer, swprintf(buffer, 27, L"%lld", n));
++ stream.printout(buffer, swprintf(buffer, 27, L"%lld", n));
+ }else if( stream.flags() & ios_base::oct){
+ if( stream.flags() & ios_base::showbase){
+- stream.write(buffer, swprintf(buffer, 27, L"%#llo", n));
++ stream.printout(buffer, swprintf(buffer, 27, L"%#llo", n));
+ }else{
+- stream.write(buffer, swprintf(buffer, 27, L"%llo", n) );
++ stream.printout(buffer, swprintf(buffer, 27, L"%llo", n) );
+ }
+ }else if (stream.flags() & ios_base::hex){
+ if(stream.flags() & ios_base::showbase){
+ if(stream.flags() & ios_base::uppercase){
+- stream.write(buffer, swprintf(buffer, 27, L"%#llX", n) );
++ stream.printout(buffer, swprintf(buffer, 27, L"%#llX", n) );
+ }else{
+- stream.write(buffer, swprintf(buffer, 27, L"%#llx", n) );
++ stream.printout(buffer, swprintf(buffer, 27, L"%#llx", n) );
+ }
+ }else{
+ if(stream.flags() & ios_base::uppercase){
+- stream.write(buffer, swprintf(buffer, 27, L"%llX", n) );
++ stream.printout(buffer, swprintf(buffer, 27, L"%llX", n) );
+ }else{
+- stream.write(buffer, swprintf(buffer, 27, L"%llx", n) );
++ stream.printout(buffer, swprintf(buffer, 27, L"%llx", n) );
+ }
+ }
+ }
+@@ -399,25 +399,25 @@
+ {
+ wchar_t buffer[28];
+ if( stream.flags() & ios_base::dec){
+- stream.write(buffer, swprintf(buffer, 27, L"%llu", n));
++ stream.printout(buffer, swprintf(buffer, 27, L"%llu", n));
+ }else if( stream.flags() & ios_base::oct){
+ if( stream.flags() & ios_base::showbase){
+- stream.write(buffer, swprintf(buffer, 27, L"%#llo", n));
++ stream.printout(buffer, swprintf(buffer, 27, L"%#llo", n));
+ }else{
+- stream.write(buffer, swprintf(buffer, 27, L"%llo", n) );
++ stream.printout(buffer, swprintf(buffer, 27, L"%llo", n) );
+ }
+ }else if (stream.flags() & ios_base::hex){
+ if(stream.flags() & ios_base::showbase){
+ if(stream.flags() & ios_base::uppercase){
+- stream.write(buffer, swprintf(buffer, 27, L"%#llX", n) );
++ stream.printout(buffer, swprintf(buffer, 27, L"%#llX", n) );
+ }else{
+- stream.write(buffer, swprintf(buffer, 27, L"%#llx", n) );
++ stream.printout(buffer, swprintf(buffer, 27, L"%#llx", n) );
+ }
+ }else{
+ if(stream.flags() & ios_base::uppercase){
+- stream.write(buffer, swprintf(buffer, 27, L"%llX", n) );
++ stream.printout(buffer, swprintf(buffer, 27, L"%llX", n) );
+ }else{
+- stream.write(buffer, swprintf(buffer, 27, L"%llx", n) );
++ stream.printout(buffer, swprintf(buffer, 27, L"%llx", n) );
+ }
+ }
+ }
+@@ -447,7 +447,7 @@
+ } else {
+ swprintf(format_string, 32, L"%%%u.%ug", static_cast<int>(stream.width()), static_cast<unsigned int>(stream.precision()));
+ }
+- stream.write(buffer, swprintf(buffer, 32, format_string, f) );
++ stream.printout(buffer, swprintf(buffer, 32, format_string, f) );
+ if(stream.flags() & ios_base::unitbuf){
+ stream.flush();
+ }
+@@ -471,7 +471,7 @@
+ } else {
+ swprintf(format_string, 32, L"%%%u.%uLg", static_cast<unsigned int>(stream.width()), static_cast<unsigned int>(stream.precision()));
+ }
+- stream.write(buffer, swprintf(buffer, 32, format_string, f) );
++ stream.printout(buffer, swprintf(buffer, 32, format_string, f) );
+ if(stream.flags() & ios_base::unitbuf){
+ stream.flush();
+ }