summaryrefslogtreecommitdiff
path: root/sal/workben
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2010-11-23 16:30:46 +0000
committerCaolán McNamara <caolanm@redhat.com>2010-11-23 16:33:02 +0000
commitc969a74136a9f6c84aa13b8c90f1aea1ec1b14b0 (patch)
treeaa25d84aae931212e88c4ec00ea7aa2d8ea318b3 /sal/workben
parent34f7bb827b085aacdc7089c9844a72be760faa7f (diff)
make more of the workbens build, and add performance test
Diffstat (limited to 'sal/workben')
-rw-r--r--sal/workben/makefile.mk430
-rw-r--r--sal/workben/measure_oustrings.cxx149
-rw-r--r--sal/workben/t_cipher.c48
-rw-r--r--sal/workben/t_digest.c12
-rw-r--r--sal/workben/t_random.c4
-rw-r--r--sal/workben/testfile.cxx83
-rw-r--r--sal/workben/testpip2.cxx14
-rw-r--r--sal/workben/testpipe.cxx13
-rw-r--r--sal/workben/testproc.cxx7
9 files changed, 404 insertions, 356 deletions
diff --git a/sal/workben/makefile.mk b/sal/workben/makefile.mk
index 99795f6fb..9275a2bcd 100644
--- a/sal/workben/makefile.mk
+++ b/sal/workben/makefile.mk
@@ -31,357 +31,241 @@ PRJNAME=sal
TARGET=workben
LIBTARGET=NO
TARGETTYPE=CUI
-#ENABLE_EXCEPTIONS=TRUE
NO_DEFAULT_STL=YES
-#TESTAPP=test_osl_getVolInfo
-#TESTAPP=test_osl_joinProcess
-#TESTAPP=getlocaleinfotest
-#TESTAPP=test_osl_joinProcess
-#TESTAPP=getlocaleinfotest
-#TESTAPP=salstattest
-#TESTAPP=saldyntest
-
-TESTAPP=t_readline
-#TESTAPP=t_cipher
-#TESTAPP=t_digest
-#TESTAPP=t_random
-#TESTAPP=t_layer
-#TESTAPP=t_tls
-#TESTAPP=t_zip
-
-#TESTAPP=testfile
-#TESTAPP=testpipe
-#TESTAPP=testpip2
-#TESTAPP=testproc
-#TESTAPP=tgetpwnam
-#TESTAPP=salstattest
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
-CFLAGS+= $(LFS_CFLAGS)
-CXXFLAGS+= $(LFS_CFLAGS)
+CFLAGS+=$(LFS_CFLAGS)
+CXXFLAGS+=$(LFS_CFLAGS)
# --- Files --------------------------------------------------------
-.IF "$(TESTAPP)" == "test_osl_getVolInfo"
-
-SHL1OBJS=$(SLO)$/t_osl_getVolInfo.obj
-SHL1TARGET=togvi
-
-.IF "$(GUI)" == "WNT"
-APP1STDLIBS=$(KERNEL32LIB)
-SHL1STDLIBS=$(LB)$/isal.lib
-SHL1STDLIBS+=$(SOLARLIBDIR)$/cppunit.lib
-.ENDIF
-
-.IF "$(GUI)" == "UNX"
-SHL1STDLIBS=$(LB)$/libsal.so
-SHL1STDLIBS+=$(SOLARLIBDIR)$/libcppunit$(DLLPOSTFIX).a
-.ENDIF
-
-SHL1IMPLIB=i$(SHL1TARGET)
-SHL1DEF=$(MISC)$/$(SHL1TARGET).def
-DEF1NAME=$(SHL1TARGET)
-DEF1EXPORTFILE=export.exp
-.ENDIF
-
-.IF "$(TESTAPP)" == "test_osl_joinProcess"
-OBJFILES=$(OBJ)$/t_ojp_exe.obj
-APP1TARGET=ojpx
-APP1OBJS=$(OBJFILES)
-
-.IF "$(GUI)" == "UNX"
-APP1STDLIBS=$(LB)$/libsal.so
-.ENDIF
-
-SHL1OBJS=$(SLO)$/t_osl_joinProcess.obj
-SHL1TARGET=tojp
-
-.IF "$(GUI)" == "WNT"
-APP1STDLIBS=$(KERNEL32LIB)
-SHL1STDLIBS=$(LB)$/isal.lib
-SHL1STDLIBS+=$(SOLARLIBDIR)$/cppunit.lib
-.ENDIF
-
-.IF "$(GUI)" == "UNX"
-SHL1STDLIBS=$(LB)$/libsal.so
-SHL1STDLIBS+=$(SOLARLIBDIR)$/libcppunit$(DLLPOSTFIX).a
-.ENDIF
-
-SHL1IMPLIB=i$(SHL1TARGET)
-SHL1DEF=$(MISC)$/$(SHL1TARGET).def
-DEF1NAME=$(SHL1TARGET)
-DEF1EXPORTFILE=export.exp
-.ENDIF
-
-.IF "$(TESTAPP)" == "getlocaleinfotest"
-
- OBJFILES=$(OBJ)$/getlocaleinfotest.obj
-
- APP1TARGET= getlitest
- APP1OBJS=$(OBJFILES)
-
- APP1STDLIBS=\
- $(KERNEL32LIB)
-
- APP1LIBS=\
- $(LB)$/kernel9x.lib\
- $(LB)$/isal.lib
-
- APP1DEPN=$(LB)$/isal.lib
-
-.ENDIF
-
-.IF "$(TESTAPP)" == "salstattest"
-
- CFLAGS+= -DUSE_SAL_STATIC
-
- OBJFILES= $(OBJ)$/salstattest.obj
-
- APP1TARGET= salstattest
- APP1OBJS= $(OBJFILES)
- APP1STDLIBS=\
- $(LB)$/asal.lib\
- $(SHELL32LIB)\
- $(USER32LIB)\
- $(COMDLG32LIB)\
- $(ADVAPI32LIB)
-
- APP1DEPN= $(LB)$/asal.lib
-
-.ENDIF # salstattest
-
-.IF "$(TESTAPP)" == "saldyntest"
-
- OBJFILES= $(OBJ)$/saldyntest.obj
-
- APP1TARGET= saldyntest
- APP1OBJS= $(OBJFILES)
- APP1STDLIBS=\
- $(LB)$/isal.lib\
- $(SHELL32LIB)\
- $(USER32LIB)\
- $(COMDLG32LIB)\
- $(ADVAPI32LIB)
-
- APP1DEPN= $(LB)$/isal.lib
-
-.ENDIF # salstattest
-
#
# t_readline
#
-.IF "$(TESTAPP)" == "t_readline"
-
-CFILES= t_readline.c
-OBJFILES= $(OBJ)$/t_readline.obj
+OBJFILES+=\
+ $(OBJ)$/t_readline.obj
-APP1TARGET= t_readline
-APP1OBJS= $(OBJFILES)
+APP1TARGET=t_readline
+APP1OBJS=$(OBJ)$/t_readline.obj
APP1STDLIBS=$(SALLIB)
-APP1DEPN= $(SLB)$/sal.lib
-
+APP1DEPN=$(SLB)$/sal.lib
APP1RPATH=UREBIN
-.ENDIF # t_readline
-
#
-# t_cipher
+# testfile
#
-.IF "$(TESTAPP)" == "t_cipher"
-
-CFILES= t_cipher.c
-OBJFILES= $(OBJ)$/t_cipher.obj
+OBJFILES+=\
+ $(OBJ)$/testfile.obj
-APP1TARGET= t_cipher
-APP1OBJS= $(OBJFILES)
+APP1TARGET=testfile
+APP1OBJS=$(OBJ)$/testfile.obj
APP1STDLIBS=$(SALLIB)
-APP1DEPN= $(SLB)$/sal.lib
-
-.ENDIF # t_cipher
+APP1DEPN=$(SLB)$/sal.lib
#
-# t_digest.
+# testpipe
#
-.IF "$(TESTAPP)" == "t_digest"
-
-CFILES= t_digest.c
-OBJFILES= $(OBJ)$/t_digest.obj
+OBJFILES+=\
+ $(OBJ)$/testpipe.obj
-APP2TARGET= t_digest
-APP2OBJS= $(OBJFILES)
+APP2TARGET=testpipe
+APP2OBJS=$(OBJ)$/testpipe.obj
APP2STDLIBS=$(SALLIB)
-APP2DEPN= $(SLB)$/sal.lib
-
-.ENDIF # t_digest
+APP2DEPN=$(SLB)$/sal.lib
#
-# t_random.
+# testpip2
#
-.IF "$(TESTAPP)" == "t_random"
+OBJFILES+=\
+ $(OBJ)$/testpip2.obj
-CFILES= t_random.c
-OBJFILES= $(OBJ)$/t_random.obj
-
-APP3TARGET= t_random
-APP3OBJS= $(OBJFILES)
+APP3TARGET=testpip2
+APP3OBJS=$(OBJ)$/testpip2.obj
APP3STDLIBS=$(SALLIB)
-APP3DEPN= $(SLB)$/sal.lib
-
-.ENDIF # t_random
+APP3DEPN=$(SLB)$/sal.lib
#
-# t_layer.
+# testproc
#
-.IF "$(TESTAPP)" == "t_layer"
-
-CFILES= t_layer.c
-OBJFILES= $(OBJ)$/t_layer.obj
+OBJFILES+=\
+ $(OBJ)$/testproc.obj
-APP4TARGET= t_layer
-APP4OBJS= $(OBJFILES)
+APP4TARGET=testproc
+APP4OBJS=$(OBJ)$/testproc.obj
APP4STDLIBS=$(SALLIB)
-APP4DEPN= $(SLB)$/sal.lib
+APP4DEPN=$(SLB)$/sal.lib
-.ENDIF # t_layer
+#
+# tgetpwnam
+#
+.IF "$(OS)"=="SCO" || "$(OS)"=="NETBSD" || "$(OS)"=="FREEBSD" || "$(OS)"=="OPENBSD"
+OBJFILES+=\
+ $(OBJ)$/tgetpwnam.obj
+
+APP5TARGET=tgetpwnam
+APP5OBJS=$(OBJ)$/tgetpwnam.obj
+APP5STDLIBS=$(SALLIB)
+APP5DEPN=$(SLB)$/sal.lib
+.ENDIF # (sco | netbsd | freebsd)
#
-# t_tls.
+# measure_oustrings
#
-.IF "$(TESTAPP)" == "t_tls"
+OBJFILES+=\
+ $(OBJ)$/measure_oustrings.obj
-CFILES= t_tls.c
-OBJFILES= $(OBJ)$/t_tls.obj
+APP6TARGET=measure_oustrings
+APP6OBJS=$(OBJ)$/measure_oustrings.obj
+APP6STDLIBS=$(SALLIB)
+APP6DEPN=$(SLB)$/sal.lib
-.IF "$(SALTLSLIB)" == ""
+#
+# t_random.
+#
+OBJFILES+=\
+ $(OBJ)$/t_random.obj
-.IF "$(GUI)" == "UNX"
-SALTLSLIB= -lsaltls2
-.ENDIF # unx
+APP7TARGET=t_random
+APP7OBJS=$(OBJ)$/t_random.obj
+APP7STDLIBS=$(SALLIB)
+APP7DEPN=$(SLB)$/sal.lib
-.IF "$(GUI)" == "WNT"
-SALTLSLIB= $(SALTLSLIB)
-.ENDIF # wnt
+#
+# t_cipher
+#
+OBJFILES+=\
+ $(OBJ)$/t_cipher.obj
-.ENDIF # saltlslib
+APP8TARGET=t_cipher
+APP8OBJS=$(OBJ)$/t_cipher.obj
+APP8STDLIBS=$(SALLIB)
+APP8DEPN=$(SLB)$/sal.lib
-APP5TARGET= t_tls
-APP5OBJS= $(OBJFILES)
-APP5STDLIBS=$(SALTLSLIB) $(SALLIB)
-APP5DEPN= $(SLB)$/sal.lib
+#
+# t_digest.
+#
+OBJFILES+=\
+ $(OBJ)$/t_digest.obj
-.ENDIF # t_tls
+APP9TARGET=t_digest
+APP9OBJS=$(OBJ)$/t_digest.obj
+APP9STDLIBS=$(SALLIB)
+APP9DEPN=$(SLB)$/sal.lib
#
-# t_zip.
+# getlitest
#
-.IF "$(TESTAPP)" == "t_zip"
+.IF "$(TESTAPP)" == "getlocaleinfotest"
+OBJFILES+=\
+ $(OBJ)$/getlocaleinfotest.obj
-CFILES= t_zip.c
-OBJFILES= $(OBJ)$/t_zip.obj
+APP10TARGET=getlitest
+APP10OBJS=$(OBJ)$/getlocaleinfotest.obj
-.IF "$(SALZIPLIB)" == ""
+APP10STDLIBS=\
+ $(KERNEL32LIB)
-.IF "$(GUI)" == "UNX"
-SALZIPLIB= -lsalzip2
-.ENDIF # unx
+APP10LIBS=\
+ $(LB)$/kernel9x.lib\
+ $(LB)$/isal.lib
-.IF "$(GUI)" == "WNT"
-SALZIPLIB= $(SALZIPLIB)
-.ENDIF # wnt
+APP10DEPN=$(LB)$/isal.lib
+.ENDIF
-.ENDIF # salziplib
+.IF "$(TESTAPP)" == "test_osl_getVolInfo"
-APP6TARGET= t_zip
-APP6OBJS= $(OBJFILES)
-APP6STDLIBS=$(SALZIPLIB) $(SALLIB)
-APP6DEPN= $(SLB)$/sal.lib
+SHL10OBJS=$(SLO)$/t_osl_getVolInfo.obj
+SHL10TARGET=togvi
-.ENDIF # t_zip
+.IF "$(GUI)" == "WNT"
+APP10STDLIBS=$(KERNEL32LIB)
+SHL10STDLIBS=$(LB)$/isal.lib
+SHL10STDLIBS+=$(SOLARLIBDIR)$/cppunit.lib
+.ENDIF
-#
-# testfile
-#
-.IF "$(TESTAPP)" == "testfile"
+.IF "$(GUI)" == "UNX"
+SHL10STDLIBS=$(LB)$/libsal.so
+SHL10STDLIBS+=$(SOLARLIBDIR)$/libcppunit$(DLLPOSTFIX).a
+.ENDIF
-CXXFILES= testfile.cxx
-OBJFILES= $(OBJ)$/testfile.obj
+SHL10IMPLIB=i$(SHL1TARGET)
+SHL10DEF=$(MISC)$/$(SHL1TARGET).def
+DEF10NAME=$(SHL1TARGET)
+DEF10EXPORTFILE=export.exp
+.ENDIF
-APP1TARGET= testfile
-APP1OBJS= $(OBJFILES)
-APP1STDLIBS=$(SALLIB)
-APP1DEPN= $(SLB)$/sal.lib
+.IF "$(TESTAPP)" == "test_osl_joinProcess"
+OBJFILES+=\
+ $(OBJ)$/t_ojp_exe.obj
+APP10TARGET=ojpx
+APP10OBJS=$(OBJ)$/t_ojp_exe.obj
-.ENDIF # testfile
+.IF "$(GUI)" == "UNX"
+APP10STDLIBS=$(LB)$/libsal.so
+.ENDIF
-#
-# testpipe
-#
-.IF "$(TESTAPP)" == "testpipe"
+SHL10OBJS=$(SLO)$/t_osl_joinProcess.obj
+SHL10TARGET=tojp
+
+.IF "$(GUI)" == "WNT"
+APP10STDLIBS=$(KERNEL32LIB)
+SHL10STDLIBS=$(LB)$/isal.lib
+SHL10STDLIBS+=$(SOLARLIBDIR)$/cppunit.lib
+.ENDIF
-CXXFILES= testpipe.cxx
-OBJFILES= $(OBJ)$/testpipe.obj
+.IF "$(GUI)" == "UNX"
+SHL10STDLIBS=$(LB)$/libsal.so
+SHL10STDLIBS+=$(SOLARLIBDIR)$/libcppunit$(DLLPOSTFIX).a
+.ENDIF
-APP2TARGET= testpipe
-APP2OBJS= $(OBJFILES)
-APP2STDLIBS=$(SALLIB)
-APP2DEPN= $(SLB)$/sal.lib
+SHL10IMPLIB=i$(SHL1TARGET)
+SHL10DEF=$(MISC)$/$(SHL1TARGET).def
+DEF10NAME=$(SHL1TARGET)
+DEF10EXPORTFILE=export.exp
+.ENDIF
-.ENDIF # testpipe
+.IF "$(TESTAPP)" == "salstattest"
-#
-# testpip2
-#
-.IF "$(TESTAPP)" == "testpip2"
+ CFLAGS+= -DUSE_SAL_STATIC
-CXXFILES= testpip2.cxx
-OBJFILES= $(OBJ)$/testpip2.obj
+ OBJFILES+=$(OBJ)$/salstattest.obj
-APP3TARGET= testpip2
-APP3OBJS= $(OBJFILES)
-APP3STDLIBS=$(SALLIB)
-APP3DEPN= $(SLB)$/sal.lib
+ APP10TARGET=salstattest
+ APP10OBJS=$(OBJ)$/salstattest.obj
+ APP10STDLIBS=\
+ $(LB)$/asal.lib\
+ $(SHELL32LIB)\
+ $(USER32LIB)\
+ $(COMDLG32LIB)\
+ $(ADVAPI32LIB)
-.ENDIF # testpip2
+ APP10DEPN=$(LB)$/asal.lib
-#
-# testproc
-#
-.IF "$(TESTAPP)" == "testproc"
+.ENDIF # salstattest
-CXXFILES= testproc.cxx
-OBJFILES= $(OBJ)$/testproc.obj
+.IF "$(TESTAPP)" == "saldyntest"
-APP4TARGET= testproc
-APP4OBJS= $(OBJFILES)
-APP4STDLIBS=$(SALLIB)
-APP4DEPN= $(SLB)$/sal.lib
+ OBJFILES+=$(OBJ)$/saldyntest.obj
-.ENDIF # testproc
+ APP10TARGET=saldyntest
+ APP10OBJS=$(OBJ)$/saldyntest.obj
+ APP10STDLIBS=\
+ $(LB)$/isal.lib\
+ $(SHELL32LIB)\
+ $(USER32LIB)\
+ $(COMDLG32LIB)\
+ $(ADVAPI32LIB)
-#
-# tgetpwnam
-#
-.IF "$(TESTAPP)" == "tgetpwnam"
-.IF "$(OS)"=="SCO" || "$(OS)"=="NETBSD" || "$(OS)"=="FREEBSD" || \
- "$(OS)"=="OPENBSD"
+ APP10DEPN=$(LB)$/isal.lib
-CXXFILES= tgetpwnam.cxx
-OBJFILES= $(OBJ)$/tgetpwnam.obj
+.ENDIF # salstattest
-APP5TARGET= tgetpwnam
-APP5OBJS= $(OBJFILES)
-APP5STDLIBS=$(SALLIB)
-APP5DEPN= $(SLB)$/sal.lib
-.ENDIF # (sco | netbsd | freebsd)
-.ENDIF # tgetpwname
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-
-
diff --git a/sal/workben/measure_oustrings.cxx b/sal/workben/measure_oustrings.cxx
new file mode 100644
index 000000000..bff7d6dea
--- /dev/null
+++ b/sal/workben/measure_oustrings.cxx
@@ -0,0 +1,149 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * [ Caolán McNamara <caolanm:redhat.com> ]
+ * Portions created by Caolán McNamara are Copyright (C) 2010 * Red Hat, Inc.
+ * All Rights Reserved.
+ *
+ * Contributor(s): Caolán McNamara <caolanm@redhat.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+#include <sal/main.h>
+#include <rtl/ustring.hxx>
+#include <osl/time.h>
+
+#include <iostream>
+
+#if defined __GXX_EXPERIMENTAL_CXX0X__
+# define HAVE_CXX_Ox 1
+#endif
+
+#ifdef HAVE_CXX_Ox
+# define SAL_DECLARE_UTF16(str) u ## str
+#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550)
+# define SAL_DECLARE_UTF16(str) U ## str
+#elif __SIZEOF_WCHAR_T__ == 2
+# define SAL_DECLARE_UTF16(str) L ## str
+#endif
+
+#ifdef SAL_DECLARE_UTF16
+# define RTL_CONSTASCII_USTRINGPARAM_WIDE(str) \
+ reinterpret_cast<const sal_Unicode*>(SAL_DECLARE_UTF16(str)), SAL_N_ELEMENTS(str)
+#endif
+
+SAL_IMPLEMENT_MAIN()
+{
+ //get my cpu fan up to speed :-)
+ for (int i = 0; i < 10000000; ++i)
+ {
+ rtl::OUString sFoo(rtl::OUString::createFromAscii("X"));
+ rtl::OUString sBar(RTL_CONSTASCII_USTRINGPARAM("X"));
+#ifdef SAL_DECLARE_UTF16
+ rtl::OUString sBoo(RTL_CONSTASCII_USTRINGPARAM_WIDE("X"));
+#endif
+ rtl::OUString sBaz(static_cast<sal_Unicode>('X'));
+ rtl::OUString sNone;
+ }
+
+ std::cout << "--Empty Strings--" << std::endl;
+
+ {
+ sal_uInt32 nStartTime = osl_getGlobalTimer();
+ for (int i = 0; i < 100000000; ++i)
+ rtl::OUString sFoo;
+ sal_uInt32 nEndTime = osl_getGlobalTimer();
+ std::cout << "rtl::OUString() " << nEndTime - nStartTime << "ms" << std::endl;
+ }
+
+ {
+ sal_uInt32 nStartTime = osl_getGlobalTimer();
+ for (int i = 0; i < 100000000; ++i)
+ rtl::OUString sFoo(rtl::OUString::createFromAscii(""));
+ sal_uInt32 nEndTime = osl_getGlobalTimer();
+ std::cout << "rtl::OUString::createFromAscii() " << nEndTime - nStartTime << "ms" << std::endl;
+ }
+
+ std::cout << "--Single Chars--" << std::endl;
+
+ {
+ sal_uInt32 nStartTime = osl_getGlobalTimer();
+ for (int i = 0; i < 100000000; ++i)
+ rtl::OUString sFoo(rtl::OUString::createFromAscii("X"));
+ sal_uInt32 nEndTime = osl_getGlobalTimer();
+ std::cout << "rtl::OUString::createFromAscii(\"X\") " << nEndTime - nStartTime << "ms" << std::endl;
+ }
+
+ {
+ sal_uInt32 nStartTime = osl_getGlobalTimer();
+ for (int i = 0; i < 100000000; ++i)
+ rtl::OUString sBar(RTL_CONSTASCII_USTRINGPARAM("X"));
+ sal_uInt32 nEndTime = osl_getGlobalTimer();
+ std::cout << "rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\"X\")) " << nEndTime - nStartTime << "ms" << std::endl;
+ }
+
+#ifdef SAL_DECLARE_UTF16
+ {
+ sal_uInt32 nStartTime = osl_getGlobalTimer();
+ for (int i = 0; i < 100000000; ++i)
+ rtl::OUString sBar(RTL_CONSTASCII_USTRINGPARAM_WIDE("X"));
+ sal_uInt32 nEndTime = osl_getGlobalTimer();
+ std::cout << "rtl::OUString(RTL_CONSTASCII_USTRINGPARAM_WIDE(\"X\")) " << nEndTime - nStartTime<< "ms" << std::endl;
+ }
+#endif
+
+ {
+ sal_uInt32 nStartTime = osl_getGlobalTimer();
+ for (int i = 0; i < 100000000; ++i)
+ rtl::OUString sBaz(static_cast<sal_Unicode>('X'));
+ sal_uInt32 nEndTime = osl_getGlobalTimer();
+ std::cout << "rtl::OUString(static_cast<sal_Unicode>('X') " << nEndTime - nStartTime << "ms" << std::endl;
+ }
+
+ std::cout << "--MultiChar Strings--" << std::endl;
+ {
+ sal_uInt32 nStartTime = osl_getGlobalTimer();
+ for (int i = 0; i < 100000000; ++i)
+ rtl::OUString sFoo(rtl::OUString::createFromAscii("XXXXXXXXXXXXXXX"));
+ sal_uInt32 nEndTime = osl_getGlobalTimer();
+ std::cout << "rtl::OUString::createFromAscii(\"XXXXXXXX\") " << nEndTime - nStartTime << "ms" << std::endl;
+ }
+
+ {
+ sal_uInt32 nStartTime = osl_getGlobalTimer();
+ for (int i = 0; i < 100000000; ++i)
+ rtl::OUString sBar(RTL_CONSTASCII_USTRINGPARAM("XXXXXXXXXXXXXXX"));
+ sal_uInt32 nEndTime = osl_getGlobalTimer();
+ std::cout << "rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\"XXXXXXXX\")) " << nEndTime - nStartTime << "ms" << std::endl;
+ }
+
+#ifdef SAL_DECLARE_UTF16
+ {
+ sal_uInt32 nStartTime = osl_getGlobalTimer();
+ for (int i = 0; i < 100000000; ++i)
+ rtl::OUString sBar(RTL_CONSTASCII_USTRINGPARAM_WIDE("XXXXXXXXXXXXXXX"));
+ sal_uInt32 nEndTime = osl_getGlobalTimer();
+ std::cout << "rtl::OUString(RTL_CONSTASCII_USTRINGPARAM_WIDE(\"XXXXXXXX\")) " << nEndTime - nStartTime << "ms" << std::endl;
+ }
+#endif
+
+ return 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/workben/t_cipher.c b/sal/workben/t_cipher.c
index d8133dfd0..e1445f29c 100644
--- a/sal/workben/t_cipher.c
+++ b/sal/workben/t_cipher.c
@@ -152,28 +152,6 @@ static sal_uInt8 cbc_iv[8] =
static sal_Char cbc_data[40] = "7654321 Now is the time for ";
-static sal_uInt8 ecb_ok[32] =
-{
- 0x2A, 0xFD, 0x7D, 0xAA, 0x60, 0x62, 0x6B, 0xA3,
- 0x86, 0x16, 0x46, 0x8C, 0xC2, 0x9C, 0xF6, 0xE1,
- 0x29, 0x1E, 0x81, 0x7C, 0xC7, 0x40, 0x98, 0x2D,
- 0x6F, 0x87, 0xAC, 0x5F, 0x17, 0x1A, 0xAB, 0xEA
-};
-static sal_uInt8 cbc_ok[32] =
-{
- 0x6B, 0x77, 0xB4, 0xD6, 0x30, 0x06, 0xDE, 0xE6,
- 0x05, 0xB1, 0x56, 0xE2, 0x74, 0x03, 0x97, 0x93,
- 0x58, 0xDE, 0xB9, 0xE7, 0x15, 0x46, 0x16, 0xD9,
- 0x59, 0xF1, 0x65, 0x2B, 0xD5, 0xFF, 0x92, 0xCC
-};
-static sal_uInt8 cfb_ok[] =
-{
- 0xE7, 0x32, 0x14, 0xA2, 0x82, 0x21, 0x39, 0xCA,
- 0xF2, 0x6E, 0xCF, 0x6D, 0x2E, 0xB9, 0xE7, 0x6E,
- 0x3D, 0xA3, 0xDE, 0x04, 0xD1, 0x51, 0x72, 0x00,
- 0x51, 0x9D, 0x57, 0xA6, 0xC3
-};
-
static sal_uInt8 arcfour_key[6][30] =
{
{ 8, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
@@ -202,6 +180,29 @@ static sal_uInt8 arcfour_data[6][30] =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff }
};
+
+#if OSL_DEBUG_LEVEL > 0
+static sal_uInt8 ecb_ok[32] =
+{
+ 0x2A, 0xFD, 0x7D, 0xAA, 0x60, 0x62, 0x6B, 0xA3,
+ 0x86, 0x16, 0x46, 0x8C, 0xC2, 0x9C, 0xF6, 0xE1,
+ 0x29, 0x1E, 0x81, 0x7C, 0xC7, 0x40, 0x98, 0x2D,
+ 0x6F, 0x87, 0xAC, 0x5F, 0x17, 0x1A, 0xAB, 0xEA
+};
+static sal_uInt8 cbc_ok[32] =
+{
+ 0x6B, 0x77, 0xB4, 0xD6, 0x30, 0x06, 0xDE, 0xE6,
+ 0x05, 0xB1, 0x56, 0xE2, 0x74, 0x03, 0x97, 0x93,
+ 0x58, 0xDE, 0xB9, 0xE7, 0x15, 0x46, 0x16, 0xD9,
+ 0x59, 0xF1, 0x65, 0x2B, 0xD5, 0xFF, 0x92, 0xCC
+};
+static sal_uInt8 cfb_ok[] =
+{
+ 0xE7, 0x32, 0x14, 0xA2, 0x82, 0x21, 0x39, 0xCA,
+ 0xF2, 0x6E, 0xCF, 0x6D, 0x2E, 0xB9, 0xE7, 0x6E,
+ 0x3D, 0xA3, 0xDE, 0x04, 0xD1, 0x51, 0x72, 0x00,
+ 0x51, 0x9D, 0x57, 0xA6, 0xC3
+};
static sal_uInt8 arcfour_ok[6][30] =
{
{ 0x75, 0xb7, 0x87, 0x80, 0x99, 0xe0, 0xc5, 0x96, 0x00},
@@ -217,8 +218,9 @@ static sal_uInt8 arcfour_ok[6][30] =
{ 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf,
0xbd, 0x61, 0x00}
};
+#endif
-int SAL_CALL main (int argc, char *argv)
+int SAL_CALL main (void)
{
rtlCipher cipher;
diff --git a/sal/workben/t_digest.c b/sal/workben/t_digest.c
index b3e3e876f..bf9b0be89 100644
--- a/sal/workben/t_digest.c
+++ b/sal/workben/t_digest.c
@@ -165,7 +165,7 @@ static char *pt (unsigned char *md, int length)
return(buf);
}
-int SAL_CALL main (int argc, char **argv)
+int SAL_CALL main (void)
{
const char **P,**R, **Q;
char *p;
@@ -308,7 +308,7 @@ int SAL_CALL main (int argc, char **argv)
i = 1;
while (*P)
{
- rtl_digest_initHMAC_MD5 (Digest, *Q, strlen(*Q));
+ rtl_digest_initHMAC_MD5 (Digest, (const sal_uInt8*)(*Q), strlen(*Q));
rtl_digest_updateHMAC_MD5 (Digest, *P, strlen(*P));
rtl_digest_getHMAC_MD5 (Digest, md, sizeof(md));
@@ -336,8 +336,8 @@ int SAL_CALL main (int argc, char **argv)
i = 1;
while (*P)
{
- rtl_digest_initHMAC_SHA1 (Digest, *Q, strlen(*Q));
- rtl_digest_updateHMAC_SHA1 (Digest, *P, strlen(*P));
+ rtl_digest_initHMAC_SHA1 (Digest, (const sal_uInt8*)(*Q), strlen(*Q));
+ rtl_digest_updateHMAC_SHA1 (Digest, (const sal_uInt8*)(*P), strlen(*P));
rtl_digest_getHMAC_SHA1 (Digest, md, sizeof(md));
p=pt (md, RTL_DIGEST_LENGTH_HMAC_SHA1);
@@ -361,8 +361,8 @@ int SAL_CALL main (int argc, char **argv)
Q=digest_key_HMAC_MD5;
rtl_digest_PBKDF2 (
md, RTL_DIGEST_LENGTH_MD5, /* [out] derived key */
- Q[1], strlen(Q[1]), /* [in] password */
- P[1], strlen(P[1]), /* [in] salt */
+ (const sal_uInt8*)(Q[1]), strlen(Q[1]), /* [in] password */
+ (const sal_uInt8*)(P[1]), strlen(P[1]), /* [in] salt */
1000); /* [in] iteration count */
p=pt (md, RTL_DIGEST_LENGTH_MD5);
diff --git a/sal/workben/t_random.c b/sal/workben/t_random.c
index 6011c8351..ea24cc464 100644
--- a/sal/workben/t_random.c
+++ b/sal/workben/t_random.c
@@ -46,9 +46,9 @@ static char *pt (unsigned char *md, int length)
* main.
*/
#ifdef WIN32
-int __cdecl main (int argc, char **argv)
+int __cdecl main (void)
#else
-int main (int argc, char **argv)
+int main (void)
#endif
{
rtlRandomPool pool;
diff --git a/sal/workben/testfile.cxx b/sal/workben/testfile.cxx
index 167b8c460..7b2e7dc01 100644
--- a/sal/workben/testfile.cxx
+++ b/sal/workben/testfile.cxx
@@ -72,17 +72,17 @@ rtl::OUString file_not_exist;
-void print_error(::rtl::OString& str, FileBase::RC rc);
+void print_error(const ::rtl::OString& str, FileBase::RC rc);
void PressKey()
{
printf("\nPress Return !\n");
- int i=getchar();
+ getchar();
}
-void printFileName(::rtl::OUString& str)
+void printFileName(const ::rtl::OUString& str)
{
- rtl::OString aString;
+ rtl::OString aString;
aString = rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US );
@@ -208,13 +208,13 @@ sal_Bool Initialize( void )
for ( int i=0 ; i<12 ; i++ )
{
sal_uInt32 cLineBrake=0;
- while ( (pCount-pBuffer < uBytesRead) && *pCount!='=')
+ while ( (static_cast<sal_uInt64>(pCount-pBuffer) < uBytesRead) && *pCount!='=')
pCount++;
pCount++;
pBegin=pCount;
- while ( (pCount-pBuffer < uBytesRead) && !testLineBreak(pCount,uBytesRead-(pCount-pBuffer), &cLineBrake))
+ while ( (static_cast<sal_uInt64>(pCount-pBuffer) < uBytesRead) && !testLineBreak(pCount,uBytesRead-(pCount-pBuffer), &cLineBrake))
pCount++;
dir[i]=rtl::OUString(pBegin, pCount-pBegin, RTL_TEXTENCODING_ASCII_US);
@@ -460,7 +460,6 @@ TimeValue getSystemTime()
void DirectoryOpenAndCloseTest( void )
{
FileBase::RC rc;
- int i=0;
Directory *pDir;
printf( "--------------------------------------------\n");
@@ -585,7 +584,6 @@ void DirectoryOpenAndCloseTest( void )
void DirectoryCreateAndRemoveTest( void )
{
FileBase::RC rc,rc1;
- int i=0;
Directory *pDir;
printf( "--------------------------------------------\n" );
@@ -673,7 +671,6 @@ void DirectoryCreateAndRemoveTest( void )
static void FileOpenAndCloseTest( void )
{
FileBase::RC rc;
- int i=0;
printf( "--------------------------------------------\n" );
printf( "File-Open-And-Close-Test\n" );
@@ -806,7 +803,7 @@ void FileWriteAndReadTest( void )
sal_uInt64 uWritten;
sal_uInt64 uRead;
- sal_Char *pWriteBuffer="Hier kommt der Osterhase !";
+ const sal_Char *pWriteBuffer="Hier kommt der Osterhase !";
sal_uInt64 nLen=strlen( pWriteBuffer );
sal_Char *pReadBuffer;
@@ -947,7 +944,9 @@ void FileCopyAndMoveTest( void )
destPath+=file3;
printf( "Copy a file to a not existing directory \n");
- printf( "Copy the file %s to %s\n", file1.getStr(), destPath.getStr() );
+ printf( "Copy the file %s to %s\n",
+ rtl::OUStringToOString( file1, RTL_TEXTENCODING_ASCII_US ).getStr(),
+ rtl::OUStringToOString( destPath, RTL_TEXTENCODING_ASCII_US ).getStr() );
rc=File::copy( file1, destPath );
print_error( rtl::OString( "FileCopy" ), rc );
@@ -1120,9 +1119,9 @@ void FileSizeTest( void )
filesize=rStatus.getFileSize();
if ( filesize == 5000 )
- printf( "\nOK : FileSize: %i\n", filesize );
+ printf( "\nOK : FileSize: %" SAL_PRIuUINT64 "\n", filesize );
else
- printf( "\nError : FileSize: %i\n", filesize );
+ printf( "\nError : FileSize: %" SAL_PRIuUINT64 "\n", filesize );
}
}
@@ -1186,7 +1185,7 @@ void FilePointerTest( void )
rc =rFile.getPos( filepointer );
print_error( rtl::OString( "GetPos" ), rc );
- printf( "Position of the FilePointer: %i\n", filepointer );
+ printf( "Position of the FilePointer: %" SAL_PRIuUINT64 "\n", filepointer );
printf( "\n" );
@@ -1207,13 +1206,13 @@ void FilePointerTest( void )
{
print_error( rtl::OString( "GetPos" ), rc );
printf( "\nVerify: OK !\n" );
- printf( "Filepointer-Position: %llu\n",filepointer );
+ printf( "Filepointer-Position: %" SAL_PRIuUINT64 "\n",filepointer );
}
else
{
print_error( rtl::OString( "GetPos" ), rc );
printf( "\nFilePointer-Test: Error\n" );
- printf( "Filepointer-Position: %i != 5000 \n",filepointer );
+ printf( "Filepointer-Position: %" SAL_PRIuUINT64 " != 5000 \n",filepointer );
}
printf( "\n" );
@@ -1432,9 +1431,29 @@ void FileTimeTest( void )
DirectoryItem aItem;
- struct tm sSysCreationTime = { 0, 20, 12, 4, 9, 100 };
- struct tm sSysAccessTime = { 0, 40, 1, 6, 5, 98 };
- struct tm sSysModifyTime = { 0, 1, 24, 13, 11, 95 };
+ struct tm sSysCreationTime;
+ sSysCreationTime.tm_sec = 0;
+ sSysCreationTime.tm_min = 20;
+ sSysCreationTime.tm_hour = 12;
+ sSysCreationTime.tm_mday = 4;
+ sSysCreationTime.tm_mon = 9;
+ sSysCreationTime.tm_year = 99;
+
+ struct tm sSysAccessTime;
+ sSysAccessTime.tm_sec = 0;
+ sSysAccessTime.tm_min = 40;
+ sSysAccessTime.tm_hour = 1;
+ sSysAccessTime.tm_mday = 6;
+ sSysAccessTime.tm_mon = 5;
+ sSysAccessTime.tm_year = 98;
+
+ struct tm sSysModifyTime;
+ sSysModifyTime.tm_sec = 0;
+ sSysModifyTime.tm_min = 1;
+ sSysModifyTime.tm_hour = 24;
+ sSysModifyTime.tm_mday = 13;
+ sSysModifyTime.tm_mon = 11;
+ sSysModifyTime.tm_year = 95;
time_t aSysCreationTime = mktime( &sSysCreationTime );
time_t aSysAccessTime = mktime( &sSysAccessTime );
@@ -1660,7 +1679,7 @@ void DirectoryItemTest( void )
printFileName( file1 );
printf( "\n" );
- rc=DirectoryItem::get( *pFile , aItem );
+ rc=DirectoryItem::get( file1 , aItem );
print_error( rtl::OString( "GetDirectoryItem" ), rc );
pStatus=new FileStatus( FileStatusMask_All );
@@ -1683,17 +1702,13 @@ void DirectoryItemTest( void )
printf( "\n" );
//---------------------------------------------------
- // get DirectoryItem from an empty file-handle
+ // get DirectoryItem
//--------------------------------------------------
- pFile=new File( file1 );
-
printf( "Get DirectoryItem from an empty File-Handle\n" );
- rc=DirectoryItem::get( *pFile , aItem );
+ rc=DirectoryItem::get( file1 , aItem );
print_error( rtl::OString( "GetDirectoryItem" ), rc );
- delete pFile;
-
printf( "\n" );
//--------------------------------------------------
@@ -1861,7 +1876,7 @@ void FileStatusTest( FileStatus *pStatus )
printf( "\ngetFileSize:\n" );
FileSize=pStatus->getFileSize();
- printf( "FileSize: %i\n", FileSize);
+ printf( "FileSize: %" SAL_PRIuUINT64 "\n", FileSize);
//--------------------------------------------------
// GetFileName
@@ -2070,7 +2085,7 @@ void VolumeInfoTest( void )
sal_uInt64 TotalSpace;
TotalSpace=rInfo.getTotalSpace();
- printf( "Total Space: %i\n",TotalSpace );
+ printf( "Total Space: %" SAL_PRIuUINT64 "\n",TotalSpace );
//--------------------------------------------------
// getFreeSpace
@@ -2078,7 +2093,7 @@ void VolumeInfoTest( void )
sal_uInt64 FreeSpace;
FreeSpace=rInfo.getFreeSpace();
- printf( "Free Space: %i\n",FreeSpace );
+ printf( "Free Space: %" SAL_PRIuUINT64 "\n",FreeSpace );
//--------------------------------------------------
// getUsedSpace
@@ -2086,7 +2101,7 @@ void VolumeInfoTest( void )
sal_uInt64 UsedSpace;
UsedSpace=rInfo.getUsedSpace();
- printf( "Used Space: %i\n",UsedSpace );
+ printf( "Used Space: %" SAL_PRIuUINT64 "\n",UsedSpace );
//--------------------------------------------------
// getMaxNameLength
@@ -2094,7 +2109,7 @@ void VolumeInfoTest( void )
sal_uInt32 MaxNameLength;
MaxNameLength=rInfo.getMaxNameLength();
- printf( "MaxNameLength: %i\n",MaxNameLength );
+ printf( "MaxNameLength: %" SAL_PRIuUINT32 "\n",MaxNameLength );
//--------------------------------------------------
// getMaxPathLength
@@ -2102,7 +2117,7 @@ void VolumeInfoTest( void )
sal_uInt32 MaxPathLength;
MaxPathLength=rInfo.getMaxPathLength();
- printf( "MaxPathLength: %i\n",MaxPathLength );
+ printf( "MaxPathLength: %" SAL_PRIuUINT32 "\n",MaxPathLength );
//--------------------------------------------------
// getFileSystemName
@@ -2533,10 +2548,10 @@ void CanonicalNameTest(void)
// print_error
//--------------------------------------------------
-void print_error( ::rtl::OString& str, FileBase::RC rc )
+void print_error( const ::rtl::OString& str, FileBase::RC rc )
{
- printf( "%s : ",str.getStr() );
+ printf( "%s : ", str.getStr() );
switch(rc)
{
case FileBase::E_None:
diff --git a/sal/workben/testpip2.cxx b/sal/workben/testpip2.cxx
index c9b98b8a4..8d62294e8 100644
--- a/sal/workben/testpip2.cxx
+++ b/sal/workben/testpip2.cxx
@@ -32,9 +32,7 @@
#include <stdio.h>
#include <stdlib.h>
-#define INCL_DOSPROCESS
#include <osl/pipe.h>
-#include <os2.h>
// eindeutiger Name fr die Pipe
const char pszPipeName[] = "TestPipe";
@@ -58,13 +56,13 @@ void fail( const char * pszText, int retval )
int main (void)
{
char szBuffer[ 256 ];
- sSize_t nChars;
-
- // gib dem Server die Chance, die Pipe zu ffnen
- DosSleep( 1000 );
+ rtl_uString* ustrPipeName=0;
+ sal_Int32 nChars;
+ rtl_uString_newFromAscii(&ustrPipeName,pszPipeName);
+
// erzeuge die Pipe
- Pipe = osl_createPipe( pszPipeName, osl_Pipe_OPEN, 0 );
+ Pipe = osl_createPipe( ustrPipeName, osl_Pipe_OPEN, 0 );
if( !Pipe )
fail( "unable to open pipe.\n",
@@ -88,7 +86,7 @@ int main (void)
osl_getLastPipeError( Pipe ) );
// schliesse die Pipe
- osl_destroyPipe( Pipe );
+ osl_releasePipe( Pipe );
printf( "TestPipe Client: test passed.\n" );
return 0;
diff --git a/sal/workben/testpipe.cxx b/sal/workben/testpipe.cxx
index 225305260..c3cdc5a01 100644
--- a/sal/workben/testpipe.cxx
+++ b/sal/workben/testpipe.cxx
@@ -44,8 +44,8 @@ const char szTestString[] = "This is a test";
char szBuffer[256];
const char * cp;
-Size_t n;
-sSize_t nChars;
+size_t n;
+sal_Int32 nChars;
// osl specific variables
oslPipe Pipe;
@@ -91,10 +91,9 @@ int main (int argc, const char *argv[])
0,
osl_Process_NORMAL,
0,
- NULL,
NULL,
- 0,
- NULL,
+ NULL,
+ 0,
&Process );
if( ProcessError != osl_Process_E_None )
@@ -158,8 +157,8 @@ int main (int argc, const char *argv[])
osl_freeProcessHandle( Process );
// schliesse die Pipes
- osl_destroyPipe( C1Pipe );
- osl_destroyPipe( Pipe );
+ osl_releasePipe( C1Pipe );
+ osl_releasePipe( Pipe );
printf( "TestPipe Server: test passed.\n" );
return 0;
diff --git a/sal/workben/testproc.cxx b/sal/workben/testproc.cxx
index 71cd13742..d4f5fa4d8 100644
--- a/sal/workben/testproc.cxx
+++ b/sal/workben/testproc.cxx
@@ -40,9 +40,9 @@
#define MAIN main
#endif
-void MAIN (void)
+int MAIN (void)
{
- oslProcess Process;
+ //oslProcess Process;
oslProcessError ProcessError;
sal_uInt32 nArgCount;
sal_uInt32 index;
@@ -59,7 +59,7 @@ void MAIN (void)
osl_getCommandArg(index,&ustrArg);
- fprintf(stderr,"done ...\n\n",index);
+ fprintf(stderr,"done ...\n\n");
}
ProcessError = osl_getExecutableFile(&ustrExeFile);
@@ -73,6 +73,7 @@ void MAIN (void)
NULL,
NULL,
&Process );*/
+ return 0;
}