/*
-**********************************************************************
-* Copyright (c) 2002-2005, International Business Machines
+***********************************************************************
+* © 2016 and later: Unicode, Inc. and others.
+* License & terms of use: http://www.unicode.org/copyright.html#License
+***********************************************************************
+***********************************************************************
+* Copyright (c) 2002-2014, International Business Machines
* Corporation and others. All Rights Reserved.
-**********************************************************************
-**********************************************************************
+***********************************************************************
+***********************************************************************
*/
#ifndef _CONVPERF_H
#define _CONVPERF_H
#include "unicode/ucnv.h"
#include "unicode/uclean.h"
#include "unicode/ustring.h"
+#include "cmemory.h" // for UPRV_LENGTHOF
#include "unicode/uperf.h"
#define CONVERSION_FLAGS (0) /*WC_DEFAULTCHAR WC_COMPOSITECHECK & WC_SEPCHARS*/
#define MAX_BUF_SIZE 3048
-#define LENGTHOF(array) (sizeof(array)/sizeof((array)[0]))
class ICUToUnicodePerfFunction : public UPerfFunction{
private:
name = cpName;
src = pszIn;
srcLen = szLen;
- dstLen = LENGTHOF(dest);
+ dstLen = UPRV_LENGTHOF(dest);
unsigned short bEnc[30]={'\0'};
const char* tenc=name;
for(int i=0;*tenc!='\0';i++){
mimeInfo.uiCodePage = 0;
mimeInfo.uiInternetEncoding =0;
/* get the charset info */
- pMulti->GetCharsetInfo(bEnc,&mimeInfo);
+ pMulti->GetCharsetInfo((wchar_t *)bEnc,&mimeInfo);
uiCodePage = (mimeInfo.uiInternetEncoding==0)?mimeInfo.uiCodePage:mimeInfo.uiInternetEncoding;
}
virtual void call(UErrorCode* status){
name = cpName;
src = pszIn;
srcLen = szLen;
- dstLen = LENGTHOF(dest);
+ dstLen = UPRV_LENGTHOF(dest);
lpUsedDefaultChar=FALSE;
unsigned short bEnc[30]={'\0'};
const char* tenc=name;
mimeInfo.uiCodePage = 0;
mimeInfo.uiInternetEncoding =0;
/* get the charset info */
- pMulti->GetCharsetInfo(bEnc,&mimeInfo);
+ pMulti->GetCharsetInfo((wchar_t *)bEnc,&mimeInfo);
uiCodePage = (mimeInfo.uiInternetEncoding==0)?mimeInfo.uiCodePage:mimeInfo.uiInternetEncoding;
}
virtual void call(UErrorCode* status){
tenc++;
}
/* get the charset info */
- pMulti->GetCharsetInfo(bEnc,&mimeInfo);
+ pMulti->GetCharsetInfo((wchar_t *)bEnc,&mimeInfo);
pMulti->CreateConvertCharset(mimeInfo.uiCodePage, 1200 /*unicode*/, (DWORD)0,&pConvToUni);
getErr(err,status);
src = source;
srcLen = sourceLen;
- dstLen = LENGTHOF(dst);
+ dstLen = UPRV_LENGTHOF(dst);
cpName = name;
}
tenc++;
}
/* get the charset info */
- pMulti->GetCharsetInfo(bEnc,&mimeInfo);
+ pMulti->GetCharsetInfo((wchar_t *)bEnc,&mimeInfo);
pMulti->CreateConvertCharset(1200 /*unicode*/, mimeInfo.uiCodePage, (DWORD)0,&pConvFromUni);
getErr(err,status);
src = source;
srcLen = sourceLen;
- dstLen = LENGTHOF(dst);
+ dstLen = UPRV_LENGTHOF(dst);
cpName = name;
}
src = source;
srcLen = sourceLen;
- dstLen = LENGTHOF(dst);
+ dstLen = UPRV_LENGTHOF(dst);
cpName = name;
unsigned short bEnc[30]={'\0'};
const char* tenc=name;
MIMECSETINFO mimeInfo;
mimeInfo.uiCodePage = 0;
mimeInfo.uiInternetEncoding =0;
- pMulti->GetCharsetInfo(bEnc,&mimeInfo);
+ pMulti->GetCharsetInfo((wchar_t *)bEnc,&mimeInfo);
dwEnc = (mimeInfo.uiInternetEncoding==0)?mimeInfo.uiCodePage:mimeInfo.uiInternetEncoding;
}
}
src = source;
srcLen = sourceLen;
- dstLen = LENGTHOF(dst);
+ dstLen = UPRV_LENGTHOF(dst);
cpName = name;
/* get the charset info */
MIMECSETINFO mimeInfo;
mimeInfo.uiCodePage = 0;
mimeInfo.uiInternetEncoding =0;
- pMulti->GetCharsetInfo(bEnc,&mimeInfo);
+ pMulti->GetCharsetInfo((wchar_t *)bEnc,&mimeInfo);
dwEnc = (mimeInfo.uiInternetEncoding==0)?mimeInfo.uiCodePage:mimeInfo.uiInternetEncoding;
}