Landing fix for bug 164924 on the trunk -- don't use the build-in BinHex decoder on Mac or Mac OS X, and build the nsAppleFileDecoder on Mac OS X. r=sdagley, sr=darin

This commit is contained in:
sfraser%netscape.com 2002-10-08 03:12:32 +00:00
Родитель 14152f97ca
Коммит 09ee14b911
7 изменённых файлов: 46 добавлений и 8 удалений

Просмотреть файл

@ -98,6 +98,12 @@ EXTRA_DSO_LDOPTS = \
$(ZLIB_LIBS) \
$(NULL)
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
EXTRA_DSO_LDOPTS += \
$(TK_LIBS) \
$(NULL)
endif
include $(topsrcdir)/config/rules.mk
ifeq ($(OS_ARCH),WINNT)

Просмотреть файл

@ -65,10 +65,19 @@
#include "nsNetCID.h"
#if defined(XP_MAC) || defined(XP_MACOSX)
// Mac OS
#define BUILD_APPLEFILE_DECODER 1
#else
// other platforms
#define BUILD_BINHEX_DECODER 1
#endif
///////////////////////////////////////////////////////////////////////////////
#include "nsStreamConverterService.h"
#if defined(XP_MAC)
#ifdef BUILD_APPLEFILE_DECODER
#include "nsAppleFileDecoder.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppleFileDecoder)
#endif
@ -178,7 +187,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsAboutCacheEntry)
#include "nsUnknownDecoder.h"
#include "nsTXTToHTMLConv.h"
#include "nsIndexedToHTML.h"
#ifndef XP_MAC
#ifdef BUILD_BINHEX_DECODER
#include "nsBinHexDecoder.h"
#endif
@ -204,7 +213,7 @@ nsresult NS_NewStreamConv(nsStreamConverterService **aStreamConv);
#define DEFLATE_TO_UNCOMPRESSED "?from=deflate&to=uncompressed"
#define PLAIN_TO_HTML "?from=text/plain&to=text/html"
#ifndef XP_MAC
#ifdef BUILD_BINHEX_DECODER
#define BINHEX_TO_WILD "?from=application/mac-binhex40&to=*/*"
#endif
@ -221,7 +230,7 @@ static const char *const g_StreamConverterArray[] = {
COMPRESS_TO_UNCOMPRESSED,
XCOMPRESS_TO_UNCOMPRESSED,
DEFLATE_TO_UNCOMPRESSED,
#ifndef XP_MAC
#ifdef BUILD_BINHEX_DECODER
BINHEX_TO_WILD,
#endif
PLAIN_TO_HTML
@ -278,7 +287,8 @@ UnregisterStreamConverters(nsIComponentManager *aCompMgr, nsIFile *aPath,
}
return rv;
}
#ifndef XP_MAC
#ifdef BUILD_BINHEX_DECODER
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBinHexDecoder);
#endif
@ -667,7 +677,7 @@ static const nsModuleComponentInfo gNetModuleInfo[] = {
UnregisterStreamConverters // unregisters *all* converters
},
#if defined(XP_MAC)
#ifdef BUILD_APPLEFILE_DECODER
{ NS_APPLEFILEDECODER_CLASSNAME,
NS_APPLEFILEDECODER_CID,
NS_IAPPLEFILEDECODER_CONTRACTID,
@ -755,7 +765,7 @@ static const nsModuleComponentInfo gNetModuleInfo[] = {
NS_ISTREAMCONVERTER_KEY PLAIN_TO_HTML,
CreateNewNSTXTToHTMLConvFactory
},
#ifndef XP_MAC
#ifdef BUILD_BINHEX_DECODER
{ "nsBinHexConverter", NS_BINHEXDECODER_CID,
NS_ISTREAMCONVERTER_KEY BINHEX_TO_WILD,
nsBinHexDecoderConstructor

Просмотреть файл

@ -55,8 +55,13 @@ CPPSRCS = \
nsDirIndex.cpp \
nsDirIndexParser.cpp \
nsIndexedToHTML.cpp \
$(NULL)
ifeq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
CPPSRCS += \
nsBinHexDecoder.cpp \
$(NULL)
endif
# we don't want the shared lib, but we want to force the creation of a
# static lib.

Просмотреть файл

@ -38,5 +38,11 @@ XPIDLSRCS = \
nsIDirIndexListener.idl \
$(NULL)
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
XPIDLSRCS += \
nsIAppleFileDecoder.idl \
$(NULL)
endif
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -36,6 +36,13 @@ CPPSRCS = \
nsStreamConverterService.cpp \
$(NULL)
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
CPPSRCS += \
nsAppleFileDecoder.cpp \
$(NULL)
endif
# we don't want the shared lib, but we want to force the creation of a
# static lib.
FORCE_STATIC_LIB = 1

Просмотреть файл

@ -247,6 +247,7 @@ NS_IMETHODIMP nsAppleFileDecoder::Write(const char *buffer, PRUint32 bufferSize,
break;
case parseEntries :
{
if (!m_entries)
{
m_entries = new ap_entry[m_headers.entriesCount];
@ -275,6 +276,7 @@ NS_IMETHODIMP nsAppleFileDecoder::Write(const char *buffer, PRUint32 bufferSize,
m_headerOk = PR_TRUE;
m_state = parseLookupPart;
}
}
break;
case parseLookupPart :
@ -382,6 +384,7 @@ NS_IMETHODIMP nsAppleFileDecoder::Write(const char *buffer, PRUint32 bufferSize,
break;
case parseResourceFork :
{
dataCount = m_currentPartLength - m_currentPartCount;
if (dataCount > bufferSize)
dataCount = bufferSize;
@ -398,6 +401,7 @@ NS_IMETHODIMP nsAppleFileDecoder::Write(const char *buffer, PRUint32 bufferSize,
if (noErr != FSWrite(m_rfRefNum, &count, buffPtr) || count != dataCount)
return NS_ERROR_FAILURE;
m_totalResourceForkWritten += dataCount;
}
break;
case parseWriteThrough :

Просмотреть файл

@ -39,7 +39,7 @@
#ifndef nsAppleFileDecoder_h__
#define nsAppleFileDecoder_h__
#include "nsIAppleFIleDecoder.h"
#include "nsIAppleFileDecoder.h"
#include "nsILocalFileMac.h"
/*