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

Unified Diff: icu46/source/test/threadtest/converttest.cpp

Issue 5516007: Check in the pristine copy of ICU 4.6... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: Created 10 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « icu46/source/test/threadtest/Makefile.in ('k') | icu46/source/test/threadtest/stringtest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: icu46/source/test/threadtest/converttest.cpp
===================================================================
--- icu46/source/test/threadtest/converttest.cpp (revision 0)
+++ icu46/source/test/threadtest/converttest.cpp (revision 0)
@@ -0,0 +1,88 @@
+//
+//********************************************************************
+// Copyright (C) 2002-2003, International Business Machines
+// Corporation and others. All Rights Reserved.
+//********************************************************************
+//
+// File converttest.cpp
+//
+
+#include "threadtest.h"
+#include "unicode/utypes.h"
+#include "unicode/ucnv.h"
+#include "unicode/uclean.h"
+#include "stdio.h"
+
+U_CAPI UBool U_EXPORT2 ucnv_cleanup();
+
+class ConvertThreadTest: public AbstractThreadTest {
+public:
+ ConvertThreadTest();
+ virtual ~ConvertThreadTest();
+ virtual void check();
+ virtual void runOnce();
+
+private:
+ UConverter *fCnv;
+};
+
+
+ConvertThreadTest::ConvertThreadTest() {
+ UErrorCode err = U_ZERO_ERROR;
+
+ fCnv = ucnv_open("gb18030", &err);
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "ConvertTest - could not ucnv_open(\"gb18030\")\n");
+ fCnv = NULL;
+ }
+};
+
+
+ConvertThreadTest::~ConvertThreadTest() {
+ ucnv_close(fCnv);
+ fCnv = 0;
+}
+
+void ConvertThreadTest::runOnce() {
+ UErrorCode err = U_ZERO_ERROR;
+ UConverter *cnv1;
+ UConverter *cnv2;
+ char buf[U_CNV_SAFECLONE_BUFFERSIZE];
+ int32_t bufSize = U_CNV_SAFECLONE_BUFFERSIZE;
+
+ cnv1 = ucnv_open("shift_jis", &err);
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "ucnv_open(\"shift_jis\") failed.\n");
+ }
+
+ cnv2 = ucnv_safeClone(fCnv, // The source converter, common to all threads.
+ buf,
+ &bufSize,
+ &err);
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "ucnv_safeClone() failed.\n");
+ }
+ ucnv_close(cnv1);
+ ucnv_close(cnv2);
+ ucnv_flushCache();
+}
+
+void ConvertThreadTest::check() {
+ UErrorCode err = U_ZERO_ERROR;
+
+ if (fCnv) {ucnv_close(fCnv);}
+ //if (ucnv_cleanup () == FALSE) {
+ // fprintf(stderr, "ucnv_cleanup() failed - cache was not empty.\n");
+ //}
+ fCnv = ucnv_open("gb18030", &err);
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "ConvertTest::check() - could not redo ucnv_open(\"gb18030\")\n");
+ fCnv = NULL;
+ }
+}
+
+
+AbstractThreadTest *createConvertTest() {
+ return new ConvertThreadTest();
+}
+
Property changes on: icu46/source/test/threadtest/converttest.cpp
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « icu46/source/test/threadtest/Makefile.in ('k') | icu46/source/test/threadtest/stringtest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698