Bug 339144 - Expose a custom factory type for simple nsIUnicharInputStream instances, r=darin

git-svn-id: svn://10.0.0.236/trunk@203371 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
benjamin%smedbergs.us
2006-07-21 16:28:51 +00:00
parent db5fb1b061
commit e5f238eaac
15 changed files with 237 additions and 106 deletions

View File

@@ -86,4 +86,7 @@ EXTRA_DSO_LDOPTS = \
include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES += \
-I$(topsrcdir)/xpcom/io \
$(NULL)

View File

@@ -50,6 +50,7 @@
#include "nsCRT.h"
#include "nsNetUtil.h"
#include "nsStringEnumerator.h"
#include "nsUnicharInputStream.h"
#define MOZ_PERSONAL_DICT_NAME "persdict.dat"
@@ -120,8 +121,10 @@ NS_IMETHODIMP mozPersonalDictionary::Load()
nsCOMPtr<nsIInputStream> inStream;
NS_NewLocalFileInputStream(getter_AddRefs(inStream), theFile);
nsCOMPtr<nsIUnicharInputStream> convStream;
res = NS_NewUTF8ConverterStream(getter_AddRefs(convStream), inStream, 0);
res = nsSimpleUnicharStreamFactory::GetInstance()->
CreateInstanceFromUTF8Stream(inStream, getter_AddRefs(convStream));
if(NS_FAILED(res)) return res;
// we're rereading to get rid of the old data -- we shouldn't have any, but...