Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(878)

Side by Side Diff: source/test/perf/convperf/convperf.h

Issue 845603002: Update ICU to 54.1 step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@master
Patch Set: remove unusued directories Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 ********************************************************************** 2 **********************************************************************
3 * Copyright (c) 2002-2005, International Business Machines 3 * Copyright (c) 2002-2014, International Business Machines
4 * Corporation and others. All Rights Reserved. 4 * Corporation and others. All Rights Reserved.
5 ********************************************************************** 5 **********************************************************************
6 ********************************************************************** 6 **********************************************************************
7 */ 7 */
8 #ifndef _CONVPERF_H 8 #ifndef _CONVPERF_H
9 #define _CONVPERF_H 9 #define _CONVPERF_H
10 10
11 #include <mlang.h> 11 #include <mlang.h>
12 #include <objbase.h> 12 #include <objbase.h>
13 #include <stdlib.h> 13 #include <stdlib.h>
14 #include "unicode/ucnv.h" 14 #include "unicode/ucnv.h"
15 #include "unicode/uclean.h" 15 #include "unicode/uclean.h"
16 #include "unicode/ustring.h" 16 #include "unicode/ustring.h"
17 #include "cmemory.h" // for UPRV_LENGTHOF
17 18
18 #include "unicode/uperf.h" 19 #include "unicode/uperf.h"
19 20
20 #define CONVERSION_FLAGS (0) /*WC_DEFAULTCHAR WC_COMPOSITECHECK & WC_SEPCHARS*/ 21 #define CONVERSION_FLAGS (0) /*WC_DEFAULTCHAR WC_COMPOSITECHECK & WC_SEPCHARS*/
21 #define MAX_BUF_SIZE 3048 22 #define MAX_BUF_SIZE 3048
22 #define LENGTHOF(array) (sizeof(array)/sizeof((array)[0]))
23 23
24 class ICUToUnicodePerfFunction : public UPerfFunction{ 24 class ICUToUnicodePerfFunction : public UPerfFunction{
25 private: 25 private:
26 UConverter* conv; 26 UConverter* conv;
27 const char* src; 27 const char* src;
28 int32_t srcLen; 28 int32_t srcLen;
29 UChar* target; 29 UChar* target;
30 UChar* targetLimit; 30 UChar* targetLimit;
31 31
32 public: 32 public:
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 char* src; 152 char* src;
153 UINT srcLen; 153 UINT srcLen;
154 WCHAR dest[MAX_BUF_SIZE]; 154 WCHAR dest[MAX_BUF_SIZE];
155 UINT dstLen; 155 UINT dstLen;
156 const char* name; 156 const char* name;
157 public: 157 public:
158 WinANSIToUnicodePerfFunction(const char* cpName, char* pszIn,UINT szLen, UEr rorCode& status){ 158 WinANSIToUnicodePerfFunction(const char* cpName, char* pszIn,UINT szLen, UEr rorCode& status){
159 name = cpName; 159 name = cpName;
160 src = pszIn; 160 src = pszIn;
161 srcLen = szLen; 161 srcLen = szLen;
162 dstLen = LENGTHOF(dest); 162 dstLen = UPRV_LENGTHOF(dest);
163 unsigned short bEnc[30]={'\0'}; 163 unsigned short bEnc[30]={'\0'};
164 const char* tenc=name; 164 const char* tenc=name;
165 for(int i=0;*tenc!='\0';i++){ 165 for(int i=0;*tenc!='\0';i++){
166 bEnc[i]=*tenc; 166 bEnc[i]=*tenc;
167 tenc++; 167 tenc++;
168 } 168 }
169 LPMULTILANGUAGE2 pMulti; 169 LPMULTILANGUAGE2 pMulti;
170 170
171 CoInitialize(NULL); 171 CoInitialize(NULL);
172 172
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 char dest[MAX_BUF_SIZE]; 206 char dest[MAX_BUF_SIZE];
207 UINT dstLen; 207 UINT dstLen;
208 const char* name; 208 const char* name;
209 BOOL lpUsedDefaultChar; 209 BOOL lpUsedDefaultChar;
210 210
211 public: 211 public:
212 WinANSIFromUnicodePerfFunction(const char* cpName, WCHAR* pszIn,UINT szLen, UErrorCode& status){ 212 WinANSIFromUnicodePerfFunction(const char* cpName, WCHAR* pszIn,UINT szLen, UErrorCode& status){
213 name = cpName; 213 name = cpName;
214 src = pszIn; 214 src = pszIn;
215 srcLen = szLen; 215 srcLen = szLen;
216 dstLen = LENGTHOF(dest); 216 dstLen = UPRV_LENGTHOF(dest);
217 lpUsedDefaultChar=FALSE; 217 lpUsedDefaultChar=FALSE;
218 unsigned short bEnc[30]={'\0'}; 218 unsigned short bEnc[30]={'\0'};
219 const char* tenc=name; 219 const char* tenc=name;
220 for(int i=0;*tenc!='\0';i++){ 220 for(int i=0;*tenc!='\0';i++){
221 bEnc[i]=*tenc; 221 bEnc[i]=*tenc;
222 tenc++; 222 tenc++;
223 } 223 }
224 LPMULTILANGUAGE2 pMulti; 224 LPMULTILANGUAGE2 pMulti;
225 225
226 CoInitialize(NULL); 226 CoInitialize(NULL);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 for(int i=0;*tenc!='\0';i++){ 301 for(int i=0;*tenc!='\0';i++){
302 bEnc[i]=*tenc; 302 bEnc[i]=*tenc;
303 tenc++; 303 tenc++;
304 } 304 }
305 /* get the charset info */ 305 /* get the charset info */
306 pMulti->GetCharsetInfo((wchar_t *)bEnc,&mimeInfo); 306 pMulti->GetCharsetInfo((wchar_t *)bEnc,&mimeInfo);
307 pMulti->CreateConvertCharset(mimeInfo.uiCodePage, 1200 /*unicode*/, (DWO RD)0,&pConvToUni); 307 pMulti->CreateConvertCharset(mimeInfo.uiCodePage, 1200 /*unicode*/, (DWO RD)0,&pConvToUni);
308 getErr(err,status); 308 getErr(err,status);
309 src = source; 309 src = source;
310 srcLen = sourceLen; 310 srcLen = sourceLen;
311 dstLen = LENGTHOF(dst); 311 dstLen = UPRV_LENGTHOF(dst);
312 cpName = name; 312 cpName = name;
313 } 313 }
314 314
315 virtual void call(UErrorCode* status){ 315 virtual void call(UErrorCode* status){
316 HRESULT err= pConvToUni->DoConversionToUnicode(src,&srcLen,dst, &dstLen) ; 316 HRESULT err= pConvToUni->DoConversionToUnicode(src,&srcLen,dst, &dstLen) ;
317 getErr(err,*status); 317 getErr(err,*status);
318 } 318 }
319 virtual long getOperationsPerIteration(void){ 319 virtual long getOperationsPerIteration(void){
320 return srcLen; 320 return srcLen;
321 } 321 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 for(int i=0;*tenc!='\0';i++){ 357 for(int i=0;*tenc!='\0';i++){
358 bEnc[i]=*tenc; 358 bEnc[i]=*tenc;
359 tenc++; 359 tenc++;
360 } 360 }
361 /* get the charset info */ 361 /* get the charset info */
362 pMulti->GetCharsetInfo((wchar_t *)bEnc,&mimeInfo); 362 pMulti->GetCharsetInfo((wchar_t *)bEnc,&mimeInfo);
363 pMulti->CreateConvertCharset(1200 /*unicode*/, mimeInfo.uiCodePage, (DWO RD)0,&pConvFromUni); 363 pMulti->CreateConvertCharset(1200 /*unicode*/, mimeInfo.uiCodePage, (DWO RD)0,&pConvFromUni);
364 getErr(err,status); 364 getErr(err,status);
365 src = source; 365 src = source;
366 srcLen = sourceLen; 366 srcLen = sourceLen;
367 dstLen = LENGTHOF(dst); 367 dstLen = UPRV_LENGTHOF(dst);
368 cpName = name; 368 cpName = name;
369 369
370 } 370 }
371 371
372 virtual void call(UErrorCode* status){ 372 virtual void call(UErrorCode* status){
373 HRESULT err= pConvFromUni->DoConversionFromUnicode(src,&srcLen,dst, &dst Len); 373 HRESULT err= pConvFromUni->DoConversionFromUnicode(src,&srcLen,dst, &dst Len);
374 getErr(err,*status); 374 getErr(err,*status);
375 } 375 }
376 virtual long getOperationsPerIteration(void){ 376 virtual long getOperationsPerIteration(void){
377 return srcLen; 377 return srcLen;
(...skipping 19 matching lines...) Expand all
397 CoCreateInstance( 397 CoCreateInstance(
398 __uuidof(CMultiLanguage), 398 __uuidof(CMultiLanguage),
399 NULL, 399 NULL,
400 CLSCTX_SERVER, 400 CLSCTX_SERVER,
401 __uuidof(IMultiLanguage2), 401 __uuidof(IMultiLanguage2),
402 (void**)&pMulti 402 (void**)&pMulti
403 ); 403 );
404 404
405 src = source; 405 src = source;
406 srcLen = sourceLen; 406 srcLen = sourceLen;
407 dstLen = LENGTHOF(dst); 407 dstLen = UPRV_LENGTHOF(dst);
408 cpName = name; 408 cpName = name;
409 unsigned short bEnc[30]={'\0'}; 409 unsigned short bEnc[30]={'\0'};
410 const char* tenc=name; 410 const char* tenc=name;
411 for(int i=0;*tenc!='\0';i++){ 411 for(int i=0;*tenc!='\0';i++){
412 bEnc[i]=*tenc; 412 bEnc[i]=*tenc;
413 tenc++; 413 tenc++;
414 } 414 }
415 /* get the charset info */ 415 /* get the charset info */
416 MIMECSETINFO mimeInfo; 416 MIMECSETINFO mimeInfo;
417 mimeInfo.uiCodePage = 0; 417 mimeInfo.uiCodePage = 0;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 458
459 459
460 unsigned short bEnc[30]={'\0'}; 460 unsigned short bEnc[30]={'\0'};
461 const char* tenc=name; 461 const char* tenc=name;
462 for(int i=0;*tenc!='\0';i++){ 462 for(int i=0;*tenc!='\0';i++){
463 bEnc[i]=*tenc; 463 bEnc[i]=*tenc;
464 tenc++; 464 tenc++;
465 } 465 }
466 src = source; 466 src = source;
467 srcLen = sourceLen; 467 srcLen = sourceLen;
468 dstLen = LENGTHOF(dst); 468 dstLen = UPRV_LENGTHOF(dst);
469 cpName = name; 469 cpName = name;
470 /* get the charset info */ 470 /* get the charset info */
471 MIMECSETINFO mimeInfo; 471 MIMECSETINFO mimeInfo;
472 mimeInfo.uiCodePage = 0; 472 mimeInfo.uiCodePage = 0;
473 mimeInfo.uiInternetEncoding =0; 473 mimeInfo.uiInternetEncoding =0;
474 474
475 pMulti->GetCharsetInfo((wchar_t *)bEnc,&mimeInfo); 475 pMulti->GetCharsetInfo((wchar_t *)bEnc,&mimeInfo);
476 dwEnc = (mimeInfo.uiInternetEncoding==0)?mimeInfo.uiCodePage:mimeInfo.ui InternetEncoding; 476 dwEnc = (mimeInfo.uiInternetEncoding==0)?mimeInfo.uiCodePage:mimeInfo.ui InternetEncoding;
477 } 477 }
478 478
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 UPerfFunction* TestICU_ISO2022JP_FromUnicode(); 559 UPerfFunction* TestICU_ISO2022JP_FromUnicode();
560 UPerfFunction* TestWinANSI_ISO2022JP_ToUnicode(); 560 UPerfFunction* TestWinANSI_ISO2022JP_ToUnicode();
561 UPerfFunction* TestWinANSI_ISO2022JP_FromUnicode(); 561 UPerfFunction* TestWinANSI_ISO2022JP_FromUnicode();
562 UPerfFunction* TestWinIML2_ISO2022JP_ToUnicode(); 562 UPerfFunction* TestWinIML2_ISO2022JP_ToUnicode();
563 UPerfFunction* TestWinIML2_ISO2022JP_FromUnicode(); 563 UPerfFunction* TestWinIML2_ISO2022JP_FromUnicode();
564 564
565 }; 565 };
566 566
567 #endif 567 #endif
568 568
OLDNEW
« no previous file with comments | « source/test/perf/collperf2/collperf2.vcxproj.filters ('k') | source/test/perf/convperf/convperf.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698