Closed Bug 334768 Opened 18 years ago Closed 18 years ago

bzip2 compression is broken

Categories

(Toolkit Graveyard :: Data Collection/Metrics, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bryner, Assigned: bryner)

Details

Attachments

(1 file, 1 obsolete file)

CompressBZ2() is failing due to not running BZ_FINISH.  As it turns out, we can avoid using this whole stream API and just fopen the file ourselves, without introducing a CRT incompatibility.
Attached patch patch (obsolete) — Splinter Review
I cleaned up the GetDataFile() methods while I was at it (this change makes us no longer require a nsILocalFile for the compression output).
Attachment #219094 - Flags: first-review?(darin)
Comment on attachment 219094 [details] [diff] [review]
patch

Oh, I remember now why I didn't do this :-(

You should use GetPath + _wfopen on Windows to avoid Unicode path problems.  But that is not supported on Win9x, so you'd need to failover to calling GetNativePath + fopen on Win9x.

xpcom/io/nsWinAPIs.h defines mFOpen which implements the failover for you.  You can't link to that though.
Another choice is to use OpenNSPRFileDesc + PR_FileDesc2NativeHandle + _open_osfhandle + _fdopen :-)
Attached patch patchSplinter Review
Fix the current libbz2 stream usage.  We need to loop on BZ_FINISH until BZ_STREAM_END is returned.
Attachment #219094 - Attachment is obsolete: true
Attachment #219111 - Flags: first-review?(darin)
Attachment #219094 - Flags: first-review?(darin)
Comment on attachment 219111 [details] [diff] [review]
patch

r=darin
Attachment #219111 - Flags: first-review?(darin) → first-review+
checked in, branch and trunk.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Flags: first-review+
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: