File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ namespace fileop {
137137 }
138138
139139 const auto buf_size = 1024 * 1024 * 4 ;
140- auto bufs = std::make_unique_for_overwrite <char []>( buf_size);
140+ std::unique_ptr <char , decltype (&std::free)> bufs (( char *) std::malloc ( buf_size), &std::free );
141141
142142 while (file.read (bufs.get (),buf_size) || file.gcount () > 0 )
143143 {
Original file line number Diff line number Diff line change @@ -269,7 +269,7 @@ namespace xlogging_compress__ {
269269 using gzFileType = typename std::remove_pointer<gzFile>::type;
270270 std::unique_ptr<gzFileType, closegz_deleter> gz_closer (out);
271271
272- auto bufs = std::make_unique_for_overwrite <char []>( LOGGING_GZ_BUFLEN);
272+ std::unique_ptr <char , decltype (&std::free)> bufs (( char *) std::malloc ( LOGGING_GZ_BUFLEN), &std::free );
273273 char * buf = bufs.get ();
274274 int len;
275275
Original file line number Diff line number Diff line change @@ -3091,8 +3091,8 @@ R"x*x*x(<html>
30913091
30923092 constexpr auto buf_size = 512 * 1024 ;
30933093
3094- auto buf0 = std::make_unique_for_overwrite <char []>( buf_size);
3095- auto buf1 = std::make_unique_for_overwrite <char []>( buf_size);
3094+ std::unique_ptr <char , decltype (&std::free)> buf0 (( char *) std::malloc ( buf_size), &std::free );
3095+ std::unique_ptr <char , decltype (&std::free)> buf1 (( char *) std::malloc ( buf_size), &std::free );
30963096
30973097 // 分别使用主从缓冲指针用于并发读写.
30983098 auto primary_buf = buf0.get ();
@@ -4284,7 +4284,7 @@ R"x*x*x(<html>
42844284 if (m_option.tcp_rate_limit_ > 0 && m_option.tcp_rate_limit_ < buf_size)
42854285 buf_size = m_option.tcp_rate_limit_ ;
42864286
4287- auto bufs = std::make_unique_for_overwrite <char []>( buf_size);
4287+ std::unique_ptr <char , decltype (&std::free)> bufs (( char *) std::malloc ( buf_size), &std::free );
42884288 char * buf = bufs.get ();
42894289
42904290 std::streamsize total = 0 ;
You can’t perform that action at this time.
0 commit comments