on master help sign in
Switched to unsafe (ie, no-copy) pack functions for zlib
7766ef6Michael Snoyman
Network/Wai/Zlib.hs+2−2
@@ -48,7 +48,7 @@ finishStream iter stream outbuff acc = do
48 c_set_avail_out stream outbuff $ fromIntegral chunkSize
48 c_set_avail_out stream outbuff $ fromIntegral chunkSize
49 status <- c_call_deflate_finish stream
49 status <- c_call_deflate_finish stream
50 newAvail <- fromIntegral `fmap` c_get_avail_out stream
50 newAvail <- fromIntegral `fmap` c_get_avail_out stream
51− bs <- packCStringLen (outbuff, chunkSize - newAvail)
51+ bs <- unsafePackCStringLen (outbuff, chunkSize - newAvail)
52 eacc <- iter acc bs
52 eacc <- iter acc bs
53 if status == 0 || newAvail == 0
53 if status == 0 || newAvail == 0
54 then case eacc of
54 then case eacc of
@@ -71,7 +71,7 @@ compressIter iter stream outbuff accInit bsInput = do
71 c_set_avail_out stream outbuff $ fromIntegral chunkSize
71 c_set_avail_out stream outbuff $ fromIntegral chunkSize
72 c_call_deflate_noflush stream
72 c_call_deflate_noflush stream
73 newAvail <- fromIntegral `fmap` c_get_avail_out stream
73 newAvail <- fromIntegral `fmap` c_get_avail_out stream
74− bs <- packCStringLen (outbuff, chunkSize - newAvail)
74+ bs <- unsafePackCStringLen (outbuff, chunkSize - newAvail)
75 eacc <- iter acc bs
75 eacc <- iter acc bs
76 if newAvail == 0
76 if newAvail == 0
77 then case eacc of
77 then case eacc of