this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Still on track to fix some fstream ABI issues

+56 -13
+3 -3
etc/dylib.conf
··· 1 1 [aliases] 2 2 /usr/lib/libSystem.B.dylib=libSystem.B.dylib.so 3 3 /usr/lib/libobjc.A.dylib=libobjc.A.dylib.so 4 - libintl.8.dylib=libSystem.B.dylib.so 5 - libiconv.2.dylib=libSystem.B.dylib.so 4 + /usr/lib/libintl.8.dylib=libc.so.6 6 5 /usr/lib/libz.1.dylib=libz.so.1 7 - /usr/lib/libstdc++.6.dylib=libSystem.B.dylib.so 6 + /usr/lib/libstdc++.6.dylib=libstdc++.so.6 8 7 /usr/lib/libcrypto.0.9.8.dylib=libcrypto.so 9 8 /usr/lib/libgcc_s.1.dylib=libgcc_s.so 10 9 /usr/lib/libbz2.1.0.dylib=libbz2.so.1 10 + /usr/lib/libiconv.2.dylib=libc.so.6 11 11 #libncurses.5.4.dylib=libncurses.so.5 12 12 /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation=libCoreFoundation.so 13 13 /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices=libCoreServices.so
+10
src/libSystem/libc/stdio.cpp
··· 17 17 #include <limits.h> 18 18 #include <typeinfo> 19 19 #include "log.h" 20 + #include <ext/stdio_filebuf.h> 21 + 22 + template class __gnu_cxx::stdio_filebuf<char, std::char_traits<char> >; 23 + template class std::basic_filebuf<char, std::char_traits<char> >; 20 24 21 25 extern char g_sysroot[PATH_MAX]; 22 26 ··· 401 405 return pThis->sys_open(f->linux_fp, mode); 402 406 } 403 407 408 + extern "C" void _ZN9__gnu_cxx13stdio_filebufIcSt11char_traitsIcEEC1EP8_IO_FILESt13_Ios_Openmodem(__gnu_cxx::stdio_filebuf<char, std::char_traits<char> >* pThis, FILE* f, std::_Ios_Openmode m, unsigned long l); 409 + void _ZN9__gnu_cxx13stdio_filebufIcSt11char_traitsIcEEC1EP7__sFILESt13_Ios_Openmodem(__gnu_cxx::stdio_filebuf<char, std::char_traits<char> >* pThis, __darwin_FILE* f, std::_Ios_Openmode m, unsigned long l) 410 + { 411 + _ZN9__gnu_cxx13stdio_filebufIcSt11char_traitsIcEEC1EP8_IO_FILESt13_Ios_Openmodem(pThis, f->linux_fp, m, l); 412 + } 413 +
+2
src/libSystem/libc/stdio.h
··· 4 4 #include <stdarg.h> 5 5 #include <wchar.h> 6 6 #include <bits/basic_file.h> 7 + #include <ext/stdio_filebuf.h> 7 8 8 9 /* stdio buffers */ 9 10 struct __darwin_sbuf ··· 113 114 int __darwin_remove(const char* path); 114 115 115 116 std::__basic_file<char>* _ZNSt12__basic_fileIcE8sys_openEP7__sFILESt13_Ios_Openmode(std::__basic_file<char>* pThis, __darwin_FILE* f, std::ios_base::openmode mode); 117 + void _ZN9__gnu_cxx13stdio_filebufIcSt11char_traitsIcEEC1EP7__sFILESt13_Ios_Openmodem(__gnu_cxx::stdio_filebuf<char, std::char_traits<char> >* pThis, __darwin_FILE* f, std::_Ios_Openmode m, unsigned long l); 116 118 117 119 } 118 120
+41 -10
tests/src/fstream.cpp
··· 1 + // CFLAGS: -O3 1 2 #include <fstream> 2 3 #include <iostream> 3 4 #include <unistd.h> ··· 5 6 #include <cstdio> 6 7 #include <ext/stdio_filebuf.h> 7 8 9 + void printFile(const char* path); 10 + void test1(); 11 + void test2(); 12 + 13 + char text[8001] = ""; 14 + const char* file = "/tmp/__test123"; 15 + 8 16 int main() 9 17 { 10 18 //__gnu_cxx::stdio_filebuf<char> out; 11 - std::ifstream in; 12 - const char* text = "Hello world"; 19 + char text[8001] = ""; 13 20 const char* file = "/tmp/__test123"; 14 - char buf[100]; 21 + 22 + for (int i = 0; i < 800; i++) 23 + memcpy(text+i*10, "1234567890", 11); 15 24 16 - //out.open(file, std::ios_base::out | std::ios_base::binary); 25 + test1(); 26 + test2(); 27 + 28 + return 0; 29 + } 30 + 31 + void test1() 32 + { 17 33 __gnu_cxx::stdio_filebuf<char> out(fopen(file, "w+b"), std::ios_base::out|std::ios_base::binary); 18 34 out.sputn(text, strlen(text)); 19 35 out.close(); 20 36 21 - in.open(file); 22 - in.getline(buf, 100); 37 + printFile(file); 38 + } 39 + 40 + void test2() 41 + { 42 + std::filebuf out2; 43 + out2.open(file, std::ios_base::binary|std::ios_base::in|std::ios_base::out|std::ios_base::trunc); 44 + out2.sputn(text, strlen(text)); 45 + out2.close(); 46 + 47 + printFile(file); 48 + } 49 + 50 + void printFile(const char* path) 51 + { 52 + std::ifstream in; 53 + char buf[8001]; 54 + 55 + in.open(path); 56 + in.getline(buf, sizeof(buf)); 23 57 in.close(); 24 58 25 - std::cout << "sizeof: " << sizeof(out) << std::endl; 26 59 std::cout << buf << std::endl; 27 - unlink(file); 28 - 29 - return 0; 60 + unlink(path); 30 61 } 31 62