Bug 939578 - Build netwerk/streamconv in unified mode. r=mcmanus

This commit is contained in:
Chris Peterson 2013-11-16 23:33:56 -08:00
parent facf7517b4
commit eed95ac5c2
7 changed files with 38 additions and 37 deletions

View File

@ -3,6 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef ParseRTPList_h___
#define ParseRTPList_h___
#include <stdint.h>
#include <string.h>
#include "prtime.h"
@ -94,7 +97,8 @@ struct list_result
/* (converting all-upcase names may be desirable) */
};
int ParseFTPList(const char *line,
int ParseFTPList(const char *line,
struct list_state *state,
struct list_result *result );
#endif /* !ParseRTPList_h___ */

View File

@ -4,7 +4,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
SOURCES += [
UNIFIED_SOURCES += [
'mozTXTToHTMLConv.cpp',
'nsDirIndex.cpp',
'nsDirIndexParser.cpp',
@ -16,13 +16,13 @@ SOURCES += [
]
if 'ftp' in CONFIG['NECKO_PROTOCOLS']:
SOURCES += [
UNIFIED_SOURCES += [
'nsFTPDirListingConv.cpp',
'ParseFTPList.cpp',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'cocoa':
SOURCES += [
UNIFIED_SOURCES += [
'nsBinHexDecoder.cpp',
]

View File

@ -20,11 +20,6 @@
#include "nsMimeTypes.h"
#include <algorithm>
// sadly I couldn't find char defintions for CR LF elsehwere in the code (they are defined as strings in nsCRT.h)
#define CR '\015'
#define LF '\012'
nsBinHexDecoder::nsBinHexDecoder() :
mState(0), mCRC(0), mFileCRC(0), mOctetin(26),
mDonePos(3), mInCRC(0), mCount(0), mMarker(0), mPosInbuff(0),
@ -62,7 +57,7 @@ NS_INTERFACE_MAP_END
// The binhex 4.0 decoder table....
static signed char binhex_decode[256] =
static const signed char binhex_decode[256] =
{
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@ -321,7 +316,7 @@ nsresult nsBinHexDecoder::ProcessNextChunk(nsIRequest * aRequest, nsISupports *
while (mPosInDataBuffer < numBytesInBuffer)
{
c = mDataBuffer[mPosInDataBuffer++];
while (c == CR || c == LF)
while (c == nsCRT::CR || c == nsCRT::LF)
{
if (mPosInDataBuffer >= numBytesInBuffer)
break;
@ -430,10 +425,10 @@ int16_t nsBinHexDecoder::GetNextChar(uint32_t numBytesInBuffer)
while (mPosInDataBuffer < numBytesInBuffer)
{
c = mDataBuffer[mPosInDataBuffer++];
if (c != LF && c != CR)
if (c != nsCRT::LF && c != nsCRT::CR)
break;
}
return (c == LF || c == CR) ? 0 : (int) c;
return (c == nsCRT::LF || c == nsCRT::CR) ? 0 : (int) c;
}
//////////////////////////////////////////////////////

View File

@ -4,12 +4,21 @@
#include "nsComponentManagerUtils.h"
#include <stdio.h>
#include <algorithm>
//////////////////////////////////////////////////
// TestConverter
//////////////////////////////////////////////////
#define NS_TESTCONVERTER_CID \
{ /* B8A067B0-4450-11d3-A16E-0050041CAF44 */ \
0xb8a067b0, \
0x4450, \
0x11d3, \
{0xa1, 0x6e, 0x00, 0x50, 0x04, 0x1c, 0xaf, 0x44} \
}
NS_DEFINE_CID(kTestConverterCID, NS_TESTCONVERTER_CID);
NS_IMPL_ISUPPORTS3(TestConverter,
nsIStreamConverter,
nsIStreamListener,
@ -79,12 +88,6 @@ TestConverter::AsyncConvertData(const char *aFromType,
return NS_OK;
}
static inline uint32_t
saturated(uint64_t aValue)
{
return (uint32_t) std::min(aValue, (uint64_t) UINT32_MAX);
}
// nsIStreamListener method
/* This method handles asyncronous conversion of data. */
NS_IMETHODIMP

View File

@ -1,8 +1,13 @@
#ifndef Converters_h___
#define Converters_h___
#include "nsIStreamConverter.h"
#include "nsIFactory.h"
#include "nsCOMPtr.h"
#include "nsStringAPI.h"
#include <algorithm>
/* This file defines stream converter components, and their accompanying factory class.
* These converters implement the nsIStreamConverter interface and support both
* asynchronous and synchronous stream conversion.
@ -10,14 +15,8 @@
///////////////////////////////////////////////
// TestConverter
#define NS_TESTCONVERTER_CID \
{ /* B8A067B0-4450-11d3-A16E-0050041CAF44 */ \
0xb8a067b0, \
0x4450, \
0x11d3, \
{0xa1, 0x6e, 0x00, 0x50, 0x04, 0x1c, 0xaf, 0x44} \
}
static NS_DEFINE_CID(kTestConverterCID, NS_TESTCONVERTER_CID);
extern const nsCID kTestConverterCID;
class TestConverter : public nsIStreamConverter {
public:
@ -43,3 +42,11 @@ public:
};
nsresult CreateTestConverter(nsISupports* aOuter, REFNSIID aIID, void** aResult);
static inline uint32_t
saturated(uint64_t aValue)
{
return (uint32_t) std::min(aValue, (uint64_t) UINT32_MAX);
}
#endif /* !Converters_h___ */

View File

@ -19,8 +19,6 @@
#include "nsIRequest.h"
#include "nsNetCID.h"
#include <algorithm>
#define ASYNC_TEST // undefine this if you want to test sycnronous conversion.
/////////////////////////////////
@ -99,12 +97,6 @@ NS_IMPL_ISUPPORTS2(EndListener,
// EndListener END
////////////////////////////////////////////////////////////////////////
static uint32_t
saturated(uint64_t aValue)
{
return (uint32_t)std::min(aValue, (uint64_t)UINT32_MAX);
}
nsresult SendData(const char * aData, nsIStreamListener* aListener, nsIRequest* request) {
nsresult rv;

View File

@ -6,7 +6,7 @@
PROGRAM = 'TestStreamConv'
SOURCES += [
UNIFIED_SOURCES += [
'Converters.cpp',
'TestStreamConv.cpp',
]