diff options
Diffstat (limited to 'tools')
217 files changed, 2620 insertions, 10286 deletions
diff --git a/tools/Executable_bestreversemap.mk b/tools/Executable_bestreversemap.mk new file mode 100644 index 000000000000..c269296a607f --- /dev/null +++ b/tools/Executable_bestreversemap.mk @@ -0,0 +1,38 @@ +# 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 +# Norbert Thiebaud <nthiebaud@gmail.com> (C) 2010, All Rights Reserved. +# +# 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. + +$(eval $(call gb_Executable_Executable,bestreversemap)) + +$(eval $(call gb_Executable_set_include,bestreversemap,\ + $$(INCLUDE) \ + -I$(OUTDIR)/inc/ \ +)) + +$(eval $(call gb_Executable_add_linked_libs,bestreversemap,\ + sal \ + $(gb_STDLIBS) \ +)) + +$(eval $(call gb_Executable_add_exception_objects,bestreversemap,\ + tools/source/reversemap/bestreversemap \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/tools/Executable_mkunroll.mk b/tools/Executable_mkunroll.mk index 88d23965ab76..c81bfb19b4b3 100644 --- a/tools/Executable_mkunroll.mk +++ b/tools/Executable_mkunroll.mk @@ -29,9 +29,9 @@ $(eval $(call gb_Executable_Executable,mkunroll)) $(eval $(call gb_Executable_set_include,mkunroll,\ $$(INCLUDE) \ - -I$(SRCDIR)/tools/inc/ \ - -I$(SRCDIR)/tools/inc/pch \ - -I$(SRCDIR)/tools/bootstrp/ \ + -I$(realpath $(SRCDIR)/tools/inc) \ + -I$(realpath $(SRCDIR)/tools/inc/pch) \ + -I$(realpath $(SRCDIR)/tools/bootstrp) \ )) $(eval $(call gb_Executable_add_defs,mkunroll,\ @@ -41,20 +41,16 @@ $(eval $(call gb_Executable_add_defs,mkunroll,\ $(eval $(call gb_Executable_add_linked_libs,mkunroll,\ basegfx \ sal \ - stl \ tl \ - vos3 \ $(gb_STDLIBS) \ )) -# used to link against basegfxlx comphelp4gcc3 i18nisolang1gcc3 ucbhelper4gcc3 uno_cppu uno_cppuhelpergcc3 uno_salhelpergcc3 - seems to be superficial - $(eval $(call gb_Executable_add_exception_objects,mkunroll,\ - tools/bootstrp/addexes2/mkfilt \ - tools/bootstrp/appdef \ - tools/bootstrp/cppdep \ - tools/bootstrp/inimgr \ - tools/bootstrp/prj \ + tools/bootstrp/mkunroll/mkunroll \ +)) + +$(eval $(call gb_Executable_add_linked_static_libs,rscdep,\ + toolshelpers \ )) # vim: set noet sw=4 ts=4: diff --git a/tools/Executable_rscdep.mk b/tools/Executable_rscdep.mk index eae6304761ab..a4a7c7d1fb95 100644 --- a/tools/Executable_rscdep.mk +++ b/tools/Executable_rscdep.mk @@ -29,9 +29,9 @@ $(eval $(call gb_Executable_Executable,rscdep)) $(eval $(call gb_Executable_set_include,rscdep,\ $$(INCLUDE) \ - -I$(SRCDIR)/tools/inc/ \ - -I$(SRCDIR)/tools/inc/pch \ - -I$(SRCDIR)/tools/bootstrp/ \ + -I$(realpath $(SRCDIR)/tools/inc) \ + -I$(realpath $(SRCDIR)/tools/inc/pch) \ + -I$(realpath $(SRCDIR)/tools/bootstrp) \ )) $(eval $(call gb_Executable_add_defs,rscdep,\ @@ -40,20 +40,18 @@ $(eval $(call gb_Executable_add_defs,rscdep,\ $(eval $(call gb_Executable_add_linked_libs,rscdep,\ sal \ - stl \ tl \ - vos3 \ $(gb_STDLIBS) \ )) $(eval $(call gb_Executable_add_exception_objects,rscdep,\ - tools/bootstrp/appdef \ - tools/bootstrp/cppdep \ - tools/bootstrp/inimgr \ - tools/bootstrp/prj \ tools/bootstrp/rscdep \ )) +$(eval $(call gb_Executable_add_linked_static_libs,rscdep,\ + toolshelpers \ +)) + ifeq ($(OS),WNT) ifeq ($(HAVE_GETOPT),YES) $(eval $(call gb_Executable_add_defs,rscdep,\ diff --git a/tools/Executable_so_checksum.mk b/tools/Executable_so_checksum.mk index 431787d5497b..17d2e26cdf08 100644 --- a/tools/Executable_so_checksum.mk +++ b/tools/Executable_so_checksum.mk @@ -29,9 +29,9 @@ $(eval $(call gb_Executable_Executable,so_checksum)) $(eval $(call gb_Executable_set_include,so_checksum,\ $$(INCLUDE) \ - -I$(SRCDIR)/tools/inc/ \ - -I$(SRCDIR)/tools/inc/pch \ - -I$(SRCDIR)/tools/bootstrp/ \ + -I$(realpath $(SRCDIR)/tools/inc) \ + -I$(realpath $(SRCDIR)/tools/inc/pch) \ + -I$(realpath $(SRCDIR)/tools/bootstrp) \ )) $(eval $(call gb_Executable_add_defs,so_checksum,\ diff --git a/tools/Executable_sspretty.mk b/tools/Executable_sspretty.mk deleted file mode 100644 index e1eea22eab76..000000000000 --- a/tools/Executable_sspretty.mk +++ /dev/null @@ -1,58 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -$(eval $(call gb_Executable_Executable,sspretty)) - -$(eval $(call gb_Executable_set_include,sspretty,\ - $$(INCLUDE) \ - -I$(SRCDIR)/tools/inc/ \ - -I$(SRCDIR)/tools/inc/pch \ - -I$(SRCDIR)/tools/bootstrp/ \ -)) - -$(eval $(call gb_Executable_add_defs,sspretty,\ - -D_TOOLS_STRINGLIST \ -)) - -$(eval $(call gb_Executable_add_linked_libs,sspretty,\ - sal \ - stl \ - tl \ - vos3 \ - $(gb_STDLIBS) \ -)) -# used to link against basegfxlx comphelp4gcc3 i18nisolang1gcc3 ucbhelper4gcc3 uno_cppu uno_cppuhelpergcc3 uno_salhelpergcc3 - seems to be superficial - -$(eval $(call gb_Executable_add_exception_objects,sspretty,\ - tools/bootstrp/appdef \ - tools/bootstrp/cppdep \ - tools/bootstrp/inimgr \ - tools/bootstrp/prj \ - tools/bootstrp/sspretty \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/tools/Library_tl.mk b/tools/Library_tl.mk index 72a4e679bec7..297484b39583 100644 --- a/tools/Library_tl.mk +++ b/tools/Library_tl.mk @@ -28,17 +28,18 @@ $(eval $(call gb_Library_Library,tl)) $(eval $(call gb_Library_add_package_headers,tl,tools_inc)) +$(eval $(call gb_Library_add_package_headers,tl,tools_reversemap)) $(eval $(call gb_Library_add_precompiled_header,tl,$(SRCDIR)/tools/inc/pch/precompiled_tools)) $(eval $(call gb_Library_set_include,tl,\ $$(INCLUDE) \ - -I$(SRCDIR)/tools/inc \ - -I$(SRCDIR)/tools/inc/pch \ + -I$(realpath $(SRCDIR)/tools/inc) \ + -I$(realpath $(SRCDIR)/tools/inc/pch) \ -I$(SRCDIR)/solenv/inc \ -I$(SRCDIR)/solenv/inc/Xp31 \ -I$(OUTDIR)/inc/offuh \ - -I$(OUTDIR)/inc/stl \ + -I$(WORKDIR)/CustomTarget/tools/source/reversemap \ )) $(eval $(call gb_Library_add_defs,tl,\ @@ -50,17 +51,13 @@ $(eval $(call gb_Library_add_linked_libs,tl,\ basegfx \ comphelper \ i18nisolang1 \ - stl \ cppu \ sal \ - vos3 \ $(gb_STDLIBS) \ )) $(eval $(call gb_Library_add_exception_objects,tl,\ - tools/source/communi/geninfo \ - tools/source/communi/parser \ tools/source/datetime/datetime \ tools/source/datetime/tdate \ tools/source/datetime/ttime \ @@ -115,6 +112,7 @@ $(eval $(call gb_Library_add_exception_objects,tl,\ tools/source/string/tenccvt \ tools/source/string/tstring \ tools/source/string/tustring \ + tools/source/string/reversemap \ tools/source/testtoolloader/testtoolloader \ tools/source/zcodec/zcodec \ )) @@ -131,7 +129,7 @@ ifeq ($(OS),WNT) $(eval $(call gb_Library_set_include,tl,\ $$(INCLUDE) \ - -I$(SRCDIR)/tools/win/inc \ + -I$(realpath $(SRCDIR)/tools/win/inc) \ )) $(eval $(call gb_Library_add_exception_objects,tl,\ @@ -151,5 +149,5 @@ endif # tools/source/string/debugprint -DDEBUG -DEXCEPTIONS_OFF -DOSL_DEBUG_LEVEL=2 -DSHAREDLIB -DTOOLS_DLLIMPLEMENTATION -D_DLL_ -O0 -fno-exceptions -fpic -fvisibility=hidden -g # -DOPTIMIZE # no -DTOOLS_DLLIMPLEMENTATION on toolsdll -# -DEXCEPTIONS_OFF -fno-exceptions on geninfo parser datetime tdate ttime bigint color config fract gen line link poly2 svborder toolsin inetmime inetmsg inetstrm contnr mempool multisel table unqidx cachestr stream strmsys vcompat tenccvt tstring tustring testtoolloader +# -DEXCEPTIONS_OFF -fno-exceptions on datetime tdate ttime bigint color config fract gen line link poly2 svborder toolsin inetmime inetmsg inetstrm contnr mempool multisel table unqidx cachestr stream strmsys vcompat tenccvt tstring tustring testtoolloader # vim: set noet sw=4 ts=4: diff --git a/tools/Module_tools.mk b/tools/Module_tools.mk index 9e233408b317..a16310587a1f 100644 --- a/tools/Module_tools.mk +++ b/tools/Module_tools.mk @@ -29,13 +29,15 @@ $(eval $(call gb_Module_Module,tools)) $(eval $(call gb_Module_add_targets,tools,\ + Executable_bestreversemap \ Executable_mkunroll \ Executable_rscdep \ Executable_so_checksum \ - Executable_sspretty \ Library_tl \ Package_inc \ + Package_reversemap \ StaticLibrary_ooopathutils \ + StaticLibrary_toolshelpers \ )) # vim: set noet sw=4 ts=4: diff --git a/tools/Package_inc.mk b/tools/Package_inc.mk index 97d99653c312..45d6c4a38f4f 100644 --- a/tools/Package_inc.mk +++ b/tools/Package_inc.mk @@ -1,7 +1,7 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite @@ -47,14 +47,12 @@ $(eval $(call gb_Package_add_file,tools_inc,inc/tools/fontenum.hxx,tools/fontenu $(eval $(call gb_Package_add_file,tools_inc,inc/tools/fract.hxx,tools/fract.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/fsys.hxx,tools/fsys.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/gen.hxx,tools/gen.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/geninfo.hxx,tools/geninfo.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/getprocessworkingdir.hxx,tools/getprocessworkingdir.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/globname.hxx,tools/globname.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/inetdef.hxx,tools/inetdef.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/inetmime.hxx,tools/inetmime.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/inetmsg.hxx,tools/inetmsg.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/inetstrm.hxx,tools/inetstrm.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/iparser.hxx,tools/iparser.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/isofallback.hxx,tools/isofallback.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/line.hxx,tools/line.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/link.hxx,tools/link.hxx)) @@ -62,17 +60,13 @@ $(eval $(call gb_Package_add_file,tools_inc,inc/tools/list.hxx,tools/list.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/mapunit.hxx,tools/mapunit.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/mempool.hxx,tools/mempool.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/multisel.hxx,tools/multisel.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/ownlist.hxx,tools/ownlist.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/pathutils.hxx,tools/pathutils.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/poly.hxx,tools/poly.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/postsys.h,tools/postsys.h)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/postwin.h,tools/postwin.h)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/postx.h,tools/postx.h)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/presys.h,tools/presys.h)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/prewin.h,tools/prewin.h)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/prex.h,tools/prex.h)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/pstm.hxx,tools/pstm.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/queue.hxx,tools/queue.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/rc.h,tools/rc.h)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/rc.hxx,tools/rc.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/rcid.h,tools/rcid.h)) @@ -90,7 +84,6 @@ $(eval $(call gb_Package_add_file,tools_inc,inc/tools/stream.hxx,tools/stream.hx $(eval $(call gb_Package_add_file,tools_inc,inc/tools/string.hxx,tools/string.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/svborder.hxx,tools/svborder.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/svlibrary.hxx,tools/svlibrary.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/svwin.h,tools/svwin.h)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/table.hxx,tools/table.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/tempfile.hxx,tools/tempfile.hxx)) $(eval $(call gb_Package_add_file,tools_inc,inc/tools/tenccvt.hxx,tools/tenccvt.hxx)) diff --git a/tools/Package_reversemap.mk b/tools/Package_reversemap.mk new file mode 100644 index 000000000000..ae739de09294 --- /dev/null +++ b/tools/Package_reversemap.mk @@ -0,0 +1,33 @@ +# 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 +# Bjoern Michaelsen <bjoern.michaelsen@canonical.com> (Canonical Ltd.) +# Portions created by the Initial Developer are Copyright (C) 2011 the +# Initial Developer. All Rights Reserved. +# +# Contributor(s): Bjoern Michaelsen <bjoern.michaelsen@canonical.com> (Canonical Ltd.) +# +# 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. + +$(eval $(call gb_Package_Package,tools_reversemap,$(WORKDIR)/CustomTarget/tools/source/reversemap)) +$(eval $(call gb_Package_add_customtarget,tools_reversemap,tools/source/reversemap)) + +$(eval $(call gb_CustomTarget_add_outdir_dependencies,tools/source/reversemap,\ + $(call gb_Executable_get_target_for_build,bestreversemap) \ +)) + +# vim: set noet sw=4: diff --git a/tools/StaticLibrary_ooopathutils.mk b/tools/StaticLibrary_ooopathutils.mk index a5b12532c60b..e58becb175d3 100755..100644 --- a/tools/StaticLibrary_ooopathutils.mk +++ b/tools/StaticLibrary_ooopathutils.mk @@ -42,7 +42,7 @@ $(call gb_StaticLibrary_get_target,ooopathutils) : $(OUTDIR)/lib/$(1) $$(eval $$(call gb_Deliver_add_deliverable,$(OUTDIR)/lib/$(1),$(call gb_CxxObject_get_target,tools/source/misc/pathutils))) $(OUTDIR)/lib/$(1) : $(call gb_CxxObject_get_target,tools/source/misc/pathutils) - $$(call gb_Deliver_deliver,$$<,$$@) + $$(call gb_Deliver_deliver,$$<,$$@) endef diff --git a/tools/StaticLibrary_toolshelpers.mk b/tools/StaticLibrary_toolshelpers.mk new file mode 100644 index 000000000000..a63ac47a7eac --- /dev/null +++ b/tools/StaticLibrary_toolshelpers.mk @@ -0,0 +1,61 @@ +# 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 or as specified alternatively below. 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 +# Bjoern Michaelsen, Canonical Ltd. <bjoern.michaelsen@canonical.com> +# Portions created by the Initial Developer are Copyright (C) 2010 the +# Initial Developer. All Rights Reserved. +# +# Major Contributor(s): +# +# For minor contributions see the git repository. +# +# 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. + +$(eval $(call gb_StaticLibrary_StaticLibrary,toolshelpers)) + +$(eval $(call gb_StaticLibrary_set_include,toolshelpers,\ + $$(INCLUDE) \ + -I$(realpath $(SRCDIR)/tools/inc) \ + -I$(realpath $(SRCDIR)/tools/inc/pch) \ + -I$(realpath $(SRCDIR)/tools/bootstrp) \ +)) + +$(eval $(call gb_StaticLibrary_set_cxxflags,toolshelpers,\ + $$(CXXFLAGS) \ + -D_TOOLS_STRINGLIST \ +)) + +$(eval $(call gb_StaticLibrary_add_exception_objects,toolshelpers,\ + tools/bootstrp/appdef \ + tools/bootstrp/cppdep \ + tools/bootstrp/prj \ +)) + +ifeq ($(OS),WNT) +ifeq ($(HAVE_GETOPT),YES) +$(eval $(call gb_StaticLibrary_set_cxxflags,toolshelpers,\ + $$(CXXFLAGS) \ + -DHAVE_GETOPT \ +)) +else +$(eval $(call gb_StaticLibrary_add_linked_libs,toolshelpers,\ + gnu_getopt \ +)) +endif +endif + +# vim: set noet sw=4 ts=4: diff --git a/tools/bootstrp/addexes/replace.cxx b/tools/bootstrp/addexes/replace.cxx index 37304ab18870..07f8be79ab71 100644 --- a/tools/bootstrp/addexes/replace.cxx +++ b/tools/bootstrp/addexes/replace.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -74,3 +75,5 @@ int _cdecl main( int argc, char *argv[] ) fprintf( stdout, "%s\n", aText.GetBuffer()); return 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/bootstrp/appdef.cxx b/tools/bootstrp/appdef.cxx index ac6212724afc..9600272ca858 100644 --- a/tools/bootstrp/appdef.cxx +++ b/tools/bootstrp/appdef.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,123 +35,6 @@ #include "bootstrp/appdef.hxx" -const char* GetDefStandList() -{ - char* pRet; - char* pEnv = getenv("STAR_STANDLST"); - if ( pEnv ) - { - int nLen = strlen( pEnv ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, pEnv ); - } - else - { - int nLen = strlen( _DEF_STAND_LIST ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, _DEF_STAND_LIST ); - } - return pRet; -} - - -const char* GetIniRoot() -{ - char* pRet; - char* pEnv = getenv("STAR_INIROOT"); - if ( pEnv ) - { - int nLen = strlen( pEnv ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, pEnv ); - } - else - { - int nLen = strlen( _INIROOT ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, _INIROOT ); - } - return pRet; -} - -const char* GetIniRootOld() -{ - char* pRet; - char* pEnv = getenv("STAR_INIROOTOLD"); - if ( pEnv ) - { - int nLen = strlen( pEnv ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, pEnv ); - } - else - { - int nLen = strlen( _INIROOT_OLD ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, _INIROOT_OLD ); - } - return pRet; -} - -const char* GetSSolarIni() -{ - char* pRet; - char* pEnv = getenv("STAR_SSOLARINI"); - if ( pEnv ) - { - int nLen = strlen( pEnv ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, pEnv ); - } - else - { - int nLen = strlen( _DEF_SSOLARINI ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, _DEF_SSOLARINI ); - } - return pRet; -} - - -const char* GetSSCommon() -{ - char* pRet; - char* pEnv = getenv("STAR_SSCOMMON"); - if ( pEnv ) - { - int nLen = strlen( pEnv ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, pEnv ); - } - else - { - int nLen = strlen( _DEF_SSCOMMON ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, _DEF_SSCOMMON ); - } - return pRet; -} - - -const char* GetBServerRoot() -{ - char* pRet; - char* pEnv = getenv("STAR_BSERVERROOT"); - if ( pEnv ) - { - int nLen = strlen( pEnv ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, pEnv ); - } - else - { - int nLen = strlen( B_SERVER_ROOT ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, B_SERVER_ROOT ); - } - return pRet; -} - const char* GetEnv( const char *pVar ) { char const *pRet = getenv( pVar ); @@ -166,3 +50,5 @@ const char* GetEnv( const char *pVar, const char *pDefault ) return pDefault; return pRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/bootstrp/cppdep.cxx b/tools/bootstrp/cppdep.cxx index 28410a575b5a..ad5bb80eaffc 100644 --- a/tools/bootstrp/cppdep.cxx +++ b/tools/bootstrp/cppdep.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,8 +38,6 @@ #include <tools/stream.hxx> #include "cppdep.hxx" -//#define TEST - CppDep::CppDep( ByteString aFileName ) { aSourceFile = aFileName; @@ -56,17 +55,28 @@ CppDep::CppDep() CppDep::~CppDep() { + for ( size_t i = 0, n = pSources->size(); i < n; ++i ) { + delete (*pSources)[ i ]; + } delete pSources; + + for ( size_t i = 0, n = pSearchPath->size(); i < n; ++i ) { + delete (*pSearchPath)[ i ]; + } delete pSearchPath; + + for ( size_t i = 0, n = pFileList->size(); i < n; ++i ) { + delete (*pFileList)[ i ]; + } delete pFileList; } void CppDep::Execute() { - sal_uIntPtr nCount = pSources->Count(); - for ( sal_uIntPtr n=0; n<nCount;n++) + size_t nCount = pSources->size(); + for ( size_t n = 0; n < nCount; n++ ) { - ByteString *pStr = pSources->GetObject(n); + ByteString *pStr = (*pSources)[ n ]; Search( *pStr ); } } @@ -74,14 +84,14 @@ void CppDep::Execute() sal_Bool CppDep::AddSearchPath( const char* aPath ) { ByteString *pStr = new ByteString( aPath ); - pSearchPath->Insert( pStr, LIST_APPEND ); + pSearchPath->push_back( pStr ); return sal_False; } sal_Bool CppDep::AddSource( const char* aSource ) { ByteString *pStr = new ByteString( aSource ); - pSources->Insert( pStr, LIST_APPEND ); + pSources->push_back( pStr ); return sal_False; } @@ -116,10 +126,10 @@ sal_Bool CppDep::Search( ByteString aFileName ) if ( (aNewFile = Exists( aResult )) != "" ) { sal_Bool bFound = sal_False; - sal_uIntPtr nCount = pFileList->Count(); - for ( sal_uIntPtr i=0; i<nCount; i++ ) + size_t nCount = pFileList->size(); + for ( size_t i = 0; i < nCount; i++ ) { - ByteString *pStr = pFileList->GetObject(i); + ByteString *pStr = (*pFileList)[ i ]; if ( *pStr == aNewFile ) bFound = sal_True; } @@ -128,7 +138,7 @@ sal_Bool CppDep::Search( ByteString aFileName ) #endif if ( !bFound ) { - pFileList->Insert( new ByteString( aNewFile ), LIST_APPEND ); + pFileList->push_back( new ByteString( aNewFile ) ); #ifdef DEBUG_VERBOSE fprintf( stderr, " CppDep %s\\\n", aNewFile.GetBuffer() ); #endif @@ -151,11 +161,11 @@ ByteString CppDep::Exists( ByteString aFileName ) fprintf( stderr, "Searching %s \n", aFileName.GetBuffer() ); #endif - sal_uIntPtr nCount = pSearchPath->Count(); - for ( sal_uIntPtr n=0; n<nCount; n++) + size_t nCount = pSearchPath->size(); + for ( size_t n = 0; n < nCount; n++ ) { struct stat aBuf; - ByteString *pPathName = pSearchPath->GetObject(n); + ByteString *pPathName = (*pSearchPath)[ n ]; strcpy( pFullName, pPathName->GetBuffer()); strcat( pFullName, DIR_SEP ); @@ -244,3 +254,5 @@ int main( int argc, char **argv ) } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/bootstrp/cppdep.hxx b/tools/bootstrp/cppdep.hxx index 0744a94d8964..d1e4397f0476 100644 --- a/tools/bootstrp/cppdep.hxx +++ b/tools/bootstrp/cppdep.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -25,12 +26,12 @@ * ************************************************************************/ -#include <tools/list.hxx> #include <tools/string.hxx> +#include <vector> #define PATH_SEP ":" #define DIR_SEP "/" -DECLARE_LIST( ByteStringList, ByteString * ) +typedef ::std::vector< ByteString* > ByteStringList; class CppDep { @@ -56,3 +57,4 @@ public: sal_Bool AddSource( const char * aSource ); }; +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/bootstrp/inimgr.cxx b/tools/bootstrp/inimgr.cxx deleted file mode 100644 index 0907f8f9e102..000000000000 --- a/tools/bootstrp/inimgr.cxx +++ /dev/null @@ -1,210 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_tools.hxx" -#if !defined( UNX ) -#include <direct.h> -#else -#include <sys/stat.h> -#endif -#include <stdlib.h> -#include <stdio.h> - - -#include "bootstrp/inimgr.hxx" -#include "bootstrp/appdef.hxx" - -/****************************************************************************/ -IniManager::IniManager( ByteString &rDir, ByteString &rLocalDir ) -/****************************************************************************/ - : bUpdate( sal_True ) -{ - sLocalPath = ByteString( getenv( "LOCALINI" )); - if ( !sLocalPath.Len()) - sLocalPath = rLocalDir; - - sGlobalDir = rDir; -#if !defined( UNX ) && !defined( OS2 ) - mkdir(( char * ) sLocalPath.GetBuffer()); -#else - mkdir( sLocalPath.GetBuffer() ,00777 ); -#endif -} - -/****************************************************************************/ -IniManager::IniManager( ByteString &rDir ) -/****************************************************************************/ - : bUpdate( sal_True ) -{ - sLocalPath = GetLocalIni(); - sGlobalDir = rDir; -#if !defined( UNX ) && !defined( OS2 ) - mkdir(( char * ) sLocalPath.GetBuffer()); -#else - mkdir( sLocalPath.GetBuffer() ,00777 ); -#endif -} - -/****************************************************************************/ -IniManager::IniManager() -/****************************************************************************/ - : bUpdate( sal_True ) -{ - sLocalPath = GetLocalIni(); - -#if !defined( UNX ) && !defined( OS2 ) - mkdir(( char * ) sLocalPath.GetBuffer()); -#else - mkdir( sLocalPath.GetBuffer(), 00777 ); -#endif - - sGlobalDir = GetGlobalIni(); -} - -/****************************************************************************/ -ByteString IniManager::ToLocal( ByteString &rPath ) -/****************************************************************************/ -{ - ByteString sTmp( rPath ); -#if !defined( UNX ) - ByteString sUnc( _INI_UNC ); - sUnc.ToUpperAscii(); - ByteString sOldUnc( _INI_UNC_OLD ); - sOldUnc.ToUpperAscii(); - sTmp.ToUpperAscii(); - - sTmp.SearchAndReplace( sUnc, _INI_DRV ); - sTmp.SearchAndReplace( sOldUnc, _INI_DRV ); - sTmp.ToUpperAscii(); - - ByteString sIni( sGlobalDir ); - sIni.ToUpperAscii(); - - sTmp.SearchAndReplace( sIni, sLocalPath ); - - while ( sTmp.SearchAndReplace( "\\\\", "\\" ) != STRING_NOTFOUND ) ; -#else - sTmp.SearchAndReplace( sGlobalDir, sLocalPath ); - - ByteString sOldGlobalDir( GetIniRootOld() ); - sTmp.SearchAndReplace( sOldGlobalDir, sLocalPath ); - - while ( sTmp.SearchAndReplace( "//", "/" ) != STRING_NOTFOUND ) ; -#endif - - return sTmp; -} - -/****************************************************************************/ -ByteString IniManager::GetLocalIni() -/****************************************************************************/ -{ - ByteString sLocalPath = ByteString( getenv( "LOCALINI" )); - - if ( !sLocalPath.Len()) { -#ifdef UNX - ByteString sLocal( getenv( "HOME" )); - sLocal += ByteString( "/localini" ); -#else - ByteString sLocal( getenv( "TMP" )); - sLocal += ByteString( "\\localini" ); -#endif - - sLocalPath = sLocal; - } - - return sLocalPath; -} - -/****************************************************************************/ -ByteString IniManager::GetGlobalIni() -/****************************************************************************/ -{ - ByteString sGlobalPath = ByteString( GetEnv( "GLOBALINI" )); - - if ( !sGlobalPath.Len()) - sGlobalPath = ByteString( _INIROOT ); - - return sGlobalPath; -} - -/****************************************************************************/ -void IniManager::ForceUpdate() -/****************************************************************************/ -{ - UniString sUniGlobalDir( sGlobalDir, gsl_getSystemTextEncoding()); - DirEntry aPath( UniString( sGlobalDir, gsl_getSystemTextEncoding())); - Dir aDir( aPath, FSYS_KIND_DIR | FSYS_KIND_FILE); - -#ifndef UNX - sLocalPath.EraseTrailingChars( '\\' ); - sLocalPath += "\\"; -#else - sLocalPath.EraseTrailingChars( '/' ); - sLocalPath += "/"; -#endif - - for ( sal_uInt16 i=0; i < aDir.Count(); i++ ) { - ByteString sEntry( aDir[i].GetName(), gsl_getSystemTextEncoding()); - if (( sEntry != "." ) && - ( sEntry != ".." )) - { - if ( !FileStat( aDir[i] ).IsKind( FSYS_KIND_DIR )) { - ByteString sSrc( aDir[i].GetFull(), gsl_getSystemTextEncoding()); - ByteString sDestination( sLocalPath ); - sDestination += sEntry; - - UniString sUniDestination( sDestination, gsl_getSystemTextEncoding()); - DirEntry aDestEntry( sUniDestination ); - FileStat aDestStat( aDestEntry ); - FileStat aSrcStat( aDir[i] ); - - if (( !aDestEntry.Exists() ) || - ( aSrcStat.IsYounger( aDestStat ))) - { - FileCopier aFileCopier( aDir[ i ], aDestEntry ); - aFileCopier.Execute(); - - while ( !aDestEntry.Exists()) - aFileCopier.Execute(); - } - } - } - } -} - -/****************************************************************************/ -void IniManager::Update() -/****************************************************************************/ -{ - if ( bUpdate ) - { - ForceUpdate(); - bUpdate = sal_False; - } -} diff --git a/tools/bootstrp/iserver.cxx b/tools/bootstrp/iserver.cxx deleted file mode 100644 index 63b1b333b22f..000000000000 --- a/tools/bootstrp/iserver.cxx +++ /dev/null @@ -1,152 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_tools.hxx" -#include <tools/iparser.hxx> -#include <tools/geninfo.hxx> -#include "bootstrp/appdef.hxx" -#include <stdio.h> - - -/*****************************************************************************/ -#ifdef UNX -int main( int argc, char *argv[] ) -#else -int _cdecl main( int argc, char *argv[] ) -#endif -/*****************************************************************************/ -{ - if ( argc == 1 ) { - fprintf( stdout, "\ni_server.exe v2.0 (c) 2000\n\n" ); - fprintf( stdout, "Syntax: i_server -i accesspath [-l] [-d database] \n" ); - fprintf( stdout, "Example: - i_server -i vcl364/settings/now\n" ); - fprintf( stdout, " returns value of settings \"now\" of version \"vcl364\"\n" ); - fprintf( stdout, " - i_server -i vcl364/settings -l\n" ); - fprintf( stdout, " returns a list of all settings of version \"vcl364\"\n" ); - } - else { - sal_Bool bError = sal_False; - sal_Bool bList = sal_False; - ByteString sInfo( "" ); - ByteString sDataBase( GetDefStandList()); - - sal_Bool bGetNow = sal_False; - - int nCount = 1; - while (( nCount < argc ) && - ( !bError )) - { - if ( ByteString( argv[nCount] ).ToUpperAscii() == "-I" ) { - // requestet info path - nCount++; - if( nCount < argc ) { - sInfo = ByteString( argv[nCount] ); - nCount++; - } - else bError = sal_True; - } - else if ( ByteString( argv[nCount] ).ToUpperAscii() == "-D" ) { - // requestet info path - nCount++; - if( nCount < argc ) { - sDataBase = ByteString( argv[nCount] ); - nCount++; - } - else bError = sal_True; - } - else if ( ByteString( argv[nCount] ).ToUpperAscii() == "-L" ) { - // request list of childs - nCount++; - bList = sal_True; - } - else if ( ByteString( argv[nCount] ).ToUpperAscii() == "-N" ) { - // request list of childs - nCount++; - bGetNow = sal_True; - } - else { - bError = sal_True; - } - } - - if ( !bError ) { - InformationParser aParser( REPLACE_VARIABLES ); - ByteString sStandList( sDataBase ); - String s = String( sStandList, gsl_getSystemTextEncoding()); - GenericInformationList *pList = aParser.Execute( s ); - if ( !pList ) - return 1; - - if ( sInfo.Len()) { - GenericInformation *pInfo = pList->GetInfo( sInfo, sal_True ); - - if ( pInfo ) { - ByteString sValue( pInfo->GetValue()); - // show the info and its value - fprintf( stdout, "%s %s\n", pInfo->GetBuffer(), sValue.GetBuffer()); - if ( bList ) { - GenericInformationList *pList = pInfo->GetSubList(); - if ( pList ) { - // show whole list of childs and their values - for( sal_uIntPtr i = 0; i < pList->Count(); i++ ) { - GenericInformation *pInfo = pList->GetObject( i ); - ByteString sValue( pInfo->GetValue()); - fprintf( stdout, " %s %s\n", pInfo->GetBuffer(), sValue.GetBuffer()); - } - } - } - return 0; - } - return 1; - } - else { - // show whole list of childs and their values - for( sal_uIntPtr i = 0; i < pList->Count(); i++ ) { - GenericInformation *pInfo = pList->GetObject( i ); - if ( bGetNow ) { - ByteString sPath( "settings/now" ); - GenericInformation *pSubInfo = pInfo->GetSubInfo( sPath, sal_True ); - if ( pSubInfo && pSubInfo->GetValue() == "_TRUE" ) - fprintf( stdout, "%s\n", pInfo->GetBuffer()); - } - else { - ByteString sValue( pInfo->GetValue()); - fprintf( stdout, " %s %s\n", pInfo->GetBuffer(), sValue.GetBuffer()); - } - } - return 0; - } - } - else - fprintf( stderr, "%s: Fehler in der Kommandozeile!", argv[0] ); - // command line arror !!! - } - - return 1; -} - diff --git a/tools/bootstrp/md5.cxx b/tools/bootstrp/md5.cxx index 687441c5c511..1df85d32ff80 100644 --- a/tools/bootstrp/md5.cxx +++ b/tools/bootstrp/md5.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -147,3 +148,5 @@ rtlDigestError calc_md5_checksum( const char *filename, ByteString &aChecksum ) return error; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/bootstrp/md5.hxx b/tools/bootstrp/md5.hxx index 55aa97e941c9..f8d6e6b9695a 100644 --- a/tools/bootstrp/md5.hxx +++ b/tools/bootstrp/md5.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,3 +31,4 @@ class ByteString; rtlDigestError calc_md5_checksum( const char *filename, ByteString &aChecksum ); +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/bootstrp/mkcreate.cxx b/tools/bootstrp/mkcreate.cxx deleted file mode 100644 index adf9dde2ddaa..000000000000 --- a/tools/bootstrp/mkcreate.cxx +++ /dev/null @@ -1,945 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_tools.hxx" - -// global includes -#include <stdio.h> - -// local includes -#include "bootstrp/mkcreate.hxx" -#include "bootstrp/inimgr.hxx" -#include "bootstrp/appdef.hxx" -#include <tools/geninfo.hxx> -#include <tools/iparser.hxx> -#include "bootstrp/prj.hxx" - -char const *NoBuildProject[] = { - "solenv", - "EndOf_NoBuildProject" -}; - -char const *LimitedPath[] = { - "jurt\\com\\sun\\star", - "r_tools", - "ridljar", - "setup2", - "connectivity", - "EndOf_LimitedPath" -}; - -// -// class SourceDirectory -// - -/*****************************************************************************/ -SourceDirectory::SourceDirectory( const ByteString &rDirectoryName, - sal_uInt16 nOperatingSystem, SourceDirectory *pParentDirectory ) -/*****************************************************************************/ - : ByteString( rDirectoryName ), - pParent( pParentDirectory ), - pSubDirectories( NULL ), - nOSType( nOperatingSystem ), - nDepth( 0 ), - pDependencies( NULL ), - pCodedDependencies( NULL ), - pCodedIdentifier( NULL ) -{ - if ( pParent ) { - if ( !pParent->pSubDirectories ) - pParent->pSubDirectories = new SourceDirectoryList(); - pParent->pSubDirectories->InsertSorted( this ); - nDepth = pParent->nDepth + 1; - } -} - -/*****************************************************************************/ -SourceDirectory::~SourceDirectory() -/*****************************************************************************/ -{ - delete pSubDirectories; -} - -/*****************************************************************************/ -CodedDependency *SourceDirectory::AddCodedDependency( - const ByteString &rCodedIdentifier, sal_uInt16 nOperatingSystems ) -/*****************************************************************************/ -{ - CodedDependency *pReturn = NULL; - - if ( !pCodedDependencies ) { - pCodedDependencies = new SByteStringList(); - pReturn = new CodedDependency( rCodedIdentifier, nOperatingSystems ); - pCodedDependencies->PutString(( ByteString * ) pReturn ); - } - else { - sal_uIntPtr nPos = - pCodedDependencies->IsString( (ByteString *) (& rCodedIdentifier) ); - if ( nPos == NOT_THERE ) { - pReturn = - new CodedDependency( rCodedIdentifier, nOperatingSystems ); - pCodedDependencies->PutString(( ByteString * ) pReturn ); - } - else { - pReturn = - ( CodedDependency * ) pCodedDependencies->GetObject( nPos ); - pReturn->TryToMerge( rCodedIdentifier, nOperatingSystems ); - } - } - return pReturn; -} - -/*****************************************************************************/ -CodedDependency *SourceDirectory::AddCodedIdentifier( - const ByteString &rCodedIdentifier, sal_uInt16 nOperatingSystems ) -/*****************************************************************************/ -{ - CodedDependency *pReturn = NULL; - - if ( !pCodedIdentifier ) { - pCodedIdentifier = new SByteStringList(); - pReturn = new CodedDependency( rCodedIdentifier, nOperatingSystems ); - pCodedIdentifier->PutString(( ByteString * ) pReturn ); - } - else { - sal_uIntPtr nPos = - pCodedIdentifier->IsString( ( ByteString *) (& rCodedIdentifier) ); - if ( nPos == NOT_THERE ) { - pReturn = - new CodedDependency( rCodedIdentifier, nOperatingSystems ); - pCodedIdentifier->PutString(( ByteString * ) pReturn ); - } - else { - pReturn = - ( CodedDependency * ) pCodedIdentifier->GetObject( nPos ); - pReturn->TryToMerge( rCodedIdentifier, nOperatingSystems ); - } - } - if ( pParent && pParent->nDepth > 1 ) - pParent->AddCodedIdentifier( rCodedIdentifier, nOperatingSystems ); - - return pReturn; -} - -/*****************************************************************************/ -ByteString SourceDirectory::GetFullPath() -/*****************************************************************************/ -{ - ByteString sFullPath; - if ( pParent ) { - sFullPath = pParent->GetFullPath(); - sFullPath += ByteString( PATH_SEPARATOR ); - } - sFullPath += *this; - - return sFullPath; -} - -/*****************************************************************************/ -SourceDirectory *SourceDirectory::GetRootDirectory() -/*****************************************************************************/ -{ - if ( !pParent ) - return this; - - return pParent->GetRootDirectory(); -} - -/*****************************************************************************/ -SourceDirectory *SourceDirectory::GetSubDirectory( - const ByteString &rDirectoryPath, sal_uInt16 nOperatingSystem ) -/*****************************************************************************/ -{ - ByteString sSearch; - - sal_Bool bSubs = sal_True; - sal_uIntPtr nIndex = 0; - - while ( bSubs && ByteString( LimitedPath[ nIndex ]) != "EndOf_LimitedPath" ) { - SourceDirectory *pActDir = this; - ByteString sLimitation( LimitedPath[ nIndex ]); - - sal_Bool bBreak = sal_False; - for ( sal_uIntPtr i = sLimitation.GetTokenCount( '\\' ); i > 0 && !bBreak; i-- ) { - if (( !pActDir ) || ( *pActDir != sLimitation.GetToken(( sal_uInt16 )( i - 1 ), '\\' ))) - bBreak = sal_True; - else - pActDir = pActDir->pParent; - } - bSubs = bBreak; - nIndex++; - } - - if ( !bSubs ) - { - sSearch = rDirectoryPath; - } - else - sSearch = rDirectoryPath.GetToken( 0, PATH_SEPARATOR ); - - SourceDirectory *pSubDirectory = NULL; - - if ( pSubDirectories ) - pSubDirectory = pSubDirectories->Search( sSearch ); - - if ( !pSubDirectory ) - pSubDirectory = new SourceDirectory( - sSearch, nOperatingSystem, this ); - - pSubDirectory->nOSType |= nOperatingSystem; - - if ( sSearch.Len() == rDirectoryPath.Len()) - return pSubDirectory; - - ByteString sPath = rDirectoryPath.Copy( sSearch.Len() + 1 ); - - return pSubDirectory->GetSubDirectory( sPath, nOperatingSystem ); -} - -/*****************************************************************************/ -SourceDirectory *SourceDirectory::GetDirectory( - const ByteString &rDirectoryName, sal_uInt16 nOperatingSystem ) -/*****************************************************************************/ -{ - ByteString sDirectoryName( rDirectoryName ); -#ifdef UNX - sDirectoryName.SearchAndReplaceAll( "\\", "/" ); -#endif - - SourceDirectory *pRoot = GetRootDirectory(); - - if ( sDirectoryName.Search( *pRoot ) != 0 ) - return NULL; - - if ( sDirectoryName.Len() == pRoot->Len()) - return pRoot; - - if ( sDirectoryName.GetChar( pRoot->Len()) == PATH_SEPARATOR ) { - ByteString sSub = sDirectoryName.Copy( pRoot->Len() + 1 ); - return pRoot->GetSubDirectory( sSub, nOperatingSystem ); - } - - return NULL; -} - -/*****************************************************************************/ -SourceDirectory *SourceDirectory::Insert( const ByteString &rDirectoryName, - sal_uInt16 nOperatingSystem ) -/*****************************************************************************/ -{ - SourceDirectory *pSubDirectory = NULL; - if ( pSubDirectories ) - pSubDirectory = pSubDirectories->Search( rDirectoryName ); - - if ( !pSubDirectory ) - pSubDirectory = new SourceDirectory( - rDirectoryName, nOperatingSystem, this ); - - return pSubDirectory; -} - -/*****************************************************************************/ -Dependency *SourceDirectory::ResolvesDependency( - CodedDependency *pCodedDependency ) -/*****************************************************************************/ -{ - if ( !pCodedIdentifier ) - return NULL; - - sal_uIntPtr nPos = pCodedIdentifier->IsString( pCodedDependency ); - if ( nPos != NOT_THERE ) { - CodedDependency *pIdentifier = - ( CodedDependency * ) pCodedIdentifier->GetObject( nPos ); - sal_uInt16 nResult = - pIdentifier->GetOperatingSystem() & - pCodedDependency->GetOperatingSystem(); - Dependency *pReturn = new Dependency( *this, nResult ); - nResult ^= pCodedDependency->GetOperatingSystem(); - pCodedDependency->SetOperatingSystem( nResult ); - return pReturn; - } - return NULL; -} - - -/*****************************************************************************/ -void SourceDirectory::ResolveDependencies() -/*****************************************************************************/ -{ - if ( !pSubDirectories ) - return; - - for ( sal_uIntPtr i = 0; i < pSubDirectories->Count(); i++ ) { - SourceDirectory *pActDirectory = - ( SourceDirectory * ) pSubDirectories->GetObject( i ); - if ( pActDirectory->pSubDirectories ) - pActDirectory->ResolveDependencies(); - - if ( pActDirectory->pCodedDependencies ) { - while ( pActDirectory->pCodedDependencies->Count()) - { - CodedDependency *pCodedDependency = ( CodedDependency * ) - pActDirectory->pCodedDependencies->GetObject(( sal_uIntPtr ) 0 ); - - for ( - sal_uIntPtr k = 0; - ( k < pSubDirectories->Count()) && - ( pCodedDependency->GetOperatingSystem() != OS_NONE ); - k++ - ) { - Dependency *pDependency = - ((SourceDirectory *) pSubDirectories->GetObject( k ))-> - ResolvesDependency( pCodedDependency ); - if ( pDependency ) - { - if ( !pActDirectory->pDependencies ) - pActDirectory->pDependencies = new SByteStringList(); - pActDirectory->pDependencies->PutString( pDependency ); - } - } - if ( pCodedDependency->GetOperatingSystem()) { - if ( !pCodedDependencies ) - pCodedDependencies = new SByteStringList(); - pCodedDependencies->PutString( pCodedDependency ); - } - else - delete pCodedDependency; - pActDirectory->pCodedDependencies->Remove(( sal_uIntPtr ) 0 ); - } - } - } -} - -/*****************************************************************************/ -ByteString SourceDirectory::GetTarget() -/*****************************************************************************/ -{ - ByteString sReturn; - - if ( !pDependencies ) - return sReturn; - - sal_uIntPtr k = 0; - while ( k < pDependencies->Count()) { - if ( *this == *pDependencies->GetObject( k )) - delete pDependencies->Remove( k ); - else - k++; - } - - if ( !pDependencies->Count()) { - delete pDependencies; - pDependencies = NULL; - return sReturn; - } - - sal_Bool bDependsOnPlatform = sal_False; - for ( sal_uIntPtr i = 0; i < pDependencies->Count(); i++ ) - if ((( Dependency * ) pDependencies->GetObject( i ))-> - GetOperatingSystem() != OS_ALL ) - bDependsOnPlatform = sal_True; - - ByteString sTarget( *this ); - sTarget.SearchAndReplaceAll( "\\", "$/" ); - if ( !bDependsOnPlatform ) { - sReturn = sTarget; - sReturn += " :"; - for ( sal_uIntPtr i = 0; i < pDependencies->Count(); i++ ) { - ByteString sDependency( *pDependencies->GetObject( i )); - sDependency.SearchAndReplaceAll( "\\", "$/" ); - sReturn += " "; - sReturn += sDependency; - } - } - else { - ByteString sUNX( ".IF \"$(GUI)\" == \"UNX\"\n" ); - sUNX += sTarget; - sUNX += " :"; - sal_Bool bUNX = sal_False; - - ByteString sWNT( ".IF \"$(GUI)\" == \"WNT\"\n" ); - sWNT += sTarget; - sWNT += " :"; - sal_Bool bWNT = sal_False; - - ByteString sOS2( ".IF \"$(GUI)\" == \"OS2\"\n" ); - sOS2 += sTarget; - sOS2 += " :"; - sal_Bool bOS2 = sal_False; - - for ( sal_uIntPtr i = 0; i < pDependencies->Count(); i++ ) { - Dependency *pDependency = - ( Dependency * ) pDependencies->GetObject( i ); - ByteString sDependency( *pDependency ); - sDependency.SearchAndReplaceAll( "\\", "$/" ); - - if ( pDependency->GetOperatingSystem() & OS_UNX ) { - sUNX += " "; - sUNX += sDependency; - bUNX = sal_True; - } - if ( pDependency->GetOperatingSystem() & OS_WIN32 ) { - sWNT += " "; - sWNT += sDependency; - bWNT = sal_True; - } - if ( pDependency->GetOperatingSystem() & OS_OS2 ) { - sOS2 += " "; - sOS2 += sDependency; - bOS2 = sal_True; - } - } - - if ( bUNX ) { - sReturn += sUNX; - sReturn += "\n.ENDIF\n"; - } - if ( bWNT ) { - sReturn += sWNT; - sReturn += "\n.ENDIF\n"; - } - if ( bOS2 ) { - sReturn += sOS2; - sReturn += "\n.ENDIF\n"; - } - } - sReturn.EraseTrailingChars( '\n' ); - return sReturn; -} - -/*****************************************************************************/ -ByteString SourceDirectory::GetSubDirsTarget() -/*****************************************************************************/ -{ - ByteString sReturn; - - if ( pSubDirectories ) { - sal_Bool bDependsOnPlatform = sal_False; - for ( sal_uIntPtr i = 0; i < pSubDirectories->Count(); i++ ) - if ((( SourceDirectory * ) pSubDirectories->GetObject( i ))-> - GetOperatingSystems() != OS_ALL ) - bDependsOnPlatform = sal_True; - - if ( !bDependsOnPlatform ) { - sReturn = "RC_SUBDIRS = "; - - for ( sal_uIntPtr i = 0; i < pSubDirectories->Count(); i++ ) { - ByteString sSubDirectory( *pSubDirectories->GetObject( i )); - sSubDirectory.SearchAndReplaceAll( "\\", "$/" ); - sReturn += " \\\n\t"; - sReturn += sSubDirectory; - } - sReturn += "\n"; - } - else { - ByteString sUNX( ".IF \"$(GUI)\" == \"UNX\"\n" ); - sUNX += "RC_SUBDIRS = "; - sal_Bool bUNX = sal_False; - - ByteString sWNT( ".IF \"$(GUI)\" == \"WNT\"\n" ); - sWNT += "RC_SUBDIRS = "; - sal_Bool bWNT = sal_False; - - ByteString sOS2( ".IF \"$(GUI)\" == \"OS2\"\n" ); - sOS2 += "RC_SUBDIRS = "; - sal_Bool bOS2 = sal_False; - - for ( sal_uIntPtr i = 0; i < pSubDirectories->Count(); i++ ) { - SourceDirectory *pDirectory = - ( SourceDirectory * ) pSubDirectories->GetObject( i ); - ByteString sDirectory( *pDirectory ); - sDirectory.SearchAndReplaceAll( "\\", "$/" ); - - if ( pDirectory->GetOperatingSystems() & OS_UNX ) { - sUNX += " \\\n\t"; - sUNX += sDirectory; - bUNX = sal_True; - } - if ( pDirectory->GetOperatingSystems() & OS_WIN32 ) { - sWNT += " \\\n\t"; - sWNT += sDirectory; - bWNT = sal_True; - } - if ( pDirectory->GetOperatingSystems() & OS_OS2 ) { - sOS2 += " \\\n\t"; - sOS2 += sDirectory; - bOS2 = sal_True; - } - } - if ( bUNX ) { - sReturn += sUNX; - sReturn += "\n.ENDIF\n"; - } - if ( bWNT ) { - sReturn += sWNT; - sReturn += "\n.ENDIF\n"; - } - if ( bOS2 ) { - sReturn += sOS2; - sReturn += "\n.ENDIF\n"; - } - } - } - return sReturn; -} - -/*****************************************************************************/ -sal_uInt16 SourceDirectory::GetOSType( const ByteString &sDependExt ) -/*****************************************************************************/ -{ - sal_uInt16 nOSType = 0; - if ( sDependExt == "" ) - nOSType |= OS_ALL; - else if ( sDependExt == "N" || sDependExt == "W" ) - nOSType |= OS_WIN32; - else if ( sDependExt == "U" ) - nOSType |= OS_UNX; - else if ( sDependExt == "P" ) - nOSType |= OS_OS2; - return nOSType; -} - -/*****************************************************************************/ -SourceDirectory *SourceDirectory::CreateRootDirectory( - const ByteString &rRoot, const ByteString &rVersion, sal_Bool bAll ) -/*****************************************************************************/ -{ - IniManager aIniManager; - aIniManager.Update(); - - ByteString sDefLst( GetDefStandList()); - ByteString sStandLst( aIniManager.ToLocal( sDefLst )); - String s = String( sStandLst, gsl_getSystemTextEncoding()); - InformationParser aParser; -// fprintf( stderr, -// "Reading database %s ...\n", sStandLst.GetBuffer()); - GenericInformationList *pVerList = aParser.Execute( - s ); - -/* - ByteString sPath( rVersion ); -#ifndef UNX - sPath += ByteString( "/settings/solarlist" ); -#else - sPath += ByteString( "/settings/unxsolarlist" ); -#endif - ByteString sSolarList( _SOLARLIST ); - - GenericInformation *pInfo = pVerList->GetInfo( sPath, sal_True ); - if ( pInfo ) { - ByteString aIniRoot( GetIniRoot() ); - DirEntry aIniEntry( String( aIniRoot, RTL_TEXTENCODING_ASCII_US )); - aIniEntry += DirEntry( String( pInfo->GetValue(), RTL_TEXTENCODING_ASCII_US )).GetBase( PATH_SEPARATOR ); - sSolarList = ByteString( aIniEntry.GetFull(), RTL_TEXTENCODING_ASCII_US ); - } - - sSolarList = aIniManager.ToLocal( sSolarList ); - fprintf( stderr, - "Reading directory information %s ...\n", sSolarList.GetBuffer()); -*/ - - ByteString sVersion( rVersion ); - Star aStar( pVerList, sVersion, sal_True, rRoot.GetBuffer()); -// fprintf( stderr, -// "Creating virtual directory tree ...\n" ); - - - SourceDirectory *pSourceRoot = new SourceDirectory( rRoot, OS_ALL ); - - for ( sal_uIntPtr i = 0; i < aStar.Count(); i++ ) { - Prj *pPrj = aStar.GetObject( i ); - - sal_Bool bBuildable = sal_True; - sal_uIntPtr nIndex = 0; - - while ( bBuildable && ByteString( NoBuildProject[ nIndex ]) != "EndOf_NoBuildProject" ) { - bBuildable = ( ByteString( NoBuildProject[ nIndex ]) != pPrj->GetProjectName()); - nIndex ++; - } - - if ( bBuildable ) { - SourceDirectory *pProject = pSourceRoot->Insert( pPrj->GetProjectName(), OS_ALL ); - - SByteStringList *pPrjDependencies = pPrj->GetDependencies( sal_False ); - if ( pPrjDependencies ) - for ( sal_uIntPtr x = 0; x < pPrjDependencies->Count(); x++ ) - pProject->AddCodedDependency( *pPrjDependencies->GetObject( x ), OS_ALL ); - - pProject->AddCodedIdentifier( pPrj->GetProjectName(), OS_ALL ); - - for ( sal_uIntPtr j = 0; j < pPrj->Count(); j++ ) { - CommandData *pData = pPrj->GetObject( j ); - if ( bAll || ( pData->GetCommandType() == COMMAND_NMAKE )) { - ByteString sDirPath( rRoot ); - sDirPath += ByteString( PATH_SEPARATOR ); - sDirPath += pData->GetPath(); - SourceDirectory *pDirectory = - pSourceRoot->InsertFull( sDirPath, pData->GetOSType()); - SByteStringList *pDependencies = pData->GetDependencies(); - if ( pDependencies ) { - for ( sal_uIntPtr k = 0; k < pDependencies->Count(); k++ ) { - ByteString sDependency(*pDependencies->GetObject( k )); - ByteString sDependExt(sDependency.GetToken( 1, '.' )); - sDependExt.ToUpperAscii(); - pDirectory->AddCodedDependency( - sDependency.GetToken( 0, '.' ), GetOSType( sDependExt )); - } - } - ByteString sIdentifier = pData->GetLogFile(); - ByteString sIdExt = sIdentifier.GetToken( 1, '.' ); - sIdExt.ToUpperAscii(); - pDirectory->AddCodedIdentifier( sIdentifier.GetToken( 0, '.' ), GetOSType( sIdExt )); - } - } - } - } - delete pVerList; - return pSourceRoot; -} - -/*****************************************************************************/ -sal_Bool SourceDirectory::RemoveDirectoryTreeAndAllDependencies() -/*****************************************************************************/ -{ - if ( !pParent ) - return sal_False; - - SourceDirectoryList *pParentContent = pParent->pSubDirectories; - sal_uIntPtr i = 0; - while ( i < pParentContent->Count()) { - SourceDirectory *pCandidate = - ( SourceDirectory * )pParentContent->GetObject( i ); - if ( pCandidate == this ) { - pParentContent->Remove( i ); - } - else { - if ( pCandidate->pDependencies ) { - sal_uIntPtr nPos = pCandidate->pDependencies->IsString( this ); - if ( nPos != NOT_THERE ) - delete pCandidate->pDependencies->Remove( nPos ); - } - i++; - } - } - delete this; - return sal_True; -} - -/*****************************************************************************/ -sal_Bool SourceDirectory::CreateRecursiveMakefile( sal_Bool bAllChilds ) -/*****************************************************************************/ -{ - if ( !pSubDirectories ) - return sal_True; - - fprintf( stdout, "%s", GetFullPath().GetBuffer()); - - String aTmpStr( GetFullPath(), gsl_getSystemTextEncoding()); - DirEntry aEntry( aTmpStr ); - if ( !aEntry.Exists()) { - fprintf( stdout, " ... no directory!n" ); - return sal_False; - } - - sal_uIntPtr j = 0; - while( j < pSubDirectories->Count()) { - String sSubDirectory( - (( SourceDirectory * ) pSubDirectories->GetObject( j ))-> - GetFullPath(), - gsl_getSystemTextEncoding() - ); - DirEntry aSubDirectory( sSubDirectory ); - if ( !aSubDirectory.Exists()) - (( SourceDirectory * ) pSubDirectories->GetObject( j ))-> - RemoveDirectoryTreeAndAllDependencies(); - else - j++; - } - - DirEntry aRCFile( String( "makefile.rc", gsl_getSystemTextEncoding())); - DirEntry aRCEntry( aEntry ); - aRCEntry += aRCFile; - - DirEntry aMKFile( String( "makefile.mk", gsl_getSystemTextEncoding())); - DirEntry aMKEntry( aEntry ); - aMKEntry += aMKFile; - - sal_Bool bMakefileMk = sal_False; - if ( aMKEntry.Exists()) { - if ( nDepth == 1 && *this == ByteString( "api" )) - fprintf( stdout, " ... makefile.mk exists, ignoring (hack: prj == api)!" ); - else { - fprintf( stdout, " ... makefile.mk exists, including!" ); - bMakefileMk = sal_True; - } - } - - SvFileStream aMakefile( aRCEntry.GetFull(), STREAM_STD_WRITE | STREAM_TRUNC ); - if ( !aMakefile.IsOpen()) { - fprintf( stdout, " ... failed!\n" ); - return sal_False; - } - - ByteString sHeader( - "#*************************************************************************\n" - "#\n" - "# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n" - "#\n" - "# Copyright 2000, 2010 Oracle and/or its affiliates.\n" - "#\n" - "# OpenOffice.org - a multi-platform office productivity suite\n" - "#\n" - "# This file is part of OpenOffice.org.\n" - "#\n" - "# OpenOffice.org is free software: you can redistribute it and/or modify\n" - "# it under the terms of the GNU Lesser General Public License version 3\n" - "# only, as published by the Free Software Foundation.\n" - "#\n" - "# OpenOffice.org is distributed in the hope that it will be useful,\n" - "# but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "# GNU Lesser General Public License version 3 for more details\n" - "# (a copy is included in the LICENSE file that accompanied this code).\n" - "#\n" - "# You should have received a copy of the GNU Lesser General Public License\n" - "# version 3 along with OpenOffice.org. If not, see\n" - "# <http://www.openoffice.org/license.html>\n" - "# for a copy of the LGPLv3 License.\n" - "#\n" - "#*************************************************************************\n" - "\n" - ); - if ( !bMakefileMk ) { - if ( nDepth == 0 ) { - sHeader += ByteString( - "\n" - "# \n" - "# mark this makefile as a recursive one\n" - "# \n" - "\n" - "MAKEFILERC=yes\n" - "\n" - "# \n" - "# implementation of cvs checkout\n" - "# \n" - "\n" - ".IF \"$(checkout)\"==\"\"\n" - "all_target: ALLTAR\n" - ".ELSE\t# \"$(checkout)\"==\"\"\n" - ".IF \"$(checkout)\"==\"true\"\n" - "% : $(NULL)\n" - "\t_cvs co $@\n" - ".ELSE\t# \"$(checkout)\"==\"true\"\n" - "% : $(NULL)\n" - "\t_cvs co -r$(checkout) $@\n" - ".ENDIF\t# \"$(checkout)\"==\"true\"\n" - "all_subdirs : $(RC_SUBDIRS)\n" - ".ENDIF\t# \"$(checkout)\"==\"\"\n" - ); - } - else { - sHeader += ByteString( - "\n" - "# \n" - "# mark this makefile as a recursive one\n" - "# \n" - "\n" - "MAKEFILERC=yes\n" - ); - if ( nDepth == 1 ) - sHeader += ByteString( - ".IF \"$(build_deliver)\"==\"true\"\n" - "all_target:\t\t\\\n" - "\tTG_DELIVER\t\\\n" - "\tALLTAR\n" - ".ELSE # \"$(build_deliver)\"==\"true\"\n" - "all_target: ALLTAR\n" - ".ENDIF # \"$(build_deliver)\"==\"true\"\n" - ); - else - sHeader += ByteString( - "all_target: ALLTAR\n" - ); - } - } - else { - if ( nDepth == 1 ) - sHeader += ByteString( - ".IF \"$(build_deliver)\"==\"true\"\n" - "all_target:\t\t\\\n" - "\tTG_DELIVER\t\\\n" - "\tALLTAR\n" - ".ELSE # \"$(build_deliver)\"==\"true\"\n" - "all_target: ALLTAR\n" - ".ENDIF # \"$(build_deliver)\"==\"true\"\n" - ); - } - sHeader += ByteString( - "\n" - "# \n" - "# macro RC_SUBDIRS handles iteration over\n" - "# all mandatory sub directories\n" - "# \n" - ); - - aMakefile.WriteLine( sHeader ); - aMakefile.WriteLine( GetSubDirsTarget()); - - if ( nDepth == 0 ) { - ByteString sBootstrapTarget( - "# \n" - "# bootstrap target\n" - "# \n\n" - "bootstrap .PHONY :\n" - "\t@config_office/bootstrap\n\n" - ); - aMakefile.WriteLine( sBootstrapTarget ); - ByteString sConfigureTarget( - "# \n" - "# configure target\n" - "# \n\n" - "configure .PHONY SETDIR=config_office :\n" - "\t@configure\n" - ); - aMakefile.WriteLine( sConfigureTarget ); - } - else if ( nDepth == 1 ) { - ByteString sDeliverTarget( - "# \n" - "# deliver target to handle\n" - "# project dependencies\n" - "# \n\n" - "TG_DELIVER : $(RC_SUBDIRS)\n" - "\t$(DELIVER)\n" - ); - aMakefile.WriteLine( sDeliverTarget ); - } - - if ( bMakefileMk ) { - ByteString sInclude( - "# \n" - "# local makefile\n" - "# \n" - "\n" - ".INCLUDE : makefile.mk\n" - ); - - if ( nDepth != 1 ) - sInclude += ByteString( - "\n" - "all_rc_target: ALLTAR\n" - ); - - aMakefile.WriteLine( sInclude ); - } - - ByteString sComment( - "# \n" - "# single directory targets for\n" - "# dependency handling between directories\n" - "# \n" - ); - aMakefile.WriteLine( sComment ); - - for ( sal_uIntPtr i = 0; i < pSubDirectories->Count(); i++ ) { - ByteString sTarget( - (( SourceDirectory * )pSubDirectories->GetObject( i ))-> - GetTarget() - ); - if ( sTarget.Len()) - aMakefile.WriteLine( sTarget ); - } - - ByteString sFooter( - "\n" - ); - if ( !bMakefileMk ) { - sFooter += ByteString( - "# \n" - "# central target makefile\n" - "# \n" - "\n" - ); - if ( nDepth != 0 ) { - sFooter += ByteString( - ".INCLUDE : target.mk\n" - ); - } - else { - sFooter += ByteString( - ".IF \"$(checkout)\"==\"\"\n" - ".INCLUDE : target.mk\n" - ".ENDIF\t#\"$(checkout)\"==\"\"\n" - ); - } - } - sFooter += ByteString( - "\n" - "#*************************************************************************\n" - ); - aMakefile.WriteLine( sFooter ); - - aMakefile.Close(); - - fprintf( stdout, "\n" ); - - sal_Bool bSuccess = sal_True; - if ( bAllChilds ) - for ( sal_uIntPtr k = 0; k < pSubDirectories->Count(); k++ ) - if ( !(( SourceDirectory * ) pSubDirectories->GetObject( k ))-> - CreateRecursiveMakefile( sal_True )) - bSuccess = sal_False; - - return bSuccess; -} - -// -// class SourceDirectoryList -// - -/*****************************************************************************/ -SourceDirectoryList::~SourceDirectoryList() -/*****************************************************************************/ -{ - for ( sal_uIntPtr i = 0; i < Count(); i++ ) - delete GetObject( i ); -} - -/*****************************************************************************/ -SourceDirectory *SourceDirectoryList::Search( - const ByteString &rDirectoryName ) -/*****************************************************************************/ -{ - sal_uIntPtr nPos = IsString( ( ByteString * ) (&rDirectoryName) ); - if ( nPos != LIST_ENTRY_NOTFOUND ) - return ( SourceDirectory * ) GetObject( nPos ); - - return NULL; -} - - diff --git a/tools/bootstrp/addexes2/mkfilt.cxx b/tools/bootstrp/mkunroll/mkunroll.cxx index 9dae100352c3..ff958ba8e717 100644 --- a/tools/bootstrp/addexes2/mkfilt.cxx +++ b/tools/bootstrp/mkunroll/mkunroll.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,7 +32,7 @@ #include <stdio.h> #include <../../inc/tools/string.hxx> -#include <../../inc/tools/list.hxx> +#include <vector> class TextFilter { @@ -81,7 +82,8 @@ void TextFilter::Filter() #define LINE_LEN 2048 -class ByteStringList; +class MkLine; +typedef ::std::vector< MkLine* > ByteStringList; class MkLine { @@ -101,7 +103,6 @@ MkLine::MkLine() pPrivateTnrLst = NULL; } -DECLARE_LIST( ByteStringList, MkLine * ) class MkFilter : public TextFilter { @@ -124,7 +125,13 @@ MkFilter::MkFilter( ByteString aInFile, ByteString aOutFile ) : MkFilter::~MkFilter() { + for ( size_t i = 0, n = pTnrLst->size(); i < n; ++i ) { + delete (*pTnrLst)[ i ]; + } delete pTnrLst; + for ( size_t i = 0, n = pLst->size(); i < n; ++i ) { + delete (*pLst)[ i ]; + } delete pLst; } @@ -138,7 +145,6 @@ void MkFilter::Filter() while(( fgets(aLineBuf, LINE_LEN, pIn)) != NULL ) { ByteString aLine( aLineBuf ); - //fprintf(stderr, "aLine :%s\n", aLine.GetBuffer()); if ( aLine.Search("mkfilter1" ) != STRING_NOTFOUND ) { // Zeilen unterdruecken @@ -151,17 +157,15 @@ void MkFilter::Filter() fprintf( stderr, "\nunroll begin\n" ); nState = 1; } - ; if ( nState == 0 ) { fprintf( stderr, "." ); MkLine *pMkLine = new MkLine(); - ByteString *pStr = new ByteString( aLineBuf ); - pMkLine->aLine = *pStr; + pMkLine->aLine = aLineBuf; pMkLine->bOut = sal_False; - pLst->Insert( pMkLine, LIST_APPEND ); + pLst->push_back( pMkLine ); } else if ( nState == 1 ) { @@ -173,21 +177,19 @@ void MkFilter::Filter() fprintf( stderr, ";\nunroll end\n" ); MkLine *p_MkLine = new MkLine(); p_MkLine->bHier = sal_True; - ByteString *pByteString = new ByteString("# do not delete this line === mkfilter3i\n"); - p_MkLine->aLine = *pByteString; + p_MkLine->aLine = ByteString("# do not delete this line === mkfilter3i\n"); p_MkLine->bOut = sal_False; p_MkLine->pPrivateTnrLst = pTnrLst; pTnrLst = new ByteStringList(); - pLst->Insert( p_MkLine, LIST_APPEND ); + pLst->push_back( p_MkLine ); nState = 0; bInTnrList = sal_False; } - ByteString *pStr = new ByteString( aLineBuf ); - pMkLine->aLine = *pStr; + pMkLine->aLine = ByteString( aLineBuf ); pMkLine->bOut = sal_False; if ( bInTnrList ) - pTnrLst->Insert( pMkLine, LIST_APPEND ); + pTnrLst->push_back( pMkLine ); } else { /* Zeilen ignorieren */; @@ -196,27 +198,31 @@ void MkFilter::Filter() fprintf( stderr, "\n" ); // das File wieder ausgegeben - sal_uIntPtr nLines = pLst->Count(); - for ( sal_uIntPtr j=0; j<nLines; j++ ) + size_t nLines = pLst->size(); + for ( size_t j=0; j<nLines; j++ ) { - MkLine *pLine = pLst->GetObject( j ); + MkLine *pLine = (*pLst)[ j ]; if ( pLine->bHier ) { // die List n - Mal abarbeiten for ( sal_uInt16 n=1; n<11; n++) { - sal_uIntPtr nCount = pLine->pPrivateTnrLst->Count(); - for ( sal_uIntPtr i=0; i<nCount; i++ ) + size_t nCount = pLine->pPrivateTnrLst->size(); + for ( size_t i=0; i<nCount; i++ ) { - MkLine *pMkLine = pLine->pPrivateTnrLst->GetObject(i); + MkLine *pMkLine = (*pLine->pPrivateTnrLst)[ i ]; ByteString aLine = pMkLine->aLine; while( aLine.SearchAndReplace( aTnr, ByteString::CreateFromInt32( n )) != (sal_uInt16)-1 ) ; fputs( aLine.GetBuffer(), pOut ); fprintf( stderr, "o" ); } } - if ( pLine->pPrivateTnrLst != NULL ) + if ( pLine->pPrivateTnrLst != NULL ) { + for ( size_t i = 0, n = pLine->pPrivateTnrLst->size(); i < n; ++i ) { + delete (*pLine->pPrivateTnrLst)[ i ]; + } delete pLine->pPrivateTnrLst; + } pLine->pPrivateTnrLst = NULL; } if ( pLine->bOut ) @@ -235,3 +241,5 @@ int main() return nRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/bootstrp/prj.cxx b/tools/bootstrp/prj.cxx index b4dee65f9673..00be3bedddee 100644 --- a/tools/bootstrp/prj.cxx +++ b/tools/bootstrp/prj.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,19 +30,12 @@ #include "precompiled_tools.hxx" #include <stdlib.h> #include <stdio.h> -//#include "bootstrp/sstring.hxx" -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <tools/stream.hxx> -#include <tools/geninfo.hxx> #include "bootstrp/prj.hxx" -#include "bootstrp/inimgr.hxx" -DECLARE_LIST( UniStringList, UniString* ) - -//#define TEST 1 - -#if defined(WNT) || defined(OS2) +#if defined(WNT) #define LIST_DELIMETER ';' #define PATH_DELIMETER '\\' #elif defined UNX @@ -49,49 +43,24 @@ DECLARE_LIST( UniStringList, UniString* ) #define PATH_DELIMETER '/' #endif -//Link Star::aDBNotFoundHdl; - -// -// class SimpleConfig -// - -/*****************************************************************************/ -SimpleConfig::SimpleConfig( String aSimpleConfigFileName ) -/*****************************************************************************/ -{ - nLine = 0; - aFileName = aSimpleConfigFileName; - aFileStream.Open ( aFileName, STREAM_READ ); -} - -/*****************************************************************************/ -SimpleConfig::SimpleConfig( DirEntry& rDirEntry ) -/*****************************************************************************/ +SimpleConfig::SimpleConfig(const String &rSimpleConfigFileName) { - nLine = 0; - aFileName = rDirEntry.GetFull(); - aFileStream.Open ( aFileName, STREAM_READ ); + aFileStream.Open(rSimpleConfigFileName, STREAM_READ); } -/*****************************************************************************/ SimpleConfig::~SimpleConfig() -/*****************************************************************************/ { aFileStream.Close (); } -/*****************************************************************************/ ByteString SimpleConfig::GetNext() -/*****************************************************************************/ { - ByteString aString; - if ( aStringBuffer =="" ) while ((aStringBuffer = GetNextLine()) == "\t") ; //solange bis != "\t" if ( aStringBuffer =="" ) return ByteString(); - aString = aStringBuffer.GetToken(0,'\t'); + ByteString aString = aStringBuffer.GetToken(0,'\t'); aStringBuffer.Erase(0, aString.Len()+1); aStringBuffer.EraseLeadingChars( '\t' ); @@ -99,13 +68,8 @@ ByteString SimpleConfig::GetNext() return aString; } -/*****************************************************************************/ ByteString SimpleConfig::GetNextLine() -/*****************************************************************************/ { - ByteString aSecStr; - nLine++; - aFileStream.ReadLine ( aTmpStr ); if ( aTmpStr.Search( "#" ) == 0 ) return "\t"; @@ -114,7 +78,6 @@ ByteString SimpleConfig::GetNextLine() while ( aTmpStr.SearchAndReplace(ByteString(' '),ByteString('\t') ) != STRING_NOTFOUND ) ; int nLength = aTmpStr.Len(); sal_Bool bFound = sal_False; - ByteString aEraseString; for ( sal_uInt16 i = 0; i<= nLength; i++) { if ( aTmpStr.GetChar( i ) == 0x20 && !bFound ) @@ -123,49 +86,4 @@ ByteString SimpleConfig::GetNextLine() return aTmpStr; } -/*****************************************************************************/ -ByteString SimpleConfig::GetCleanedNextLine( sal_Bool bReadComments ) -/*****************************************************************************/ -{ - - aFileStream.ReadLine ( aTmpStr ); - if ( aTmpStr.Search( "#" ) == 0 ) - { - if (bReadComments ) - return aTmpStr; - else - while ( aTmpStr.Search( "#" ) == 0 ) - { - aFileStream.ReadLine ( aTmpStr ); - } - } - - aTmpStr = aTmpStr.EraseLeadingChars(); - aTmpStr = aTmpStr.EraseTrailingChars(); -// while ( aTmpStr.SearchAndReplace(String(' '),String('\t') ) != (sal_uInt16)-1 ); - int nLength = aTmpStr.Len(); - ByteString aEraseString; - sal_Bool bFirstTab = sal_True; - for ( sal_uInt16 i = 0; i<= nLength; i++) - { - if ( aTmpStr.GetChar( i ) == 0x20 ) - aTmpStr.SetChar( i, 0x09 ); - - if ( aTmpStr.GetChar( i ) == 0x09 ) - { - if ( bFirstTab ) - bFirstTab = sal_False; - else - { - aTmpStr.SetChar( i, 0x20 ); - } - } - else - bFirstTab = sal_True; - - } - aTmpStr.EraseAllChars(' '); - return aTmpStr; - -} - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/bootstrp/rscdep.cxx b/tools/bootstrp/rscdep.cxx index 7bcf036f6fa4..1ebd9e85ac9a 100644 --- a/tools/bootstrp/rscdep.cxx +++ b/tools/bootstrp/rscdep.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,7 +40,6 @@ #include "sal/main.h" #include <tools/string.hxx> -#include <tools/list.hxx> #include <tools/fsys.hxx> #include <tools/stream.hxx> @@ -78,8 +78,6 @@ void RscHrcDep::Execute() CppDep::Execute(); } -//static String aDelim; - int main( int argc, char** argv ) { int c; @@ -105,12 +103,10 @@ int main( int argc, char** argv ) if ( aBuf[0] == '-' && aBuf[1] == 'p' && aBuf[2] == '=' ) { strcpy(pFileNamePrefix, &aBuf[3]); - //break; } if ( aBuf[0] == '-' && aBuf[1] == 'f' && aBuf[2] == 'o' && aBuf[3] == '=' ) { strcpy(pOutputFileName, &aBuf[4]); - //break; } if ( aBuf[0] == '-' && aBuf[1] == 'f' && aBuf[2] == 'p' && aBuf[3] == '=' ) { @@ -118,16 +114,13 @@ int main( int argc, char** argv ) String aName( pSrsFileName, gsl_getSystemTextEncoding()); DirEntry aDest( aName ); aSrsBaseName = aDest.GetBase(); - //break; } if (aBuf[0] == '-' && aBuf[1] == 'i' ) { - //printf("Include : %s\n", &aBuf[2] ); pDep->AddSearchPath( &aBuf[2] ); } if (aBuf[0] == '-' && aBuf[1] == 'I' ) { - //printf("Include : %s\n", &aBuf[2] ); pDep->AddSearchPath( &aBuf[2] ); } if (aBuf[0] == '@' ) @@ -142,12 +135,10 @@ int main( int argc, char** argv ) if ( aBuf[0] == '-' && aBuf[1] == 'p' && aBuf[2] == '=' ) { strcpy(pFileNamePrefix, &aBuf[3]); - //break; } if ( aBuf2[0] == '-' && aBuf2[1] == 'f' && aBuf2[2] == 'o' ) { strcpy(pOutputFileName, &aBuf2[3]); - //break; } if ( aBuf2[0] == '-' && aBuf2[1] == 'f' && aBuf2[2] == 'p' ) { @@ -155,16 +146,13 @@ int main( int argc, char** argv ) String aName( pSrsFileName, gsl_getSystemTextEncoding()); DirEntry aDest( aName ); aSrsBaseName = aDest.GetBase(); - //break; } if (aBuf2[0] == '-' && aBuf2[1] == 'i' ) { - //printf("Include : %s\n", &aBuf[2] ); pDep->AddSearchPath( &aBuf2[2] ); } if (aBuf2[0] == '-' && aBuf2[1] == 'I' ) { - //printf("Include : %s\n", &aBuf[2] ); pDep->AddSearchPath( &aBuf2[2] ); } if (( aBuf2[0] != '-' ) && ( aBuf2[0] != '@' )) @@ -217,20 +205,7 @@ int main( int argc, char** argv ) } - DirEntry aEntry("."); - aEntry.ToAbs(); -// String aCwd = aEntry.GetName(); String aCwd(pFileNamePrefix, gsl_getSystemTextEncoding()); -/* sal_uInt16 nPos; -#ifndef UNX - while ( (nPos = aCwd.Search('\\') != STRING_NOTFOUND )) -#else - while ( (nPos = aCwd.Search('/') != STRING_NOTFOUND )) -#endif - { - String attt = aCwd.Copy( 0, nPos ); - aCwd.Erase( 0, nPos ); - } */ SvFileStream aOutStream; String aOutputFileName( pOutputFileName, gsl_getSystemTextEncoding()); DirEntry aOutEntry( aOutputFileName ); @@ -242,7 +217,6 @@ int main( int argc, char** argv ) aFileName += String(".", gsl_getSystemTextEncoding()); aFileName += aSrsBaseName; aFileName += String(".dprr", gsl_getSystemTextEncoding()); - //fprintf( stderr, "OutFileName : %s \n",aFileName.GetStr()); aOutStream.Open( aFileName, STREAM_WRITE ); ByteString aString; @@ -272,7 +246,7 @@ int main( int argc, char** argv ) aString += aRespArg; pDep->Execute(); ByteStringList *pLst = pDep->GetDepList(); - sal_uIntPtr nCount = pLst->Count(); + size_t nCount = pLst->size(); if ( nCount == 0 ) { aOutStream.WriteLine( aString ); @@ -283,9 +257,9 @@ int main( int argc, char** argv ) aOutStream.WriteLine( aString ); } - for ( sal_uIntPtr j=0; j<nCount; j++ ) + for ( size_t j = 0; j < nCount; j++ ) { - ByteString *pStr = pLst->GetObject(j); + ByteString *pStr = (*pLst)[ j ]; pStr->SearchAndReplaceAll('\\', ByteString( aDelim, RTL_TEXTENCODING_ASCII_US )); if ( j != (nCount-1) ) *pStr += ByteString( "\\" ); @@ -297,3 +271,4 @@ int main( int argc, char** argv ) return 0; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/bootstrp/so_checksum.cxx b/tools/bootstrp/so_checksum.cxx index 716e99eff9f1..e38252ea2f70 100644 --- a/tools/bootstrp/so_checksum.cxx +++ b/tools/bootstrp/so_checksum.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -54,3 +55,4 @@ int main( int argc, char * argv[] ) +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/bootstrp/sspretty.cxx b/tools/bootstrp/sspretty.cxx deleted file mode 100644 index 143705b6a2ea..000000000000 --- a/tools/bootstrp/sspretty.cxx +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_tools.hxx" -#include <tools/iparser.hxx> -#include <tools/geninfo.hxx> -#include <stdio.h> - - -/*****************************************************************************/ -#ifdef UNX -int main( int argc, char *argv[] ) -#else -int _cdecl main( int argc, char *argv[] ) -#endif -/*****************************************************************************/ -{ - if ( argc != 2 ) { - fprintf( stdout, "\nsspretty.exe v1.0 (c) 2001\n\n" ); - fprintf( stdout, "Syntax: sspretty filename\n" ); - } - else { - String aFileName( argv[ 1 ], RTL_TEXTENCODING_ASCII_US ); - InformationParser aParser; - GenericInformationList *pList = aParser.Execute( aFileName ); - if ( pList ) - aParser.Save( aFileName, pList ); - else { - fprintf( stderr, "Error reading input file!\n" ); - return 1; - } - } - return 0; -} - diff --git a/tools/inc/bootstrp/appdef.hxx b/tools/inc/bootstrp/appdef.hxx index bf73b215205e..833cd404847f 100644 --- a/tools/inc/bootstrp/appdef.hxx +++ b/tools/inc/bootstrp/appdef.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,39 +31,19 @@ #ifdef UNX -#define DEFAULT_INI_ROOT "/so/env" -#define DEFAULT_BS_ROOT "/so/env/b_server" #define PATH_SEPARATOR '/' #define S_PATH_SEPARATOR "/" #else -#define DEFAULT_INI_ROOT "r:" -#define DEFAULT_BS_ROOT "n:" #define PATH_SEPARATOR '\\' #define S_PATH_SEPARATOR "\\" #endif -#define _INI_DRV DEFAULT_INI_ROOT -#define B_SERVER_ROOT DEFAULT_BS_ROOT -#define _SOLARLIST B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "solar.lst" -#define _DEF_STAND_LIST B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "stand.lst" -#define _DEF_SSOLARINI B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "ssolar.ini" -#define _DEF_SSCOMMON B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "ssolar.cmn" -#define _INIROOT B_SERVER_ROOT S_PATH_SEPARATOR "config" -#define _INIROOT_OLD B_SERVER_ROOT S_PATH_SEPARATOR "config" -#define _INI_UNC "\\\\jumbo2.germany.sun.com\\R-Laufwerk" -#define _INI_UNC_OLD "\\\\jumbo2.germany.sun.com\\R-Laufwerk" - - // path conversion -const char* GetDefStandList(); -const char* GetIniRoot(); -const char* GetIniRootOld(); -const char* GetSSolarIni(); -const char* GetSSCommon(); -const char* GetBServerRoot(); const char* GetEnv( const char *pVar ); const char* GetEnv( const char *pVar, const char *pDefault ); #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/bootstrp/inimgr.hxx b/tools/inc/bootstrp/inimgr.hxx deleted file mode 100644 index d72df34f19af..000000000000 --- a/tools/inc/bootstrp/inimgr.hxx +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _INIMGR_HXX -#define _INIMGR_HXX - -#include <tools/fsys.hxx> -#include <tools/string.hxx> - -/***************************************************************************** -Purpose: Allows to work on a local set of initialisation files -If Update is used, the user must ensure that only one set of -Source and Destination Dir is used. Otherwise ForceUpdate has to be used -*****************************************************************************/ - -class IniManager -{ -private: - sal_Bool bUpdate; - - ByteString sGlobalDir; /// holds the org. ini dir - ByteString sLocalPath; /// holds path of local ini dir - -public: - IniManager( ByteString &rDir, ByteString &rLocalDir ); - IniManager( ByteString &rDir ); - IniManager(); - - ByteString ToLocal( ByteString &rPath ); - void Update(); /// Call ForceUpdate the First Time called - void ForceUpdate(); - - static ByteString GetLocalIni(); - static ByteString GetGlobalIni(); -}; - -#endif - diff --git a/tools/inc/bootstrp/mkcreate.hxx b/tools/inc/bootstrp/mkcreate.hxx deleted file mode 100644 index 96f272533d55..000000000000 --- a/tools/inc/bootstrp/mkcreate.hxx +++ /dev/null @@ -1,297 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _MK_CREATE_HXX -#define _MK_CREATE_HXX - -#include <tools/string.hxx> -//#include "bootstrp/sstring.hxx" - -DECLARE_LIST( UniStringList, UniString* ) - -#include <tools/list.hxx> -#include "bootstrp/prj.hxx" - -class SvStream; -class SourceDirectoryList; - -// -// class SourceDirectoryDependency -// - -class CodedDependency : public ByteString -{ -private: - sal_uInt16 nOSType; // operating systems where dependeny exists - -public: - /* create a dependency instance with given coded directory name - */ - CodedDependency( - const ByteString &rCodedIdentifier, // the coded name of the directory - sal_uInt16 nOperatingSystems // the operating systems where this dependency exists - ) : - ByteString( rCodedIdentifier ), - nOSType( nOperatingSystems ) - { - } - - /* returns the operating system - */ - sal_uInt16 GetOperatingSystem() - { - return nOSType; - } - - /* set operating system - */ - void SetOperatingSystem( sal_uInt16 nOperatingSystems ) - { - nOSType = nOperatingSystems; - } - - /* add operating systems if same dependency - */ - sal_Bool TryToMerge( - const ByteString &rCodedIdentifier, // the coded name of the directory - sal_uInt16 nOperatingSystems // the operating systems where this dependency exists - ) - { - if ( rCodedIdentifier != *this ) - return sal_False; - nOSType |= nOperatingSystems; - return sal_True; - } -}; - -// -// class Dependecy -// - -class Dependency : public ByteString -{ -private: - sal_uInt16 nOSType; // operating systems where dependecy exists - -public: - /* create a dependency instance with given directory name - */ - Dependency( - const ByteString &rDirectoryName, // the coded name of the directory - sal_uInt16 nOperatingSystems // the operating systems where this dependency exists - ) : - ByteString( rDirectoryName ), - nOSType( nOperatingSystems ) - { - } - - /* returns the operating system - */ - sal_uInt16 GetOperatingSystem() - { - return nOSType; - } -}; - -// -// class SourceDirectory -// - -class SourceDirectory : public ByteString -{ -private: - SourceDirectory *pParent; // the parent directory - SourceDirectoryList *pSubDirectories; // list of sub directories - sal_uInt16 nOSType; // operating systems where this directory is used - sal_uInt16 nDepth; // depth of directory structure (root is 0) - - SByteStringList *pDependencies; // dependencies on other directories in this depth - - SByteStringList *pCodedDependencies; // dependencies on other directories in different depth - SByteStringList *pCodedIdentifier; // symbolic identifier to resolve dependencies - - /* try to resolve a single dependency - */ - Dependency *ResolvesDependency( - CodedDependency *pCodedDependency // the dependency - ); - - /* returns the operating systems of a coded dependency - */ - static sal_uInt16 GetOSType( - const ByteString &sDependExt // the corresponding dependency extension (see also prj.hxx) - ); - - /* removes this and all sub directories with all dependencies - */ - sal_Bool RemoveDirectoryTreeAndAllDependencies(); - -public: - - /* create a directory instance with given parent and name, no parent means this is the root - * (not the file system root but the root of the source tree, e.g. o:\569) - */ - SourceDirectory( - const ByteString &rDirectoryName, // name without parent - sal_uInt16 nOperatingSystem, // the operating systems where this directory is used - SourceDirectory *pParentDirectory = NULL // parent (if not root) - ); - ~SourceDirectory(); - - /* returns the full absolute path of this directory - */ - ByteString GetFullPath(); - - /* returns a list of all sub directories - */ - SourceDirectoryList *GetSubDirectories() { return pSubDirectories; } - - /* returns the Operating systems where this directory is used - */ - sal_uInt16 GetOperatingSystems() { return nOSType; } - - /* returns the given directory - */ - SourceDirectory *GetDirectory( - const ByteString &rDirectoryName, // full path - sal_uInt16 nOperatingSystem // the operating systems where this directory is used - ); - - /* create the directory and all mandatory parents - */ - SourceDirectory *InsertFull( - const ByteString &rDirectoryName, // full path - sal_uInt16 nOperatingSystem // the operating systems where this directory is used - ) - { - return GetDirectory( rDirectoryName, nOperatingSystem ); - } - - /* create the directory as sub directory of this directory - */ - SourceDirectory *Insert( - const ByteString &rDirectoryName, // name without parent - sal_uInt16 nOperatingSystem // the operating systems where this directory is used - ); - - /* get the root directory - */ - SourceDirectory *GetRootDirectory(); - - /* get sub directory if exists - */ - SourceDirectory *GetSubDirectory( - const ByteString &rDirectoryPath, // full sub path - sal_uInt16 nOperatingSystem // the operating systems where this directory is used - ); - - /* add a dependency for several platforms - */ - CodedDependency *AddCodedDependency( - const ByteString &rCodedIdentifier, // the coded name of the directory - sal_uInt16 nOperatingSystems // the operating systems where this dependency exists - ); - - /* returns the dependency list - */ - SByteStringList *GetCodedDependencies() - { - return pCodedDependencies; - } - - /* add symbolic identifier to resolve dependencies (to this directory and all parents) - */ - CodedDependency *AddCodedIdentifier( - const ByteString &rCodedIdentifier, // the coded name of the directory - sal_uInt16 nOperatingSystems // the operating systems where this dependency exists - ); - - /* returns the identifier list - */ - SByteStringList *GetCodedIdentifier() - { - return pCodedIdentifier; - } - - /* create dependencies on other directory, coded dependecies are used - */ - void ResolveDependencies(); - - /* returns the target definition for this directory (if dependencies exist) - */ - ByteString GetTarget(); - - /* returns the target definition for all sub directory - */ - ByteString GetSubDirsTarget(); - - /* create the full directory tree (only virtual, not in file system) - */ - static SourceDirectory *CreateRootDirectory( - const ByteString &rRoot, // the root directory in file system - const ByteString &rVersion, // the solar verion (r.g. SRC590, SRC591 etc.) - sal_Bool bAll = sal_False // add all directories or only buildable ones - ); - - /* create the makefile.rc in file system - */ - sal_Bool CreateRecursiveMakefile( - sal_Bool bAllChilds = sal_False // create rcursive for all sub directories - ); -}; - -// -// class SourceDirectoryList -// - -class SourceDirectoryList : public SByteStringList -{ -public: - /* create a empty directory list - */ - SourceDirectoryList() - { - } - ~SourceDirectoryList(); - - /* search for a directory by directory name - */ - SourceDirectory *Search( - const ByteString &rDirectoryName // name without parent - ); - - /* insert a new directory - */ - sal_uIntPtr InsertSorted( - SourceDirectory *pDirectory // directory - ) - { - return PutString(( ByteString * ) pDirectory ); - } -}; - -#endif diff --git a/tools/inc/bootstrp/prj.hxx b/tools/inc/bootstrp/prj.hxx index 9e16ab2ee9a3..496f47bc88d1 100644 --- a/tools/inc/bootstrp/prj.hxx +++ b/tools/inc/bootstrp/prj.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,19 +41,17 @@ class SimpleConfig { - long nLine; - String aFileName; - SvFileStream aFileStream; - ByteString aTmpStr; - ByteString aStringBuffer; + SvFileStream aFileStream; + ByteString aTmpStr; + ByteString aStringBuffer; - ByteString GetNextLine(); + ByteString GetNextLine(); public: - SimpleConfig(String aSimpleConfigFileName); - SimpleConfig(DirEntry& rDirEntry); - ~SimpleConfig(); - ByteString GetNext(); - ByteString GetCleanedNextLine( sal_Bool bReadComments = sal_False ); + SimpleConfig(const String& rSimpleConfigFileName); + ~SimpleConfig(); + ByteString GetNext(); }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/impcont.hxx b/tools/inc/impcont.hxx index 9be0a909474d..8734f9d4ae74 100644 --- a/tools/inc/impcont.hxx +++ b/tools/inc/impcont.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -89,8 +90,6 @@ private: |* CBlock::GetObject() |* |* Beschreibung Gibt einen Pointer aus dem Block zurueck -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 |* *************************************************************************/ @@ -106,8 +105,6 @@ inline void* CBlock::GetObject( sal_uInt16 nIndex ) const |* Beschreibung Wir gehen davon aus, das Pointer in der Regel |* sich im ersten Block befindet und schalten |* deshalb eine Inline-Methode davor -|* Ersterstellung TH 02.07.93 -|* Letzte Aenderung TH 02.07.93 |* *************************************************************************/ @@ -126,8 +123,6 @@ inline void* Container::ImpGetObject( sal_uIntPtr nIndex ) const |* |* Beschreibung Wenn es nur einen Block gibt, wird davon |* das Daten-Array zurueckgegeben -|* Ersterstellung TH 24.01.96 -|* Letzte Aenderung TH 24.01.96 |* *************************************************************************/ @@ -145,3 +140,5 @@ inline void** Container::ImpGetOnlyNodes() const } #endif // _IMPCONT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/impstrg.hxx b/tools/inc/impstrg.hxx index 60b25a4c3fd6..e99e2b3990b3 100644 --- a/tools/inc/impstrg.hxx +++ b/tools/inc/impstrg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -52,3 +53,5 @@ xub_StrLen ImplStringLen( const sal_Unicode* pStr ); sal_Unicode* ImplGet1ByteUnicodeTab( rtl_TextEncoding eTextEncoding ); #endif // _IMPSTRG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/pch/precompiled_tools.cxx b/tools/inc/pch/precompiled_tools.cxx index cafe6444a55d..f467bbb6aed9 100644 --- a/tools/inc/pch/precompiled_tools.cxx +++ b/tools/inc/pch/precompiled_tools.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,3 +28,4 @@ #include "precompiled_tools.hxx" +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/pch/precompiled_tools.hxx b/tools/inc/pch/precompiled_tools.hxx index 2bc615738a08..dfed2ac7d4f6 100644 --- a/tools/inc/pch/precompiled_tools.hxx +++ b/tools/inc/pch/precompiled_tools.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -62,6 +63,7 @@ #include "osl/mutex.hxx" #include "osl/process.h" #include "osl/security.h" +#include "osl/signal.h" #include "osl/thread.h" #include "rtl/alloc.h" @@ -80,13 +82,12 @@ #include "rtl/ustring.h" #include "rtl/ustring.hxx" +#include "salhelper/timer.hxx" + #include "sys/stat.h" #include "sys/types.h" -#include "vos/macros.hxx" -#include "vos/mutex.hxx" -#include "vos/process.hxx" -#include "vos/signal.hxx" -#include "vos/timer.hxx" //---MARKER--- #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/poly.h b/tools/inc/poly.h index 7876398c1876..08bb5081c726 100644 --- a/tools/inc/poly.h +++ b/tools/inc/poly.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -90,3 +91,5 @@ public: }; #endif // _SV_POLY_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/StringListResource.hxx b/tools/inc/tools/StringListResource.hxx index 3f7f6dcc610a..6b199d855c87 100644 --- a/tools/inc/tools/StringListResource.hxx +++ b/tools/inc/tools/StringListResource.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -54,3 +55,5 @@ namespace tools }; } // namespace tools #endif // TOOLS_STRINGLISTRESOURCE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/appendunixshellword.hxx b/tools/inc/tools/appendunixshellword.hxx index 66b333bb62a5..bcfaf5f0e486 100644 --- a/tools/inc/tools/appendunixshellword.hxx +++ b/tools/inc/tools/appendunixshellword.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -57,3 +58,5 @@ TOOLS_DLLPUBLIC void appendUnixShellWord( #endif #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/b3dtrans.hxx b/tools/inc/tools/b3dtrans.hxx index 5b812bde15a2..2c136870d72b 100644 --- a/tools/inc/tools/b3dtrans.hxx +++ b/tools/inc/tools/b3dtrans.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -350,3 +351,5 @@ protected: #endif // _B3D_B3DTRANS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/bigint.hxx b/tools/inc/tools/bigint.hxx index 9a5f1e6de886..58810fffdd99 100644 --- a/tools/inc/tools/bigint.hxx +++ b/tools/inc/tools/bigint.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -82,8 +83,7 @@ public: BigInt( sal_uInt16 nVal ); BigInt( sal_uInt32 nVal ); BigInt( const BigInt& rBigInt ); - BigInt( const ByteString& rString ); - BigInt( const UniString& rString ); + BigInt( const String& rString ); #ifdef _TLBIGINT_INT64 BigInt( const SbxINT64 &r ); BigInt( const SbxUINT64 &r ); @@ -97,8 +97,7 @@ public: operator sal_uIntPtr() const; void Set( sal_Bool bSet ) { bIsSet = bSet; } - ByteString GetByteString() const; - UniString GetString() const; + String GetString() const; sal_Bool IsSet() const { return bIsSet; } sal_Bool IsNeg() const; @@ -326,3 +325,5 @@ inline sal_Bool operator>=( const BigInt& rVal1, const BigInt& rVal2 ) } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/cachestr.hxx b/tools/inc/tools/cachestr.hxx index 26085fb49e8b..adb9aacc28d2 100644 --- a/tools/inc/tools/cachestr.hxx +++ b/tools/inc/tools/cachestr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -81,3 +82,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/color.hxx b/tools/inc/tools/color.hxx index ad34f1e9de08..ecd5f83b688c 100644 --- a/tools/inc/tools/color.hxx +++ b/tools/inc/tools/color.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,9 +34,7 @@ class SvStream; class ResId; #include <tools/solar.h> -#ifndef _BGFX_COLOR_BCOLOR_HXX #include <basegfx/color/bcolor.hxx> -#endif // -------------------- // - ColorCount-Types - @@ -178,10 +177,14 @@ public: static ColorData HSBtoRGB( sal_uInt16 nHue, sal_uInt16 nSat, sal_uInt16 nBri ); void RGBtoHSB( sal_uInt16& nHue, sal_uInt16& nSat, sal_uInt16& nBri ) const; - sal_Bool operator==( const Color& rColor ) const - { return (mnColor == rColor.mnColor); } - sal_Bool operator!=( const Color& rColor ) const - { return !(Color::operator==( rColor )); } + // the range for cymk is 0 to 1.0 + static ColorData CMYKtoRGB( double fCyan, double fMagenta, double fYellow, double fKey ); + void RGBtoCMYK( double& fCyan, double& fMagenta, double& fYellow, double& fKey ); + + sal_Bool operator==( const Color& rColor ) const + { return (mnColor == rColor.mnColor); } + sal_Bool operator!=( const Color& rColor ) const + { return !(Color::operator==( rColor )); } SvStream& Read( SvStream& rIStm, sal_Bool bNewFormat = sal_True ); SvStream& Write( SvStream& rOStm, sal_Bool bNewFormat = sal_True ); @@ -237,3 +240,5 @@ inline void Color::Merge( const Color& rMergeColor, sal_uInt8 cTransparency ) } #endif // _TOOLS_COLOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/config.hxx b/tools/inc/tools/config.hxx index d0df492f5488..fae05fb8bc42 100644 --- a/tools/inc/tools/config.hxx +++ b/tools/inc/tools/config.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -99,3 +100,5 @@ private: }; #endif // _SV_CONFIG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/contnr.hxx b/tools/inc/tools/contnr.hxx index 804482afaea5..ea70c1756f3a 100644 --- a/tools/inc/tools/contnr.hxx +++ b/tools/inc/tools/contnr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -121,3 +122,5 @@ public: }; #endif // _CONTNR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/date.hxx b/tools/inc/tools/date.hxx index 6e4a2291d954..183f6af43fbd 100644 --- a/tools/inc/tools/date.hxx +++ b/tools/inc/tools/date.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -118,3 +119,5 @@ public: }; #endif // _DATE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/datetime.hxx b/tools/inc/tools/datetime.hxx index c642045c0e76..d12a276d0f03 100644 --- a/tools/inc/tools/datetime.hxx +++ b/tools/inc/tools/datetime.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -109,3 +110,5 @@ inline DateTime& DateTime::operator =( const DateTime& rDateTime ) } #endif // _DATETIME_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/debug.hxx b/tools/inc/tools/debug.hxx index 63a94555a8c1..3d75f94437cd 100644 --- a/tools/inc/tools/debug.hxx +++ b/tools/inc/tools/debug.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include "tools/toolsdllapi.h" -#ifndef _SAL_TYPES_H #include <sal/types.h> -#endif #include <tools/solar.h> // ------------ @@ -510,64 +509,6 @@ do \ #define DBG_BF_ASSERT( sCon, aError ) ((void)0) #endif -#define DBG_TRACE( aTrace ) \ -do \ -{ \ - if ( DbgIsTraceOut() ) \ - DbgTrace( aTrace ); \ -} while(0) -#define DBG_TRACE1( aTrace, x1 ) \ -do \ -{ \ - if ( DbgIsTraceOut() ) \ - { \ - DbgOutTypef( DBG_OUT_TRACE, aTrace, \ - x1 ); \ - } \ -} while(0) -#define DBG_TRACE2( aTrace, x1, x2 ) \ -do \ -{ \ - if ( DbgIsTraceOut() ) \ - { \ - DbgOutTypef( DBG_OUT_TRACE, aTrace, \ - x1, x2 ); \ - } \ -} while(0) -#define DBG_TRACE3( aTrace, x1, x2, x3 ) \ -do \ -{ \ - if ( DbgIsTraceOut() ) \ - { \ - DbgOutTypef( DBG_OUT_TRACE, aTrace, \ - x1, x2, x3 ); \ - } \ -} while(0) -#define DBG_TRACE4( aTrace, x1, x2, x3, x4 ) \ -do \ -{ \ - if ( DbgIsTraceOut() ) \ - { \ - DbgOutTypef( DBG_OUT_TRACE, aTrace, \ - x1, x2, x3, x4 ); \ - } \ -} while(0) -#define DBG_TRACE5( aTrace, x1, x2, x3, x4, x5 ) \ -do \ -{ \ - if ( DbgIsTraceOut() ) \ - { \ - DbgOutTypef( DBG_OUT_TRACE, aTrace, \ - x1, x2, x3, x4, x5 ); \ - } \ -} while(0) -#define DBG_TRACEFILE( aTrace ) \ -do \ -{ \ - if ( DbgIsTraceOut() ) \ - DbgTrace( aTrace, __FILE__, __LINE__ ); \ -} while(0) - #define DBG_WARNING( aWarning ) \ do \ { \ @@ -626,57 +567,6 @@ do \ DbgWarning( aWarning, __FILE__, __LINE__ ); \ } while(0) -#define DBG_ERROR( aError ) \ -do \ -{ \ - if ( DbgIsErrorOut() ) \ - DbgError( aError ); \ -} while(0) -#define DBG_ERROR1( aError, x1 ) \ -do \ -{ \ - if ( DbgIsErrorOut() ) \ - { \ - DbgOutTypef( DBG_OUT_ERROR, aError, \ - x1 ); \ - } \ -} while(0) -#define DBG_ERROR2( aError, x1, x2 ) \ -do \ -{ \ - if ( DbgIsErrorOut() ) \ - { \ - DbgOutTypef( DBG_OUT_ERROR, aError, \ - x1, x2 ); \ - } \ -} while(0) -#define DBG_ERROR3( aError, x1, x2, x3 ) \ -do \ -{ \ - if ( DbgIsErrorOut() ) \ - { \ - DbgOutTypef( DBG_OUT_ERROR, aError, \ - x1, x2, x3 ); \ - } \ -} while(0) -#define DBG_ERROR4( aError, x1, x2, x3, x4 ) \ -do \ -{ \ - if ( DbgIsErrorOut() ) \ - { \ - DbgOutTypef( DBG_OUT_ERROR, aError, \ - x1, x2, x3, x4 ); \ - } \ -} while(0) -#define DBG_ERROR5( aError, x1, x2, x3, x4, x5 ) \ -do \ -{ \ - if ( DbgIsErrorOut() ) \ - { \ - DbgOutTypef( DBG_OUT_ERROR, aError, \ - x1, x2, x3, x4, x5 ); \ - } \ -} while(0) #define DBG_ERRORFILE( aError ) \ do \ { \ @@ -750,13 +640,6 @@ typedef const sal_Char* (*DbgUsr)(const void* pThis ); #define DBG_ASSERTWARNING( sCon, aWarning ) ((void)0) #define DBG_ASSERT( sCon, aError ) ((void)0) #define DBG_BF_ASSERT( sCon, aError ) ((void)0) -#define DBG_TRACE( aTrace ) ((void)0) -#define DBG_TRACE1( aTrace, x1 ) ((void)0) -#define DBG_TRACE2( aTrace, x1, x2 ) ((void)0) -#define DBG_TRACE3( aTrace, x1, x2, x3 ) ((void)0) -#define DBG_TRACE4( aTrace, x1, x2, x3, x4 ) ((void)0) -#define DBG_TRACE5( aTrace, x1, x2, x3, x4, x5 ) ((void)0) -#define DBG_TRACEFILE( aTrace ) ((void)0) #define DBG_WARNING( aWarning ) ((void)0) #define DBG_WARNING1( aWarning, x1 ) ((void)0) #define DBG_WARNING2( aWarning, x1, x2 ) ((void)0) @@ -764,12 +647,6 @@ typedef const sal_Char* (*DbgUsr)(const void* pThis ); #define DBG_WARNING4( aWarning, x1, x2, x3, x4 ) ((void)0) #define DBG_WARNING5( aWarning, x1, x2, x3, x4, x5 ) ((void)0) #define DBG_WARNINGFILE( aWarning ) ((void)0) -#define DBG_ERROR( aError ) ((void)0) -#define DBG_ERROR1( aError, x1 ) ((void)0) -#define DBG_ERROR2( aError, x1, x2 ) ((void)0) -#define DBG_ERROR3( aError, x1, x2, x3 ) ((void)0) -#define DBG_ERROR4( aError, x1, x2, x3, x4 ) ((void)0) -#define DBG_ERROR5( aError, x1, x2, x3, x4, x5 ) ((void)0) #define DBG_ERRORFILE( aError ) ((void)0) #define DBG_TESTSOLARMUTEX() ((void)0) @@ -781,3 +658,5 @@ typedef const sal_Char* (*DbgUsr)(const void* pThis ); #endif #endif // _TOOLS_DEBUG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/diagnose_ex.h b/tools/inc/tools/diagnose_ex.h index b244d11dc305..4649bedc212f 100644 --- a/tools/inc/tools/diagnose_ex.h +++ b/tools/inc/tools/diagnose_ex.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -89,33 +90,36 @@ #define ENSURE_ARG_OR_THROW(c, m) if( !(c) ) { \ OSL_ENSURE(c, m); \ throw ::com::sun::star::lang::IllegalArgumentException( \ - ::rtl::OUString::createFromAscii(BOOST_CURRENT_FUNCTION) + \ - ::rtl::OUString::createFromAscii(",\n"m), \ + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(BOOST_CURRENT_FUNCTION)) + \ + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ",\n"m )), \ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(), \ 0 ); } #define ENSURE_ARG_OR_THROW2(c, m, ifc, arg) if( !(c) ) { \ OSL_ENSURE(c, m); \ throw ::com::sun::star::lang::IllegalArgumentException( \ - ::rtl::OUString::createFromAscii(BOOST_CURRENT_FUNCTION) + \ - ::rtl::OUString::createFromAscii(",\n"m), \ + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(BOOST_CURRENT_FUNCTION)) + \ + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ",\n"m )), \ ifc, \ arg ); } /** This macro asserts the given condition (in debug mode), and throws an RuntimeException afterwards. */ -#define ENSURE_OR_THROW(c, m) if( !(c) ) { \ - OSL_ENSURE(c, m); \ - throw ::com::sun::star::uno::RuntimeException( \ - ::rtl::OUString::createFromAscii(BOOST_CURRENT_FUNCTION) + \ - ::rtl::OUString::createFromAscii(",\n"m), \ - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() ); } -#define ENSURE_OR_THROW2(c, m, ifc) if( !(c) ) { \ - OSL_ENSURE(c, m); \ - throw ::com::sun::star::uno::RuntimeException( \ - ::rtl::OUString::createFromAscii(BOOST_CURRENT_FUNCTION) + \ - ::rtl::OUString::createFromAscii(",\n"m), \ - ifc ); } +#define ENSURE_OR_THROW(c, m) \ + if( !(c) ){ \ + OSL_ENSURE(c, m); \ + throw ::com::sun::star::uno::RuntimeException( \ + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(BOOST_CURRENT_FUNCTION)) + \ + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ",\n"m )), \ + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() ); } + +#define ENSURE_OR_THROW2(c, m, ifc) \ + if( !(c) ) { \ + OSL_ENSURE(c, m); \ + throw ::com::sun::star::uno::RuntimeException( \ + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(BOOST_CURRENT_FUNCTION)) + \ + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ",\n"m )), \ + ifc ); } /** This macro asserts the given condition (in debug mode), and returns the given value afterwards. @@ -173,3 +177,5 @@ } #endif // TOOLS_DIAGNOSE_EX_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/dynary.hxx b/tools/inc/tools/dynary.hxx index d7ed083b8e44..fb2fcce0d17b 100644 --- a/tools/inc/tools/dynary.hxx +++ b/tools/inc/tools/dynary.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -108,3 +109,5 @@ public: \ }; #endif // _DYNARY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/errcode.hxx b/tools/inc/tools/errcode.hxx index 404ce7bd6e34..f2cdf4f5e533 100644 --- a/tools/inc/tools/errcode.hxx +++ b/tools/inc/tools/errcode.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,10 +30,8 @@ #define _ERRCODE_HXX #ifndef __RSC -#ifndef _SOLAR_H #include <tools/solar.h> #endif -#endif /* @@ -321,3 +320,5 @@ inline sal_uIntPtr ERRCODE_TOERROR( sal_uIntPtr x ) #define ERRCODE_INET_OFFLINE (ERRCODE_AREA_INET | ERRCODE_CLASS_READ |6) #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/errinf.hxx b/tools/inc/tools/errinf.hxx index e059a7add067..ae407e345885 100644 --- a/tools/inc/tools/errinf.hxx +++ b/tools/inc/tools/errinf.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -241,3 +242,5 @@ public: #endif #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/extendapplicationenvironment.hxx b/tools/inc/tools/extendapplicationenvironment.hxx index 05eac33effba..3ea5cb7c6b14 100644 --- a/tools/inc/tools/extendapplicationenvironment.hxx +++ b/tools/inc/tools/extendapplicationenvironment.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,3 +41,5 @@ TOOLS_DLLPUBLIC void extendApplicationEnvironment(); } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/fldunit.hxx b/tools/inc/tools/fldunit.hxx index 0154b4403501..d98cb69185a0 100644 --- a/tools/inc/tools/fldunit.hxx +++ b/tools/inc/tools/fldunit.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,7 +35,9 @@ enum FieldUnit { FUNIT_NONE, FUNIT_MM, FUNIT_CM, FUNIT_M, FUNIT_KM, FUNIT_TWIP, FUNIT_POINT, FUNIT_PICA, - FUNIT_INCH, FUNIT_FOOT, FUNIT_MILE, FUNIT_CUSTOM, + FUNIT_INCH, FUNIT_FOOT, FUNIT_MILE, FUNIT_CHAR, FUNIT_LINE, FUNIT_CUSTOM, FUNIT_PERCENT, FUNIT_100TH_MM }; #endif // _TOOLS_FLDUNIT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/fontenum.hxx b/tools/inc/tools/fontenum.hxx index 54611c8f7c25..849bb2720e5c 100644 --- a/tools/inc/tools/fontenum.hxx +++ b/tools/inc/tools/fontenum.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -170,3 +171,5 @@ enum FontAntiAlias { ANTIALIAS_DONTKNOW, ANTIALIAS_FALSE, ANTIALIAS_TRUE }; #endif #endif // _TOOLS_FONTENUM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/fract.hxx b/tools/inc/tools/fract.hxx index 249f1723097b..1e9f67a50da9 100644 --- a/tools/inc/tools/fract.hxx +++ b/tools/inc/tools/fract.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -48,7 +49,7 @@ public: Fraction( long nN1, long nN2, long nD1, long nD2 ); Fraction( double dVal ); - sal_Bool IsValid() const; + bool IsValid() const; long GetNumerator() const { return nNumerator; } long GetDenominator() const { return nDenominator; } @@ -64,31 +65,19 @@ public: Fraction& operator/=( const Fraction& rfrFrac ); void ReduceInaccurate( unsigned nSignificantBits ); -#ifdef __BORLANDC__ - friend Fraction operator+( const Fraction& rVal1, const Fraction& rVal2 ); - friend Fraction operator-( const Fraction& rVal1, const Fraction& rVal2 ); - friend Fraction operator*( const Fraction& rVal1, const Fraction& rVal2 ); - friend Fraction operator/( const Fraction& rVal1, const Fraction& rVal2 ); - - friend sal_Bool operator==( const Fraction& rVal1, const Fraction& rVal2 ); - friend sal_Bool operator!=( const Fraction& rVal1, const Fraction& rVal2 ); - friend sal_Bool operator< ( const Fraction& rVal1, const Fraction& rVal2 ); - friend sal_Bool operator> ( const Fraction& rVal1, const Fraction& rVal2 ); - friend sal_Bool operator<=( const Fraction& rVal1, const Fraction& rVal2 ); - friend sal_Bool operator>=( const Fraction& rVal1, const Fraction& rVal2 ); -#else + friend inline Fraction operator+( const Fraction& rVal1, const Fraction& rVal2 ); friend inline Fraction operator-( const Fraction& rVal1, const Fraction& rVal2 ); friend inline Fraction operator*( const Fraction& rVal1, const Fraction& rVal2 ); friend inline Fraction operator/( const Fraction& rVal1, const Fraction& rVal2 ); - TOOLS_DLLPUBLIC friend sal_Bool operator==( const Fraction& rVal1, const Fraction& rVal2 ); - friend inline sal_Bool operator!=( const Fraction& rVal1, const Fraction& rVal2 ); - TOOLS_DLLPUBLIC friend sal_Bool operator< ( const Fraction& rVal1, const Fraction& rVal2 ); - TOOLS_DLLPUBLIC friend sal_Bool operator> ( const Fraction& rVal1, const Fraction& rVal2 ); - friend inline sal_Bool operator<=( const Fraction& rVal1, const Fraction& rVal2 ); - friend inline sal_Bool operator>=( const Fraction& rVal1, const Fraction& rVal2 ); -#endif + TOOLS_DLLPUBLIC friend bool operator==( const Fraction& rVal1, const Fraction& rVal2 ); + friend inline bool operator!=( const Fraction& rVal1, const Fraction& rVal2 ); + TOOLS_DLLPUBLIC friend bool operator< ( const Fraction& rVal1, const Fraction& rVal2 ); + TOOLS_DLLPUBLIC friend bool operator> ( const Fraction& rVal1, const Fraction& rVal2 ); + friend inline bool operator<=( const Fraction& rVal1, const Fraction& rVal2 ); + friend inline bool operator>=( const Fraction& rVal1, const Fraction& rVal2 ); + TOOLS_DLLPUBLIC friend SvStream& operator>>( SvStream& rIStream, Fraction& rFract ); TOOLS_DLLPUBLIC friend SvStream& operator<<( SvStream& rOStream, const Fraction& rFract ); }; @@ -106,7 +95,7 @@ inline Fraction& Fraction::operator=( const Fraction& rFrac ) return *this; } -inline sal_Bool Fraction::IsValid() const +inline bool Fraction::IsValid() const { return (nDenominator > 0); } @@ -147,19 +136,21 @@ inline Fraction operator/( const Fraction& rVal1, const Fraction& rVal2 ) return aErg; } -inline sal_Bool operator !=( const Fraction& rVal1, const Fraction& rVal2 ) +inline bool operator !=( const Fraction& rVal1, const Fraction& rVal2 ) { return !(rVal1 == rVal2); } -inline sal_Bool operator <=( const Fraction& rVal1, const Fraction& rVal2 ) +inline bool operator <=( const Fraction& rVal1, const Fraction& rVal2 ) { return !(rVal1 > rVal2); } -inline sal_Bool operator >=( const Fraction& rVal1, const Fraction& rVal2 ) +inline bool operator >=( const Fraction& rVal1, const Fraction& rVal2 ) { return !(rVal1 < rVal2); } #endif // _FRACT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/fsys.hxx b/tools/inc/tools/fsys.hxx index 9507fdb15faa..440d3aeaeabb 100644 --- a/tools/inc/tools/fsys.hxx +++ b/tools/inc/tools/fsys.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,12 +33,11 @@ #include <tools/string.hxx> #include <tools/link.hxx> #include <tools/wldcrd.hxx> -#ifndef __ERRCODE_HXX #include <tools/errcode.hxx> -#endif #include "tools/toolsdllapi.h" #include <cstdarg> +#include <vector> #define FEAT_FSYS_DOUBLESPEED @@ -46,13 +46,14 @@ // -------------- class DirEntry; -class DirEntryList; -class FSysSortList; -class FileStatList; +class FileStat; struct FileCopier_Impl; class SvFileStream; class BigInt; +typedef ::std::vector< DirEntry* > DirEntryList; +typedef ::std::vector< FileStat* > FileStatList; + #define FSYS_BUFSIZE 1024 #define FSYS_SHORTNAME_DELIMITER '@' @@ -95,6 +96,7 @@ typedef int FSysSort; #define FSYS_SORT_KIND ((FSysSort) 256) #define FSYS_SORT_CREATOR ((FSysSort) 512) #define FSYS_SORT_END ((FSysSort)1024) +typedef ::std::vector< FSysSort > FSysSortList; // DirEntryFlag enum DirEntryFlag @@ -112,21 +114,10 @@ enum DirEntryFlag enum FSysPathStyle { FSYS_STYLE_HOST, - FSYS_STYLE_FAT, - FSYS_STYLE_MSDOS = FSYS_STYLE_FAT, - FSYS_STYLE_VFAT, - FSYS_STYLE_WIN95 = FSYS_STYLE_VFAT, - FSYS_STYLE_HPFS, - FSYS_STYLE_OS2 = FSYS_STYLE_HPFS, FSYS_STYLE_NTFS, - FSYS_STYLE_NWFS, - FSYS_STYLE_SYSV, FSYS_STYLE_BSD, FSYS_STYLE_UNX = FSYS_STYLE_BSD, - FSYS_STYLE_MAC, FSYS_STYLE_DETECT, - FSYS_STYLE_UNKNOWN, - FSYS_STYLE_URL }; // FSysAction @@ -221,10 +212,8 @@ public: Time TimeAccessed() const { return aTimeAccessed; } sal_Bool IsYounger( const FileStat& rIsOlder ) const; -#define TF_FSYS_READONLY_FLAG static sal_uIntPtr SetReadOnlyFlag( const DirEntry &rEntry, sal_Bool bRO = sal_True ); static sal_Bool GetReadOnlyFlag( const DirEntry &rEntry ); - static sal_Bool HasReadOnlyFlag(); static ErrCode QueryDiskSpace( const String &rPath, BigInt &rFreeBytes, BigInt &rTotalBytes ); @@ -259,8 +248,6 @@ private: DirEntryFlag aDirFlag, FSysPathStyle eStyle ); -//#if 0 // _SOLAR__PRIVATE - friend class Dir; friend class FileStat; friend const char* ImpCheckDirEntry( const void* p ); @@ -271,11 +258,8 @@ private: FSysPathStyle eStyle ); TOOLS_DLLPRIVATE FSysError ImpParseUnixName( const ByteString& rPfad, FSysPathStyle eStyle ); - TOOLS_DLLPRIVATE sal_uInt16 ImpTryUrl( DirEntryStack& rStack, const String& rPfad, FSysPathStyle eStyle ); TOOLS_DLLPRIVATE const DirEntry* ImpGetTopPtr() const; TOOLS_DLLPRIVATE DirEntry* ImpGetTopPtr(); - TOOLS_DLLPRIVATE DirEntry* ImpGetPreTopPtr(); - TOOLS_DLLPRIVATE sal_Bool ImpToRel( String aStart ); protected: void ImpTrim( FSysPathStyle eStyle ); @@ -288,8 +272,6 @@ protected: void ImpSetStat( FileStat *p ) { pStat = p; } #endif -//#endif - protected: void SetError( sal_uIntPtr nErr ) { nError = nErr; } DirEntry* GetParent() { return pParent; } @@ -302,9 +284,6 @@ public: FSysPathStyle eParser = FSYS_STYLE_HOST ); ~DirEntry(); - sal_Bool IsLongNameOnFAT() const; - sal_Bool IsCaseSensitive (FSysPathStyle eFormatter = FSYS_STYLE_HOST) const; - sal_uIntPtr GetError() const { return nError; } sal_Bool IsValid() const; DirEntryFlag GetFlag() const { return eFlag; }; @@ -335,9 +314,6 @@ public: bool IsAbs() const; sal_Bool ToAbs(); sal_Bool Find( const String& rPfad, char cDelim = 0 ); - sal_Bool ToRel(); - sal_Bool ToRel( const DirEntry& rRefDir ); - sal_uInt16 CutRelParents(); sal_Bool SetCWD( sal_Bool bSloppy = sal_False ) const; sal_Bool MakeDir( sal_Bool bSloppy = sal_False ) const; @@ -372,11 +348,7 @@ public: static String GetAccessDelimiter( FSysPathStyle eFormatter = FSYS_STYLE_HOST ); static String GetSearchDelimiter( FSysPathStyle eFormatter = FSYS_STYLE_HOST ); - static sal_uInt16 GetMaxNameLen( FSysPathStyle eFormatter = FSYS_STYLE_HOST ); static FSysPathStyle GetPathStyle( const String &rDevice ); - static String ConvertNameToSystem( const String & rName ); - static String ConvertSystemToName( const String & rName ); - static sal_Bool IsRFSAvailable(); }; // -------------- @@ -466,8 +438,8 @@ private: protected: sal_Bool ImpInsertPointReached( const DirEntry& rIsSmaller, const FileStat& rNewStat, - sal_uIntPtr nCurPos, - sal_uIntPtr nSortIndex ) const; + size_t nCurPos, + size_t nSortIndex ) const; void ImpSortedInsert( const DirEntry *pNewEntry, const FileStat *pNewStat ); #endif @@ -487,11 +459,11 @@ public: void Reset(); sal_uInt16 Scan( sal_uInt16 nCount = 5 ); - sal_uInt16 Count( sal_Bool bUpdated = sal_True ) const; + size_t Count( sal_Bool bUpdated = sal_True ) const; sal_Bool Update(); Dir& operator +=( const Dir& rDir ); - DirEntry& operator []( sal_uInt16 nIndex ) const; + DirEntry& operator []( size_t nIndex ) const; }; // we don't need this stuff for bootstraping @@ -562,3 +534,4 @@ void FSysTest(); #endif // #ifndef _FSYS_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/gen.hxx b/tools/inc/tools/gen.hxx index 360ecdf98325..f53dba883e1a 100644 --- a/tools/inc/tools/gen.hxx +++ b/tools/inc/tools/gen.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -139,17 +140,10 @@ public: Point& operator *= ( const long nVal ); Point& operator /= ( const long nVal ); -#ifdef __BORLANDC__ - friend Point operator+( const Point &rVal1, const Point &rVal2 ); - friend Point operator-( const Point &rVal1, const Point &rVal2 ); - friend Point operator*( const Point &rVal1, const long nVal2 ); - friend Point operator/( const Point &rVal1, const long nVal2 ); -#else friend inline Point operator+( const Point &rVal1, const Point &rVal2 ); friend inline Point operator-( const Point &rVal1, const Point &rVal2 ); friend inline Point operator*( const Point &rVal1, const long nVal2 ); friend inline Point operator/( const Point &rVal1, const long nVal2 ); -#endif long getX() const { return X(); } long getY() const { return Y(); } @@ -448,13 +442,8 @@ public: Rectangle& operator += ( const Point& rPt ); Rectangle& operator -= ( const Point& rPt ); -#ifdef __BORLANDC__ - friend Rectangle operator + ( const Rectangle& rRect, const Point& rPt ); - friend Rectangle operator - ( const Rectangle& rRect, const Point& rPt ); -#else friend inline Rectangle operator + ( const Rectangle& rRect, const Point& rPt ); friend inline Rectangle operator - ( const Rectangle& rRect, const Point& rPt ); -#endif TOOLS_DLLPUBLIC friend SvStream& operator>>( SvStream& rIStream, Rectangle& rRect ); TOOLS_DLLPUBLIC friend SvStream& operator<<( SvStream& rOStream, const Rectangle& rRect ); @@ -710,3 +699,5 @@ inline Rectangle operator - ( const Rectangle& rRect, const Point& rPt ) } #endif // _GEN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/geninfo.hxx b/tools/inc/tools/geninfo.hxx deleted file mode 100644 index 889d8c1713cc..000000000000 --- a/tools/inc/tools/geninfo.hxx +++ /dev/null @@ -1,230 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BOOTSTRP_GENINFO_HXX -#define _BOOTSTRP_GENINFO_HXX - -#include "tools/toolsdllapi.h" - -#include <tools/string.hxx> -#include <tools/list.hxx> - -// forwards -class GenericInformationList; - -// -// class GenericInformation -// - -/****************************************************************************** -Purpose: holds generic informations and subinformations in a simple format -******************************************************************************/ - -class TOOLS_DLLPUBLIC GenericInformation : public ByteString // the key is stored in base class -{ -friend class GenericInformationList; // can be child or/and parent -private: - ByteString sValue; // holds value of data - ByteString sComment; - - GenericInformationList *pInfoList; // holds subinformations - GenericInformationList *pParent; // holds a pointer to parent list - - // methods - void ListDeleted() { pParent = NULL; } // allowed to be accessed - // from friend class - // GenericInformationList - -public: - GenericInformation( const ByteString &rKey, const ByteString &rValue, - GenericInformationList *pParentList = NULL, - GenericInformationList *pSubInfos = NULL ); - GenericInformation( const GenericInformation& rInf, sal_Bool bCopySubs = sal_True); - - ~GenericInformation(); - - ByteString &GetValue() { return sValue; } - void SetValue( const ByteString &rValue ) { sValue = rValue; } - - ByteString &GetComment() { return sComment; } - void SetComment( const ByteString &rComment ) { sComment = rComment; } - - // this methods used to handle sub informations - sal_Bool InsertSubInfo( GenericInformation *pInfo ); - // siehe GenericInformationList - sal_Bool InsertSubInfo( const ByteString &rPathKey, const ByteString &rValue, - sal_Bool bSearchByPath = sal_False, sal_Bool bNewPath = sal_False); - void RemoveSubInfo( GenericInformation *pInfo, sal_Bool bDelete = sal_False ); - // void RemoveSelf( sal_Bool bDelete = sal_False ); // loescht sich selbst aus der Parentliste - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // bei bDelete = sal_True werden auch alle Sublisten UND DIE INFO SELBST geloescht. - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - GenericInformation *GetSubInfo( ByteString &rKey, sal_Bool bSearchByPath = sal_False, - sal_Bool bCreatePath = sal_False ); - // path can be something like this: src370/drives/o: - - void SetSubList( GenericInformationList *pSubList ) - { pInfoList = pSubList; } - GenericInformationList *GetSubList() { return pInfoList; } -}; - -/* diese Klasse bietet einen SemaphoreLock zum lesen (und nicht Schreiben) - * oder schreiben (und nicht lesen) - */ -class GenericLockInformation : public GenericInformation -{ -public: -GenericLockInformation( const ByteString &rKey, const ByteString &rValue, - GenericInformationList *pParentList = NULL, - GenericInformationList *pSubInfos = NULL ) - : GenericInformation( rKey, rValue, pParentList, pSubInfos), - aLockState( read ), nLockKey( 0 ) {}; - //~GenericLockInformation(); - - /* bietet einen Lockmechanismus fuer exclusive Zugriffe - * - * -"writeonly" wird angesprochen, wenn von der Wurzel ausgehend - * ein Item veraendert werden soll. In der Zeit kann die Liste nicht - * gelesen werden, womit keine Inconsistenzen entstehen koennen. - * - * -"read" wird zum Normalen lesen der Infos benutzt, 90% der Betriebszeit. - * waerenddessen kann nicht geschrieben werden -> writeonly Lock. - * Ist fuer den atomaren(nicht unterbrochenen) Lesezugriff gedacht - * - * -"readonly" wird zum niederschreiben des Teilbaums benutzt, was schon mal - * 10 Minuten dauern kann. In der Zeit kann kein Writeonlylock gesetzt - * werden, aber ein rescedule. Damit koennen andere Aktionen asynchron ausgefuert - * werden, aber die Datensicherheit bleibt gewahrt - * - * Zustandsaenderung: writeonly <-> read <-> readonly - * - * nLockKey ist zum verschluesseln des LockZugriffs mit einem 32bit Wort vorgesehen. - * ist der Schluessel nicht null, so kann nur mit dem Schluessel in - * die Baumstruktur geschrieben werden. - * ist der Schluessel nLockKey Null, dann kann jeder Schreiben und die Locks loesen - */ - enum LockState{ writeonly, read, readonly }; - - /* der Schreibschutz darf nur aktiviert werden, wenn - * der Status auf Lesen steht - */ - sal_Bool SetWriteLock(sal_uInt32 nKey = 0) { return ((read==aLockState) && - (aLockState=writeonly, nLockKey=nKey, sal_True)); } - /* Schreibschutz darf nur geloest werden, wenn - * der Schreibschutz drin ist, und - * entweder der LockKey Null ist(Generalschluessel) oder der Key zum LockKey passt - */ - sal_Bool ReleaseWriteLock(sal_uInt32 nKey = 0) { return ((writeonly==aLockState) && - (!nLockKey||nKey==nLockKey) && - (aLockState=read, nLockKey=0, sal_True)); } // setzt den zustand auf "read" - sal_Bool SetReadLock(sal_uInt32 nKey = 0) { return ((read==aLockState) && - (aLockState=readonly, nLockKey=nKey, sal_True)); } - sal_Bool ReleaseReadLock(sal_uInt32 nKey = 0) { return ((readonly==aLockState) && - (!nLockKey||nKey==nLockKey) && - (aLockState=read, nLockKey=0, sal_True)); } // setzt den zustand auf "read" - - LockState GetLockState() const { return aLockState; } - sal_Bool IsWriteLocked() const { return (writeonly==aLockState); } - sal_Bool IsReadLocked() const { return (readonly==aLockState); } - sal_Bool IsNotLocked() const { return (read==aLockState); } - sal_Bool IsLocker( sal_uInt32 nKey ) { return (nKey==nLockKey || !nLockKey); } - - /* wenn der Schreibschutz aktiviert wurde, - * und bei vorhandenem Schreibschutz die Keys stimmen - * rufe die Parentmethode auf */ - sal_Bool InsertSubInfo( GenericInformation *pInfo, sal_uInt32 nKey = 0 ) { - return ((writeonly==aLockState) && - (!nLockKey || nKey==nLockKey) && - (GenericInformation::InsertSubInfo( pInfo ), sal_True)); } - - sal_Bool InsertSubInfo( const ByteString &rPathKey, const ByteString &rValue, sal_uInt32 nKey = 0, - sal_Bool bSearchByPath = sal_False, sal_Bool bNewPath = sal_False) { - return ((writeonly==aLockState) && - (!nLockKey || nKey==nLockKey) && - (GenericInformation::InsertSubInfo( rPathKey, rValue, bSearchByPath, bNewPath ), sal_True)); } - /* 29.jan.98: erweiterung um lesemoeglichkeit vom Lockclienten */ - GenericInformation *GetSubInfo( ByteString &rKey, sal_Bool bSearchByPath = sal_False, - sal_Bool bCreatePath = sal_False, sal_uInt32 nKey = 0 ) { - if (writeonly==aLockState && nLockKey && nKey!=nLockKey ) - return NULL; - return GenericInformation::GetSubInfo(rKey, bSearchByPath, bCreatePath); } - - // TYPEINFO(); -private: - - LockState aLockState; - sal_uInt32 nLockKey; -}; - -// -// class GenericInformationList -// - -/****************************************************************************** -Purpose: holds set of generic informations in a sorted list -******************************************************************************/ - -DECLARE_LIST( GenericInformationList_Impl, GenericInformation * ) - -class TOOLS_DLLPUBLIC GenericInformationList : public GenericInformationList_Impl -{ -private: - GenericInformation *pOwner; // holds parent of this list - -protected: - // methods - sal_uIntPtr InsertSorted( GenericInformation *pInfo, sal_Bool bOverwrite, - sal_uIntPtr nStart, sal_uIntPtr nEnd ); - GenericInformation *Search( sal_uIntPtr &rPos, ByteString sKey, - sal_uIntPtr nStart, sal_uIntPtr nEnd ); - -public: - GenericInformationList( GenericInformation *pParent = NULL ); - GenericInformationList(const GenericInformationList& rList, GenericInformation *pParent = NULL); - ~GenericInformationList(); - - // this methods used to handle the informations using binary search - GenericInformation *GetInfo( ByteString &rKey, sal_Bool bSearchByPath = sal_False, - sal_Bool bCreatePath = sal_False ); - /* path can be something like this: src370/drives/o: - * bCreatePath will create the neccecary paths to the GI */ - - sal_Bool InsertInfo( GenericInformation *pInfo, sal_Bool bOverwrite = sal_True ); - /* legt eine GenericInformation im Baum an mit Key-Value - * wenn bNewPath gesetzt, wird der nichtexistente Teil des Pfades neu kreiert - * wenn bNewPath nicht gesetzt ist und ein Teil des Pfades nicht vorhanden ist, - * gibt die Methode sal_False zurueck.*/ - sal_Bool InsertInfo( const ByteString &rPathKey, const ByteString &rValue, - sal_Bool bSearchByPath = sal_False, sal_Bool bNewPath = sal_False); - void RemoveInfo( GenericInformation *pInfo, sal_Bool bDelete = sal_False ); - - GenericInformation* SetOwner( GenericInformation *pNewOwner ); - -}; - -#endif - diff --git a/tools/inc/tools/getprocessworkingdir.hxx b/tools/inc/tools/getprocessworkingdir.hxx index 1b0688379590..05487ae756f5 100644 --- a/tools/inc/tools/getprocessworkingdir.hxx +++ b/tools/inc/tools/getprocessworkingdir.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,11 +39,13 @@ namespace tools { // get the process's current working directory, taking OOO_CWD into account // -// @param url -// a non-null pointer that receives the directory URL (with or without a final -// slash) upon successful return, and the empty string upon unsuccessful return -TOOLS_DLLPUBLIC bool getProcessWorkingDir(rtl::OUString * url); +// @param rUrl +// Receives the directory URL (with or without a final slash) upon successful +// return, and the empty string upon unsuccessful return +TOOLS_DLLPUBLIC bool getProcessWorkingDir(rtl::OUString& rUrl); } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/globname.hxx b/tools/inc/tools/globname.hxx index 026e4c51b9ac..552b702c4084 100755..100644 --- a/tools/inc/tools/globname.hxx +++ b/tools/inc/tools/globname.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,10 +28,11 @@ #ifndef _GLOBNAME_HXX #define _GLOBNAME_HXX +#include <vector> + #include "tools/toolsdllapi.h" #include <com/sun/star/uno/Sequence.hxx> #include <tools/string.hxx> -#include <tools/list.hxx> /************************************************************************* *************************************************************************/ @@ -119,7 +121,7 @@ public: class SvGlobalNameList { - List aList; + std::vector<ImpSvGlobalName*> aList; public: SvGlobalNameList(); ~SvGlobalNameList(); @@ -127,7 +129,7 @@ public: void Append( const SvGlobalName & ); SvGlobalName GetObject( sal_uLong ); sal_Bool IsEntry( const SvGlobalName & rName ); - sal_uInt32 Count() const { return aList.Count(); } + size_t Count() const { return aList.size(); } private: // nicht erlaubt SvGlobalNameList( const SvGlobalNameList & ); @@ -136,3 +138,4 @@ private: #endif // _GLOBNAME_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/inetdef.hxx b/tools/inc/tools/inetdef.hxx index 7341225912ab..137cb2f66f47 100644 --- a/tools/inc/tools/inetdef.hxx +++ b/tools/inc/tools/inetdef.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,83 +30,17 @@ #define _TOOLS_INETDEF_HXX //============================================================================ -#if defined WNT -#define TOOLS_INETDEF_OS "Win32" -#elif defined OS2 -#define TOOLS_INETDEF_OS "OS/2" -#elif defined UNX -#if defined AIX -#define TOOLS_INETDEF_OS "AIX" -#elif defined HPUX -#define TOOLS_INETDEF_OS "HP/UX" -#elif defined SOLARIS && defined SPARC -#define TOOLS_INETDEF_OS "Solaris Sparc" -#elif defined SOLARIS && defined INTEL -#define TOOLS_INETDEF_OS "Solaris x86" -#elif defined SCO -#define TOOLS_INETDEF_OS "SCO" -#elif defined NETBSD && defined X86 -#define TOOLS_INETDEF_OS "NETBSD x86" -#elif defined NETBSD && defined ARM32 -#define TOOLS_INETDEF_OS "NETBSD ARM32" -#elif defined NETBSD && defined SPARC -#define TOOLS_INETDEF_OS "NETBSD Sparc" -#elif defined LINUX && defined X86 -#define TOOLS_INETDEF_OS "Linux" -#elif defined FREEBSD && defined X86 -#define TOOLS_INETDEF_OS "FreeBSD/i386" -#elif defined FREEBSD && defined X86_64 -#define TOOLS_INETDEF_OS "FreeBSD/amd64" -#elif defined SINIX -#define TOOLS_INETDEF_OS "SINIX" -#else // AIX, HPUX, SOLARIS, ... -#define TOOLS_INETDEF_OS "Unix" -#endif // AIX, HPUX, SOLARIS, ... -#else // WNT, ... -#define TOOLS_INETDEF_OS "unknown OS" -#endif // WN, ... - -#define TOOLS_INETDEF_PRODUCT "StarOffice/5.2" -#define TOOLS_INETDEF_MOZILLA "Mozilla/3.0" - -#define INET_PRODUCTNAME TOOLS_INETDEF_PRODUCT " (" TOOLS_INETDEF_OS ")" -#define INET_DEF_CALLERNAME TOOLS_INETDEF_MOZILLA " (compatible; " \ - TOOLS_INETDEF_PRODUCT "; " TOOLS_INETDEF_OS ")" - -//============================================================================ // The following definitions seem obsolete and might get removed in future. -#define INET_PERS_CERT_HOMEPAGE "http://www.stardivision.de/certs.html" -#define INET_PERS_CERT_HOMEPAGE_INT \ - "http://www.stardivision.de/certs/certs##.html" - // the above definitions are only used in svx/source/options/optinet2.cxx - #if defined __RSC -#define INET_UNDEFINED 0 #define INET_NAME_RESOLVE_START 1 -#define INET_NAME_RESOLVE_ERROR 2 -#define INET_NAME_RESOLVE_SUCCESS 3 #define INET_CONNECT_START 4 -#define INET_CONNECT_ERROR 5 -#define INET_CONNECT_SUCCESS 6 -#define INET_WRITE_START 7 -#define INET_WRITE_STATUS 8 -#define INET_WRITE_ERROR 9 -#define INET_WRITE_SUCCESS 10 -#define INET_READ_START 11 #define INET_READ_STATUS 12 -#define INET_READ_ERROR 13 #define INET_READ_SUCCESS 14 -#define INET_CLOSING_CONNECTION 15 #define INET_CONNECTION_CLOSED 16 -#define INET_REQUEST_CANCELED 17 -#define INET_CONNECTION_CANCELED 18 -#define INET_SESSION_CANCELED 19 -#define INET_AUTHENTICATION 20 -#define INET_OFFLINE_ERROR 21 -#define INET_PROXY_AUTHENTICATION 22 #endif // __RSC // the above definitions are only used in sfx2/source/doc/doc.src #endif // _TOOLS_INETDEF_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/inetmime.hxx b/tools/inc/tools/inetmime.hxx index 2408bf231665..d5b56b090725 100755..100644 --- a/tools/inc/tools/inetmime.hxx +++ b/tools/inc/tools/inetmime.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,13 +28,14 @@ #ifndef TOOLS_INETMIME_HXX #define TOOLS_INETMIME_HXX +#include <boost/ptr_container/ptr_vector.hpp> + #include "tools/toolsdllapi.h" #include <rtl/alloc.h> #include <rtl/string.h> #include "rtl/tencinfo.h" #include <tools/debug.hxx> #include <tools/errcode.hxx> -#include <tools/list.hxx> #include <tools/string.hxx> class DateTime; @@ -612,9 +614,6 @@ public: rtl_TextEncoding eEncoding, sal_uInt32 & rCharacter); - static ByteString decodeUTF8(const ByteString & rText, - rtl_TextEncoding eEncoding); - static UniString decodeHeaderFieldBody(HeaderFieldType eType, const ByteString & rBody); @@ -1209,42 +1208,6 @@ inline ByteString INetMIMEStringOutputSink::takeBuffer() } //============================================================================ -class INetMIMEUnicodeOutputSink: public INetMIMEOutputSink -{ - UniString m_aBuffer; - bool m_bOverflow; - - using INetMIMEOutputSink::writeSequence; - - virtual void writeSequence(const sal_Char * pBegin, - const sal_Char * pEnd); - - virtual void writeSequence(const sal_uInt32 * pBegin, - const sal_uInt32 * pEnd); - - virtual void writeSequence(const sal_Unicode * pBegin, - const sal_Unicode * pEnd); - -public: - inline INetMIMEUnicodeOutputSink(sal_uInt32 nColumn = 0, - sal_uInt32 nLineLengthLimit - = INetMIME::SOFT_LINE_LENGTH_LIMIT): - INetMIMEOutputSink(nColumn, nLineLengthLimit), m_bOverflow(false) {} - - virtual ErrCode getError() const; - - inline UniString takeBuffer(); -}; - -inline UniString INetMIMEUnicodeOutputSink::takeBuffer() -{ - UniString aTheBuffer = m_aBuffer; - m_aBuffer.Erase(); - m_bOverflow = false; - return aTheBuffer; -} - -//============================================================================ class INetMIMEEncodedWordOutputSink { public: @@ -1417,29 +1380,36 @@ inline INetContentTypeParameter::INetContentTypeParameter(const ByteString & {} //============================================================================ -class TOOLS_DLLPUBLIC INetContentTypeParameterList: private List +class TOOLS_DLLPUBLIC INetContentTypeParameterList { public: - ~INetContentTypeParameterList() { Clear(); } - - using List::Count; void Clear(); void Insert(INetContentTypeParameter * pParameter, sal_uIntPtr nIndex) - { List::Insert(pParameter, nIndex); } + { + maEntries.insert(maEntries.begin()+nIndex,pParameter); + } - inline const INetContentTypeParameter * GetObject(sal_uIntPtr nIndex) const; + void Append(INetContentTypeParameter *pParameter) + { + maEntries.push_back(pParameter); + } + + inline const INetContentTypeParameter * GetObject(sal_uIntPtr nIndex) const + { + return &(maEntries[nIndex]); + } const INetContentTypeParameter * find(const ByteString & rAttribute) const; + +private: + + boost::ptr_vector<INetContentTypeParameter> maEntries; }; -inline const INetContentTypeParameter * -INetContentTypeParameterList::GetObject(sal_uIntPtr nIndex) const -{ - return static_cast< INetContentTypeParameter * >(List::GetObject(nIndex)); -} #endif // TOOLS_INETMIME_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/inetmsg.hxx b/tools/inc/tools/inetmsg.hxx index 1f14a67b62a7..f59f9d1d3590 100644 --- a/tools/inc/tools/inetmsg.hxx +++ b/tools/inc/tools/inetmsg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,14 +31,9 @@ #include "tools/toolsdllapi.h" #include <sal/types.h> -#ifndef _RTL_TEXTENC_H_ #include <rtl/textenc.h> -#endif -#ifndef _TOOLS_INETMIME_HXX #include <tools/inetmime.hxx> -#endif -#include <tools/list.hxx> #include <tools/stream.hxx> #include <tools/string.hxx> @@ -445,14 +441,6 @@ public: INetMIME::HEADER_FIELD_TEXT); } - void SetXMailer (const UniString& rXMailer); - UniString GetXMailer (void) const - { - return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_X_MAILER], - INetMIME::HEADER_FIELD_TEXT); - } - /** Stream operators. */ friend SvStream& operator<< ( @@ -621,3 +609,4 @@ public: #endif /* !_TOOLS_INETMSG_HXX */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/inetstrm.hxx b/tools/inc/tools/inetstrm.hxx index b1c01333c63a..16de7beedd98 100644 --- a/tools/inc/tools/inetstrm.hxx +++ b/tools/inc/tools/inetstrm.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -273,3 +274,4 @@ public: #endif /* !_TOOLS_INETSTRM_HXX */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/iparser.hxx b/tools/inc/tools/iparser.hxx deleted file mode 100644 index c31f6ebd75f7..000000000000 --- a/tools/inc/tools/iparser.hxx +++ /dev/null @@ -1,147 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef IPARSER_HXX -#define IPARSER_HXX - -#include <tools/string.hxx> -#include <tools/link.hxx> -#include <tools/stream.hxx> -#include "tools/toolsdllapi.h" - -// forwards -class Dir; -class GenericInformation; -class GenericInformationList; - -// -// class InformationParser -// - -/****************************************************************************** -Purpose: reads generic information files into a simple structure in memory -******************************************************************************/ - -// information files used by this parser have following format: - -/* - -key [value] -{ - key [value] - key [value] - { - key [value] - ... - ... - } -} -key [value] -... -... - -*/ - -#define DEF_STAND_LST "\\\\dev4\\data1\\b_server\\config\\stand.lst" - -// error codes: - -#define IP_NO_ERROR 0x0000 -#define IP_UNEXPECTED_EOF 0x0001 - -#define REPLACE_VARIABLES sal_True - -class TOOLS_DLLPUBLIC InformationParser -{ -private: - sal_Bool bRecover; - ByteString sOldLine; - - ByteString sCurrentComment; - - sal_Bool bReplaceVariables; // meaning %UPD and %VERSION - sal_uInt16 nLevel; - ByteString sUPD; - ByteString sVersion; - - Link aStatusLink; - SvStream *pActStream; - UniString sStreamName; - - sal_uInt16 nErrorCode; - sal_uIntPtr nErrorLine; - ByteString sErrorText; - sal_uIntPtr nActLine; - - // methods - TOOLS_DLLPRIVATE ByteString &ReadLine(); - TOOLS_DLLPRIVATE GenericInformation *ReadKey( GenericInformationList *pExistingList ); - inline void Recover(); - -protected: - sal_Bool Save( SvStream &rOutStream, - const GenericInformationList *pSaveList, sal_uInt16 nLevel, sal_Bool bStripped ); - GenericInformationList *Execute( SvStream &rSourceStream, - GenericInformationList *pExistingList ); - virtual void PrintStatus( ByteString &rStatus ) - { if ( aStatusLink.IsSet()) aStatusLink.Call( &rStatus ); } - -public: - InformationParser( sal_Bool bReplace = sal_False ); - virtual ~InformationParser(); - - // the following methods return NULL if any errors are detected - - // reads a information file and stores the data in a - // GenericInformationList - GenericInformationList *Execute( SvMemoryStream &rSourceStream, - GenericInformationList *pExistingList = NULL ); - GenericInformationList *Execute( SvFileStream &rSourceStream, - GenericInformationList *pExistingList = NULL ); - GenericInformationList *Execute( UniString &rSourceFile, - GenericInformationList *pExistingList = NULL ); - // reads all information files in the dir and stores the data in a - // GenericInformationList => first key is the filename - GenericInformationList *Execute( Dir &rDir, - GenericInformationList *pExistingList = NULL ); - - // save the InfrormationList to rSourceFile - // returns sal_False on error - sal_Bool Save( SvFileStream &rSourceStream, - const GenericInformationList *pSaveList ); - sal_Bool Save( SvMemoryStream &rSourceStream, - const GenericInformationList *pSaveList ); - sal_Bool Save( const UniString &rSourceFile, - const GenericInformationList *pSaveList ); - - sal_uInt16 GetErrorCode(); - ByteString &GetErrorText(); - - void SetStatusHdl( const Link &rHdl ) { aStatusLink = rHdl; } -}; - -#endif - diff --git a/tools/inc/tools/isofallback.hxx b/tools/inc/tools/isofallback.hxx index dcf4bd938376..4a2346213ba1 100644 --- a/tools/inc/tools/isofallback.hxx +++ b/tools/inc/tools/isofallback.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,11 +29,12 @@ #ifndef _ISOFALLBACK_HXX #define _ISOFALLBACK_HXX -#include <tools/string.hxx> +#include <rtl/string.hxx> #include "tools/toolsdllapi.h" // Return true if valid fallback found -TOOLS_DLLPUBLIC sal_Bool GetIsoFallback( ByteString& rLanguage ); +TOOLS_DLLPUBLIC bool GetIsoFallback(rtl::OString& rLanguage); #endif //_ISOFALLBACK_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/line.hxx b/tools/inc/tools/line.hxx index 32fc157a34a4..ffe1ceec69b1 100644 --- a/tools/inc/tools/line.hxx +++ b/tools/inc/tools/line.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -73,3 +74,5 @@ public: }; #endif // _SV_LINE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/link.hxx b/tools/inc/tools/link.hxx index f31fcabc8108..02187e339187 100644 --- a/tools/inc/tools/link.hxx +++ b/tools/inc/tools/link.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -56,16 +57,16 @@ typedef long (*PSTUB)( void*, void* ); long Class::Method( ArgType ArgName ) #define IMPL_STUB(Class, Method, ArgType) \ - long __EXPORT Class::LinkStub##Method( void* pThis, void* pCaller) \ + long Class::LinkStub##Method( void* pThis, void* pCaller) \ { \ return ((Class*)pThis )->Method( (ArgType)pCaller ); \ } #define IMPL_STATIC_LINK( Class, Method, ArgType, ArgName ) \ - long __EXPORT Class::Method( Class* pThis, ArgType ArgName ) + long Class::Method( Class* pThis, ArgType ArgName ) #define IMPL_STATIC_LINK_NOINSTANCE( Class, Method, ArgType, ArgName ) \ - long __EXPORT Class::Method( Class*, ArgType ArgName ) + long Class::Method( Class*, ArgType ArgName ) #define LINK( Inst, Class, Member ) \ Link( (Class*)Inst, (PSTUB)&Class::LinkStub##Member ) @@ -156,3 +157,5 @@ inline sal_Bool Link::operator !() const } #endif // _LINK_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/list.hxx b/tools/inc/tools/list.hxx index bb0d8627838c..9f920356b489 100644 --- a/tools/inc/tools/list.hxx +++ b/tools/inc/tools/list.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -141,3 +142,5 @@ public: \ }; #endif // _LIST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/mapunit.hxx b/tools/inc/tools/mapunit.hxx index b30d3865d862..e57316c8c380 100644 --- a/tools/inc/tools/mapunit.hxx +++ b/tools/inc/tools/mapunit.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,3 +39,5 @@ enum MapUnit { MAP_100TH_MM, MAP_10TH_MM, MAP_MM, MAP_CM, MAP_RELATIVE, MAP_REALAPPFONT, MAP_LASTENUMDUMMY }; #endif // _TOOLS_MAPUNIT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/mempool.hxx b/tools/inc/tools/mempool.hxx index 74df068908f7..0d8187882416 100644 --- a/tools/inc/tools/mempool.hxx +++ b/tools/inc/tools/mempool.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -123,3 +124,5 @@ IMPL_FIXEDMEMPOOL_DEL_BODY( Class, aPool ) aPool( IMPL_FIXEDMEMPOOL_STRING( Class ), sizeof( Class ), (InitSize), (GrowSize) ) #endif // _SVMEMPOOL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/multisel.hxx b/tools/inc/tools/multisel.hxx index 6544fe771f95..bb74783a7a35 100644 --- a/tools/inc/tools/multisel.hxx +++ b/tools/inc/tools/multisel.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,7 +30,6 @@ #include "tools/toolsdllapi.h" #include <tools/gen.hxx> -#include <tools/list.hxx> #include <tools/string.hxx> #include <vector> @@ -37,13 +37,9 @@ //------------------------------------------------------------------ -#ifdef _SV_MULTISEL_CXX -DECLARE_LIST( ImpSelList, Range* ) -#else -#define ImpSelList List -#endif +typedef ::std::vector< Range* > ImpSelList; -#define SFX_ENDOFSELECTION CONTAINER_ENTRY_NOTFOUND +#define SFX_ENDOFSELECTION ULONG_MAX //------------------------------------------------------------------ @@ -65,8 +61,8 @@ private: #ifdef _SV_MULTISEL_CXX TOOLS_DLLPRIVATE void ImplClear(); - TOOLS_DLLPRIVATE sal_uIntPtr ImplFindSubSelection( long nIndex ) const; - TOOLS_DLLPRIVATE sal_Bool ImplMergeSubSelections( sal_uIntPtr nPos1, sal_uIntPtr nPos2 ); + TOOLS_DLLPRIVATE size_t ImplFindSubSelection( long nIndex ) const; + TOOLS_DLLPRIVATE sal_Bool ImplMergeSubSelections( size_t nPos1, size_t nPos2 ); TOOLS_DLLPRIVATE long ImplFwdUnselected(); TOOLS_DLLPRIVATE long ImplBwdUnselected(); #endif @@ -108,8 +104,10 @@ public: long NextSelected(); long PrevSelected(); - sal_uIntPtr GetRangeCount() const { return aSels.Count(); } - const Range& GetRange( sal_uIntPtr nRange ) const { return *(const Range*)aSels.GetObject(nRange); } + size_t GetRangeCount() const { return aSels.size(); } + const Range& GetRange( size_t nRange ) const { + return *(const Range*)aSels[nRange]; + } }; class TOOLS_DLLPUBLIC StringRangeEnumerator @@ -214,3 +212,5 @@ public: }; #endif // _SV_MULTISEL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/ownlist.hxx b/tools/inc/tools/ownlist.hxx deleted file mode 100644 index 78cf5af8e89c..000000000000 --- a/tools/inc/tools/ownlist.hxx +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _TOOLS_OWNLIST_HXX -#define _TOOLS_OWNLIST_HXX - -#ifndef _TOOLS_LIST_HXX //autogen -#include <tools/list.hxx> -#endif -/************************************************************************* -*************************************************************************/ - -#define PRV_SV_DECL_OWNER_LIST(ClassName,Type) \ - List aTypes; \ -public: \ - ClassName( sal_uInt16 nInitSize = 16, \ - sal_uInt16 nReSize = 16 ) \ - : aTypes( nInitSize, nReSize ) {} \ - ClassName( const ClassName & rObj ) \ - { *this = rObj; } \ - ClassName & operator = ( const ClassName & ); \ - ~ClassName() \ - { Clear(); } \ - void Clear(); \ - void Remove() \ - { delete (Type *)aTypes.Remove(); } \ - void Remove( Type * pObj ) \ - { delete (Type *)aTypes.Remove( pObj ); } \ - void Remove( sal_uIntPtr nPos ) \ - { delete (Type *)aTypes.Remove( nPos ); } \ - Type & Insert( const Type &, sal_uIntPtr nPos ); \ - Type & Insert( const Type & rType ) \ - { return Insert( rType, aTypes.GetCurPos() ); } \ - Type & Append( const Type & rType ) \ - { return Insert( rType, LIST_APPEND ); } \ - Type & GetObject( sal_uIntPtr nPos ) const \ - { return *(Type *)aTypes.GetObject( nPos ); } \ - Type & operator []( sal_uIntPtr nPos ) const \ - { return *(Type *)aTypes.GetObject( nPos ); } \ - sal_uIntPtr Count() const { return aTypes.Count(); } - -#define PRV_SV_IMPL_OWNER_LIST(ClassName,Type) \ -ClassName & ClassName::operator = ( const ClassName & rObj ) \ -{ \ - if( this != &rObj ) \ - { \ - Clear(); \ - for( sal_uIntPtr i = 0; i < rObj.Count(); i++ ) \ - Append( rObj.GetObject( i ) ); \ - } \ - return *this; \ -} \ -void ClassName::Clear() \ -{ \ - Type * p = (Type *)aTypes.First(); \ - while( p ) \ - { \ - delete p; \ - p = (Type *)aTypes.Next(); \ - } \ - aTypes.Clear(); \ -} \ -Type & ClassName::Insert( const Type & rType, sal_uIntPtr nPos ) \ -{ \ - Type * pType = new Type( rType ); \ - aTypes.Insert( pType, nPos ); \ - return *pType; \ -} - -#endif // _TOOLS_OWNLIST_HXX diff --git a/tools/inc/tools/pathutils.hxx b/tools/inc/tools/pathutils.hxx index e5c54b09fb4b..1189a8334a8f 100644 --- a/tools/inc/tools/pathutils.hxx +++ b/tools/inc/tools/pathutils.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -99,3 +100,5 @@ WCHAR * resolveLink(WCHAR * path); #endif #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/poly.hxx b/tools/inc/tools/poly.hxx index 5abcca0c819d..02d2355e5af9 100644 --- a/tools/inc/tools/poly.hxx +++ b/tools/inc/tools/poly.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -120,8 +121,6 @@ private: TOOLS_DLLPRIVATE inline void ImplMakeUnique(); -//#if 0 // _SOLAR__PRIVATE - public: Point* ImplGetPointAry(); @@ -131,8 +130,6 @@ public: void ImplRead( SvStream& rIStream ); void ImplWrite( SvStream& rOStream ) const; -//#endif // __PRIVATE - public: Polygon(); Polygon( sal_uInt16 nSize ); @@ -255,11 +252,9 @@ private: ImplPolyPolygon* mpImplPolyPolygon; -//#if 0 // _SOLAR__PRIVATE TOOLS_DLLPRIVATE void ImplDoOperation( const PolyPolygon& rPolyPoly, PolyPolygon& rResult, sal_uIntPtr nOperation ) const; TOOLS_DLLPRIVATE void *ImplCreateArtVpath() const; TOOLS_DLLPRIVATE void ImplSetFromArtVpath( void *pVpath ); -//#endif // __PRIVATE public: @@ -345,3 +340,5 @@ public: typedef std::vector< PolyPolygon > PolyPolyVector; #endif // _SV_POLY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/postsys.h b/tools/inc/tools/postsys.h index 994f86ae35b5..c31074c845ed 100644 --- a/tools/inc/tools/postsys.h +++ b/tools/inc/tools/postsys.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,8 +34,6 @@ #undef PolyPolygon #undef Polygon #undef Rectangle -#undef sal_uInt8 -#undef sal_Bool #undef DELETE /* Hilfe-Ids umbenennen */ @@ -242,3 +241,4 @@ extern "C" // Konfl�kt mit den Tools-Pair vermeiden #undef Pair +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/postwin.h b/tools/inc/tools/postwin.h deleted file mode 100644 index 1e746a941f5c..000000000000 --- a/tools/inc/tools/postwin.h +++ /dev/null @@ -1,257 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -/* nicht geschuetz, muss als gegenstueck zu prewin.h includet werden */ - -#ifdef WNT -#ifdef __cplusplus -} -#endif -#endif - -#undef Region -#undef PolyPolygon -#undef Polygon -#undef Rectangle -#undef BYTE -#undef BOOL -#undef DELETE - -#ifndef VCL_NEED_BASETSD -#undef INT64 -#undef UINT64 -#undef INT32 -#undef UINT32 -#endif -#undef Folder -#undef GradientStyle_RECT - -/* Hilfe-Ids umbenennen */ -#define WIN_HELP_INDEX 0x0003 -#define WIN_HELP_HELPONHELP 0x0004 -#undef HELP_INDEX -#undef HELP_HELPONHELP - -#define WIN_MOUSE_MOVED 0x0001 -#undef MOUSE_MOVED - -#define WIN_WB_LEFT 0 -#define WIN_WB_RIGHT 1 -#undef WB_LEFT -#undef WB_RIGHT - -#ifdef GetObject -#undef GetObject -#ifdef UNICODE -#define WIN_GetObject GetObjectW -#else -#define WIN_GetObject GetObjectA -#endif -#else -#define WIN_GetObject GetObject -#endif - -#ifdef SetPrinter -#undef SetPrinter -#ifdef UNICODE -#define WIN_SetPrinter SetPrinterW -#else -#define WIN_SetPrinter SetPrinterA -#endif -#else -#define WIN_SetPrinter SetPrinter -#endif - -#ifdef GetPrinter -#undef GetPrinter -#ifdef UNICODE -#define WIN_GetPrinter GetPrinterW -#else -#define WIN_GetPrinter GetPrinterA -#endif -#else -#define WIN_GetPrinter GetPrinter -#endif - -#ifdef DrawText -#undef DrawText -#ifdef UNICODE -#define WIN_DrawText DrawTextW -#else -#define WIN_DrawText DrawTextA -#endif -#else -#define WIN_DrawText DrawText -#endif - -#ifdef mciSetCommand -#undef mciSetCommand -#ifdef UNICODE -#define WIN_mciSetCommand mciSetCommandW -#else -#define WIN_mciSetCommand mciSetCommandA -#endif -#else -#define mciSetCommand mciSetCommand -#endif - -#ifdef SetPort -#undef SetPort -#ifdef UNICODE -#define WIN_SetPort SetPortW -#else -#define WIN_SetPort SetPortA -#endif -#else -#define WIN_SetPort SetPort -#endif - -#ifdef CopyFile -#undef CopyFile -#ifdef UNICODE -#define WIN_CopyFile CopyFileW -#else -#define WIN_CopyFile CopyFileA -#endif -#else -#define WIN_CopyFile CopyFile -#endif - - -#ifdef GetUserName -#undef GetUserName -#ifdef UNICODE -#define WIN_GetUserName GetUserNameW -#else -#define WIN_GetUserName GetUserNameA -#endif -#else -#define WIN_GetUserName GetUserName -#endif - -#ifdef GetClassName -#undef GetClassName -#ifdef UNICODE -#define WIN_GetClassName GetClassNameW -#else -#define WIN_GetClassName GetClassNameA -#endif -#else -#define WIN_GetClassName GetClassName -#endif - -#ifdef GetCharWidth -#undef GetCharWidth -#ifdef UNICODE -#define WIN_GetCharWidth GetCharWidthW -#else -#define WIN_GetCharWidth GetCharWidthA -#endif -#else -#define WIN_GetCharWidth GetCharWidth -#endif - -#ifdef GetMetaFile -#undef GetMetaFile -#ifdef UNICODE -#define WIN_GetMetaFile GetMetaFileW -#else -#define WIN_GetMetaFile GetMetaFileA -#endif -#else -#define WIN_GetMetaFile GetMetaFile -#endif - -#ifdef GetNumberFormat -#undef GetNumberFormat -#ifdef UNICODE -#define WIN_GetNumberFormat GetNumberFormatW -#else -#define WIN_GetNumberFormat GetNumberFormatA -#endif -#else -#define WIN_GetNumberFormat GetNumberFormat -#endif - -#ifdef GetGlyphOutline -#undef GetGlyphOutline -#ifdef UNICODE -#define WIN_GetGlyphOutline GetGlyphOutlineW -#else -#define WIN_GetGlyphOutline GetGlyphOutlineA -#endif -#else -#define WIN_GetGlyphOutline GetGlyphOutline -#endif - -#ifdef GetKerningPairs -#undef GetKerningPairs -#ifdef UNICODE -#define WIN_GetKerningPairs GetKerningPairsW -#else -#define WIN_GetKerningPairs GetKerningPairsA -#endif -#else -#define WIN_GetKerningPairs GetKerningPairs -#endif - -#ifdef FindWindow -#undef FindWindow -#ifdef UNICODE -#define WIN_FindWindow FindWindowW -#else -#define WIN_FindWindow FindWindowA -#endif -#else -#define WIN_FindWindow FindWindow -#endif - -// keine Yield-Definition -#undef Yield - -/* new StretchBlt() Modes (simpler names) */ -#ifndef STRETCH_ANDSCANS -#define STRETCH_ANDSCANS 1 -#endif -#ifndef STRETCH_ORSCANS -#define STRETCH_ORSCANS 2 -#endif -#ifndef STRETCH_DELETESCANS -#define STRETCH_DELETESCANS 3 -#endif - -#ifdef WNT -extern "C" -{ -BOOL WINAPI WIN_Rectangle( HDC hDC, int X1, int Y1, int X2, int Y2 ); -BOOL WINAPI WIN_Polygon( HDC hDC, CONST POINT * ppt, int ncnt ); -BOOL WINAPI WIN_PolyPolygon( HDC hDC, CONST POINT * ppt, LPINT npcnt, int ncnt ); -} -#endif - -// svwin.h nicht mehr includen -#define _SVWIN_H diff --git a/tools/inc/tools/postx.h b/tools/inc/tools/postx.h index 3e77fde5d14b..3979438b29a8 100644 --- a/tools/inc/tools/postx.h +++ b/tools/inc/tools/postx.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -71,3 +72,4 @@ Error KeyPress must be Equal 2 #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/presys.h b/tools/inc/tools/presys.h index 7e84a92fb257..3f71249b7cc5 100644 --- a/tools/inc/tools/presys.h +++ b/tools/inc/tools/presys.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,7 +28,7 @@ /* nicht geschuetzt, darf nur einmal includet werden */ -// Konflkt mit den Tools-Pair vermeiden +// Konfl�kt mit den Tools-Pair vermeiden #define Pair StlPair #if defined WNT @@ -38,3 +39,5 @@ #define Region WIN_Region #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/prewin.h b/tools/inc/tools/prewin.h deleted file mode 100644 index 86bda268722d..000000000000 --- a/tools/inc/tools/prewin.h +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -/* nicht geschuetzt, darf nur einmal includet werden */ - -#if defined WNT - -#define Rectangle BLA_Rectangle -#define Polygon BLA_Polygon -#define PolyPolygon BLA_PolyPolygon -#define Region WIN_Region -#define Folder WIN_Folder -#define GradientStyle_RECT WIN_GradientStyle_RECT - -#ifdef __cplusplus -extern "C" { -#endif - -#define STRICT -#ifdef _MSC_VER -#pragma warning(push, 1) -#endif -#include <windows.h> -#ifdef _MSC_VER -#pragma warning(pop) -#endif -#include <shellapi.h> -#include <commdlg.h> -#include <dlgs.h> -#ifdef USE_TOOLHELP -#include <tlhelp32.h> -#endif -#ifdef USE_IMAGEHLP -#include <imagehlp.h> -#endif -#ifdef INCLUDE_MMSYSTEM -#include <mmsystem.h> -#endif -#ifdef _MSC_VER -#pragma warning(push, 1) -#endif -#include <commctrl.h> -#ifdef _MSC_VER -#pragma warning(pop) -#endif - -#endif diff --git a/tools/inc/tools/prex.h b/tools/inc/tools/prex.h index 250a72b2476c..151b0fe46279 100644 --- a/tools/inc/tools/prex.h +++ b/tools/inc/tools/prex.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,7 +44,9 @@ extern "C" { #endif -#if defined(LINUX) || defined(FREEBSD) || defined(MACOSX) // should really check for xfree86 or for X11R6.1 and higher +// FIXME: should really check for xfree86 or for X11R6.1 and higher +#if defined(LINUX) || defined(FREEBSD) || defined(MACOSX) || defined(NETBSD) || \ + defined(OPENBSD) || defined(DRAGONFLY) #define __XKeyboardExtension__ 1 #else #define __XKeyboardExtension__ 0 @@ -72,3 +75,4 @@ typedef unsigned long Pixel; #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/pstm.hxx b/tools/inc/tools/pstm.hxx index f149e977f3b3..68b4932e1e51 100644 --- a/tools/inc/tools/pstm.hxx +++ b/tools/inc/tools/pstm.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,16 +28,12 @@ #ifndef _PSTM_HXX #define _PSTM_HXX -#include <hash_map> +#include <boost/unordered_map.hpp> #include "tools/toolsdllapi.h" -#ifndef _TABLE_HXX #include <tools/table.hxx> -#endif -#ifndef _INQIDX_HXX #include <tools/unqidx.hxx> -#endif #include <tools/ref.hxx> #include <tools/rtti.hxx> #include <tools/stream.hxx> @@ -52,7 +49,7 @@ typedef void * (*SvCreateInstancePersist)( SvPersistBase ** ); class TOOLS_DLLPUBLIC SvClassManager { - typedef std::hash_map< sal_uInt16, SvCreateInstancePersist > Map; + typedef boost::unordered_map< sal_uInt16, SvCreateInstancePersist > Map; Map aAssocTable; public: void Register( sal_uInt16 nClassId, SvCreateInstancePersist pFunc ); @@ -152,11 +149,7 @@ public:\ SV_DECL_PERSIST_LIST(ClassName,EntryName)\ SV_IMPL_PERSIST_LIST(ClassName,EntryName) -//#if 0 // _SOLAR__PRIVATE DECLARE_UNIQUEINDEX( SvPersistUIdx,SvPersistBase *) -//#else -//typedef UniqueIndex SvPersistUIdx; -//#endif //========================================================================= class SvStream; @@ -259,3 +252,5 @@ public: }; #endif // _PSTM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/queue.hxx b/tools/inc/tools/queue.hxx deleted file mode 100644 index 4df0a60a1618..000000000000 --- a/tools/inc/tools/queue.hxx +++ /dev/null @@ -1,104 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _QUEUE_HXX -#define _QUEUE_HXX - -#include <tools/solar.h> -#include <tools/contnr.hxx> - -// --------- -// - Queue - -// --------- - -#define QUEUE_ENTRY_NOTFOUND CONTAINER_ENTRY_NOTFOUND - -class Queue : private Container -{ -public: - using Container::Clear; - using Container::Count; - using Container::GetObject; - using Container::GetPos; - - Queue( sal_uInt16 _nInitSize = 16, sal_uInt16 _nReSize = 16 ) : - Container( _nReSize, _nInitSize, _nReSize ) {} - Queue( const Queue& rQueue ) : Container( rQueue ) {} - - void Put( void* p ) { Container::Insert( p, CONTAINER_APPEND ); } - void* Get() { return Container::Remove( (sal_uIntPtr)0 ); } - - Queue& operator =( const Queue& rQueue ) - { Container::operator =( rQueue ); return *this; } - - sal_Bool operator ==( const Queue& rQueue ) const - { return Container::operator ==( rQueue ); } - sal_Bool operator !=( const Queue& rQueue ) const - { return Container::operator !=( rQueue ); } -}; - -// ----------------- -// - DECLARE_QUEUE - -// ----------------- - -#define DECLARE_QUEUE( ClassName, Type ) \ -class ClassName : private Queue \ -{ \ -public: \ - using Queue::Clear; \ - using Queue::Count; \ - \ - ClassName( sal_uInt16 _nInitSize = 16, \ - sal_uInt16 _nReSize = 16 ) : \ - Queue( _nInitSize, _nReSize ) {} \ - ClassName( const ClassName& rClassName ) : \ - Queue( rClassName ) {} \ - \ - void Put( Type p ) { Queue::Put( (void*)p ); } \ - Type Get() { return (Type)Queue::Get(); } \ - \ - Type GetObject( sal_uIntPtr nIndex ) const \ - { return (Type)Queue::GetObject( nIndex ); } \ - sal_uIntPtr GetPos( const Type p ) const \ - { return Queue::GetPos( (const void*)p ); } \ - sal_uIntPtr GetPos( const Type p, sal_uIntPtr nStartIndex, \ - sal_Bool bForward = sal_True ) const \ - { return Queue::GetPos( (const void*)p, \ - nStartIndex, \ - bForward ); } \ - \ - ClassName& operator =( const ClassName& rClassName ) \ - { Queue::operator =( rClassName ); \ - return *this; } \ - \ - sal_Bool operator ==( const Queue& rQueue ) const \ - { return Queue::operator ==( rQueue ); } \ - sal_Bool operator !=( const Queue& rQueue ) const \ - { return Queue::operator !=( rQueue ); } \ -}; - -#endif // _QUEUE_HXX diff --git a/tools/inc/tools/rc.h b/tools/inc/tools/rc.h index e11aed2937fd..ce735d6a70e3 100644 --- a/tools/inc/tools/rc.h +++ b/tools/inc/tools/rc.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -219,3 +220,5 @@ typedef short RSWND_STYLE; #define DATE_DAY 0x04 #endif // _TOOLS_RC_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/rc.hxx b/tools/inc/tools/rc.hxx index d8cd73d6dcbc..a6310197e442 100644 --- a/tools/inc/tools/rc.hxx +++ b/tools/inc/tools/rc.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -109,3 +110,5 @@ class TOOLS_DLLPUBLIC Resource }; #endif // _SV_RC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/rcid.h b/tools/inc/tools/rcid.h index 3daf64c547a7..9fa43c503ee3 100644 --- a/tools/inc/tools/rcid.h +++ b/tools/inc/tools/rcid.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -132,3 +133,5 @@ // (RSC_NOTYPE + 0x200) - (RSC_NOTYPE + 0x300) fuer Sfx reserviert #endif // _RCID_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/ref.hxx b/tools/inc/tools/ref.hxx index e2c2c5c893be..9ef9fd0d1776 100644 --- a/tools/inc/tools/ref.hxx +++ b/tools/inc/tools/ref.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,20 +34,6 @@ //========================================================================= -#define PRV_SV_DECL_REF_SIGNATURE( ClassName, Ref ) \ - inline ClassName##Ref() { pObj = 0; } \ - inline ClassName##Ref( const ClassName##Ref & rObj ); \ - inline ClassName##Ref( ClassName * pObjP ); \ - inline void Clear(); \ - inline ~ClassName##Ref(); \ - inline ClassName##Ref & operator = ( const ClassName##Ref & rObj ); \ - inline ClassName##Ref & operator = ( ClassName * pObj ); \ - inline sal_Bool Is() const { return pObj != NULL; } \ - inline ClassName * operator & () const { return pObj; } \ - inline ClassName * operator -> () const { return pObj; } \ - inline ClassName & operator * () const { return *pObj; } \ - inline operator ClassName * () const { return pObj; } - #define PRV_SV_IMPL_REF_COUNTERS( ClassName, Ref, AddRef, AddNextRef, ReleaseRef, Init, pRefbase ) \ inline ClassName##Ref::ClassName##Ref( const ClassName##Ref & rObj ) \ { pObj = rObj.pObj; if( pObj ) { Init pRefbase->AddNextRef; } } \ @@ -79,14 +66,22 @@ inline ClassName##Ref & ClassName##Ref::operator = ( ClassName * pObjP ) \ protected: \ ClassName * pObj; \ public: \ -PRV_SV_DECL_REF_SIGNATURE(ClassName, Ref) + inline ClassName##Ref() { pObj = 0; } \ + inline ClassName##Ref( const ClassName##Ref & rObj ); \ + inline ClassName##Ref( ClassName * pObjP ); \ + inline void Clear(); \ + inline ~ClassName##Ref(); \ + inline ClassName##Ref & operator = ( const ClassName##Ref & rObj ); \ + inline ClassName##Ref & operator = ( ClassName * pObj ); \ + inline sal_Bool Is() const { return pObj != NULL; } \ + inline ClassName * operator & () const { return pObj; } \ + inline ClassName * operator -> () const { return pObj; } \ + inline ClassName & operator * () const { return *pObj; } \ + inline operator ClassName * () const { return pObj; } #define PRV_SV_DECL_REF( ClassName ) \ PRV_SV_DECL_REF_LOCK( ClassName, Ref ) -#define PRV_SV_DECL_LOCK( ClassName ) \ -PRV_SV_DECL_REF_LOCK( ClassName, Lock ) - #define SV_DECL_REF( ClassName ) \ class ClassName; \ class ClassName##Ref \ @@ -98,7 +93,7 @@ class ClassName##Ref \ class ClassName; \ class ClassName##Lock \ { \ - PRV_SV_DECL_LOCK( ClassName ) \ + PRV_SV_DECL_REF_LOCK( ClassName, Lock ) \ }; #define SV_IMPL_REF( ClassName ) \ @@ -114,10 +109,6 @@ PRV_SV_IMPL_REF_COUNTERS( ClassName, Lock, OwnerLock( sal_True ), \ SV_DECL_REF(ClassName) \ SV_IMPL_REF(ClassName) -#define SV_DECL_IMPL_LOCK( ClassName ) \ - SV_DECL_LOCK(ClassName) \ - SV_IMPL_LOCK(ClassName) - /************************** S v R e f L i s t ****************************/ #define PRV_SV_DECL_REF_LIST(CN,EN,vis) \ @@ -151,6 +142,7 @@ inline void Append( const CN##MemberList & );\ #define SV_DECL_REF_LIST(CN,EN) \ PRV_SV_DECL_REF_LIST(CN,EN,/* empty */) + #define SV_DECL_REF_LIST_VISIBILITY(CN,EN,vis) \ PRV_SV_DECL_REF_LIST(CN,EN,vis) @@ -313,13 +305,6 @@ public:\ PRV_SV_DECL_MEMBER_LIST(ClassName,EntryName)\ }; -#define SV_IMPL_MEMBER_LIST(ClassName,EntryName)\ - PRV_SV_IMPL_MEMBER_LIST(ClassName,EntryName,SvRefBaseMemberList) - -#define SV_DECL_IMPL_MEMBER_LIST(ClassName,EntryName)\ -SV_DECL_MEMBER_LIST(ClassName,EntryName)\ -SV_IMPL_MEMBER_LIST(ClassName,EntryName) - /************************** S v R e f B a s e ****************************/ #define SV_NO_DELETE_REFCOUNT 0x80000000 class TOOLS_DLLPUBLIC SvRefBase @@ -366,11 +351,9 @@ public: sal_uIntPtr GetRefCount() const { return nRefCount; } }; -//#if 0 // _SOLAR__PRIVATE #ifndef EMPTYARG #define EMPTYARG #endif -//#endif SV_DECL_IMPL_REF(SvRefBase) @@ -454,3 +437,5 @@ public: \ SV_DECL_WEAK( SvWeakBase ) #endif // _Weak_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/resary.hxx b/tools/inc/tools/resary.hxx index b6cd8f8943c6..6f3af5869580 100644 --- a/tools/inc/tools/resary.hxx +++ b/tools/inc/tools/resary.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,12 +41,10 @@ struct ImplResStringItem XubString maStr; long mnValue; -//#if 0 // _SOLAR__PRIVATE #ifdef _TOOLS_RESARY_CXX ImplResStringItem( const XubString& rStr ) : maStr( rStr ) {} #endif -//#endif }; // ------------------ @@ -91,3 +90,5 @@ class TOOLS_DLLPUBLIC ResStringArray }; #endif // _TOOLS_RESARY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/resid.hxx b/tools/inc/tools/resid.hxx index cf3ec3d78ea9..99d0bc45b022 100644 --- a/tools/inc/tools/resid.hxx +++ b/tools/inc/tools/resid.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,6 +31,7 @@ #include <tools/solar.h> #include <osl/diagnose.h> +#include "tools/toolsdllapi.h" struct RSHEADER_TYPE; typedef sal_uInt32 RESOURCE_TYPE; @@ -42,6 +44,10 @@ class ResMgr; //- ResId - //--------- +namespace rtl { + class OUString; +} + class ResId { /* @@ -157,6 +163,10 @@ class ResId sal_uInt32 GetId() const { return m_nResId & ~RSC_DONTRELEASE; } RSHEADER_TYPE* GetpResource() const { return m_pResource; } + + static TOOLS_DLLPUBLIC rtl::OUString toString(const ResId& aId); }; #endif // _RESID_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/resmgr.hxx b/tools/inc/tools/resmgr.hxx index 327eff7a3b80..72f8d8d2827e 100644 --- a/tools/inc/tools/resmgr.hxx +++ b/tools/inc/tools/resmgr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -239,3 +240,5 @@ inline sal_uInt32 RSHEADER_TYPE::GetLocalOff() } #endif // _SV_RESMGR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/rtti.hxx b/tools/inc/tools/rtti.hxx index 70a9dee7c04d..34f14c59f747 100644 --- a/tools/inc/tools/rtti.hxx +++ b/tools/inc/tools/rtti.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -172,3 +173,5 @@ typedef void* (*TypeId)(); ( pObj && (pObj)->Type() == TYPE(T) ) #endif // _RTTI_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/shl.hxx b/tools/inc/tools/shl.hxx index 73933d91e53b..0abf98c25c45 100644 --- a/tools/inc/tools/shl.hxx +++ b/tools/inc/tools/shl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -112,3 +113,5 @@ TOOLS_DLLPUBLIC void** GetAppData( sal_uInt16 nSharedLib ); #endif // _SHL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/simplerm.hxx b/tools/inc/tools/simplerm.hxx index 6b8f31147f96..00767880c915 100644 --- a/tools/inc/tools/simplerm.hxx +++ b/tools/inc/tools/simplerm.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,7 +36,7 @@ #ifndef _TOOLS_SIMPLERESMGR_HXX_ #define _TOOLS_SIMPLERESMGR_HXX_ -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <tools/resid.hxx> #include <i18npool/lang.h> #include <tools/string.hxx> @@ -46,7 +47,7 @@ class InternalResMgr; class TOOLS_DLLPUBLIC SimpleResMgr { protected: - vos::OMutex m_aAccessSafety; + osl::Mutex m_aAccessSafety; InternalResMgr* m_pResImpl; public: @@ -115,3 +116,5 @@ public: }; #endif // _TOOLS_SIMPLERESMGR_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/solar.h b/tools/inc/tools/solar.h index 1686e82bf52d..3636368e6c3e 100644 --- a/tools/inc/tools/solar.h +++ b/tools/inc/tools/solar.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,7 +39,6 @@ #undef _SOLAR__PRIVATE #endif #define _SOLAR__PRIVATE 1 -#define __REFERENCED 0 /************************************************************ Intermediate type to solve type clash with Windows headers. @@ -54,10 +54,6 @@ typedef sal_uIntPtr sal_uLong; /* Replaces type ULONG */ typedef int FASTBOOL; #define DELETEZ( p ) ( delete p,p = 0 ) -#define __FAR_DATA -#define __READONLY_DATA const -#define __EXPORT - #ifdef WNT #if defined (_MSC_VER) && ( _MSC_VER < 1200 ) #define __LOADONCALLAPI _cdecl @@ -76,7 +72,6 @@ typedef int FASTBOOL; /*** solar binary types **********************************************/ -#ifndef _SOLAR_NOSVBT /* Solar (portable) Binary (exchange) Type; OSI 6 subset always little endian; not necessarily aligned */ @@ -146,33 +141,6 @@ inline void DoubleToSVBT64( double n, SVBT64 p ) { p[0] = ((sal_uInt8*)&n)[7 p[7] = ((sal_uInt8*)&n)[0]; } #endif #endif -#endif - - -/*** standard floating point definitions *******************************/ - -#ifndef F_PI -#define F_PI 3.14159265358979323846 -#endif -#ifndef F_PI2 -#define F_PI2 1.57079632679489661923 -#endif -#ifndef F_PI4 -#define F_PI4 0.785398163397448309616 -#endif -#ifndef F_PI180 -#define F_PI180 0.01745329251994 -#endif -#ifndef F_PI1800 -#define F_PI1800 0.001745329251994 -#endif -#ifndef F_PI18000 -#define F_PI18000 0.0001745329251994 -#endif -#ifndef F_2PI -#define F_2PI 6.28318530717958647694 -#endif - /*** standard macros *****************************************/ @@ -203,12 +171,8 @@ template<typename T> inline T Abs(T a) { return (a>=0?a:-a); } /*** C / C++ - macros **************************************************/ #ifdef __cplusplus -#define BEGIN_C extern "C" { -#define END_C } #define EXTERN_C extern "C" #else -#define BEGIN_C -#define END_C #define EXTERN_C #endif @@ -221,9 +185,6 @@ template<typename T> inline T Abs(T a) { return (a>=0?a:-a); } #define HACK( comment ) #endif -#define _MAKE_NUMSTR( n ) # n -#define MAKE_NUMSTR( n ) _MAKE_NUMSTR( n ) - #define _LF ((char)0x0A) #define _CR ((char)0x0D) @@ -243,128 +204,40 @@ template<typename T> inline T Abs(T a) { return (a>=0?a:-a); } /* dll file extensions *******************************************************/ #if defined WNT -#if defined(__MINGW32__) - #define __DLLEXTENSION "gi" -#else - #define __DLLEXTENSION "mi" -#endif -#elif defined OS2 - #define __DLLEXTENSION "go" + #define __DLLEXTENSION "lo" +#elif defined MACOSX + #define __DLLEXTENSION "lo.dylib" #elif defined UNX -#ifdef AIX - #define __DLLEXTENSION "ap.so" -#elif defined HPUX - #define __DLLEXTENSION "hr.sl" -#elif defined SOLARIS && defined SPARC && defined IS_LP64 - #define __DLLEXTENSION "su.so" -#elif defined SOLARIS && defined SPARC && !defined __GNUC__ - #define __DLLEXTENSION "ss.so" -#elif defined SOLARIS && defined SPARC && defined __GNUC__ - #define __DLLEXTENSION "sogs.so" -#elif defined SOLARIS && defined INTEL && !defined __GNUC__ - #define __DLLEXTENSION "si.so" -#elif defined SOLARIS && defined INTEL && defined __GNUC__ - #define __DLLEXTENSION "sogi.so" -#elif defined SCO - #define __DLLEXTENSION "ci.so" -#elif defined NETBSD && defined X86 - #define __DLLEXTENSION "bi.so" -#elif defined NETBSD && defined ARM32 - #define __DLLEXTENSION "ba.so" -#elif defined NETBSD && defined SPARC - #define __DLLEXTENSION "bs.so" -#elif defined NETBSD && defined POWERPC - #define __DLLEXTENSION "bp.so" -#elif defined LINUX && defined X86 - #define __DLLEXTENSION "li.so" -#elif defined LINUX && defined POWERPC - #define __DLLEXTENSION "lp.so" -#elif defined LINUX && defined S390 - #define __DLLEXTENSION "l3.so" -#elif defined LINUX && defined ARM32 - #define __DLLEXTENSION "lr.so" -#elif defined LINUX && defined SPARC - #define __DLLEXTENSION "ls.so" -#elif defined LINUX && defined __x86_64__ - #define __DLLEXTENSION "lx.so" -#elif defined LINUX && defined MIPS - #define __DLLEXTENSION "lm.so" -#elif defined LINUX && defined IA64 - #define __DLLEXTENSION "la.so" -#elif defined LINUX && defined M68K - #define __DLLEXTENSION "lm.so" -#elif defined LINUX && defined HPPA - #define __DLLEXTENSION "lh.so" -#elif defined LINUX && defined AXP - #define __DLLEXTENSION "ll.so" -#elif defined LINUX - #error unknown plattform -#elif defined FREEBSD && defined X86 - #define __DLLEXTENSION "fi.so" -#elif defined FREEBSD && defined X86_64 - #define __DLLEXTENSION "fx.so" -#elif defined MACOSX && defined POWERPC - #define __DLLEXTENSION "mxp.dylib" -#elif defined MACOSX && defined X86 - #define __DLLEXTENSION "mxi.dylib" + #define __DLLEXTENSION "lo.so" #else - #define __DLLEXTENSION ".so" -#endif + #error unknown plattform #endif // ----------------------------------------------------------------------- -#ifndef NOREPLACESTRING #define UniString String #define XubString String -#else -#define XubString UniString -#endif #define xub_Unicode sal_Unicode -#define xub_uUnicode sal_Unicode -#ifdef STRING32 -#define xub_StrLen sal_uInt32 -#else #define xub_StrLen sal_uInt16 -#endif // -- moved here from libcall.hxx ---------------------------------------- -#define LIBRARY_STR(s) # s -#define LIBRARY_STRING(s) LIBRARY_STR(s) - -#define GETFUNCTION( s ) GetFunction( s ) #define LIBRARY_CONCAT3( s1, s2, s3 ) \ s1 s2 s3 #define LIBRARY_CONCAT4( s1, s2, s3, s4 ) \ s1 s2 s3 s4 -#if defined WNT || defined OS2 +#if defined WNT #define SVLIBRARY( Base ) \ LIBRARY_CONCAT3( Base, __DLLEXTENSION, ".DLL" ) -#define SVLIBRARYLANG( Base, Lang ) \ - LIBRARY_CONCAT3( Base, Lang, ".DLL" ) #elif defined UNX #define SVLIBRARY( Base ) \ LIBRARY_CONCAT3( "lib", Base, __DLLEXTENSION ) -#define SVLIBRARYLANG( Base, Lang ) \ - LIBRARY_CONCAT3( "lib", Base, Lang ) #else #define SVLIBRARY( Base ) \ LIBRARY_CONCAT2( Base, __DLLEXTENSION ) -#define SVLIBRARYLANG( Base, Lang ) \ - LIBRARY_CONCAT2( Base, Lang ) -#endif - -#if defined MACOSX -#define SV_LIBFILENAME(str) \ - LIBRARYFILENAME_CONCAT2( str, __DLLEXTENSION ) -#elif defined UNX -#define SV_LIBFILENAME(str) \ - LIBRARYFILENAME_CONCAT2( str, __DLLEXTENSION ) -#else -#define SV_LIBFILENAME(str) \ - LIBRARYFILENAME_CONCAT3( str, __DLLEXTENSION, ".dll" ) #endif #endif /* _SOLAR_H */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/solarmutex.hxx b/tools/inc/tools/solarmutex.hxx index f8b784c9f9ae..eef67455a6bb 100644 --- a/tools/inc/tools/solarmutex.hxx +++ b/tools/inc/tools/solarmutex.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,18 +29,20 @@ #define _TOOLS_SOLARMUTEX_HXX #include "tools/toolsdllapi.h" -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> namespace tools { class TOOLS_DLLPUBLIC SolarMutex { public: - static ::vos::IMutex* GetSolarMutex(); - static void SetSolarMutex( ::vos::IMutex* pMutex ); + static ::osl::SolarMutex* GetSolarMutex(); + static void SetSolarMutex( ::osl::SolarMutex* pMutex ); static bool Acquire(); static void Release(); }; } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/stack.hxx b/tools/inc/tools/stack.hxx index 6ac6aa2fc586..d3c76d1a0165 100644 --- a/tools/inc/tools/stack.hxx +++ b/tools/inc/tools/stack.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -103,3 +104,5 @@ public: \ }; #endif // _STACK_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/stream.hxx b/tools/inc/tools/stream.hxx index 841b364fef6e..0e5094561734 100644 --- a/tools/inc/tools/stream.hxx +++ b/tools/inc/tools/stream.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include "tools/toolsdllapi.h" #include <tools/solar.h> #include <tools/string.hxx> -#ifndef _EINF_HXX #include <tools/errinf.hxx> -#endif #include <tools/ref.hxx> #include <tools/rtti.hxx> @@ -95,9 +94,6 @@ typedef sal_uInt16 StreamMode; #define COMPRESSMODE_ZBITMAP (sal_uInt16)0x0001 #define COMPRESSMODE_NATIVE (sal_uInt16)0x0010 -#define JUSTIFY_RIGHT 0x00 -#define JUSTIFY_LEFT 0x01 - #define STREAM_IO_DONTKNOW 0 #define STREAM_IO_READ 1 #define STREAM_IO_WRITE 2 @@ -268,26 +264,15 @@ private: sal_uInt16 nCompressMode; LineEnd eLineDelimiter; CharSet eStreamCharSet; -// CharSet eTargetCharSet; // Verschluesselung - ByteString aKey; // aKey.Len != 0 -> Verschluesselung + rtl::OString m_aCryptMaskKey; // aCryptMaskKey.getLength != 0 -> Verschluesselung unsigned char nCryptMask; - // Formatierung von Strings - char cFiller; - sal_uInt8 nRadix; - sal_uInt8 nPrecision; - sal_uInt8 nWidth; - sal_uInt8 nPrintfParams; - sal_uInt8 nJustification; - ByteString aFormatString; - // Userdata long nVersion; // for external use // Hilfsmethoden - void CreateFormatString(); TOOLS_DLLPRIVATE void ImpInit(); SvStream ( const SvStream& rStream ); // not implemented @@ -339,15 +324,12 @@ public: { nCompressMode = nNewMode; } sal_uInt16 GetCompressMode() const { return nCompressMode; } - void SetKey( const ByteString& rKey ); - const ByteString& GetKey() const { return aKey; } + void SetCryptMaskKey(const rtl::OString& rCryptMaskKey); + const rtl::OString& GetCryptMaskKey() const { return m_aCryptMaskKey; } void SetStreamCharSet( CharSet eCharSet ) { eStreamCharSet = eCharSet; } CharSet GetStreamCharSet() const { return eStreamCharSet; } -// void SetTargetCharSet( CharSet eCharSet ) -// { eTargetCharSet = eCharSet; } -// CharSet GetTargetCharSet() const { return eTargetCharSet; } void SetLineDelimiter( LineEnd eLineEnd ) { eLineDelimiter = eLineEnd; } @@ -355,6 +337,7 @@ public: SvStream& operator>>( sal_uInt16& rUInt16 ); SvStream& operator>>( sal_uInt32& rUInt32 ); + SvStream& operator>>( sal_uInt64& rUInt64 ); SvStream& operator>>( long& rLong ); SvStream& operator>>( short& rShort ); SvStream& operator>>( int& rInt ); @@ -373,6 +356,7 @@ public: SvStream& operator<<( sal_uInt16 nUInt16 ); SvStream& operator<<( sal_uInt32 nUInt32 ); + SvStream& operator<<( sal_uInt64 nuInt64 ); SvStream& operator<<( long nLong ); SvStream& operator<<( short nShort ); SvStream& operator<<( int nInt ); @@ -398,37 +382,8 @@ public: SvStream& WriteByteString( const UniString& rStr ) { return WriteByteString( rStr, GetStreamCharSet() ); } SvStream& WriteByteString( const ByteString& rStr ); - void SetRadix( sal_uInt8 nRad ) - { nRadix = nRad; CreateFormatString(); } - sal_uInt8 GetRadix() const { return nRadix; } - void SetPrecision( sal_uInt8 nPrec ) - { nPrecision = nPrec; CreateFormatString(); } - sal_uInt8 GetPrecision() const { return nPrecision; } - void SetWidth( sal_uInt8 nWid) - { nWidth = nWid; CreateFormatString(); } - sal_uInt8 GetWidth() const { return nWidth; } - void SetFiller( char cFil ) - { cFiller = cFil; CreateFormatString(); } - char GetFiller() const { return cFiller; } - void SetJustification( sal_uInt8 nJus ) - { nJustification = nJus; CreateFormatString(); } - sal_uInt8 GetJustification() const { return nJustification; } - - SvStream& ReadNumber( short& rShort ); - SvStream& ReadNumber( sal_uInt16& rUInt16 ); - SvStream& ReadNumber( long& rLong ); - SvStream& ReadNumber( sal_uInt32& rUInt32 ); - SvStream& ReadNumber( int& rInt ); - SvStream& ReadNumber( float& rFloat ); - SvStream& ReadNumber( double& rDouble ); - - SvStream& WriteNumber( short nShort ); - SvStream& WriteNumber( sal_uInt16 nUInt16 ); - SvStream& WriteNumber( long nLong ); SvStream& WriteNumber( sal_uInt32 nUInt32 ); - SvStream& WriteNumber( int nInt ); - SvStream& WriteNumber( float nFloat ); - SvStream& WriteNumber( const double& rDouble ); + SvStream& WriteNumber( sal_Int32 nInt32 ); sal_Size Read( void* pData, sal_Size nSize ); sal_Size Write( const void* pData, sal_Size nSize ); @@ -455,8 +410,6 @@ public: sal_Bool ReadByteStringLine( String& rStr ) { return ReadByteStringLine( rStr, GetStreamCharSet()); } sal_Bool WriteByteStringLine( const String& rStr, rtl_TextEncoding eDestCharSet ); sal_Bool WriteByteStringLine( const String& rStr ) { return WriteByteStringLine( rStr, GetStreamCharSet()); } - sal_Bool WriteByteStringLines( const String& rStr, rtl_TextEncoding eDestCharSet ); - sal_Bool WriteByteStringLines( const String& rStr ) { return WriteByteStringLine( rStr, GetStreamCharSet()); } /// Switch to no endian swapping and write 0xfeff sal_Bool StartWritingUnicodeText(); @@ -493,17 +446,7 @@ public: sal_Bool WriteUniStringLine( const String& rStr ); /// Write multiple lines of Unicode (with CovertLineEnd) and append line end (endlu()) sal_Bool WriteUniStringLines( const String& rStr ); - /// Write a line of Unicode if eDestCharSet==RTL_TEXTENCODING_UNICODE, - /// otherwise write a line of Bytecode converted to eDestCharSet - sal_Bool WriteUniOrByteStringLine( const String& rStr, rtl_TextEncoding eDestCharSet ); - sal_Bool WriteUniOrByteStringLine( const String& rStr ) - { return WriteUniOrByteStringLine( rStr, GetStreamCharSet() ); } - /// Write multiple lines of Unicode if eDestCharSet==RTL_TEXTENCODING_UNICODE, - /// otherwise write multiple lines of Bytecode converted to eDestCharSet, - /// CovertLineEnd is applied. - sal_Bool WriteUniOrByteStringLines( const String& rStr, rtl_TextEncoding eDestCharSet ); - sal_Bool WriteUniOrByteStringLines( const String& rStr ) - { return WriteUniOrByteStringLines( rStr, GetStreamCharSet() ); } + /// Write a Unicode character if eDestCharSet==RTL_TEXTENCODING_UNICODE, /// otherwise write as Bytecode converted to eDestCharSet. /// This may result in more than one byte being written @@ -581,48 +524,6 @@ public: long GetVersion() { return nVersion; } void SetVersion( long n ) { nVersion = n; } - /** Add a mark to indicate to which position in the stream you want to be - able to seek back. - - @descr If you set a mark at nPos, you indicate to the stream that you - won't issue seek operations to any position 'before' nPos. This can - be exploited by 'transient streams' that do not permanently store - their data; they can discard any buffered data up to nPos. - - @descr However, if the stream is already positioned past nPos, this - method is not guaranteed to have the desired effect. A 'transient - stream' may have already discarded the buffered data at nPos, so that - a seek operation to nPos will fail nonetheless. - - @descr There can be more than one mark for a stream, indicating that - you want to be able to seek back in the stream as far as the 'lowest' - off all the marks. There can even be multiple marks at the same - position (and they must all be individually removed with - RemoveMark()). - - @param nPos The position in the stream at which to add a mark. - */ - virtual void AddMark(sal_Size nPos); - - /** Remove a mark introduced with AddMark(). - - @descr If you no longer need to seek back to some position for which - you added a mark, you should remove that mark. (And a 'transient - stream' that does not permanently store its data can then potentially - discard some of its buffered data.) - - @descr Removing one mark does not have any effects on any other - marks. Especially, if you have multiple marks at the same position, - you must call this method multiple times to effectively 'unmark' that - position. - - @descr If you specify a position for which there is no mark, this - method simply has no effect. - - @param nPos The position in the stream at which to remove the mark. - */ - virtual void RemoveMark(sal_Size nPos); - friend SvStream& operator<<( SvStream& rStr, SvStrPtr f ); // fuer Manips }; @@ -632,81 +533,6 @@ inline SvStream& operator<<( SvStream& rStr, SvStrPtr f ) return rStr; } -inline SvStream& SvStream::ReadNumber( short& rShort ) -{ - long nTmp; - ReadNumber( nTmp ); - rShort = (short)nTmp; - return *this; -} - -inline SvStream& SvStream::ReadNumber( sal_uInt16& rUShort ) -{ - sal_uInt32 nTmp; - ReadNumber( nTmp ); - rUShort = (sal_uInt16)nTmp; - return *this; -} - -inline SvStream& SvStream::ReadNumber( int& rInt ) -{ - long nTmp; - ReadNumber( nTmp ); - rInt = (int)nTmp; - return *this; -} - -/* -inline SvStream& SvStream::ReadNumber( unsigned int& rUInt ) -{ - sal_uIntPtr nTmp; - ReadNumber( nTmp ); - rUInt = (unsigned int)nTmp; - return *this; -} -*/ - -inline SvStream& SvStream::ReadNumber( float& rFloat ) -{ - double nTmp; - ReadNumber( nTmp ); - rFloat = (float)nTmp; - return *this; -} - -inline SvStream& SvStream::WriteNumber( short nShort ) -{ - WriteNumber( (long)nShort ); - return *this; -} - -inline SvStream& SvStream::WriteNumber( sal_uInt16 nUShort ) -{ - WriteNumber( (sal_uInt32)nUShort ); - return *this; -} - -inline SvStream& SvStream::WriteNumber( int nInt ) -{ - WriteNumber( (long)nInt ); - return *this; -} - -/* -inline SvStream& SvStream::WriteNumber( unsigned int nUInt ) -{ - WriteNumber( (sal_uIntPtr)nUInt ); - return *this; -} -*/ - -inline SvStream& SvStream::WriteNumber( float nFloat ) -{ - double nTemp = nFloat; - WriteNumber( nTemp ); - return *this; -} - inline void SvStream::SetEndianSwap( sal_Bool bVal ) { #ifdef OSL_BIGENDIAN @@ -854,9 +680,7 @@ public: class TOOLS_DLLPUBLIC SvDataCopyStream { public: - /*-----------------MM 30.04.96 11:01----------------- - mehrfaches Aufrufen von Load und Assign erlaubt - --------------------------------------------------*/ + // mehrfaches Aufrufen von Load und Assign erlaubt TYPEINFO(); virtual ~SvDataCopyStream(){} virtual void Load( SvStream & ) = 0; @@ -865,3 +689,5 @@ public: }; #endif // _STREAM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx index 510d66937299..f77d9630d962 100755..100644 --- a/tools/inc/tools/string.hxx +++ b/tools/inc/tools/string.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,12 +33,8 @@ #include <osl/thread.h> #include <rtl/textenc.h> #include <rtl/textcvt.h> -#ifndef _RTL_STRING_HXX #include <rtl/string.hxx> -#endif -#ifndef _RTL_USTRING_HXX #include <rtl/ustring.hxx> -#endif #include "tools/toolsdllapi.h" /******************************************************************************* @@ -136,8 +133,6 @@ enum StringCompare { COMPARE_LESS = -1, COMPARE_EQUAL = 0, COMPARE_GREATER = 1 } #ifdef SAL_W32 #pragma pack(push, 8) -#elif defined(SAL_OS2) -#pragma pack(1) #endif typedef struct _ByteStringData @@ -149,8 +144,6 @@ typedef struct _ByteStringData #ifdef SAL_W32 #pragma pack(pop) -#elif defined(SAL_OS2) -#pragma pack() #endif // -------------- @@ -424,8 +417,6 @@ inline ByteString ByteString::GetQuotedToken( xub_StrLen nToken, const ByteStrin #ifdef SAL_W32 #pragma pack(push, 4) -#elif defined(SAL_OS2) -#pragma pack(1) #endif typedef struct _UniStringData @@ -437,8 +428,6 @@ typedef struct _UniStringData #ifdef SAL_W32 #pragma pack(pop) -#elif defined(SAL_OS2) -#pragma pack() #endif // ------------- @@ -469,6 +458,8 @@ private: void operator +=(int); // not implemented; to detect misuses // of operator +=(sal_Unicode) + //detect and reject use of RTL_CONSTASCII_STRINGPARAM instead of RTL_CONSTASCII_USTRINGPARAM + TOOLS_DLLPRIVATE UniString( const sal_Char*, sal_Int32 ); public: UniString(); UniString( const ResId& rResId ); @@ -689,3 +680,5 @@ inline UniString UniString::GetQuotedToken( xub_StrLen nToken, const UniString& } #endif // _STRING_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/svborder.hxx b/tools/inc/tools/svborder.hxx index a525618a6c17..86c5feb4f4dc 100644 --- a/tools/inc/tools/svborder.hxx +++ b/tools/inc/tools/svborder.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -95,3 +96,4 @@ TOOLS_DLLPUBLIC Rectangle & operator -= ( Rectangle & rRect, const SvBorder & rB #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/svlibrary.hxx b/tools/inc/tools/svlibrary.hxx index fa8ff7c8068b..b10adde91541 100644 --- a/tools/inc/tools/svlibrary.hxx +++ b/tools/inc/tools/svlibrary.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,3 +41,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/svwin.h b/tools/inc/tools/svwin.h deleted file mode 100644 index b4ea6fcc3374..000000000000 --- a/tools/inc/tools/svwin.h +++ /dev/null @@ -1,36 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVWIN_H -#define _SVWIN_H - -#if defined WNT -#include <tools/prewin.h> -#include <tools/postwin.h> -#endif - -#endif diff --git a/tools/inc/tools/table.hxx b/tools/inc/tools/table.hxx index 6fff4d7d7f2b..bfb91fbe7dc6 100644 --- a/tools/inc/tools/table.hxx +++ b/tools/inc/tools/table.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,9 +42,7 @@ class TOOLS_DLLPUBLIC Table : private Container { private: sal_uIntPtr nCount; -//#if 0 // _SOLAR__PRIVATE TOOLS_DLLPRIVATE sal_uIntPtr ImplGetIndex( sal_uIntPtr nKey, sal_uIntPtr* pIndex = NULL ) const; -//#endif public: Table( sal_uInt16 nInitSize = 16, sal_uInt16 nReSize = 16 ); Table( const Table& rTable ) : Container( rTable ) @@ -150,3 +149,5 @@ public: \ }; #endif // _TOOLS_TABLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/tempfile.hxx b/tools/inc/tools/tempfile.hxx index 896fed5da0cd..d356e7bf66fc 100644 --- a/tools/inc/tools/tempfile.hxx +++ b/tools/inc/tools/tempfile.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -75,3 +76,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/tenccvt.hxx b/tools/inc/tools/tenccvt.hxx index 4c9968149291..a5840d77b34d 100644 --- a/tools/inc/tools/tenccvt.hxx +++ b/tools/inc/tools/tenccvt.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ #define _TOOLS_TENCCVT_HXX #include <rtl/textenc.h> -#ifndef _TOOLS_SOLAR_H #include <tools/solar.h> -#endif #include "tools/toolsdllapi.h" // ---------------------------------------- @@ -55,4 +54,17 @@ TOOLS_DLLPUBLIC rtl_TextEncoding GetOneByteTextEncoding( rtl_TextEncoding eEncod TOOLS_DLLPUBLIC rtl_TextEncoding GetSOLoadTextEncoding( rtl_TextEncoding eEncoding, sal_uInt16 nVersion = SOFFICE_FILEFORMAT_50 ); TOOLS_DLLPUBLIC rtl_TextEncoding GetSOStoreTextEncoding( rtl_TextEncoding eEncoding, sal_uInt16 nVersion = SOFFICE_FILEFORMAT_50 ); +/* + * Given a Unicode character, return a legacy Microsoft Encoding which + * supports it. Returns RTL_TEXTENCODING_DONTKNOW if there is + * no encoding which could support the character + * + * Useful as a utility to categorize unicode characters into the best fit + * windows charset range for exporting to ww6 & wmf or as a hint to non \u + * unicode token aware rtf readers + */ +TOOLS_DLLPUBLIC rtl_TextEncoding getBestMSEncodingByChar(sal_Unicode c); + #endif // _TOOLS_TENCCVT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/testtoolloader.hxx b/tools/inc/tools/testtoolloader.hxx index 04431d622959..0b48ee597509 100644 --- a/tools/inc/tools/testtoolloader.hxx +++ b/tools/inc/tools/testtoolloader.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,3 +38,5 @@ namespace tools } #endif // _TOOLS_TESTTOOLLOADER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/time.hxx b/tools/inc/tools/time.hxx index 5b0b508598d8..9b2534013af6 100644 --- a/tools/inc/tools/time.hxx +++ b/tools/inc/tools/time.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -110,3 +111,5 @@ public: }; #endif // _TOOLS_TIME_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/tools.h b/tools/inc/tools/tools.h index e1ad470cf620..d8040a28a859 100644 --- a/tools/inc/tools/tools.h +++ b/tools/inc/tools/tools.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,3 +37,5 @@ TOOLS_DLLPUBLIC void DeInitTools(); TOOLS_DLLPUBLIC void GlobalDeInitTools(); #endif // _TOOLS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/toolsdllapi.h b/tools/inc/tools/toolsdllapi.h index fbd41130a145..6deb71293853 100644 --- a/tools/inc/tools/toolsdllapi.h +++ b/tools/inc/tools/toolsdllapi.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,3 +40,4 @@ #endif /* INCLUDED_TOOLSDLLAPI_H */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/unqid.hxx b/tools/inc/tools/unqid.hxx index a8ef2587d486..9e05b44b4437 100644 --- a/tools/inc/tools/unqid.hxx +++ b/tools/inc/tools/unqid.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -107,3 +108,5 @@ public: }; #endif // _UNQID_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/unqidx.hxx b/tools/inc/tools/unqidx.hxx index 6059af077abc..74aa57d54d1a 100644 --- a/tools/inc/tools/unqidx.hxx +++ b/tools/inc/tools/unqidx.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -149,3 +150,5 @@ public: \ }; #endif // _UNQIDX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/urlobj.hxx b/tools/inc/tools/urlobj.hxx index cb9c7e407bcc..67342db5d161 100644 --- a/tools/inc/tools/urlobj.hxx +++ b/tools/inc/tools/urlobj.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -141,7 +142,8 @@ enum INetProtocol INET_PROT_GENERIC = 30, INET_PROT_SMB = 31, INET_PROT_HID = 32, - INET_PROT_END = 33 + INET_PROT_SFTP = 33, + INET_PROT_END = 34 }; //============================================================================ @@ -1534,6 +1536,9 @@ private: TOOLS_DLLPRIVATE static bool scanIPv6reference( sal_Unicode const *& rBegin, sal_Unicode const * pEnd); + +private: + void changeScheme(INetProtocol eTargetScheme); }; // static @@ -1920,3 +1925,5 @@ inline rtl::OUString INetURLObject::decode(rtl::OUStringBuffer const & rText, } #endif // _URLOBJ_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/vcompat.hxx b/tools/inc/tools/vcompat.hxx index 93517b77053d..dcac766aaf78 100644 --- a/tools/inc/tools/vcompat.hxx +++ b/tools/inc/tools/vcompat.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -68,3 +69,5 @@ public: }; #endif // _VCOMPAT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/vector2d.hxx b/tools/inc/tools/vector2d.hxx index 10c33b57c871..4b6d6473ff0b 100644 --- a/tools/inc/tools/vector2d.hxx +++ b/tools/inc/tools/vector2d.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -117,3 +118,5 @@ inline Vector2D& Vector2D::Normalize() } #endif // _SV_VECTOR2D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/weakbase.h b/tools/inc/tools/weakbase.h index a66da8c7c33f..7108ba882126 100644 --- a/tools/inc/tools/weakbase.h +++ b/tools/inc/tools/weakbase.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -158,3 +159,4 @@ private: #endif // _TOOLS_WEAKBASE_H_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/weakbase.hxx b/tools/inc/tools/weakbase.hxx index 81f53fb3516b..5e941910147c 100644 --- a/tools/inc/tools/weakbase.hxx +++ b/tools/inc/tools/weakbase.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -181,3 +182,4 @@ inline WeakConnection< reference_type >* WeakBase< reference_type >::getWeakConn #endif // _TOOLS_WEAKBASE_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/wintypes.hxx b/tools/inc/tools/wintypes.hxx index 18adfbab37ef..e4f0a0daf7f1 100644 --- a/tools/inc/tools/wintypes.hxx +++ b/tools/inc/tools/wintypes.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -193,6 +194,7 @@ typedef sal_Int64 WinBits; #define WB_OWNERDRAWDECORATION ((WinBits)SAL_CONST_INT64(0x2000000000)) #define WB_DEFAULTWIN ((WinBits)SAL_CONST_INT64(0x4000000000)) #define WB_NEEDSFOCUS ((WinBits)SAL_CONST_INT64(0x1000000000)) +#define WB_POPUP ((WinBits)SAL_CONST_INT64(0x20000000)) #define WB_HSCROLL WB_HORZ #define WB_VSCROLL WB_VERT @@ -269,6 +271,7 @@ typedef sal_Int64 WinBits; #define WB_STDMODAL (WB_STDDIALOG) #define WB_STDTABDIALOG (WB_STDDIALOG) #define WB_STDTABCONTROL 0 +#define WB_STDPOPUP (WB_BORDER | WB_POPUP | WB_SYSTEMWINDOW | WB_3DLOOK | WB_DIALOGCONTROL) // For TreeListBox #define WB_HASBUTTONS ((WinBits)SAL_CONST_INT64(0x000100000000)) @@ -342,3 +345,4 @@ enum ProminentEntry { PROMINENT_TOP, PROMINENT_MIDDLE }; #endif // _TOOLS_WINTYPES_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/wldcrd.hxx b/tools/inc/tools/wldcrd.hxx index 4938bc212db2..c1c6a33fcaa0 100644 --- a/tools/inc/tools/wldcrd.hxx +++ b/tools/inc/tools/wldcrd.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -89,3 +90,5 @@ inline WildCard& WildCard::operator=( const WildCard& rWildCard ) } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/zcodec.hxx b/tools/inc/tools/zcodec.hxx index d42e87f5d4e0..578f367b4cdd 100644 --- a/tools/inc/tools/zcodec.hxx +++ b/tools/inc/tools/zcodec.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -126,3 +127,5 @@ public: }; #endif // _ZCODEC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/toolsin.hxx b/tools/inc/toolsin.hxx index 7259682c9895..de88389fbb39 100644 --- a/tools/inc/toolsin.hxx +++ b/tools/inc/toolsin.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,3 +51,5 @@ struct TOOLSINDATA TOOLSINDATA* ImplGetToolsInData(); #endif // _TOOLSIN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/os2/inc/dll.hxx b/tools/os2/inc/dll.hxx deleted file mode 100644 index 81a87a03ece7..000000000000 --- a/tools/os2/inc/dll.hxx +++ /dev/null @@ -1,39 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _DLL_HXX -#define _DLL_HXX - -// MultiThread-Sicherung aktivieren -void EnterMultiThread( int bEnter ); -int IsMultiThread(); - -// Um Resourcen wieder freizugeben -//YD void ImpDeInitOS2Tools(); -inline void ImpDeInitOS2Tools() {} - -#endif diff --git a/tools/os2/source/dll/toolsdll.cxx b/tools/os2/source/dll/toolsdll.cxx deleted file mode 100644 index 0e0bdec3a9b0..000000000000 --- a/tools/os2/source/dll/toolsdll.cxx +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SHL_HXX -#include <tools/shl.hxx> -#endif - -#ifndef _DLL_HXX -#include <dll.hxx> -#endif - -// ======================================================================= - -static void* aAppData[SHL_COUNT]; - -// ----------------------------------------------------------------------- - -void** GetAppData( USHORT nSharedLib ) -{ - return &(aAppData[nSharedLib]); -} - -// ======================================================================= - diff --git a/tools/prj/build.lst b/tools/prj/build.lst index 1e5c9135145f..eeb470c384d6 100644 --- a/tools/prj/build.lst +++ b/tools/prj/build.lst @@ -1,2 +1,3 @@ -tl tools : cppu external offuh vos ZLIB:zlib EXPAT:expat basegfx comphelper i18npool NULL +tl tools : cppu external offuh ZLIB:zlib EXPAT:expat basegfx comphelper i18npool NULL tl tools\prj nmake - all tl_prj NULL +# tl tools\qa nmake - all tl_qa tl_utl NULL diff --git a/tools/qa/test_pathutils.cxx b/tools/qa/test_pathutils.cxx index 5966406e150f..99046a6211c9 100644 --- a/tools/qa/test_pathutils.cxx +++ b/tools/qa/test_pathutils.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,10 @@ #include <cwchar> -#include "testshl/simpleheader.hxx" +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/plugin/TestPlugIn.h> + #include "tools/pathutils.hxx" namespace { @@ -69,8 +73,10 @@ void Test::testBuildPath() { buildPath(L"", L"..\\a", L"..\\a"); } -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests"); +CPPUNIT_TEST_SUITE_REGISTRATION(Test); } -NOADDITIONAL; +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/qa/test_reversemap.cxx b/tools/qa/test_reversemap.cxx new file mode 100644 index 000000000000..e1ea8698ce87 --- /dev/null +++ b/tools/qa/test_reversemap.cxx @@ -0,0 +1,173 @@ +/* -*- 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> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. 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 "precompiled_tools.hxx" +#include "sal/config.h" + +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/plugin/TestPlugIn.h> + +#include <rtl/ustring.hxx> +#include <vector> + +#include "tools/tenccvt.hxx" + +//Tests for getBestMSEncodingByChar + +namespace +{ + + class Test: public CppUnit::TestFixture + { + public: + void testEncoding(rtl_TextEncoding eEncoding); + + void test1258(); + void test1257(); + void test1256(); + void test1255(); + void test1254(); + void test1253(); + void test1252(); + void test1251(); + void test1250(); + void test874(); + + CPPUNIT_TEST_SUITE(Test); + CPPUNIT_TEST(test1258); + CPPUNIT_TEST(test1257); + CPPUNIT_TEST(test1256); + CPPUNIT_TEST(test1255); + CPPUNIT_TEST(test1254); + CPPUNIT_TEST(test1253); + CPPUNIT_TEST(test1252); + CPPUNIT_TEST(test1251); + CPPUNIT_TEST(test1250); + CPPUNIT_TEST(test874); + CPPUNIT_TEST_SUITE_END(); + }; + + void Test::testEncoding(rtl_TextEncoding eEncoding) + { + //Taking the single byte legacy encodings, fill in all possible values + std::vector<sal_Char> aAllChars(255); + for (int i = 1; i <= 255; ++i) + aAllChars[i-1] = static_cast<sal_Char>(i); + + //Some slots are unused, so don't map to private, just set them to 'X' + sal_uInt32 convertFlags = OUSTRING_TO_OSTRING_CVTFLAGS ^ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE; + rtl::OUString sOrigText(&aAllChars[0], aAllChars.size(), eEncoding, convertFlags); + sOrigText = sOrigText.replace( 0xfffd, 'X' ); + + //Should clearly be equal + sal_Int32 nLength = aAllChars.size(); + CPPUNIT_ASSERT_EQUAL(sOrigText.getLength(), nLength); + + rtl::OUString sFinalText; + + //Split up in chunks of the same encoding returned by + //getBestMSEncodingByChar, convert to it, and back + rtl_TextEncoding ePrevEncoding = RTL_TEXTENCODING_DONTKNOW; + const sal_Unicode *pStr = sOrigText.getStr(); + sal_Int32 nChunkStart=0; + for (int i = 0; i < 255; ++i) + { + rtl_TextEncoding eCurrEncoding = getBestMSEncodingByChar(pStr[i]); + if (eCurrEncoding != ePrevEncoding) + { + rtl::OString aChunk(pStr+nChunkStart, i-nChunkStart, ePrevEncoding); + sFinalText += rtl::OStringToOUString(aChunk, ePrevEncoding); + nChunkStart = i; + } + ePrevEncoding = eCurrEncoding; + } + if (nChunkStart < 255) + { + rtl::OString aChunk(pStr+nChunkStart, 255-nChunkStart, ePrevEncoding); + sFinalText += rtl::OStringToOUString(aChunk, ePrevEncoding); + } + + //Final text should be the same as original + CPPUNIT_ASSERT_EQUAL(sOrigText, sFinalText); + } + + void Test::test1252() + { + testEncoding(RTL_TEXTENCODING_MS_1252); + } + + void Test::test874() + { + testEncoding(RTL_TEXTENCODING_MS_874); + } + + void Test::test1258() + { + testEncoding(RTL_TEXTENCODING_MS_1258); + } + + void Test::test1257() + { + testEncoding(RTL_TEXTENCODING_MS_1257); + } + + void Test::test1256() + { + testEncoding(RTL_TEXTENCODING_MS_1256); + } + + void Test::test1255() + { + testEncoding(RTL_TEXTENCODING_MS_1255); + } + + void Test::test1254() + { + testEncoding(RTL_TEXTENCODING_MS_1254); + } + + void Test::test1253() + { + testEncoding(RTL_TEXTENCODING_MS_1253); + } + + void Test::test1251() + { + testEncoding(RTL_TEXTENCODING_MS_1251); + } + + void Test::test1250() + { + testEncoding(RTL_TEXTENCODING_MS_1250); + } + + CPPUNIT_TEST_SUITE_REGISTRATION(Test); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/qa/urlobj/export.map b/tools/qa/urlobj/export.map new file mode 100644 index 000000000000..8c1ebd8cfe1f --- /dev/null +++ b/tools/qa/urlobj/export.map @@ -0,0 +1,7 @@ + UDK_3.0 { + global: + registerAllTestFunction; + + local: + *; + }; diff --git a/tools/qa/urlobj/makefile.mk b/tools/qa/urlobj/makefile.mk new file mode 100644 index 000000000000..09745b1103d6 --- /dev/null +++ b/tools/qa/urlobj/makefile.mk @@ -0,0 +1,66 @@ + #************************************************************************* + # + # 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 + # [ insert your name / company etc. here eg. Jim Bob <jim@bob.org> ] + # Portions created by the Initial Developer are Copyright (C) 2010 the + # Initial Developer. All Rights Reserved. + # + # Contributor(s): Florian Reuter <freuter@novell.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. + #************************************************************************* + + PRJ=..$/.. + + PRJNAME=tools + TARGET=qa_tools_urlobj_test + # this is removed at the moment because we need some enhancements + # TESTDIR=TRUE + + ENABLE_EXCEPTIONS=TRUE + + # --- Settings ----------------------------------------------------- + + .INCLUDE : settings.mk + + # BEGIN ---------------------------------------------------------------- + # auto generated Target:job by codegen.pl + SHL1OBJS= \ + $(SLO)$/tools_urlobj_test.obj + + SHL1TARGET= tools_urlobj + SHL1STDLIBS=\ + $(SALLIB) \ + $(CPPUNITLIB) \ + $(TOOLSLIB) + + SHL1IMPLIB= i$(SHL1TARGET) + DEF1NAME =$(SHL1TARGET) + SHL1VERSIONMAP= export.map + # auto generated Target:job + # END ------------------------------------------------------------------ + + #------------------------------- All object files ------------------------------- + # do this here, so we get right dependencies + # SLOFILES=$(SHL1OBJS) + + # --- Targets ------------------------------------------------------ + + .INCLUDE : target.mk + .INCLUDE : _cppunit.mk diff --git a/tools/qa/urlobj/tools_urlobj_test.cxx b/tools/qa/urlobj/tools_urlobj_test.cxx new file mode 100644 index 000000000000..4b476e7ad388 --- /dev/null +++ b/tools/qa/urlobj/tools_urlobj_test.cxx @@ -0,0 +1,186 @@ +/* -*- 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 + * [ insert your name / company etc. here eg. Jim Bob <jim@bob.org> ] + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Florian Reuter <freuter@novell.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 <cppunit/simpleheader.hxx> + + #include <urlobj.hxx> + + namespace tools_urlobj + { + + class urlobjTest : public CppUnit::TestFixture + { + + public: + // initialise your test code values here. + void setUp() + { + } + + void tearDown() + { + } + + // insert your test code here. + // this is only demonstration code + void urlobjTest_001() + { + INetURLObject aUrl(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file://10.10.1.1/sampledir/sample.file"))); + #ifdef LINUX + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("smb://10.10.1.1/sampledir/sample.file")==0); + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_SMB); + #endif + #ifdef WIN + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("file://10.10.1.1/sampledir/sample.file")==0); + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_FILE); + #endif + CPPUNIT_ASSERT(aUrl.GetHost(INetURLObject::NO_DECODE).compareToAscii("10.10.1.1")==0); + CPPUNIT_ASSERT(aUrl.GetURLPath(INetURLObject::NO_DECODE).compareToAscii("/sampledir/sample.file")==0); + CPPUNIT_ASSERT(aUrl.getName().compareToAscii("sample.file")==0); + CPPUNIT_ASSERT(aUrl.getBase().compareToAscii("sample")==0); + CPPUNIT_ASSERT(aUrl.getExtension().compareToAscii("file")==0); + } + + void urlobjTest_002() + { + INetURLObject aUrl; + aUrl.setFSysPath(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\\\\137.65.170.24\\c$\\Img0001.jpg")), INetURLObject::FSYS_DETECT); + #ifdef LINUX + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("smb://137.65.170.24/c$/Img0001.jpg")==0); + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_SMB); + #endif + #ifdef WIN + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("file://137.65.170.24/c$/Img0001.jpg")==0); + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_FILE); + #endif + CPPUNIT_ASSERT(aUrl.GetHost(INetURLObject::NO_DECODE).compareToAscii("137.65.170.24")==0); + CPPUNIT_ASSERT(aUrl.GetURLPath(INetURLObject::NO_DECODE).compareToAscii("/c$/Img0001.jpg")==0); + CPPUNIT_ASSERT(aUrl.getName().compareToAscii("Img0001.jpg")==0); + CPPUNIT_ASSERT(aUrl.getBase().compareToAscii("Img0001")==0); + CPPUNIT_ASSERT(aUrl.getExtension().compareToAscii("jpg")==0); + } + + + void urlobjTest_003() + { + INetURLObject aUrl; + aUrl.setFSysPath(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\\\\hive-winxp-x86\\pmladek\\test2.odt")), INetURLObject::FSYS_DETECT); + #ifdef LINUX + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("smb://hive-winxp-x86/pmladek/test2.odt")==0); + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_SMB); + #endif + #ifdef WIN + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("file://hive-winxp-x86/pmladek/test2.odt")==0); + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_FILE); + #endif + CPPUNIT_ASSERT(aUrl.GetHost(INetURLObject::NO_DECODE).compareToAscii("hive-winxp-x86")==0); + CPPUNIT_ASSERT(aUrl.GetURLPath(INetURLObject::NO_DECODE).compareToAscii("/pmladek/test2.odt")==0); + } + + void urlobjTest_004() + { + INetURLObject aUrl(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("smb://10.10.1.1/sampledir/sample.file"))); + #ifdef LINUX + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("smb://10.10.1.1/sampledir/sample.file")==0); + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_SMB); + #endif + #ifdef WIN + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("file://10.10.1.1/sampledir/sample.file")==0); + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_FILE); + #endif + CPPUNIT_ASSERT(aUrl.GetHost(INetURLObject::NO_DECODE).compareToAscii("10.10.1.1")==0); + CPPUNIT_ASSERT(aUrl.GetURLPath(INetURLObject::NO_DECODE).compareToAscii("/sampledir/sample.file")==0); + CPPUNIT_ASSERT(aUrl.getName().compareToAscii("sample.file")==0); + CPPUNIT_ASSERT(aUrl.getBase().compareToAscii("sample")==0); + CPPUNIT_ASSERT(aUrl.getExtension().compareToAscii("file")==0); + } + + void urlobjTest_005() + { + INetURLObject aUrl; + aUrl.setFSysPath(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("//137.65.170.24/c$/Img0001.jpg")), INetURLObject::FSYS_DETECT); + #ifdef LINUX + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("smb://137.65.170.24/c$/Img0001.jpg")==0); + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_SMB); + #endif + #ifdef WIN + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("file://137.65.170.24/c$/Img0001.jpg")==0); + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_FILE); + #endif + CPPUNIT_ASSERT(aUrl.GetHost(INetURLObject::NO_DECODE).compareToAscii("137.65.170.24")==0); + CPPUNIT_ASSERT(aUrl.GetURLPath(INetURLObject::NO_DECODE).compareToAscii("/c$/Img0001.jpg")==0); + CPPUNIT_ASSERT(aUrl.getName().compareToAscii("Img0001.jpg")==0); + CPPUNIT_ASSERT(aUrl.getBase().compareToAscii("Img0001")==0); + CPPUNIT_ASSERT(aUrl.getExtension().compareToAscii("jpg")==0); + } + + + void urlobjTest_006() + { + INetURLObject aUrl; + aUrl.setFSysPath(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("//hive-winxp-x86/pmladek/test2.odt")), INetURLObject::FSYS_DETECT); + #ifdef LINUX + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("smb://hive-winxp-x86/pmladek/test2.odt")==0); + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_SMB); + #endif + #ifdef WIN + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("file://hive-winxp-x86/pmladek/test2.odt")==0); + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_FILE); + #endif + CPPUNIT_ASSERT(aUrl.GetHost(INetURLObject::NO_DECODE).compareToAscii("hive-winxp-x86")==0); + CPPUNIT_ASSERT(aUrl.GetURLPath(INetURLObject::NO_DECODE).compareToAscii("/pmladek/test2.odt")==0); + } + + + + // Change the following lines only, if you add, remove or rename + // member functions of the current class, + // because these macros are need by auto register mechanism. + + CPPUNIT_TEST_SUITE(urlobjTest); + CPPUNIT_TEST(urlobjTest_001); + CPPUNIT_TEST(urlobjTest_002); + CPPUNIT_TEST(urlobjTest_003); + CPPUNIT_TEST(urlobjTest_004); + CPPUNIT_TEST(urlobjTest_005); + CPPUNIT_TEST(urlobjTest_006); + CPPUNIT_TEST_SUITE_END(); + }; // class createPool + + + CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(tools_urlobj::urlobjTest, "tools_urlobj"); + } // namespace rtl_random + + + // ----------------------------------------------------------------------------- + + // this macro creates an empty function, which will called by the RegisterAllFunctions() + // to let the user the possibility to also register some functions by hand. + NOADDITIONAL; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/qa/version.map b/tools/qa/version.map index 7321bbca16ad..3308588ef6f8 100644 --- a/tools/qa/version.map +++ b/tools/qa/version.map @@ -27,7 +27,7 @@ UDK_3_0_0 { global: - registerAllTestFunction; + cppunitTestPlugIn; local: *; diff --git a/tools/source/communi/geninfo.cxx b/tools/source/communi/geninfo.cxx deleted file mode 100644 index 01a325054a69..000000000000 --- a/tools/source/communi/geninfo.cxx +++ /dev/null @@ -1,408 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_tools.hxx" -#include "tools/geninfo.hxx" -#include <stdio.h> - -// -// class GenericInformation -// - -/*****************************************************************************/ -GenericInformation::GenericInformation( const ByteString &rKey, - const ByteString &rValue, - GenericInformationList *pParentList, - GenericInformationList *pSubInfos ) -/*****************************************************************************/ - : ByteString( rKey ), - sValue( rValue ), - pInfoList( pSubInfos ), - pParent( pParentList ) -{ - // if a ParentList exists, insert this object into it - if ( pParent ) - pParent->InsertInfo( this ); - // make myself owner of pInfoList - if ( pInfoList ) - pInfoList->SetOwner( this ); -} - -/*****************************************************************************/ -GenericInformation::GenericInformation( const GenericInformation& rInf, - sal_Bool bCopySubs) -/*****************************************************************************/ - : ByteString( rInf ), - sValue( rInf.sValue ), - pInfoList( 0L ), - pParent(NULL) -{ - if(bCopySubs && rInf.pInfoList) - pInfoList = new GenericInformationList(*rInf.pInfoList, this); -} - -/*****************************************************************************/ -GenericInformation::~GenericInformation() -/*****************************************************************************/ -{ - // remove pInfoList and all childs out of memory - delete pInfoList; - pInfoList = 0; - - // remove this Info out of ParentList - if ( pParent ) - pParent->RemoveInfo( this ); -} - -/*****************************************************************************/ -sal_Bool GenericInformation::InsertSubInfo( GenericInformation *pInfo ) -/*****************************************************************************/ -{ - return ( pInfoList && pInfoList->InsertInfo( pInfo )); -} - -/*****************************************************************************/ -sal_Bool GenericInformation::InsertSubInfo( const ByteString &rPathKey, const ByteString &rValue, - sal_Bool bSearchByPath, sal_Bool bNewPath ) -/*****************************************************************************/ -{ - return (pInfoList && pInfoList->InsertInfo( rPathKey, rValue, bSearchByPath, bNewPath )); -} - -/*****************************************************************************/ -void GenericInformation::RemoveSubInfo( GenericInformation *pInfo, - sal_Bool bDelete ) -/*****************************************************************************/ -{ - pInfoList->RemoveInfo( pInfo, bDelete ); -} - -/*****************************************************************************/ -//void GenericInformation::RemoveSelf( sal_Bool bDelete ) -/*****************************************************************************/ -/*{ - if ( pParent ) - pParent->RemoveInfo( this, bDelete ); // loescht sich aus der Liste vom Parent und - // bei Bedarf auch mit obiger Methode alle Sublisten - - // loescht sich bei Bedarf auch selbst - if ( bDelete ) - delete this; -} -*/ - -/*****************************************************************************/ -GenericInformation *GenericInformation::GetSubInfo( ByteString &rKey, - sal_Bool bSearchByPath, - sal_Bool bCreatePath ) -/*****************************************************************************/ -{ - if ( !pInfoList && bCreatePath ) - pInfoList = new GenericInformationList( this ); - if ( pInfoList ) - return pInfoList->GetInfo( rKey, bSearchByPath, bCreatePath ); - return NULL; -} - - -// -// class GenericInformationList -// - -/*****************************************************************************/ -GenericInformationList::GenericInformationList( GenericInformation *pParent ) -/*****************************************************************************/ - : pOwner( pParent ) -{ -} - -/*****************************************************************************/ -GenericInformationList::GenericInformationList(const GenericInformationList& rList, - GenericInformation *pParent) -/*****************************************************************************/ - : GenericInformationList_Impl() -{ - sal_uInt16 i; - GenericInformation* pTemp,*pWork; - - pOwner = pParent; - - for(i=0;i<rList.Count();i++) - { - pTemp = rList.GetObject(i); - pWork = new GenericInformation(*pTemp,sal_True); - - Insert(pWork,LIST_APPEND); - } -} - -/*****************************************************************************/ -GenericInformationList::~GenericInformationList() -/*****************************************************************************/ -{ - // delete all Informations stored in this List - // ### GH: Hier werden dann wohl etwa die H�lfte der Eintr�ge gel�scht -/* for ( sal_uIntPtr i = 0; i < Count(); i++ ) { - GetObject( i )->ListDeleted(); - delete GetObject( i ); - Remove( i );*/ - // Neue Variante: - while ( Count() ) { - GetObject( 0 )->ListDeleted(); - delete GetObject( 0 ); - Remove( (sal_uIntPtr)0 ); - } -} - -/*****************************************************************************/ -GenericInformation *GenericInformationList::Search( sal_uIntPtr &rPos, ByteString sKey, - sal_uIntPtr nStart, sal_uIntPtr nEnd ) -/*****************************************************************************/ -{ - if ( Count() == 0 ) { - rPos = 0; - return NULL; - } - - if ( nStart == nEnd ) { - rPos = nStart; - ByteString sCandidate = ByteString( *GetObject( nStart )); - if ( sCandidate.ToUpperAscii() == sKey.ToUpperAscii()) { - return GetObject( nStart ); // found !!! - } - else { - // requested key not found - return NULL; - } - } - - // search binary in existing list - sal_uIntPtr nActPos = nStart + (( nEnd - nStart ) / 2 ); - rPos = nActPos; - ByteString sCandidate = ByteString( *GetObject( nActPos )); - - if ( sCandidate.ToUpperAscii() == sKey.ToUpperAscii()) - return GetObject( nActPos ); // found !!! - - // split the list at ActPos - if ( sCandidate < sKey ) - return Search( rPos, sKey, nActPos + 1, nEnd ); - else - return Search( rPos, sKey, nStart, nActPos ); -} - -/*****************************************************************************/ -GenericInformation *GenericInformationList::GetInfo( ByteString &rKey, - sal_Bool bSearchByPath, - sal_Bool bCreatePath ) -/*****************************************************************************/ -{ - - rKey.EraseLeadingChars( '/' ); - rKey.EraseTrailingChars( '/' ); - - ByteString sKey; - if ( bSearchByPath ) - sKey = rKey.GetToken( 0, '/' ); - else - sKey = rKey; - - sal_uIntPtr nPos = 0; - GenericInformation *pReturnInfo = Search( nPos, sKey, 0, Count() - 1 ); - /* wenn kein Searchpath gesetzt und kein Returninfo vorhanden, - * gib NULL zurueck - * wenn Searchpath gesetzt und returninfo vorhanden, - * suche weiter nach unten - * wenn searchpath gesetzt kein returninfo vorhanden und newpath gesetzt, - * mache neues Verzeichniss - */ - sal_uInt16 nTokenCount = rKey.GetTokenCount('/'); - // search for next key of path in next level of tree - if ( bSearchByPath && (nTokenCount > 1)) { - ByteString sPath = ByteString(rKey.Copy( sKey.Len() + 1 )); - if ( !pReturnInfo ) { // wenn kein Return, dann muss man es anlegen - if ( !bCreatePath ) // wenn aber kein Create, dann nicht anlegen - return NULL; - pReturnInfo = new GenericInformation( sKey, "", this, NULL); - pReturnInfo->SetSubList( new GenericInformationList( pReturnInfo )); - } - return pReturnInfo->GetSubInfo( sPath, sal_True, bCreatePath ); - } - if ( !pReturnInfo && bCreatePath ) { - pReturnInfo = new GenericInformation ( sKey, "", this, NULL); - } - - return pReturnInfo; // kann durchaus NULL sein. -} - -/*****************************************************************************/ -sal_uIntPtr GenericInformationList::InsertSorted( GenericInformation *pInfo, - sal_Bool bOverwrite, - sal_uIntPtr nStart, sal_uIntPtr nEnd ) -/*****************************************************************************/ -{ - if ( Count() == 0 ) { - // empty list, so insert at first pos - Insert( pInfo, LIST_APPEND ); - return 0; - } - - ByteString sKey( pInfo->GetBuffer()); - sKey.ToUpperAscii(); - - // Check to sppeed up reading a (partially) sorted list - if ( nStart == 0 && Count()-1 == nEnd ) - { - ByteString sCandidate( *GetObject( nEnd )); - if ( sCandidate.ToUpperAscii() < sKey ) - { - Insert( pInfo, LIST_APPEND ); - return nEnd+1; - } - } - -// ### GH: dieser Block schein �berfl�ssig zu sein - if ( Count() == 1 ) { - ByteString sCandidate( *GetObject( 0 )); - if ( sCandidate.ToUpperAscii() == sKey ) { - // key allready exists in list - if ( bOverwrite ) - Replace( pInfo, sal_uIntPtr(0)); // ### Laut NF scheint hier ein Memory Leak zu sein - return 0; - } - else if ( sCandidate > sKey ) { - Insert( pInfo, sal_uIntPtr(0)); - return 0; - } - else { - Insert( pInfo, LIST_APPEND ); - return 1; - } - } -// ### GH: /ENDE/ dieser Block schein �berfl�ssig zu sein - - sal_uIntPtr nActPos = nStart + (( nEnd - nStart ) / 2 ); - ByteString sCandidate = ByteString( *GetObject( nActPos )); - - if ( sCandidate.ToUpperAscii() == sKey ) { - // key allready exists in list - if ( bOverwrite ) - Replace( pInfo, nActPos ); // ### Laut NF scheint hier ein Memory Leak zu sein - return nActPos; - } - - if ( nStart == nEnd ) { - // now more ways to search for key -> insert here - if ( sCandidate > sKey ) { - Insert( pInfo, nStart ); - return nStart; - } - else { - Insert( pInfo, nStart + 1 ); - return ( nStart + 1 ); - } - } - - if ( nActPos == Count() - 1 ) { - // reached end of list -> insert here - Insert( pInfo, LIST_APPEND ); - return ( nActPos + 1 ); - } - - ByteString sSecondCand = ByteString( *GetObject( nActPos + 1 )); - if (( sCandidate < sKey ) && ( sSecondCand.ToUpperAscii() > sKey )) { - // optimal position to insert object - Insert( pInfo, nActPos + 1 ); - return ( nActPos + 1 ); - } - - if ( sCandidate < sKey ) - return InsertSorted( pInfo, bOverwrite, nActPos + 1, nEnd ); - else - return InsertSorted( pInfo, bOverwrite, nStart, nActPos ); -} - -/*****************************************************************************/ -sal_Bool GenericInformationList::InsertInfo( GenericInformation *pInfo, - sal_Bool bOverwrite ) -/*****************************************************************************/ -{ - if ( !pInfo->Len()) - return sal_False; - - InsertSorted( pInfo, bOverwrite, 0, Count() - 1 ); - return sal_True; -} - - -/*****************************************************************************/ -sal_Bool GenericInformationList::InsertInfo( const ByteString &rPathKey, const ByteString &rValue, - sal_Bool bSearchByPath, sal_Bool bNewPath ) -/*****************************************************************************/ -{ - GenericInformation *pInfo; - ByteString sPathKey ( rPathKey ); - sPathKey.EraseLeadingChars( '/' ); - sPathKey.EraseTrailingChars( '/' ); - - pInfo = GetInfo( sPathKey, bSearchByPath, bNewPath ); - - if ( pInfo ) { - pInfo->SetValue( rValue ); - return sal_True; - } - return sal_False; -} - -/*****************************************************************************/ -void GenericInformationList::RemoveInfo( GenericInformation *pInfo, - sal_Bool bDelete ) -/*****************************************************************************/ -{ - Remove( pInfo ); - if ( bDelete ) - delete pInfo; -/* if ( Count() == 0 && pOwner ) // Leere Listen entfernen; - { - SetOwner( NULL ); - delete this; - } Rausgepatched by GH */ -} - -GenericInformation* GenericInformationList::SetOwner( GenericInformation *pNewOwner ) -{ - GenericInformation *pOldOwner = pOwner; - if ( pOwner ) // bei parent austragen; - pOwner->SetSubList( NULL ); - if ( pNewOwner ) - pNewOwner->SetSubList( this ); - pOwner = pNewOwner; - return pOldOwner; -} - - diff --git a/tools/source/communi/parser.cxx b/tools/source/communi/parser.cxx deleted file mode 100644 index f3baa37049e2..000000000000 --- a/tools/source/communi/parser.cxx +++ /dev/null @@ -1,469 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_tools.hxx" - -#include <stdio.h> -#include <tools/stream.hxx> -#include <tools/fsys.hxx> - -#include "tools/iparser.hxx" -#include "tools/geninfo.hxx" - - - -// -// class InformationParser -// - -#define cKeyLevelChar '\t' - -/*****************************************************************************/ -InformationParser::InformationParser( sal_Bool bReplace ) -/*****************************************************************************/ - : bRecover( sal_False ), - sOldLine( "" ), - bReplaceVariables( bReplace ), - nLevel( 0 ), - sUPD( "" ), - sVersion( "" ), - pActStream( NULL ), - nErrorCode( 0 ), - nErrorLine( 0 ), - sErrorText( "" ), - nActLine( 0 ) -{ -} - -/*****************************************************************************/ -InformationParser::~InformationParser() -/*****************************************************************************/ -{ -} - -/*****************************************************************************/ -ByteString &InformationParser::ReadLine() -/*****************************************************************************/ -{ - ByteString sLine; - - if ( bRecover ) { - bRecover = sal_False; - } - else { - if ( !pActStream->IsEof()) { - pActStream->ReadLine( sLine ); - xub_StrLen nStart = 0; - xub_StrLen nEnd = sLine.Len(); - sal_Bool bCopy = sal_False; - while ( nStart < nEnd && ( sLine.GetChar( nStart ) == ' ' || sLine.GetChar( nStart ) == 0x09 ) ) - { - nStart++; - bCopy = sal_True; - } - - while ( nStart < nEnd && ( sLine.GetChar( nEnd-1 ) == ' ' || sLine.GetChar( nEnd-1 ) == 0x09 ) ) - { - nEnd--; - bCopy = sal_True; - } - - if ( bCopy ) - sLine = sLine.Copy( nStart, nEnd - nStart ); - - if (( sLine.GetChar( 0 ) == '#' ) || ( !sLine.Len())) { - if ( sCurrentComment.Len()) - sCurrentComment += "\n"; - sCurrentComment += sLine; - return ReadLine(); - } - else { - if ( bReplaceVariables ) { - sLine.SearchAndReplaceAll( "%UPD", sUPD ); - sLine.SearchAndReplaceAll( "%VERSION", sVersion ); - } - } - } - else { - if ( nLevel ) { - sLine = "}"; - fprintf( stdout, "Reached EOF parsing %s. Suplying extra '}'\n",ByteString( sStreamName, gsl_getSystemTextEncoding()).GetBuffer() ); - // nErrorCode = IP_UNEXPECTED_EOF; - // nErrorLine = nActLine; - } - else - sLine = ""; - } - - sOldLine = sLine; - nActLine++; - } - - return sOldLine; -} - -/*****************************************************************************/ -GenericInformation *InformationParser::ReadKey( - GenericInformationList *pExistingList ) -/*****************************************************************************/ -{ - // this method has no error handling yet, but it works very fast. - // it is used to create whole informations and sub informations in - // a simple data format in memory, readed in a configuration file with - // following format: - - /* - - key [value] - { - key [value] - key [value] - { - key [value] - ... - ... - } - } - key [value] - ... - ... - - */ - - GenericInformation *pInfo = NULL; - - ByteString sLine( ReadLine()); - ByteString sKey; - ByteString sValue; - ByteString sComment( sCurrentComment ); - sCurrentComment = ""; - - // key separated from value by tab? - sal_uInt16 nWSPos = sLine.Search( ' ' ); - if ( sLine.Search( '\t' ) < nWSPos ) { - nWSPos = sLine.Search( '\t' ); - sLine.SearchAndReplace( "\t", " " ); - } - - if ( sLine.GetTokenCount( ' ' ) > 1 ) { - sKey = sLine.GetToken( 0, ' ' ); - sValue = sLine.Copy( sKey.Len() + 1 ); - while (( sValue.Search( ' ' ) == 0 ) || ( sValue.Search( '\t' ) == 0 )) { - sValue.Erase( 0, 1 ); - } - } - else - sKey=sLine; - - if ( bReplaceVariables && !nLevel ) { - sUPD = sKey.Copy( sKey.Len() - 3 ); - sVersion = sKey; - } - - if ( ReadLine() == "{" ) { - nLevel++; - GenericInformationList *pSubList = new GenericInformationList(); - while ( ReadLine() != "}" ) { - Recover(); - ReadKey( pSubList ); - } - nLevel--; - pInfo = new GenericInformation( sKey, sValue, - pExistingList, pSubList ); - pInfo->SetComment( sComment ); - } - else { - Recover(); - if ( !sKey.Equals( "}" ) && !sKey.Equals( "{" ) ) - { - pInfo = new GenericInformation( sKey, sValue, pExistingList ); - pInfo->SetComment( sComment ); - } - } - - return pInfo; -} - -/*****************************************************************************/ -void InformationParser::Recover() -/*****************************************************************************/ -{ - bRecover = sal_True; -} - -/*****************************************************************************/ -sal_Bool InformationParser::Save( SvStream &rOutStream, - const GenericInformationList *pSaveList, - sal_uInt16 level, sal_Bool bStripped ) -/*****************************************************************************/ -{ - sal_uInt16 i; - sal_uIntPtr nInfoListCount; - ByteString sTmpStr; - GenericInformation *pGenericInfo; - GenericInformationList *pGenericInfoList; - - static ByteString aKeyLevel; - aKeyLevel.Expand( level, cKeyLevelChar ); - - for ( nInfoListCount = 0; nInfoListCount < pSaveList->Count(); nInfoListCount++) { - // Key-Value Paare schreiben - pGenericInfo = pSaveList->GetObject( nInfoListCount ); - sTmpStr = ""; - if ( !bStripped && level ) - sTmpStr.Append( aKeyLevel.GetBuffer(), level ); - - if ( !bStripped ) - for ( i = 0; i < pGenericInfo->GetComment().GetTokenCount( '\n' ); i++ ) { - sTmpStr += pGenericInfo->GetComment().GetToken( i, '\n' ); - sTmpStr += "\n"; - if ( level ) - sTmpStr.Append( aKeyLevel.GetBuffer(), level ); - } - - sTmpStr += pGenericInfo->GetBuffer(); - sTmpStr += ' '; - sTmpStr += pGenericInfo->GetValue(); - if ( !rOutStream.WriteLine( sTmpStr ) ) - return sal_False; - - // wenn vorhanden, bearbeite recursive die Sublisten - if (( pGenericInfoList = pGenericInfo->GetSubList() ) != NULL ) { - // oeffnende Klammer - sTmpStr = ""; - if ( !bStripped && level ) - sTmpStr.Append( aKeyLevel.GetBuffer(), level ); - sTmpStr += '{'; - if ( !rOutStream.WriteLine( sTmpStr ) ) - return sal_False; - // recursiv die sublist abarbeiten - if ( !Save( rOutStream, pGenericInfoList, level+1, bStripped ) ) - return sal_False; - // schliessende Klammer - sTmpStr = ""; - if ( !bStripped && level ) - sTmpStr.Append( aKeyLevel.GetBuffer(), level ); - sTmpStr += '}'; - if ( !rOutStream.WriteLine( sTmpStr ) ) - return sal_False; - } - } - return sal_True; -} - -/*****************************************************************************/ -GenericInformationList *InformationParser::Execute( - SvStream &rSourceStream, - GenericInformationList *pExistingList ) -/*****************************************************************************/ -{ - GenericInformationList *pList; - if ( pExistingList ) - pList = pExistingList; - else - pList = new GenericInformationList(); - - pActStream = &rSourceStream; - - // read all infos out of current file - while( !rSourceStream.IsEof()) { - nLevel = 0; - ReadKey( pList ); - } - - return pList; -} - -/*****************************************************************************/ -GenericInformationList *InformationParser::Execute( SvMemoryStream &rSourceStream, - GenericInformationList *pExistingList ) -/*****************************************************************************/ -{ - sStreamName = UniString( "Memory", gsl_getSystemTextEncoding()); - return Execute( (SvStream &)rSourceStream, pExistingList ); -} - -/*****************************************************************************/ -GenericInformationList *InformationParser::Execute( - SvFileStream &rSourceStream, - GenericInformationList *pExistingList ) -/*****************************************************************************/ -{ - if ( !rSourceStream.IsOpen()) - return NULL; - sStreamName = rSourceStream.GetFileName(); - return Execute( (SvStream &)rSourceStream, pExistingList ); -} - -/*****************************************************************************/ -GenericInformationList *InformationParser::Execute( UniString &rSourceFile, - GenericInformationList *pExistingList ) -/*****************************************************************************/ -{ - DirEntry aDirEntry( rSourceFile ); - if ( !aDirEntry.Exists()) - return NULL; - - GenericInformationList *pList; - if ( pExistingList ) - pList = pExistingList; - else - pList = new GenericInformationList(); - - // reset status - nErrorCode = 0; - nErrorLine = 0; - nActLine = 0; - - SvFileStream aActStream; - aActStream.Open( rSourceFile, STREAM_READ ); - if( aActStream.GetError()) - return NULL; - - pActStream = &aActStream; - if ( !Execute( aActStream, pList )) { - delete pList; - pList = NULL; - } - - // close the stream - aActStream.Close(); - pActStream = NULL; - - if ( !nErrorCode ) - return pList; - - return NULL; -} - -/*****************************************************************************/ -GenericInformationList *InformationParser::Execute( Dir &rDir, - GenericInformationList *pExistingList ) -/*****************************************************************************/ -{ - GenericInformationList *pList; - - if ( pExistingList ) - pList = pExistingList; - else - pList = new GenericInformationList(); - - for ( sal_uInt16 i = 0; i < rDir.Count(); i++ ) { - - // execute this dir - UniString sNextFile( rDir[i].GetFull()); - GenericInformationList *pSubList = Execute( sNextFile ); - - if ( !pSubList ) { - // any errors ? - delete pList; - return NULL; - } - - // create new info and insert it into list - ByteString sFileKey( rDir[i].GetName(), RTL_TEXTENCODING_UTF8 ); - new GenericInformation( - sFileKey, - ByteString( "" ), - pList, pSubList ); - } - - return pList; -} - -/*****************************************************************************/ -sal_Bool InformationParser::Save( SvFileStream &rSourceStream, - const GenericInformationList *pSaveList ) -/*****************************************************************************/ -{ - if ( !rSourceStream.IsOpen() || !Save( (SvStream &)rSourceStream, pSaveList, 0, sal_False )) - { - printf( "ERROR saving file \"%s\"\n",ByteString( rSourceStream.GetFileName(), gsl_getSystemTextEncoding()).GetBuffer() ); - return sal_False; - } - - return sal_True; -} - -/*****************************************************************************/ -sal_Bool InformationParser::Save( SvMemoryStream &rSourceStream, - const GenericInformationList *pSaveList ) -/*****************************************************************************/ -{ - Time a; - sal_Bool bRet = Save( (SvStream &)rSourceStream, pSaveList, 0, sal_True ); - Time b; - b = b - a; - return bRet; -} - -/*****************************************************************************/ -sal_Bool InformationParser::Save( const UniString &rSourceFile, - const GenericInformationList *pSaveList ) -/*****************************************************************************/ -{ - SvFileStream *pOutFile = new SvFileStream( rSourceFile, STREAM_STD_WRITE | STREAM_TRUNC ); - - if ( !Save( *pOutFile, pSaveList )) { - delete pOutFile; - return sal_False; - } - delete pOutFile; - return sal_True; -} - -/*****************************************************************************/ -sal_uInt16 InformationParser::GetErrorCode() -/*****************************************************************************/ -{ - return nErrorCode; -} - -/*****************************************************************************/ -ByteString &InformationParser::GetErrorText() -/*****************************************************************************/ -{ - // sErrorText = pActStream->GetFileName(); - sErrorText = ByteString( sStreamName, gsl_getSystemTextEncoding()); - sErrorText += ByteString( " (" ); - sErrorText += ByteString::CreateFromInt64(nErrorLine); - sErrorText += ByteString( "): " ); - - switch ( nErrorCode ) { - case IP_NO_ERROR: - sErrorText += ByteString( "Keine Fehler aufgetereten" ); - break; - case IP_UNEXPECTED_EOF: - sErrorText += ByteString( "Ungltiges Dateiende!" ); - break; - } - - return sErrorText; -} - - diff --git a/tools/source/datetime/datetime.cxx b/tools/source/datetime/datetime.cxx index ffdbd25789ac..05d25edd91b9 100644 --- a/tools/source/datetime/datetime.cxx +++ b/tools/source/datetime/datetime.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,10 +36,6 @@ |* |* DateTime::IsBetween() |* -|* Beschreibung DATETIME.SDW -|* Ersterstellung TH 18.05.92 -|* Letzte Aenderung TH 18.05.92 -|* *************************************************************************/ sal_Bool DateTime::IsBetween( const DateTime& rFrom, @@ -54,10 +51,6 @@ sal_Bool DateTime::IsBetween( const DateTime& rFrom, |* |* DateTime::operator >() |* -|* Beschreibung DATETIME.SDW -|* Ersterstellung TH 18.05.92 -|* Letzte Aenderung TH 18.05.92 -|* *************************************************************************/ sal_Bool DateTime::operator >( const DateTime& rDateTime ) const @@ -73,10 +66,6 @@ sal_Bool DateTime::operator >( const DateTime& rDateTime ) const |* |* DateTime::operator <() |* -|* Beschreibung DATETIME.SDW -|* Ersterstellung TH 18.05.92 -|* Letzte Aenderung TH 18.05.92 -|* *************************************************************************/ sal_Bool DateTime::operator <( const DateTime& rDateTime ) const @@ -92,10 +81,6 @@ sal_Bool DateTime::operator <( const DateTime& rDateTime ) const |* |* DateTime::operator >=() |* -|* Beschreibung DATETIME.SDW -|* Ersterstellung TH 18.05.92 -|* Letzte Aenderung TH 18.05.92 -|* *************************************************************************/ sal_Bool DateTime::operator >=( const DateTime& rDateTime ) const @@ -111,10 +96,6 @@ sal_Bool DateTime::operator >=( const DateTime& rDateTime ) const |* |* DateTime::operator <=() |* -|* Beschreibung DATETIME.SDW -|* Ersterstellung TH 18.05.92 -|* Letzte Aenderung TH 18.05.92 -|* *************************************************************************/ sal_Bool DateTime::operator <=( const DateTime& rDateTime ) const @@ -130,10 +111,6 @@ sal_Bool DateTime::operator <=( const DateTime& rDateTime ) const |* |* DateTime::GetSecFromDateTime() |* -|* Beschreibung DATETIME.SDW -|* Ersterstellung TH 02.10.96 -|* Letzte Aenderung TH 02.10.96 -|* *************************************************************************/ long DateTime::GetSecFromDateTime( const Date& rDate ) const @@ -155,10 +132,6 @@ long DateTime::GetSecFromDateTime( const Date& rDate ) const |* |* DateTime::GetSecFromDateTime() |* -|* Beschreibung DATETIME.SDW -|* Ersterstellung TH 02.10.96 -|* Letzte Aenderung TH 02.10.96 -|* *************************************************************************/ void DateTime::MakeDateTimeFromSec( const Date& rDate, sal_uIntPtr nSec ) @@ -176,10 +149,6 @@ void DateTime::MakeDateTimeFromSec( const Date& rDate, sal_uIntPtr nSec ) |* |* DateTime::operator +=() |* -|* Beschreibung DATETIME.SDW -|* Ersterstellung TH 02.10.96 -|* Letzte Aenderung TH 02.10.96 -|* *************************************************************************/ DateTime& DateTime::operator +=( const Time& rTime ) @@ -215,10 +184,6 @@ DateTime& DateTime::operator +=( const Time& rTime ) |* |* DateTime::operator -=() |* -|* Beschreibung DATETIME.SDW -|* Ersterstellung TH 02.10.96 -|* Letzte Aenderung TH 02.10.96 -|* *************************************************************************/ DateTime& DateTime::operator -=( const Time& rTime ) @@ -254,10 +219,6 @@ DateTime& DateTime::operator -=( const Time& rTime ) |* |* DateTime::operator+() |* -|* Beschreibung DATETIME.SDW -|* Ersterstellung TH 02.10.96 -|* Letzte Aenderung TH 02.10.96 -|* *************************************************************************/ DateTime operator +( const DateTime& rDateTime, long nDays ) @@ -271,10 +232,6 @@ DateTime operator +( const DateTime& rDateTime, long nDays ) |* |* DateTime::operator-() |* -|* Beschreibung DATETIME.SDW -|* Ersterstellung TH 02.10.96 -|* Letzte Aenderung TH 02.10.96 -|* *************************************************************************/ DateTime operator -( const DateTime& rDateTime, long nDays ) @@ -288,10 +245,6 @@ DateTime operator -( const DateTime& rDateTime, long nDays ) |* |* DateTime::operator+() |* -|* Beschreibung DATETIME.SDW -|* Ersterstellung TH 02.10.96 -|* Letzte Aenderung TH 02.10.96 -|* *************************************************************************/ DateTime operator +( const DateTime& rDateTime, const Time& rTime ) @@ -305,10 +258,6 @@ DateTime operator +( const DateTime& rDateTime, const Time& rTime ) |* |* DateTime::operator-() |* -|* Beschreibung DATETIME.SDW -|* Ersterstellung TH 02.10.96 -|* Letzte Aenderung TH 02.10.96 -|* *************************************************************************/ DateTime operator -( const DateTime& rDateTime, const Time& rTime ) @@ -440,3 +389,5 @@ DateTime DateTime::CreateFromWin32FileDateTime( const sal_uInt32 & rLower, const return DateTime( _aDate, _aTime ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx index 2a3c36daf9ed..66adb081b04d 100644 --- a/tools/source/datetime/tdate.cxx +++ b/tools/source/datetime/tdate.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,17 +29,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_tools.hxx" -#if defined( OS2 ) -#define INCL_DOSDATETIME -#include <svpm.h> -#elif defined( WNT ) -#ifdef _MSC_VER -#pragma warning (push,1) -#endif -#include <tools/svwin.h> -#ifdef _MSC_VER -#pragma warning (pop) -#endif +#if defined( WNT ) +#include <windows.h> #else #include <time.h> #endif @@ -145,15 +137,7 @@ static void DaysToDate( long nDays, Date::Date() { -#if defined( OS2 ) - DATETIME aDateTime; - DosGetDateTime( &aDateTime ); - - // Datum zusammenbauen - nDate = ((sal_uIntPtr)aDateTime.day) + - (((sal_uIntPtr)aDateTime.month)*100) + - (((sal_uIntPtr)aDateTime.year)*10000); -#elif defined WNT +#if defined WNT SYSTEMTIME aDateTime; GetLocalTime( &aDateTime ); @@ -492,3 +476,5 @@ long operator -( const Date& rDate1, const Date& rDate2 ) rDate2.GetYear() ); return nTempDays1 - nTempDays2; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/datetime/ttime.cxx b/tools/source/datetime/ttime.cxx index fee1c159df44..43e1b65c82b6 100644 --- a/tools/source/datetime/ttime.cxx +++ b/tools/source/datetime/ttime.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,18 +31,8 @@ #define _TOOLS_TIME_CXX -#if defined( OS2 ) -#define INCL_DOSMISC -#define INCL_DOSDATETIME -#include <svpm.h> -#elif defined( WNT ) -#ifdef _MSC_VER -#pragma warning (push,1) -#endif -#include <tools/svwin.h> -#ifdef _MSC_VER -#pragma warning (pop) -#endif +#if defined( WNT ) +#include <windows.h> #elif defined UNX #include <unistd.h> #include <limits.h> @@ -99,16 +90,7 @@ static Time Sec100ToTime( sal_Int32 nSec100 ) Time::Time() { -#if defined( OS2 ) - DATETIME aDateTime; - DosGetDateTime( &aDateTime ); - - // Zeit zusammenbauen - nTime = (((sal_Int32)aDateTime.hours)*1000000) + - (((sal_Int32)aDateTime.minutes)*10000) + - (((sal_Int32)aDateTime.seconds)*100) + - ((sal_Int32)aDateTime.hundredths); -#elif defined( WNT ) +#if defined( WNT ) SYSTEMTIME aDateTime; GetLocalTime( &aDateTime ); @@ -318,23 +300,7 @@ sal_Bool Time::IsEqualIgnore100Sec( const Time& rTime ) const Time Time::GetUTCOffset() { -#if defined( OS2 ) -#undef timezone - DATETIME aDateTime; - DosGetDateTime( &aDateTime ); - - // Zeit zusammenbauen - if ( aDateTime.timezone != -1 ) - { - short nTempTime = (short)Abs( aDateTime.timezone ); - Time aTime( 0, (sal_uInt16)nTempTime ); - if ( aDateTime.timezone > 0 ) - aTime = -aTime; - return aTime; - } - else - return Time( 0 ); -#elif defined( WNT ) +#if defined( WNT ) TIME_ZONE_INFORMATION aTimeZone; aTimeZone.Bias = 0; DWORD nTimeZoneRet = GetTimeZoneInformation( &aTimeZone ); @@ -396,10 +362,6 @@ sal_uIntPtr Time::GetSystemTicks() { #if defined WNT return (sal_uIntPtr)GetTickCount(); -#elif defined( OS2 ) - sal_uIntPtr nClock; - DosQuerySysInfo( QSV_MS_COUNT, QSV_MS_COUNT, &nClock, sizeof( nClock ) ); - return (sal_uIntPtr)nClock; #else timeval tv; gettimeofday (&tv, 0); @@ -419,10 +381,6 @@ sal_uIntPtr Time::GetProcessTicks() { #if defined WNT return (sal_uIntPtr)GetTickCount(); -#elif defined( OS2 ) - sal_uIntPtr nClock; - DosQuerySysInfo( QSV_MS_COUNT, QSV_MS_COUNT, &nClock, sizeof( nClock ) ); - return (sal_uIntPtr)nClock; #else static sal_uIntPtr nImplTicksPerSecond = 0; static double dImplTicksPerSecond; @@ -443,3 +401,5 @@ sal_uIntPtr Time::GetProcessTicks() return (sal_uIntPtr)fTicks; #endif } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx index bbde4efe6d9e..b2b6367ca734 100644 --- a/tools/source/debug/debug.cxx +++ b/tools/source/debug/debug.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,32 +37,20 @@ #include <direct.h> #endif +#include <errno.h> #include <time.h> #include <cstdarg> // combinations #include <stdlib.h> #include <string.h> #include <stdio.h> -#ifdef OS2 -#define INCL_DOSSEMAPHORES -#define INCL_DOSMISC -#define INCL_WINDIALOGS -#define INCL_WINSHELLDATA -#include <svpm.h> -#endif - #if defined ( WNT ) -#ifdef _MSC_VER -#pragma warning (push,1) -#endif -#include <tools/svwin.h> -#ifdef _MSC_VER -#pragma warning (pop) -#endif +#include <windows.h> #endif #include <tools/debug.hxx> #include <rtl/string.h> +#include <sal/macros.h> #include <vector> @@ -178,7 +167,11 @@ struct DebugData aDbgData.bOverwrite = sal_True; aDbgData.nTraceOut = DBG_OUT_NULL; aDbgData.nWarningOut = DBG_OUT_NULL; +#ifdef UNX + aDbgData.nErrorOut = DBG_OUT_SHELL; +#else aDbgData.nErrorOut = DBG_OUT_MSGBOX; +#endif aDbgData.bMemInit = 0x77; aDbgData.bMemBound = 0x55; aDbgData.bMemFree = 0x33; @@ -209,8 +202,6 @@ static int bDbgImplInMain = sal_False; #if defined( WNT ) static CRITICAL_SECTION aImplCritDbgSection; -#elif defined( OS2 ) -static HMTX hImplCritDbgSection = 0; #endif static sal_Bool bImplCritDbgSectionInit = sal_False; @@ -220,8 +211,6 @@ void ImplDbgInitLock() { #if defined( WNT ) InitializeCriticalSection( &aImplCritDbgSection ); -#elif defined( OS2 ) - DosCreateMutexSem( NULL, &hImplCritDbgSection, 0, sal_False ); #endif bImplCritDbgSectionInit = sal_True; } @@ -232,8 +221,6 @@ void ImplDbgDeInitLock() { #if defined( WNT ) DeleteCriticalSection( &aImplCritDbgSection ); -#elif defined( OS2 ) - DosCloseMutexSem( hImplCritDbgSection ); #endif bImplCritDbgSectionInit = sal_False; } @@ -247,8 +234,6 @@ void ImplDbgLock() #if defined( WNT ) EnterCriticalSection( &aImplCritDbgSection ); -#elif defined( OS2 ) - DosRequestMutexSem( hImplCritDbgSection, SEM_INDEFINITE_WAIT ); #endif } @@ -261,14 +246,12 @@ void ImplDbgUnlock() #if defined( WNT ) LeaveCriticalSection( &aImplCritDbgSection ); -#elif defined( OS2 ) - DosReleaseMutexSem( hImplCritDbgSection ); #endif } // ======================================================================= -#if (defined WNT || defined OS2) && !defined SVX_LIGHT +#if defined WNT //#define SV_MEMMGR // #endif #ifdef SV_MEMMGR @@ -315,10 +298,6 @@ static sal_uIntPtr ImplGetPerfTime() { #if defined( WNT ) return (sal_uIntPtr)GetTickCount(); -#elif defined( OS2 ) - sal_uIntPtr nClock; - DosQuerySysInfo( QSV_MS_COUNT, QSV_MS_COUNT, &nClock, sizeof( nClock ) ); - return (sal_uIntPtr)nClock; #else static sal_uIntPtr nImplTicksPerSecond = 0; static double dImplTicksPerSecond; @@ -481,7 +460,7 @@ namespace { "dev/null", "file", "window", "shell", "messagebox", "testtool", "debugger", "abort" }; - for ( sal_uIntPtr name = 0; name < sizeof( names ) / sizeof( names[0] ); ++name ) + for ( size_t name = 0; name < SAL_N_ELEMENTS( names ); ++name ) { if ( strcmp( i_buffer, names[ name ] ) == 0 ) { @@ -502,10 +481,12 @@ namespace sal_Char aBuf[2]; size_t nValueLen = lcl_tryReadConfigString( _pLine, _nLineLen, _pKeyName, aBuf, sizeof( aBuf ) ); if ( nValueLen ) + { if ( strcmp( aBuf, "1" ) == 0 ) *_out_pnAllFlags |= _nCheckFlag; else *_out_pnAllFlags &= ~_nCheckFlag; + } } void lcl_tryReadHexByte( const sal_Char* _pLine, size_t _nLineLen, const sal_Char* _pKeyName, sal_uInt8* _out_pnValue ) { @@ -680,9 +661,6 @@ static void DbgGetDbgFileName( sal_Char* pStr, sal_Int32 nMaxLen ) strncpy( pStr, pName, nMaxLen ); else GetProfileStringA( "sv", "dbgsv", "dbgsv.ini", pStr, nMaxLen ); -#elif defined( OS2 ) - PrfQueryProfileString( HINI_PROFILE, (PSZ)"SV", (PSZ)"DBGSV", - "dbgsv.ini", (PSZ)pStr, nMaxLen ); #else strncpy( pStr, "dbgsv.ini", nMaxLen ); #endif @@ -704,9 +682,6 @@ static void DbgGetLogFileName( sal_Char* pStr ) strcpy( pStr, pName ); else GetProfileStringA( "sv", "dbgsvlog", "dbgsv.log", pStr, 200 ); -#elif defined( OS2 ) - PrfQueryProfileString( HINI_PROFILE, (PSZ)"SV", (PSZ)"DBGSVLOG", - "dbgsv.log", (PSZ)pStr, 200 ); #else strcpy( pStr, "dbgsv.log" ); #endif @@ -718,8 +693,6 @@ static void DbgDebugBeep() { #if defined( WNT ) MessageBeep( MB_ICONHAND ); -#elif defined( OS2 ) - WinAlarm( HWND_DESKTOP, WA_ERROR ); #endif } @@ -825,7 +798,11 @@ static DebugData* GetDebugData() } - getcwd( aCurPath, sizeof( aCurPath ) ); + sal_Char* getcwdResult = getcwd( aCurPath, sizeof( aCurPath ) ); + if ( !getcwdResult ) + { + OSL_TRACE( "getcwd failed with error %s", strerror(errno) ); + } // Daten initialisieren if ( aDebugData.aDbgData.nTestFlags & DBG_TEST_XTOR ) @@ -854,8 +831,17 @@ static FILETYPE ImplDbgInitFile() static sal_Bool bFileInit = sal_False; sal_Char aBuf[4096]; - getcwd( aBuf, sizeof( aBuf ) ); - chdir( aCurPath ); + sal_Char* getcwdResult = getcwd( aBuf, sizeof( aBuf ) ); + if ( !getcwdResult ) { + OSL_TRACE( "getcwd failed with error = %s", strerror(errno) ); + return NULL; + } + + int chdirResult = chdir( aCurPath ); + if ( !chdirResult ) { + OSL_TRACE ( "chdir failed with error = %s", strerror(errno) ); + return NULL; + } DebugData* pData = GetDebugData(); FILETYPE pDebugFile; @@ -890,7 +876,11 @@ static FILETYPE ImplDbgInitFile() else pDebugFile = FileOpen( pData->aDbgData.aDebugName, "a" ); - chdir( aBuf ); + chdirResult = chdir( aBuf ); + if ( !chdirResult ) + { + OSL_TRACE( "chdir failed with error = %s", strerror(errno) ); + } return pDebugFile; } @@ -1681,7 +1671,7 @@ void DbgOut( const sal_Char* pMsg, sal_uInt16 nDbgOut, const sal_Char* pFile, sa int nMsgLen = strlen( pMsg ); if ( nBufLen+nMsgLen > DBG_BUF_MAXLEN ) { - int nCopyLen = DBG_BUF_MAXLEN-nBufLen-3; + int nCopyLen = DBG_BUF_MAXLEN-nBufLen-4; strncpy( &(aBufOut[nBufLen]), pMsg, nCopyLen ); strcpy( &(aBufOut[nBufLen+nCopyLen]), "..." ); } @@ -1824,3 +1814,5 @@ void DbgOutTypef( sal_uInt16, const sal_Char*, ... ) {} void DbgOutf( const sal_Char*, ... ) {} #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/debug/stcktree.cxx b/tools/source/debug/stcktree.cxx index 34cda7e81119..d2dcbc5fb7a8 100644 --- a/tools/source/debug/stcktree.cxx +++ b/tools/source/debug/stcktree.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -318,3 +319,5 @@ void DbgFreeStackTree( void*, sal_uIntPtr ) {} void DbgPrintStackTree( void* ) {} #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/fsys/comdep.cxx b/tools/source/fsys/comdep.cxx index fa1009ad5fd3..3461b46c9316 100644 --- a/tools/source/fsys/comdep.cxx +++ b/tools/source/fsys/comdep.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,6 @@ #include "comdep.hxx" #include <tools/debug.hxx> -#include <tools/list.hxx> #include <tools/fsys.hxx> DBG_NAMEEX( DirEntry ) @@ -39,6 +39,6 @@ DBG_NAMEEX( DirEntry ) #include "unx.cxx" #elif defined WNT #include "wntmsc.cxx" -#elif defined OS2 -#include "os2.cxx" #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/fsys/comdep.hxx b/tools/source/fsys/comdep.hxx index cd6f8db2cd57..e528d3b6fdfd 100755..100644 --- a/tools/source/fsys/comdep.hxx +++ b/tools/source/fsys/comdep.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,29 +31,19 @@ #include <tools/fsys.hxx> -#define ACCESSDELIM(e) ( (e == FSYS_STYLE_MAC) ? ":" : \ - ( ( e == FSYS_STYLE_VFAT || e == FSYS_STYLE_HPFS || \ - e == FSYS_STYLE_FAT ) || e == FSYS_STYLE_NTFS ) \ - ? "\\" : "/" ) +#define ACCESSDELIM(e) ( ( e == FSYS_STYLE_NTFS ) ? "\\" : "/" ) #define ACCESSDELIM_C(e)(char)\ - ( (e == FSYS_STYLE_MAC) ? ':' : \ - ( ( e == FSYS_STYLE_VFAT || e == FSYS_STYLE_HPFS || \ - e == FSYS_STYLE_FAT ) || e == FSYS_STYLE_NTFS ) \ - ? '\\' : '/' ) -#define SEARCHDELIM(e) ( (e == FSYS_STYLE_SYSV || e == FSYS_STYLE_BSD) ? ":" \ - : ";" ) + ( ( e == FSYS_STYLE_NTFS ) ? '\\' : '/' ) +#define SEARCHDELIM(e) ( (e == FSYS_STYLE_BSD) ? ":" : ";" ) #define SEARCHDELIM_C(e)(char)\ - ( (e == FSYS_STYLE_SYSV || e == FSYS_STYLE_BSD) ? ':' \ - : ';' ) -#define ACTPARENT(e) ( (e == FSYS_STYLE_MAC) ? ":" : ".." ) -#define ACTCURRENT(e) ( (e == FSYS_STYLE_MAC) ? "" : "." ) + ( (e == FSYS_STYLE_BSD) ? ':' : ';' ) +#define ACTPARENT(e) ".." +#define ACTCURRENT(e) "." #if defined UNX #include "unx.hxx" #elif defined WNT #include "wntmsc.hxx" -#elif defined OS2 -#include "os2.hxx" #endif //-------------------------------------------------------------------- @@ -92,7 +83,7 @@ struct DirReader_Impl // nur den String der Memer-Var nehmen! -#if defined(UNX) || defined(OS2) //for further exlpanation see DirReader_Impl::Read() in unx.cxx +#if defined(UNX) //for further eplanation see DirReader_Impl::Read() in unx.cxx pDosDir = NULL; #else aBypass = ByteString(aPath, osl_getThreadTextEncoding()); @@ -144,7 +135,7 @@ struct FileCopier_Impl //-------------------------------------------------------------------- -#if defined WNT || defined OS2 +#if defined WNT sal_Bool IsRedirectable_Impl( const ByteString &rPath ); #else #define IsRedirectable_Impl( rPath ) sal_True @@ -154,3 +145,5 @@ sal_Bool IsRedirectable_Impl( const ByteString &rPath ); #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/fsys/dirent.cxx b/tools/source/fsys/dirent.cxx index 0c9e45cb72f2..a188569868e1 100755..100644 --- a/tools/source/fsys/dirent.cxx +++ b/tools/source/fsys/dirent.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,13 +29,16 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_tools.hxx" - #if !defined UNX +#ifdef WNT +#include <windows.h> +#undef GetObject +#endif #include <io.h> #include <process.h> #endif -#if defined(UNX) || defined(OS2) +#if defined(UNX) #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> @@ -46,7 +50,6 @@ #include <stdio.h> #include <string.h> #include <tools/debug.hxx> -#include <tools/list.hxx> #include "comdep.hxx" #include <tools/fsys.hxx> #define _TOOLS_HXX @@ -57,16 +60,15 @@ #endif #include <tools/stream.hxx> -#ifndef _VOS_MUTEX_HXX -#include <vos/mutex.hxx> -#endif +#include <osl/mutex.hxx> #include <osl/file.hxx> #include <rtl/instance.hxx> using namespace osl; -using namespace rtl; + +using ::rtl::OUString; int ApiRet2ToSolarError_Impl( int nApiRet ); @@ -121,7 +123,7 @@ int Sys2SolarError_Impl( int nSysErr ) #endif } - DBG_TRACE1( "FSys: unknown system error %d occured", nSysErr ); + OSL_TRACE( "FSys: unknown system error %d occurred", nSysErr ); return FSYS_ERR_UNKNOWN; } @@ -136,13 +138,13 @@ sal_Bool bInRedirection = sal_True; #else sal_Bool bInRedirection = sal_False; #endif -static vos:: OMutex * pRedirectMutex = 0; +static osl::Mutex* pRedirectMutex = 0; //------------------------------------------------------------------------ void FSysRedirector::Register( FSysRedirector *pRedirector ) { if ( pRedirector ) - pRedirectMutex = new vos:: OMutex ; + pRedirectMutex = new osl::Mutex; else DELETEZ( pRedirectMutex ); _pRedirector = pRedirector; @@ -165,7 +167,7 @@ void FSysRedirector::DoRedirect( String &rPath ) // Redirection is acessible only by one thread per time // dont move the guard behind the bInRedirection check!!! // think of nested calls (when called from callback) - vos:: OGuard aGuard( pRedirectMutex ); + osl::MutexGuard aGuard( pRedirectMutex ); // if already in redirection, dont redirect if ( bInRedirection ) @@ -243,10 +245,6 @@ DBG_NAME( DirEntry ); |* |* DirEntry::~DirEntryStack() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MI 04.07.91 -|* *************************************************************************/ DirEntryStack::~DirEntryStack() @@ -262,8 +260,6 @@ DirEntryStack::~DirEntryStack() |* Beschreibung Pruefung eines DirEntry fuer DBG_UTIL |* Parameter void* p Zeiger auf den DirEntry |* Return-Wert char* Fehlermeldungs-TExtension oder NULL -|* Ersterstellung MI 16.07.91 -|* Letzte Aenderung MI 26.05.93 |* *************************************************************************/ @@ -284,8 +280,6 @@ const char* ImpCheckDirEntry( const void* p ) |* ImplCutPath() |* |* Beschreibung Fuegt ... ein, damit maximal nMaxChars lang -|* Ersterstellung MI 06.04.94 -|* Letzte Aenderung DV 24.06.96 |* *************************************************************************/ @@ -341,10 +335,6 @@ ByteString ImplCutPath( const ByteString& rStr, sal_uInt16 nMax, char cAccDel ) |* |* DirEntry::ImpParseOs2Name() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MI 23.06.95 -|* *************************************************************************/ FSysError DirEntry::ImpParseOs2Name( const ByteString& rPfad, FSysPathStyle eStyle ) @@ -457,36 +447,15 @@ FSysError DirEntry::ImpParseOs2Name( const ByteString& rPfad, FSysPathStyle eSty else { - if ( eStyle == FSYS_STYLE_FAT ) + // normalen Entries kommen auf den Stack + DirEntry *pNew = new DirEntry( aName, FSYS_FLAG_NORMAL, eStyle ); + if ( !pNew->IsValid() ) { - // ist der Name grundsaetzlich ungueltig? - int nPunkte = 0; - const char *pChar; - for ( pChar = aName.GetBuffer(); - nPunkte < 2 && *pChar != 0; - pChar++ ) - { - if ( *pChar == ';' ) - nPunkte = 0; - else - nPunkte += ( *pChar == '.' ) ? 1 : 0; - } - if ( nPunkte > 1 ) - { - aName = rPfad; - return FSYS_ERR_MISPLACEDCHAR; - } + aName = rPfad; + ErrCode eErr = pNew->GetError(); + delete pNew; + return eErr; } - - // normalen Entries kommen auf den Stack - DirEntry *pNew = new DirEntry( aName, FSYS_FLAG_NORMAL, eStyle ); - if ( !pNew->IsValid() ) - { - aName = rPfad; - ErrCode eErr = pNew->GetError(); - delete pNew; - return eErr; - } aStack.Push( pNew ); } } @@ -538,73 +507,26 @@ FSysError DirEntry::ImpParseOs2Name( const ByteString& rPfad, FSysPathStyle eSty |* |* DirEntry::ImpParseName() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.08.91 -|* Letzte Aenderung MI 26.05.93 -|* *************************************************************************/ FSysError DirEntry::ImpParseName( const ByteString& rbInitName, FSysPathStyle eStyle ) { - String rInitName( rbInitName, osl_getThreadTextEncoding() ); if ( eStyle == FSYS_STYLE_HOST ) eStyle = DEFSTYLE; - // KI-Division of FSys - if ( eStyle == FSYS_STYLE_DETECT ) - { - sal_Unicode cFirst = rInitName.GetChar(0); - if ( rInitName.Len() == 2 && rInitName.GetChar(1) == ':' && - ((cFirst >= 'A' && cFirst <= 'Z') || - (cFirst >= 'a' && cFirst <= 'z'))) - eStyle = FSYS_STYLE_HPFS; - else if ( rInitName.Len() > 2 && rInitName.GetChar(1) == ':' ) - { - if ( rInitName.Search( ':', 2 ) == STRING_NOTFOUND ) - eStyle = FSYS_STYLE_HPFS; - else - eStyle = FSYS_STYLE_MAC; - } - else if ( rInitName.Search( '/' ) != STRING_NOTFOUND ) - eStyle = FSYS_STYLE_BSD; - else if ( rInitName.Search( '\\' ) != STRING_NOTFOUND ) - eStyle = FSYS_STYLE_HPFS; - else if ( rInitName.Search( ':' ) != STRING_NOTFOUND ) - eStyle = FSYS_STYLE_MAC; - else - eStyle = FSYS_STYLE_HPFS; - } - - switch ( eStyle ) - { - case FSYS_STYLE_FAT: - case FSYS_STYLE_VFAT: - case FSYS_STYLE_HPFS: - case FSYS_STYLE_NTFS: - case FSYS_STYLE_NWFS: - return ImpParseOs2Name( rbInitName, eStyle ); - - case FSYS_STYLE_BSD: - case FSYS_STYLE_SYSV: - return ImpParseUnixName( rbInitName, eStyle ); - - case FSYS_STYLE_MAC: - return FSYS_ERR_OK; +#if defined(WNT) + return ImpParseOs2Name( rbInitName, eStyle ); +#else + return ImpParseUnixName( rbInitName, eStyle ); +#endif - default: - return FSYS_ERR_UNKNOWN; - } } /************************************************************************* |* |* GetStyle() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 15.11.91 -|* Letzte Aenderung MI 15.11.91 -|* *************************************************************************/ static FSysPathStyle GetStyle( FSysPathStyle eStyle ) @@ -622,12 +544,10 @@ static FSysPathStyle GetStyle( FSysPathStyle eStyle ) |* Beschreibung bringt den Namen auf Betriebssystem-Norm |* z.B. 8.3 lower beim MS-DOS Formatter |* wirkt nicht rekursiv -|* Ersterstellung MI 12.08.91 -|* Letzte Aenderung MI 21.05.92 |* *************************************************************************/ -void DirEntry::ImpTrim( FSysPathStyle eStyle ) +void DirEntry::ImpTrim( FSysPathStyle /* eStyle */ ) { // Wildcards werden nicht geclipt if ( ( aName.Search( '*' ) != STRING_NOTFOUND ) || @@ -635,103 +555,25 @@ void DirEntry::ImpTrim( FSysPathStyle eStyle ) ( aName.Search( ';' ) != STRING_NOTFOUND ) ) return; - switch ( eStyle ) +#if defined(WNT) + if ( aName.Len() > 254 ) { - case FSYS_STYLE_FAT: - { - sal_uInt16 nPunktPos = aName.Search( '.' ); - if ( nPunktPos == STRING_NOTFOUND ) - { - if ( aName.Len() > 8 ) - { - nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK; - aName.Erase( 8 ); - } - } - else - { - if ( nPunktPos > 8 ) - { - nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK; - aName.Erase( 8, nPunktPos - 8 ); - nPunktPos = 8; - } - if ( aName.Len() > nPunktPos + 3 ) - { - if ( aName.Len() - nPunktPos > 4 ) - { - nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK; - aName.Erase( nPunktPos + 4 ); - } - } - } - aName.ToLowerAscii(); - break; - } - - case FSYS_STYLE_VFAT: - case FSYS_STYLE_HPFS: - case FSYS_STYLE_NTFS: - case FSYS_STYLE_NWFS: - if ( aName.Len() > 254 ) - { - nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK; - aName.Erase( 254 ); - } - - if ( eStyle == FSYS_STYLE_HPFS && - ( eFlag == FSYS_FLAG_ABSROOT || eFlag == FSYS_FLAG_RELROOT ) ) - aName.ToUpperAscii(); - break; - - case FSYS_STYLE_SYSV: - if ( aName.Len() > 14 ) - { - nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK; - aName.Erase( 14 ); - } - break; - - case FSYS_STYLE_BSD: - if ( aName.Len() > 250 ) - { - nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK; - aName.Erase( 250 ); - } - break; - - case FSYS_STYLE_MAC: - if ( eFlag & ( FSYS_FLAG_ABSROOT | FSYS_FLAG_VOLUME ) ) - { - if ( aName.Len() > 27 ) - { - nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK; - aName.Erase( 27 ); - } - } - else - { - if ( aName.Len() > 31 ) - { - nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK; - aName.Erase( 31 ); - } - } - break; - - default: - /* kann nicht sein */; + nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK; + aName.Erase( 254 ); + } +#else + if ( aName.Len() > 250 ) + { + nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK; + aName.Erase( 250 ); } +#endif } /************************************************************************* |* |* DirEntry::DirEntry() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ DirEntry::DirEntry( const ByteString& rName, DirEntryFlag eDirFlag, @@ -754,10 +596,6 @@ DirEntry::DirEntry( const ByteString& rName, DirEntryFlag eDirFlag, |* |* DirEntry::DirEntry() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ DirEntry::DirEntry( const DirEntry& rOrig ) : @@ -785,10 +623,6 @@ DirEntry::DirEntry( const DirEntry& rOrig ) : |* |* DirEntry::DirEntry() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ DirEntry::DirEntry( const String& rInitName, FSysPathStyle eStyle ) @@ -809,7 +643,7 @@ DirEntry::DirEntry( const String& rInitName, FSysPathStyle eStyle ) } ByteString aTmpName(rInitName, osl_getThreadTextEncoding()); - if( eStyle == FSYS_STYLE_URL || aTmpName.CompareIgnoreCaseToAscii("file:",5 ) == COMPARE_EQUAL ) + if( aTmpName.CompareIgnoreCaseToAscii("file:",5 ) == COMPARE_EQUAL ) { #ifndef BOOTSTRAP DBG_WARNING( "File URLs are not permitted but accepted" ); @@ -865,7 +699,7 @@ DirEntry::DirEntry( const ByteString& rInitName, FSysPathStyle eStyle ) } ByteString aTmpName( rInitName ); - if( eStyle == FSYS_STYLE_URL || rInitName.CompareIgnoreCaseToAscii("file:",5 ) == COMPARE_EQUAL ) + if( rInitName.CompareIgnoreCaseToAscii("file:",5 ) == COMPARE_EQUAL ) { #ifndef BOOTSTRAP DBG_WARNING( "File URLs are not permitted but accepted" ); @@ -895,10 +729,6 @@ DirEntry::DirEntry( const ByteString& rInitName, FSysPathStyle eStyle ) |* |* DirEntry::DirEntry() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ DirEntry::DirEntry( DirEntryFlag eDirFlag ) @@ -917,10 +747,6 @@ DirEntry::DirEntry( DirEntryFlag eDirFlag ) |* |* DirEntry::~DirEntry() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ DirEntry::~DirEntry() @@ -938,10 +764,6 @@ DirEntry::~DirEntry() |* |* DirEntry::ImpGetTopPtr() const |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ const DirEntry* DirEntry::ImpGetTopPtr() const @@ -959,10 +781,6 @@ const DirEntry* DirEntry::ImpGetTopPtr() const |* |* DirEntry::ImpGetTopPtr() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 13.11.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ DirEntry* DirEntry::ImpGetTopPtr() @@ -978,36 +796,8 @@ DirEntry* DirEntry::ImpGetTopPtr() /************************************************************************* |* -|* DirEntry::ImpGetPreTopPtr() -|* -|* Beschreibung liefert einen Pointer auf den vorletzten Entry -|* Ersterstellung MI 01.11.91 -|* Letzte Aenderung MA 02.12.91 -|* -*************************************************************************/ - -DirEntry* DirEntry::ImpGetPreTopPtr() -{ - DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); - - DirEntry *pTemp = this; - if ( pTemp->pParent ) - { - while ( pTemp->pParent->pParent ) - pTemp = pTemp->pParent; - } - - return pTemp; -} - -/************************************************************************* -|* |* DirEntry::ImpChangeParent() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MI 21.05.92 -|* *************************************************************************/ DirEntry* DirEntry::ImpChangeParent( DirEntry* pNewParent, sal_Bool bNormalize ) @@ -1031,22 +821,18 @@ DirEntry* DirEntry::ImpChangeParent( DirEntry* pNewParent, sal_Bool bNormalize ) |* |* DirEntry::Exists() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MI 24.09.91 -|* *************************************************************************/ sal_Bool DirEntry::Exists( FSysAccess nAccess ) const { #ifndef BOOTSTRAP - static vos::OMutex aLocalMutex; - vos::OGuard aGuard( aLocalMutex ); + static osl::Mutex aLocalMutex; + osl::MutexGuard aGuard( aLocalMutex ); #endif if ( !IsValid() ) return sal_False; -#if defined WNT || defined OS2 +#if defined WNT // spezielle Filenamen sind vom System da if ( ( aName.CompareIgnoreCaseToAscii("CLOCK$") == COMPARE_EQUAL || aName.CompareIgnoreCaseToAscii("CON") == COMPARE_EQUAL || @@ -1070,7 +856,7 @@ sal_Bool DirEntry::Exists( FSysAccess nAccess ) const return sal_True; } -#if defined WNT || defined OS2 +#if defined WNT if ( 0 != ( eKind & FSYS_KIND_DEV ) ) { return DRIVE_EXISTS( ImpGetTopPtr()->aName.GetChar(0) ); @@ -1084,10 +870,6 @@ sal_Bool DirEntry::Exists( FSysAccess nAccess ) const |* |* DirEntry::First() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 15.01.92 -|* *************************************************************************/ sal_Bool DirEntry::First() @@ -1132,10 +914,6 @@ sal_Bool DirEntry::First() |* |* DirEntry::GetFull() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ String DirEntry::GetFull( FSysPathStyle eStyle, sal_Bool bWithDelimiter, @@ -1166,12 +944,6 @@ String DirEntry::GetFull( FSysPathStyle eStyle, sal_Bool bWithDelimiter, aRet = ByteString(GetName( eStyle ), osl_getThreadTextEncoding()); } - if ( ( eStyle == FSYS_STYLE_MAC ) && - ( ImpGetTopPtr()->eFlag != FSYS_FLAG_VOLUME ) && - ( ImpGetTopPtr()->eFlag != FSYS_FLAG_ABSROOT ) && - ( aRet.GetChar(0) != ':' ) ) - aRet.Insert( ACCESSDELIM_C(eStyle), 0 ); - //! Hack if ( bWithDelimiter ) if ( aRet.GetChar( aRet.Len()-1 ) != ACCESSDELIM_C(eStyle) ) @@ -1188,10 +960,6 @@ String DirEntry::GetFull( FSysPathStyle eStyle, sal_Bool bWithDelimiter, |* |* DirEntry::GetPath() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ DirEntry DirEntry::GetPath() const @@ -1208,10 +976,6 @@ DirEntry DirEntry::GetPath() const |* |* DirEntry::GetExtension() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ String DirEntry::GetExtension( char cSep ) const @@ -1235,10 +999,6 @@ String DirEntry::GetExtension( char cSep ) const |* |* DirEntry::GetBase() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ String DirEntry::GetBase( char cSep ) const @@ -1265,10 +1025,6 @@ String DirEntry::GetBase( char cSep ) const |* |* DirEntry::GetName() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 13:47 -|* *************************************************************************/ String DirEntry::GetName( FSysPathStyle eStyle ) const @@ -1286,62 +1042,15 @@ String DirEntry::GetName( FSysPathStyle eStyle ) const case FSYS_FLAG_ABSROOT: { - if ( eStyle == FSYS_STYLE_URL ) - { - aRet = "file:///"; - aRet += aName; - -#ifndef UNX - if ( aName.Len()) - { - if ( aName.GetChar(aName.Len()-1) == ':' ) - { - aRet.SetChar(aRet.Len()-1, '|'); - } - else - { - aRet.Insert( '/', 5 ); - } - aRet += "/"; - } -#endif - } - else if ( eStyle != FSYS_STYLE_MAC && - aName.Len() > 1 && aName.GetChar( 1 ) != ':' ) - { - // UNC-Pathname - aRet = ACCESSDELIM_C(eStyle); - aRet += ACCESSDELIM_C(eStyle); - aRet += aName ; - aRet += ACCESSDELIM_C(eStyle); - } - else - { - aRet = aName; - aRet += ACCESSDELIM_C(eStyle); - } + aRet = aName; + aRet += ACCESSDELIM_C(eStyle); break; } case FSYS_FLAG_INVALID: case FSYS_FLAG_VOLUME: { - if ( eStyle == FSYS_STYLE_URL ) - { - aRet = "file:///"; - aRet += aName; -#ifndef UNX - if ( aName.Len() && aName.GetChar(aName.Len()-1) == ':' ) - { - aRet.SetChar(aRet.Len()-1, '|'); - } -#endif - } - else - { - aRet = aName; - } - + aRet = aName; break; } @@ -1363,10 +1072,6 @@ String DirEntry::GetName( FSysPathStyle eStyle ) const |* |* DirEntry::IsAbs() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ bool DirEntry::IsAbs() const @@ -1384,10 +1089,6 @@ bool DirEntry::IsAbs() const |* |* DirEntry::CutName() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ String DirEntry::CutName( FSysPathStyle eStyle ) @@ -1431,8 +1132,6 @@ String DirEntry::CutName( FSysPathStyle eStyle ) |* DirEntry::NameCompare |* |* Beschreibung Vergleich nur die Namen (ohne Pfad, aber mit Gross/Klein) -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 |* *************************************************************************/ @@ -1457,10 +1156,6 @@ StringCompare DirEntry::NameCompare( const DirEntry &rWith ) const |* |* DirEntry::operator==() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ sal_Bool DirEntry::operator==( const DirEntry& rEntry ) const @@ -1476,14 +1171,8 @@ sal_Bool DirEntry::operator==( const DirEntry& rEntry ) const ( rEntry.eFlag == FSYS_FLAG_INVALID ) ) return sal_False; -#ifndef OS2 - const -#endif - DirEntry *pThis = (DirEntry *)this; -#ifndef OS2 - const -#endif - DirEntry *pWith = (DirEntry *)&rEntry; + const DirEntry *pThis = (DirEntry *)this; + const DirEntry *pWith = (DirEntry *)&rEntry; while( pThis && pWith && (pThis->eFlag == pWith->eFlag) ) { if ( CMP_LOWER(pThis->aName) != CMP_LOWER(pWith->aName) ) @@ -1499,10 +1188,6 @@ sal_Bool DirEntry::operator==( const DirEntry& rEntry ) const |* |* DirEntry::operator=() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ DirEntry& DirEntry::operator=( const DirEntry& rEntry ) @@ -1512,7 +1197,7 @@ DirEntry& DirEntry::operator=( const DirEntry& rEntry ) if ( this == &rEntry ) return *this; if ( rEntry.nError != FSYS_ERR_OK ) { - DBG_ERROR("Zuweisung mit invalidem DirEntry"); + OSL_FAIL("Zuweisung mit invalidem DirEntry"); nError = rEntry.nError; return *this; } @@ -1537,10 +1222,6 @@ DirEntry& DirEntry::operator=( const DirEntry& rEntry ) |* |* DirEntry::operator+() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ DirEntry DirEntry::operator+( const DirEntry& rEntry ) const @@ -1628,10 +1309,6 @@ DirEntry DirEntry::operator+( const DirEntry& rEntry ) const |* |* DirEntry::operator+=() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ DirEntry &DirEntry::operator+=( const DirEntry& rEntry ) @@ -1645,10 +1322,6 @@ DirEntry &DirEntry::operator+=( const DirEntry& rEntry ) |* |* DirEntry::GetAccessDelimiter() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 27.05.93 -|* Letzte Aenderung MI 10.06.93 -|* *************************************************************************/ String DirEntry::GetAccessDelimiter( FSysPathStyle eFormatter ) @@ -1660,10 +1333,6 @@ String DirEntry::GetAccessDelimiter( FSysPathStyle eFormatter ) |* |* DirEntry::SetExtension() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 02.08.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ void DirEntry::SetExtension( const String& rExtension, char cSep ) @@ -1702,10 +1371,6 @@ void DirEntry::SetExtension( const String& rExtension, char cSep ) |* |* DirEntry::CutExtension() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 23.07.93 -|* Letzte Aenderung MI 23.07.93 -|* *************************************************************************/ String DirEntry::CutExtension( char cSep ) @@ -1731,10 +1396,6 @@ String DirEntry::CutExtension( char cSep ) |* |* DirEntry::SetName() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 04.09.93 -|* Letzte Aenderung MI 04.09.93 -|* *************************************************************************/ void DirEntry::SetName( const String& rName, FSysPathStyle eFormatter ) @@ -1747,8 +1408,7 @@ void DirEntry::SetName( const String& rName, FSysPathStyle eFormatter ) if ( (eFlag != FSYS_FLAG_NORMAL) || (aName.Search( ':' ) != STRING_NOTFOUND) || - (aName.Search( aAccDelim ) != STRING_NOTFOUND) || - (eFormatter == FSYS_STYLE_FAT && (aName.GetTokenCount( '.' ) > 2) ) ) + (aName.Search( aAccDelim ) != STRING_NOTFOUND) ) { eFlag = FSYS_FLAG_INVALID; } @@ -1762,10 +1422,6 @@ void DirEntry::SetName( const String& rName, FSysPathStyle eFormatter ) |* |* DirEntry::Find() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ sal_Bool DirEntry::Find( const String& rPfad, char cDelim ) { @@ -1806,153 +1462,8 @@ sal_Bool DirEntry::Find( const String& rPfad, char cDelim ) /************************************************************************* |* -|* DirEntry::ImpToRel() -|* -|* Beschreibung -|* Ersterstellung MI 17.06.93 -|* Letzte Aenderung MI 17.06.93 -|* -*************************************************************************/ - -sal_Bool DirEntry::ImpToRel( String aCurStr ) -{ - DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); - - DirEntry aThis(*this); - aThis.ToAbs(); - String aThisStr( aThis.GetFull( FSYS_STYLE_HPFS ) ); - - // #109512 preserve case of path even if caseinsensitive - String aThisCompareStr( aThisStr ), aCurCompareStr( aCurStr ); - if ( ! IsCaseSensitive() ) - { - aThisCompareStr.ToLowerAscii(); - aCurCompareStr.ToLowerAscii(); - } - - // "Ubereinstimmung pr"ufen - sal_uInt16 nPos = aThisCompareStr.Match( aCurCompareStr ); - if ( nPos == STRING_MATCH && aThisStr.Len() != aCurStr.Len() ) - nPos = Min( aThisStr.Len(), aCurStr.Len() ); - - // Sonderfall, die DirEntries sind identisch - if ( nPos == STRING_MATCH ) - { - // dann ist der relative Pfad das aktuelle Verzeichnis - *this = DirEntry(); - return sal_True; - } - - // Sonderfall, die DirEntries sind total verschieden - if ( nPos == 0 ) - { - // dann ist der relativste Pfad absolut - *this = aThis; - return sal_False; - } - - // sonst nehmen wir die identischen Einzelteile vorne weg - while ( nPos > 0 && aThisStr.GetChar(nPos) != '\\' ) - --nPos; - aThisStr.Erase( 0, nPos + ( ( aThisStr.GetChar(nPos) == '\\' ) ? 1 : 0 ) ); - aCurStr.Erase( 0, nPos + ( ( aCurStr.GetChar(nPos) == '\\' ) ? 1 : 0 ) ); - - // und fuellen mit dem Level der Directories auf - for ( nPos = 0; nPos < aCurStr.Len(); ++nPos ) - if ( aCurStr.GetChar(nPos) == '\\' ) - aThisStr.Insert( String( "..\\", osl_getThreadTextEncoding() ), 0 ); - - // das ist dann unser relativer Pfad - *this = DirEntry( aThisStr, FSYS_STYLE_HPFS ); - return sal_True; -} - -/************************************************************************* -|* -|* DirEntry::CutRelParents() -|* -|* Beschreibung -|* Ersterstellung MI 01.08.95 -|* Letzte Aenderung MI 01.08.95 -|* -*************************************************************************/ - -sal_uInt16 DirEntry::CutRelParents() -{ - DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); - - // erstes '..' finden - DirEntry *pDir = 0; - DirEntry *pPar; - - for ( pPar = this; - pPar && pPar->eFlag != FSYS_FLAG_PARENT; - pPar = pPar->pParent ) - pDir = pPar; - - // '..' zaehlen - sal_uInt16 nParCount = 0; - while ( pPar && pPar->eFlag == FSYS_FLAG_PARENT ) - { - ++nParCount; - pPar = pPar->pParent; - } - - // cutten - if ( pDir ) - DELETEZ(pDir->pParent); - else - eFlag = FSYS_FLAG_CURRENT; - - return nParCount; -} - -/************************************************************************* -|* -|* DirEntry::ToRel() -|* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.06.93 -|* Letzte Aenderung MI 17.06.93 -|* -*************************************************************************/ - -sal_Bool DirEntry::ToRel() -{ - DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); - - DirEntry aCur; - aCur.ToAbs(); - return ImpToRel( aCur.GetFull( FSYS_STYLE_HPFS ) ); -} - -/************************************************************************* -|* -|* DirEntry::ToRel() -|* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 -|* -*************************************************************************/ - -sal_Bool DirEntry::ToRel( const DirEntry& rStart ) -{ - DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); - - DirEntry aStart( rStart ); - aStart.ToAbs(); - return ImpToRel( aStart.GetFull( FSYS_STYLE_HPFS ) ); -} - -/************************************************************************* -|* |* DirEntry::GetDevice() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ #ifndef UNX @@ -1976,10 +1487,6 @@ DirEntry DirEntry::GetDevice() const |* |* DirEntry::SetBase() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 23.10.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ void DirEntry::SetBase( const String& rBase, char cSep ) @@ -2005,10 +1512,6 @@ void DirEntry::SetBase( const String& rBase, char cSep ) |* |* DirEntry::GetSearchDelimiter() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 10.06.93 -|* Letzte Aenderung MI 10.06.93 -|* *************************************************************************/ String DirEntry::GetSearchDelimiter( FSysPathStyle eFormatter ) @@ -2018,49 +1521,9 @@ String DirEntry::GetSearchDelimiter( FSysPathStyle eFormatter ) /************************************************************************* |* -|* DirEntry::GetMaxNameLen() -|* -|* Beschreibung Liefert die maximale Anzahl von Zeichen in -|* einzelnen Namensteile. Bei FileSystmen mit -|* fester Extension (FAT) zaehlt diese nicht mit. -|* Bei unbekannten FileSytemen und FSYS_STYLE_URL -|* wird USHRT_MAX zurueckgegeben. -|* Ersterstellung MI 17.06.97 -|* Letzte Aenderung MI 17.06.97 -|* -*************************************************************************/ - -sal_uInt16 DirEntry::GetMaxNameLen( FSysPathStyle eFormatter ) -{ - eFormatter = GetStyle( eFormatter ); - switch ( eFormatter ) - { - case FSYS_STYLE_MAC: return 31; - - case FSYS_STYLE_FAT: return 8; - - case FSYS_STYLE_VFAT: - case FSYS_STYLE_NTFS: - case FSYS_STYLE_NWFS: - case FSYS_STYLE_HPFS: return 255; - - - case FSYS_STYLE_SYSV: return 14; - - case FSYS_STYLE_BSD: return 250; - - default: - return USHRT_MAX; - } -} - -/************************************************************************* -|* |* DirEntry::TempName() |* |* Beschreibung FSYS.SDW - Aha, wo? -|* Ersterstellung VB 06.09.93 (im SWG) -|* Letzte Aenderung MI 06.02.98 |* *************************************************************************/ namespace { struct TempNameBase_Impl : public rtl::Static< DirEntry, TempNameBase_Impl > {}; } @@ -2096,20 +1559,19 @@ const DirEntry& DirEntry::SetTempNameBase( const String &rBase ) DirEntry DirEntry::TempName( DirEntryKind eKind ) const { // ggf. Base-Temp-Dir verwenden (macht Remote keinen Sinn => vorher) - const DirEntry &rEntry = TempNameBase_Impl::get(); + const DirEntry &rEntry = TempNameBase_Impl::get(); if ( !pParent && FSYS_FLAG_CURRENT != rEntry.eFlag && FSYS_FLAG_ABSROOT != eFlag ) - { DirEntry aFactory( rEntry ); aFactory += GetName(); return aFactory.TempName(); } - ByteString aDirName; // hiermit hatte MPW C++ Probleme - immmer noch?? + ByteString aDirName; char *ret_val; size_t i; - // dertermine Directory, Prefix and Extension + // determine Directory, Prefix and Extension char pfx[6]; char ext[5]; const char *dir; @@ -2135,17 +1597,15 @@ DirEntry DirEntry::TempName( DirEntryKind eKind ) const else { aDirName = ByteString(GetFull(), osl_getThreadTextEncoding()); - strcpy( pfx, "sv" ); + strcpy( pfx, "lo" ); strcpy( ext, ".tmp" ); } dir = aDirName.GetBuffer(); - // wurde kein Dir angegeben, dann nehmen wir ein passendes TEMP-Verz. char sBuf[_MAX_PATH]; if ( eFlag == FSYS_FLAG_CURRENT || ( !pParent && pWild ) ) dir = TempDirImpl(sBuf); - // ab hier leicht modifizierter Code von VB DirEntry aRet(FSYS_FLAG_INVALID); i = strlen(dir); // need to add ?\\? + prefix + number + pid + .ext + '\0' @@ -2156,7 +1616,7 @@ DirEntry DirEntry::TempName( DirEntryKind eKind ) const strcpy(ret_val,dir); /* Make sure directory ends with a separator */ -#if defined(WNT) || defined(OS2) +#if defined(WNT) if ( i>0 && ret_val[i-1] != '\\' && ret_val[i-1] != '/' && ret_val[i-1] != ':') ret_val[i++] = '\\'; @@ -2224,7 +1684,7 @@ DirEntry DirEntry::TempName( DirEntryKind eKind ) const } else { -#if defined(UNX) || defined(OS2) +#if defined(UNX) if( access( ByteString(aRedirected, osl_getThreadTextEncoding()).GetBuffer(), F_OK ) ) { aRet = DirEntry( aRetVal ); @@ -2253,10 +1713,6 @@ DirEntry DirEntry::TempName( DirEntryKind eKind ) const |* |* DirEntry::operator[]() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 03.03.92 -|* Letzte Aenderung MI 03.03.92 -|* *************************************************************************/ const DirEntry &DirEntry::operator[]( sal_uInt16 nParentLevel ) const @@ -2276,10 +1732,6 @@ const DirEntry &DirEntry::operator[]( sal_uInt16 nParentLevel ) const |* |* DirEntry::ImpParseUnixName() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MI 26.05.93 -|* *************************************************************************/ FSysError DirEntry::ImpParseUnixName( const ByteString& rPfad, FSysPathStyle eStyle ) @@ -2396,10 +1848,6 @@ FSysError DirEntry::ImpParseUnixName( const ByteString& rPfad, FSysPathStyle eSt |* |* DirEntry::MakeShortName() |* -|* Beschreibung -|* Ersterstellung TLX -|* Letzte Aenderung PB 21.08.97 (in CreateEntry_Impl()) -|* *************************************************************************/ ErrCode CreateEntry_Impl( const DirEntry &rPath, DirEntryKind eKind ) @@ -2449,13 +1897,6 @@ sal_Bool IsValidEntry_Impl( const DirEntry &rPath, aPath += aName; if ( 1 == aPath.Level() ) return sal_False; - if ( eStyle == FSYS_STYLE_FAT || eStyle == FSYS_STYLE_NWFS || - eStyle == FSYS_STYLE_UNKNOWN ) - { - DirEntry aDosEntry( rLongName, FSYS_STYLE_FAT ); - if ( !aDosEntry.IsValid() ) - return sal_False; - } // Pfad-Trenner sind nicht erlaubt (bei ungek"urzten auch nicht FSYS_SHORTNAME_DELIMITER) char cDelim = bUseDelim == 2 ? FSYS_SHORTNAME_DELIMITER : char(0); @@ -2476,14 +1917,6 @@ sal_Bool IsValidEntry_Impl( const DirEntry &rPath, //------------------------------------------------------------------------- -#define MAX_EXT_FAT 3 -#define MAX_LEN_FAT 8 -#define INVALID_CHARS_FAT "\\/\"':|^<>[]?* " - -#define MAX_EXT_MAC 16 // nur wegen sinnvoller Namensk"rzung -#define MAX_LEN_MAC 31 -#define INVALID_CHARS_MAC "\":" - #define MAX_EXT_MAX 250 #define MAX_LEN_MAX 255 #define INVALID_CHARS_DEF "\\/\"':|^<>?*" @@ -2500,22 +1933,6 @@ sal_Bool DirEntry::MakeShortName( const String& rLongName, DirEntryKind eKind, // Auf Novell-Servern (wegen der rottigen Clients) nur 7bit ASCII - // HRO: #69627# Weg mit dem Scheiss. Wenn es Client gibt, die so einen - // BUG haben, dann muss halt der Client ersetzt werden, aber doch nicht das - // Office kastrieren !!! - -#if 0 - if ( FSYS_STYLE_NWFS == GetPathStyle( ImpGetTopPtr()->GetName() ) ) - { - for ( sal_uInt16 n = aLongName.Len(); n; --n ) - { - short nChar = aLongName(n-1); - if ( nChar < 32 || nChar >= 127 ) - aLongName.Erase( n-1, 1 ); - } - } -#endif - // bei FSYS_KIND_ALL den alten Namen merken und abh"angen (rename) ByteString aOldName; if ( FSYS_KIND_ALL == eKind ) @@ -2536,49 +1953,27 @@ sal_Bool DirEntry::MakeShortName( const String& rLongName, DirEntryKind eKind, if ( FSYS_STYLE_DETECT == eStyle ) eStyle = DirEntry::GetPathStyle( GetDevice().GetName() ); ByteString aInvalidChars; - switch ( eStyle ) - { - case FSYS_STYLE_FAT: - nMaxExt = MAX_EXT_FAT; - nMaxLen = MAX_LEN_FAT; - aInvalidChars = INVALID_CHARS_FAT; - break; - - case FSYS_STYLE_MAC: - nMaxExt = MAX_EXT_MAC; - nMaxLen = MAX_LEN_MAC; - aInvalidChars = INVALID_CHARS_MAC; - break; - - default: - nMaxExt = MAX_EXT_MAX; - nMaxLen = MAX_LEN_MAX; - aInvalidChars = INVALID_CHARS_DEF; - } + nMaxExt = MAX_EXT_MAX; + nMaxLen = MAX_LEN_MAX; + aInvalidChars = INVALID_CHARS_DEF; // Extension abschneiden und kuerzen ByteString aExt; ByteString aFName = bLongName; - if ( FSYS_STYLE_MAC != eStyle ) + DirEntry aUnparsed; + aUnparsed.aName = bLongName; + aExt = ByteString(aUnparsed.CutExtension(), osl_getThreadTextEncoding()); + aFName = aUnparsed.aName; + if ( aExt.Len() > nMaxExt ) { - DirEntry aUnparsed; - aUnparsed.aName = bLongName; - aExt = ByteString(aUnparsed.CutExtension(), osl_getThreadTextEncoding()); - aFName = aUnparsed.aName; - if ( aExt.Len() > nMaxExt ) - { - char c = aExt.GetChar( aExt.Len() - 1 ); - aExt.Erase(nMaxExt-1); - aExt += c; - } + char c = aExt.GetChar( aExt.Len() - 1 ); + aExt.Erase(nMaxExt-1); + aExt += c; } - if ( FSYS_STYLE_FAT != eStyle ) - { - // ausser auf einem FAT-System geh"ort die Extension zur - // Maxl"ange. Muss also vorher mit dem Punkt abgezogen werden. - nMaxLen -= ( aExt.Len() + 1 ); - } + // ausser auf einem FAT-System geh"ort die Extension zur + // Maxl"ange. Muss also vorher mit dem Punkt abgezogen werden. + nMaxLen -= ( aExt.Len() + 1 ); // Name k"urzen ByteString aSName; @@ -2646,10 +2041,6 @@ sal_Bool DirEntry::MakeShortName( const String& rLongName, DirEntryKind eKind, |* |* DirEntry::CreatePath() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ sal_Bool DirEntry::MakeDir( sal_Bool bSloppy ) const @@ -2715,10 +2106,6 @@ sal_Bool DirEntry::MakeDir( sal_Bool bSloppy ) const |* |* DirEntry::CopyTo() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MI 07.08.96 -|* *************************************************************************/ FSysError DirEntry::CopyTo( const DirEntry& rDest, FSysAction nActions ) const @@ -2749,13 +2136,9 @@ FSysError DirEntry::CopyTo( const DirEntry& rDest, FSysAction nActions ) const |* |* DirEntry::MoveTo() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung HRO 24.03.99 -|* *************************************************************************/ -#if defined WNT || defined UNX || defined OS2 +#if defined WNT || defined UNX FSysError DirEntry::MoveTo( const DirEntry& rNewName ) const { @@ -2778,13 +2161,6 @@ FSysError DirEntry::MoveTo( const DirEntry& rNewName ) const return FSYS_ERR_ALREADYEXISTS; } -#if defined(OS2) - if ( FileStat(*this).IsKind(FSYS_KIND_DIR) && aDest.GetPath() != GetPath() ) - { - return FSYS_ERR_NOTSUPPORTED; - } -#endif - FSysFailOnErrorImpl(); String aFrom( GetFull() ); @@ -2859,7 +2235,7 @@ FSysError DirEntry::MoveTo( const DirEntry& rNewName ) const // on some nfs connections rename with from == to // leads to destruction of file if ( ( aFrom != aTo ) && ( 0 != rename( bFrom.GetBuffer(), bTo.GetBuffer() ) ) ) -#if !defined(UNX) && !defined(OS2) +#if !defined(UNX) return Sys2SolarError_Impl( GetLastError() ); #else { @@ -2897,6 +2273,10 @@ FSysError DirEntry::MoveTo( const DirEntry& rNewName ) const } else { + if ( fpIN ) + fclose( fpIN ); + if ( fpOUT ) + fclose( fpOUT ); return Sys2SolarError_Impl( EXDEV ); } } @@ -2916,10 +2296,6 @@ FSysError DirEntry::MoveTo( const DirEntry& rNewName ) const |* |* DirEntry::Kill() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MI 07.08.96 -|* *************************************************************************/ FSysError DirEntry::Kill( FSysAction nActions ) const @@ -3002,9 +2378,7 @@ FSysError DirEntry::Kill( FSysAction nActions ) const { if ( FSYS_ACTION_USERECYCLEBIN == (nActions & FSYS_ACTION_USERECYCLEBIN) ) { -#ifdef OS2 - eError = ApiRet2ToSolarError_Impl( DosDelete( (PSZ) pName ) ); -#elif defined(WNT) +#if defined(WNT) SHFILEOPSTRUCT aOp; aOp.hwnd = 0; aOp.wFunc = FO_DELETE; @@ -3053,8 +2427,6 @@ FSysError DirEntry::Kill( FSysAction nActions ) const |* DirEntry::Contains() |* |* Beschreibung ob rSubEntry direkt oder indirect in *this liegt -|* Ersterstellung MI 20.03.97 -|* Letzte Aenderung MI 20.03.97 |* *************************************************************************/ @@ -3078,10 +2450,6 @@ sal_Bool DirEntry::Contains( const DirEntry &rSubEntry ) const |* |* DirEntry::Level() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 03.03.92 -|* Letzte Aenderung MI 03.03.92 -|* *************************************************************************/ sal_uInt16 DirEntry::Level() const @@ -3101,42 +2469,8 @@ sal_uInt16 DirEntry::Level() const /************************************************************************* |* -|* DirEntry::ConvertNameToSystem() -|* -|* Beschreibung -|* Ersterstellung DV 29.03.96 -|* Letzte Aenderung DV 29.03.96 -|* -*************************************************************************/ - -String DirEntry::ConvertNameToSystem( const String &rName ) -{ - return rName; -} - -/************************************************************************* -|* -|* DirEntry::ConvertSystemToName() -|* -|* Beschreibung -|* Ersterstellung DV 29.03.96 -|* Letzte Aenderung DV 29.03.96 -|* -*************************************************************************/ - -String DirEntry::ConvertSystemToName( const String &rName ) -{ - return rName; -} - -/************************************************************************* -|* |* DirEntry::IsValid() |* -|* Beschreibung -|* Ersterstellung MI 18.09.93 -|* Letzte Aenderung TPF 18.09.98 -|* *************************************************************************/ sal_Bool DirEntry::IsValid() const @@ -3144,63 +2478,6 @@ sal_Bool DirEntry::IsValid() const return (nError == FSYS_ERR_OK); } -/************************************************************************* -|* -|* DirEntry::IsRFSAvailable() -|* -|* Beschreibung -|* Ersterstellung TPF 21.10.98 -|* Letzte Aenderung TPF 21.10.98 -|* -*************************************************************************/ - -sal_Bool DirEntry::IsRFSAvailable() -{ - return sal_False; -} - -/************************************************************************* -|* -|* IsLongNameOnFAT() -|* -|* Beschreibung ?berpr?ft , ob das DirEntry einen langen -|* Filenamen auf einer FAT-Partition enth?lt (EAs). -|* (eigentlich nur f?r OS2 interessant) -|* Ersterstellung TPF 02.10.98 -|* Letzte Aenderung TPF 01.03.1999 -|* -*************************************************************************/ - -sal_Bool DirEntry::IsLongNameOnFAT() const -{ - // FAT-System? - DirEntry aTempDirEntry(*this); - aTempDirEntry.ToAbs(); - if (DirEntry::GetPathStyle(aTempDirEntry.GetDevice().GetName().GetChar(0)) != FSYS_STYLE_FAT) - { - return sal_False; // nein, also false - } - - // DirEntry-Kette auf lange Dateinamen pr?fen - for( sal_uInt16 iLevel = this->Level(); iLevel > 0; iLevel-- ) - { - const DirEntry& rEntry = (const DirEntry&) (*this)[iLevel-1]; - String aBase( rEntry.GetBase() ); - String aExtension( rEntry.GetExtension() ); - - if (aBase.Len()>8) // Name > 8? - { - return sal_True; - } - - if (aExtension.Len()>3) // Extension > 3? - { - return sal_True; - } - } - return sal_False; -} - //======================================================================== #if defined(DBG_UTIL) @@ -3211,3 +2488,4 @@ void FSysTest() #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/fsys/filecopy.cxx b/tools/source/fsys/filecopy.cxx index e087b6c4a4c3..66b01e57a4b4 100755..100644 --- a/tools/source/fsys/filecopy.cxx +++ b/tools/source/fsys/filecopy.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,16 +30,7 @@ #include "precompiled_tools.hxx" #if defined WNT -#ifndef _SVWIN_H -#include <io.h> -#include <tools/svwin.h> -#endif - -#elif defined(OS2) -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <share.h> +#include <windows.h> #include <io.h> #elif defined UNX @@ -65,10 +57,6 @@ using namespace ::osl; |* |* FileCopier::FileCopier() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 13.04.94 -|* Letzte Aenderung MI 13.04.94 -|* *************************************************************************/ FileCopier::FileCopier() : @@ -114,10 +102,6 @@ FileCopier::FileCopier( const FileCopier& rCopier ) : |* |* FileCopier::~FileCopier() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 13.04.94 -|* Letzte Aenderung MI 13.04.94 -|* *************************************************************************/ FileCopier::~FileCopier() @@ -129,10 +113,6 @@ FileCopier::~FileCopier() |* |* FileCopier::operator =() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 13.04.94 -|* Letzte Aenderung MI 13.04.94 -|* *************************************************************************/ FileCopier& FileCopier::operator = ( const FileCopier &rCopier ) @@ -152,10 +132,6 @@ FileCopier& FileCopier::operator = ( const FileCopier &rCopier ) |* |* FileCopier::Progress() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 13.04.94 -|* Letzte Aenderung MI 13.04.94 -|* *************************************************************************/ sal_Bool FileCopier::Progress() @@ -228,10 +204,6 @@ const Link& FileCopier::GetErrorHdl() const |* |* FileCopier::Execute() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 13.04.94 -|* Letzte Aenderung PB 16.06.00 -|* *************************************************************************/ FSysError FileCopier::DoCopy_Impl( @@ -240,78 +212,14 @@ FSysError FileCopier::DoCopy_Impl( FSysError eRet = FSYS_ERR_OK; ErrCode eWarn = FSYS_ERR_OK; - // HPFS->FAT? - FSysPathStyle eSourceStyle = DirEntry::GetPathStyle( rSource.ImpGetTopPtr()->GetName() ); - FSysPathStyle eTargetStyle = DirEntry::GetPathStyle( rTarget.ImpGetTopPtr()->GetName() ); - sal_Bool bMakeShortNames = ( eSourceStyle == FSYS_STYLE_HPFS && eTargetStyle == FSYS_STYLE_FAT ); - // Zieldateiname ggf. kuerzen DirEntry aTgt; - if ( bMakeShortNames ) - { - aTgt = rTarget.GetPath(); - aTgt.MakeShortName( rTarget.GetName() ); - } - else - aTgt = rTarget; - - // kein Move wenn Namen gekuerzt werden muessten - if ( bMakeShortNames && FSYS_ACTION_MOVE == ( pImp->nActions & FSYS_ACTION_MOVE ) && aTgt != rTarget ) - return ERRCODE_IO_NAMETOOLONG; + aTgt = rTarget; // source is directory? FileStat aSourceFileStat( rSource ); if ( aSourceFileStat.IsKind( FSYS_KIND_DIR ) ) { -#ifdef OS2 - CHAR szSource[CCHMAXPATHCOMP]; - HOBJECT hSourceObject; - - strcpy(szSource, ByteString(rSource.GetFull(), osl_getThreadTextEncoding()).GetBuffer()); - hSourceObject = WinQueryObject(szSource); - - if ( hSourceObject ) - { - PSZ pszSourceName; - PSZ pszTargetName; - CHAR szTarget[CCHMAXPATHCOMP]; - HOBJECT hTargetObject; - HOBJECT hReturn = NULLHANDLE; - - strcpy(szTarget, ByteString(rTarget.GetFull(), osl_getThreadTextEncoding()).GetBuffer()); - pszTargetName = strrchr(szTarget, '\\'); - pszSourceName = strrchr(szSource, '\\'); - - hTargetObject = WinQueryObject(szTarget); - - if ( hTargetObject ) - WinDestroyObject(hTargetObject); - - if ( pszTargetName && pszSourceName ) - { - *pszTargetName = '\0'; - pszSourceName++; - pszTargetName++; - - if(strcmp(pszSourceName, pszTargetName) == 0) - { - hTargetObject = WinQueryObject(szTarget); - - if(pImp->nActions & FSYS_ACTION_MOVE) - { - hReturn = WinMoveObject(hSourceObject, hTargetObject, 0); - } - else - { - hReturn = WinCopyObject(hSourceObject, hTargetObject, 0); - } - if ( bMakeShortNames && aTarget.Exists() ) - aTarget.Kill(); - return hReturn ? FSYS_ERR_OK : FSYS_ERR_UNKNOWN; - } - } - } -#endif // recursive copy eRet = Error( aTgt.MakeDir() ? FSYS_ERR_OK : FSYS_ERR_UNKNOWN, 0, &aTgt ); Dir aSourceDir( rSource, FSYS_KIND_DIR|FSYS_KIND_FILE ); @@ -484,3 +392,5 @@ FSysError FileCopier::ExecuteExact( FSysAction nActions, FSysExact eExact ) // recursive copy return DoCopy_Impl( aAbsSource, aAbsTarget ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/fsys/fstat.cxx b/tools/source/fsys/fstat.cxx index 6a32585b2c1e..c0a9c8ce5eba 100755..100644 --- a/tools/source/fsys/fstat.cxx +++ b/tools/source/fsys/fstat.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,10 +43,6 @@ |* |* FileStat::FileStat() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 11.06.91 -|* Letzte Aenderung MI 11.06.91 -|* *************************************************************************/ FileStat::FileStat() @@ -66,10 +63,6 @@ FileStat::FileStat() |* |* FileStat::FileStat() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 11.06.91 -|* Letzte Aenderung MI 11.06.91 -|* *************************************************************************/ FileStat::FileStat( const DirEntry& rDirEntry, FSysAccess nAccess ) @@ -109,10 +102,6 @@ FileStat::FileStat( const DirEntry& rDirEntry, FSysAccess nAccess ) |* |* FileStat::IsYounger() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MA 11.11.91 -|* Letzte Aenderung MA 11.11.91 -|* *************************************************************************/ // sal_True wenn die Instanz j"unger als rIsOlder ist. @@ -133,9 +122,6 @@ sal_Bool FileStat::IsYounger( const FileStat& rIsOlder ) const |* |* FileStat::IsKind() |* -|* Ersterstellung MA 11.11.91 (?) -|* Letzte Aenderung KH 16.01.95 -|* *************************************************************************/ sal_Bool FileStat::IsKind( DirEntryKind nKind ) const @@ -148,29 +134,8 @@ sal_Bool FileStat::IsKind( DirEntryKind nKind ) const /************************************************************************* |* -|* FileStat::HasReadOnlyFlag() -|* -|* Ersterstellung MI 06.03.97 -|* Letzte Aenderung UT 01.07.98 -|* -*************************************************************************/ - -sal_Bool FileStat::HasReadOnlyFlag() -{ -#if defined WNT || defined UNX || defined OS2 - return sal_True; -#else - return sal_False; -#endif -} - -/************************************************************************* -|* |* FileStat::GetReadOnlyFlag() |* -|* Ersterstellung MI 06.03.97 -|* Letzte Aenderung UT 02.07.98 -|* *************************************************************************/ sal_Bool FileStat::GetReadOnlyFlag( const DirEntry &rEntry ) @@ -181,16 +146,6 @@ sal_Bool FileStat::GetReadOnlyFlag( const DirEntry &rEntry ) DWORD nRes = GetFileAttributes( (LPCTSTR) aFPath.GetBuffer() ); return ULONG_MAX != nRes && ( FILE_ATTRIBUTE_READONLY & nRes ) == FILE_ATTRIBUTE_READONLY; -#elif defined OS2 - FILESTATUS3 aFileStat; - APIRET nRet = DosQueryPathInfo( (PSZ)aFPath.GetBuffer(), 1, &aFileStat, sizeof(aFileStat) ); - switch ( nRet ) - { - case NO_ERROR: - return FILE_READONLY == ( aFileStat.attrFile & FILE_READONLY ); - default: - return sal_False; - } #elif defined UNX /* could we stat the object? */ struct stat aBuf; @@ -207,9 +162,6 @@ sal_Bool FileStat::GetReadOnlyFlag( const DirEntry &rEntry ) |* |* FileStat::SetReadOnlyFlag() |* -|* Ersterstellung MI 06.03.97 -|* Letzte Aenderung UT 01.07.98 -|* *************************************************************************/ sal_uIntPtr FileStat::SetReadOnlyFlag( const DirEntry &rEntry, sal_Bool bRO ) @@ -224,26 +176,6 @@ sal_uIntPtr FileStat::SetReadOnlyFlag( const DirEntry &rEntry, sal_Bool bRO ) ( nRes & ~FILE_ATTRIBUTE_READONLY ) | ( bRO ? FILE_ATTRIBUTE_READONLY : 0 ) ); return ( ULONG_MAX == nRes ) ? ERRCODE_IO_UNKNOWN : 0; -#elif defined OS2 - FILESTATUS3 aFileStat; - APIRET nRet = DosQueryPathInfo( (PSZ)aFPath.GetBuffer(), 1, &aFileStat, sizeof(aFileStat) ); - if ( !nRet ) - { - aFileStat.attrFile = ( aFileStat.attrFile & ~FILE_READONLY ) | - ( bRO ? FILE_READONLY : 0 ); - nRet = DosSetPathInfo( (PSZ)aFPath.GetBuffer(), 1, &aFileStat, sizeof(aFileStat), 0 ); - } - switch ( nRet ) - { - case NO_ERROR: - return ERRCODE_NONE; - - case ERROR_SHARING_VIOLATION: - return ERRCODE_IO_LOCKVIOLATION; - - default: - return ERRCODE_IO_NOTEXISTS; - } #elif defined UNX /* first, stat the object to get permissions */ struct stat aBuf; @@ -282,11 +214,8 @@ sal_uIntPtr FileStat::SetReadOnlyFlag( const DirEntry &rEntry, sal_Bool bRO ) |* |* FileStat::SetDateTime |* -|* Ersterstellung PB 27.06.97 -|* Letzte Aenderung -|* *************************************************************************/ -#if defined WNT || defined OS2 +#if defined WNT void FileStat::SetDateTime( const String& rFileName, const DateTime& rNewDateTime ) @@ -296,7 +225,6 @@ void FileStat::SetDateTime( const String& rFileName, Date aNewDate = rNewDateTime; Time aNewTime = rNewDateTime; -#if defined WNT TIME_ZONE_INFORMATION aTZI; DWORD dwTZI = GetTimeZoneInformation( &aTZI ); @@ -361,54 +289,7 @@ void FileStat::SetDateTime( const String& rFileName, SetFileTime( hFile, &aFileTime, &aFileTime, &aFileTime ); CloseHandle( hFile ); } -#elif defined OS2 - - // open file - ULONG nAction = FILE_EXISTED; - HFILE hFile = 0; - ULONG nFlags = OPEN_FLAGS_WRITE_THROUGH | - OPEN_FLAGS_FAIL_ON_ERROR | OPEN_FLAGS_NO_CACHE | - OPEN_FLAGS_RANDOM | OPEN_FLAGS_NOINHERIT | - OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE; - - APIRET nRet = DosOpen((PSZ)aFileName.GetBuffer(), &hFile, (PULONG)&nAction, - 0/*size*/, FILE_NORMAL, - OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS, - nFlags, 0/*ea*/); - - if ( nRet == 0 ) - { - FILESTATUS3 FileInfoBuffer; - - nRet = DosQueryFileInfo( - hFile, 1, &FileInfoBuffer, sizeof(FileInfoBuffer)); - - if ( nRet == 0 ) - { - FDATE aNewDate; - FTIME aNewTime; - - // create date and time words - aNewDate.day = rNewDateTime.GetDay(); - aNewDate.month = rNewDateTime.GetMonth(); - aNewDate.year = rNewDateTime.GetYear() - 1980; - aNewTime.twosecs = rNewDateTime.GetSec() / 2; - aNewTime.minutes = rNewDateTime.GetMin(); - aNewTime.hours = rNewDateTime.GetHour(); - - // set file date and time - FileInfoBuffer.fdateCreation = aNewDate; - FileInfoBuffer.ftimeCreation = aNewTime; - FileInfoBuffer.fdateLastAccess = aNewDate; - FileInfoBuffer.ftimeLastAccess = aNewTime; - FileInfoBuffer.fdateLastWrite = aNewDate; - FileInfoBuffer.ftimeLastWrite = aNewTime; - - DosSetFileInfo(hFile, 1, &FileInfoBuffer, sizeof(FileInfoBuffer)); - } - DosClose(hFile); - } -#endif - } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/fsys/os2.cxx b/tools/source/fsys/os2.cxx deleted file mode 100644 index 03f8f9eb46ce..000000000000 --- a/tools/source/fsys/os2.cxx +++ /dev/null @@ -1,1014 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define INCL_DOSEXCEPTIONS - -#include <stdlib.h> - -#ifdef __BORLANDC__ -#include <alloc.h> -#else -#include <malloc.h> -#endif -#include <tools/debug.hxx> -#include <tools/list.hxx> -#include <tools/bigint.hxx> -#include <tools/fsys.hxx> -#include "comdep.hxx" - -#ifdef OS2 -#ifndef _VOS_MUTEX_HXX //autogen -#include <vos/mutex.hxx> -#endif -#endif - -int Sys2SolarError_Impl( int nSysErr ); - -DECLARE_LIST( DirEntryList, DirEntry* ); -DECLARE_LIST( FSysSortList, FSysSort* ); -DECLARE_LIST( FileStatList, FileStat* ); - -static char sCaseMap[256]; -static BOOL bCaseMap = FALSE; -static BOOL bDriveMap = FALSE; - -struct DriveMapItem -{ - DirEntryKind nKind; - char cName; - FSysPathStyle nStyle; -}; - -void CreateCaseMapImpl(); -void CreateDriveMapImpl(); - -static DriveMapItem aDriveMap[26]; - -static BOOL bLastCaseSensitive = FALSE; - -//==================================================================== - -int ApiRet2ToSolarError_Impl( int nApiRet ) -{ - switch ( nApiRet ) - { - case NO_ERROR: return ERRCODE_NONE; - case ERROR_FILE_NOT_FOUND: return ERRCODE_IO_NOTEXISTS; - case ERROR_PATH_NOT_FOUND: return ERRCODE_IO_NOTEXISTSPATH; - case ERROR_TOO_MANY_OPEN_FILES: return ERRCODE_IO_TOOMANYOPENFILES; - case ERROR_ACCESS_DENIED: return ERRCODE_IO_ACCESSDENIED; - case ERROR_NOT_ENOUGH_MEMORY: return ERRCODE_IO_OUTOFMEMORY; - case ERROR_BAD_FORMAT: return ERRCODE_IO_WRONGFORMAT; - case ERROR_NOT_SAME_DEVICE: return ERRCODE_IO_INVALIDDEVICE; - case ERROR_WRITE_PROTECT: return ERRCODE_IO_INVALIDDEVICE; - case ERROR_BAD_UNIT: return ERRCODE_IO_INVALIDDEVICE; - case ERROR_CRC: return ERRCODE_IO_INVALIDDEVICE; - case ERROR_NOT_DOS_DISK: return ERRCODE_IO_INVALIDDEVICE; - case ERROR_WRITE_FAULT: return ERRCODE_IO_CANTWRITE; - case ERROR_READ_FAULT: return ERRCODE_IO_CANTREAD; - case ERROR_SHARING_VIOLATION: return ERRCODE_IO_LOCKVIOLATION; - case ERROR_LOCK_VIOLATION: return ERRCODE_IO_LOCKVIOLATION; - case ERROR_WRONG_DISK: return ERRCODE_IO_LOCKVIOLATION; - case ERROR_HANDLE_DISK_FULL: return ERRCODE_IO_OUTOFSPACE; - case ERROR_NOT_SUPPORTED: return ERRCODE_IO_NOTSUPPORTED; - case ERROR_DUP_NAME: return ERRCODE_IO_ALREADYEXISTS; - case ERROR_BAD_NETPATH: return ERRCODE_IO_NOTEXISTSPATH; - case ERROR_DEV_NOT_EXIST: return ERRCODE_IO_NOTEXISTS; - case ERROR_NETWORK_ACCESS_DENIED: return ERRCODE_IO_ACCESSDENIED; - case ERROR_INVALID_PARAMETER: return ERRCODE_IO_INVALIDPARAMETER; - case ERROR_NET_WRITE_FAULT: return ERRCODE_IO_CANTWRITE; - case ERROR_DEVICE_IN_USE: return ERRCODE_IO_INVALIDPARAMETER; - case ERROR_DISK_FULL: return ERRCODE_IO_OUTOFSPACE; - case ERROR_BAD_ARGUMENTS: return ERRCODE_IO_INVALIDPARAMETER; - case ERROR_BAD_PATHNAME: return ERRCODE_IO_NOTEXISTSPATH; - case ERROR_LOCK_FAILED: return ERRCODE_IO_LOCKVIOLATION; - case ERROR_LOCKED: return ERRCODE_IO_LOCKVIOLATION; - case ERROR_DUPLICATE_NAME: return ERRCODE_IO_ALREADYEXISTS; - case ERROR_DIRECTORY_IN_CDS: return ERRCODE_IO_LOCKVIOLATION; - case ERROR_CURRENT_DIRECTORY: return ERRCODE_IO_LOCKVIOLATION; - case ERROR_FILENAME_EXCED_RANGE: return ERRCODE_IO_NAMETOOLONG; - } - - DBG_TRACE1( "FSys: unknown apiret error %d occured", nApiRet ); - return FSYS_ERR_UNKNOWN; -} - -//-------------------------------------------------------------------- - -char* volumeid( const char* pPfad ) -{ - static FSINFO aFSInfoBuf; - ULONG ulFSInfoLevel = FSIL_VOLSER; - ULONG nDriveNumber; - - nDriveNumber = toupper(*pPfad) - 'A' + 1; - - if ( nDriveNumber >= 3 ) - { - APIRET rc = DosQueryFSInfo( - nDriveNumber, ulFSInfoLevel, &aFSInfoBuf, sizeof(FSINFO) ); - if ( rc ) - return 0; - return (char*) aFSInfoBuf.vol.szVolLabel; - } - return 0; -} - -//-------------------------------------------------------------------- - -/************************************************************************* -|* -|* DirEntry::ToAbs() -|* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 13:30 -|* -*************************************************************************/ - -BOOL DirEntry::ToAbs() -{ - DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); - - if ( FSYS_FLAG_VOLUME == eFlag ) - { - eFlag = FSYS_FLAG_ABSROOT; - return TRUE; - } - - if ( IsAbs() ) - return TRUE; - - char sBuf[_MAX_PATH + 1]; - *this = DirEntry( String( getcwd( sBuf, _MAX_PATH ), osl_getThreadTextEncoding() ) ) + *this; - - return IsAbs(); -} - -/************************************************************************* -|* -|* DirEntry::GetVolume() -|* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 04.03.92 -|* Letzte Aenderung MI 04.03.92 -|* -*************************************************************************/ - -String DirEntry::GetVolume() const -{ - DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); - - String aRet; - const DirEntry *pTop = ImpGetTopPtr(); - ByteString aName = ByteString( pTop->aName ).ToLowerAscii(); - - if ( ( pTop->eFlag == FSYS_FLAG_ABSROOT || - pTop->eFlag == FSYS_FLAG_RELROOT || - pTop->eFlag == FSYS_FLAG_VOLUME ) - && aName != "a:" && aName != "b:" && Exists() ) - { - const char *pVol; - pVol = volumeid( (char*) pTop->aName.GetBuffer() ); - if (pVol) - aRet = String( pVol, osl_getThreadTextEncoding()); - } - - return aRet; -} - -/************************************************************************* -|* -|* DirEntry::SetCWD() -|* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MI 21.05.92 -|* -*************************************************************************/ - -BOOL DirEntry::SetCWD( BOOL bSloppy ) const -{ - DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); - - if ( eFlag == FSYS_FLAG_CURRENT && !aName.Len() ) - return TRUE; - - if ( !chdir(ByteString(GetFull(), osl_getThreadTextEncoding()).GetBuffer()) ) - { - //nError = FSYS_ERR_OK; - return TRUE; - } - - if ( bSloppy && pParent && - !chdir(ByteString(pParent->GetFull(), osl_getThreadTextEncoding()).GetBuffer()) ) - { - //nError = FSYS_ERR_OK; - return TRUE; - } - - //nError = FSYS_ERR_NOTADIRECTORY; - return FALSE; -} - -/************************************************************************* -|* -|* DirEntry::MoveTo() -|* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 14:07 -|* -*************************************************************************/ - -#if 0 // YD see dirent.cxx -BOOL createLongNameEA( const PCSZ pszPath, ULONG ulAttributes, const String& aLongName ); - -FSysError DirEntry::MoveTo( const DirEntry& rDest ) const -{ - DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); - - DirEntry aTmpDest(rDest); - FileStat aTmpStat(aTmpDest); - if ( aTmpStat.IsKind(FSYS_KIND_DIR) ) - aTmpDest += DirEntry( GetName() ); - - String aSource( GetFull() ); - String aDest( aTmpDest.GetFull() ); - String aShortSource(""); - String aShortDest(""); - - if (Folder::IsAvailable()) - { - if (IsLongNameOnFAT()) - { - // in kurzen Pfad wandeln - ItemIDPath aItemIDPath(aSource); - aShortSource = aItemIDPath.GetHostNotationPath(); - } - if (rDest.IsLongNameOnFAT()) - { - // in kurzen Pfad wandeln - ItemIDPath aItemIDPath(aDest); - aShortDest = aItemIDPath.GetHostNotationPath(); - } - } - - APIRET nRet = DosMove( aShortSource.Len()>0?(PSZ)aShortSource.GetStr():(PSZ)aSource.GetStr(), - aShortDest.Len()>0?(PSZ)aShortDest.GetStr():(PSZ)aDest.GetStr()); - - if ( nRet == ERROR_DIRECTORY_IN_CDS || - nRet == ERROR_CURRENT_DIRECTORY ) - { - // 2nd chance with modified CWD - DosSetCurrentDir( (PSZ) "\\" ); - nRet = DosMove( aShortSource.Len()>0?(PSZ)aShortSource.GetStr():(PSZ)aSource.GetStr(), - aShortDest.Len()>0?(PSZ)aShortDest.GetStr():(PSZ)aDest.GetStr()); - } - else if ( nRet == ERROR_NOT_SAME_DEVICE ) - { - // other volume => copy+delete - FileCopier aMover( *this, rDest ); - nRet = aMover.Execute( FSYS_ACTION_MOVE|FSYS_ACTION_RECURSIVE ); - return nRet; - } - - if ( (nRet==NO_ERROR) && aShortDest.Len()>0) - { - createLongNameEA((const char*)aShortDest, FILE_NORMAL, rDest.GetName()); - } - - return ApiRet2ToSolarError_Impl( nRet ); -} -#endif // 0 - -//------------------------------------------------------------------------- - -USHORT DirReader_Impl::Init() -{ - // Block-Devices auflisten? - if ( pDir->eAttrMask & FSYS_KIND_BLOCK ) - { - CreateDriveMapImpl(); - // CWD merken - DirEntry aCurrentDir; - aCurrentDir.ToAbs(); - - // einzeln auf Existenz und Masken-konformit"at pr"ufen - USHORT nRead = 0; - char sDrive[3] = { '?', ':', 0 }; - char sRoot[4] = { '?', ':', '\\', 0 }; - for ( char c = 'a'; c <= 'z'; c++ ) - { - sDrive[0] = c; - sRoot[0] = c; - DirEntry* pDrive = new DirEntry( sDrive, FSYS_FLAG_VOLUME, FSYS_STYLE_HOST ); - if ( pDir->aNameMask.Matches( String( ByteString(sDrive), osl_getThreadTextEncoding())) - && aDriveMap[c-'a'].nKind != FSYS_KIND_UNKNOWN ) - { - if ( pDir->pStatLst ) //Status fuer Sort gewuenscht? - { - FileStat *pNewStat = new FileStat( *pDrive ); - pDir->ImpSortedInsert( pDrive, pNewStat ); - } - else - pDir->ImpSortedInsert( pDrive, NULL ); - ++nRead; - } - else - delete pDrive; - } - - // CWD restaurieren - aCurrentDir.SetCWD(); - return nRead; - } - - return 0; -} - -//------------------------------------------------------------------------- - -USHORT DirReader_Impl::Read() -{ - if (!pDosDir) - { - pDosDir = opendir( (char*) ByteString(aPath, osl_getThreadTextEncoding()).GetBuffer() ); - } - - if (!pDosDir) - { - bReady = TRUE; - return 0; - } - - // Directories und Files auflisten? - if ( ( pDir->eAttrMask & FSYS_KIND_DIR || pDir->eAttrMask & FSYS_KIND_FILE ) && - ( ( pDosEntry = readdir( pDosDir ) ) != NULL ) ) - { - String aD_Name(pDosEntry->d_name, osl_getThreadTextEncoding()); - if ( pDir->aNameMask.Matches( aD_Name ) ) - { - DirEntryFlag eFlag = - 0 == strcmp( pDosEntry->d_name, "." ) ? FSYS_FLAG_CURRENT - : 0 == strcmp( pDosEntry->d_name, ".." ) ? FSYS_FLAG_PARENT - : FSYS_FLAG_NORMAL; - DirEntry *pTemp = new DirEntry( ByteString(pDosEntry->d_name), eFlag, FSYS_STYLE_UNX ); - if ( pParent ) - pTemp->ImpChangeParent( new DirEntry( *pParent ), FALSE); - FileStat aStat( *pTemp ); - if ( ( ( ( pDir->eAttrMask & FSYS_KIND_DIR ) && - ( aStat.IsKind( FSYS_KIND_DIR ) ) ) || - ( ( pDir->eAttrMask & FSYS_KIND_FILE ) && - !( aStat.IsKind( FSYS_KIND_DIR ) ) ) ) && - !( pDir->eAttrMask & FSYS_KIND_VISIBLE && - pDosEntry->d_name[0] == '.' ) ) - { - if ( pDir->pStatLst ) //Status fuer Sort gewuenscht? - pDir->ImpSortedInsert( pTemp, new FileStat( aStat ) ); - else - pDir->ImpSortedInsert( pTemp, NULL );; - return 1; - } - else - delete pTemp; - } - } - else - bReady = TRUE; - return 0; -} - -/************************************************************************* -|* -|* FileStat::FileStat() -|* -|* Beschreibung FSYS.SDW -|* Ersterstellung MA 05.11.91 -|* Letzte Aenderung MA 07.11.91 -|* -*************************************************************************/ - -FileStat::FileStat( const void *pInfo, // struct dirent - const void * ): // dummy - aDateCreated(0), - aTimeCreated(0), - aDateModified(0), - aTimeModified(0), - aDateAccessed(0), - aTimeAccessed(0) -{ - struct dirent *pDirent = (struct dirent*) pInfo; - - nSize = pDirent->d_size; - - aDateCreated = MsDos2Date( (FDATE*) &pDirent->d_date ); - aTimeCreated = MsDos2Time( (FTIME*) &pDirent->d_time ); - aDateModified = aDateModified; - aTimeModified = aTimeModified; - aDateAccessed = aDateModified; - aTimeAccessed = aTimeModified; - - nKindFlags = FSYS_KIND_FILE; - if ( pDirent->d_type & DOS_DIRECT ) - nKindFlags = FSYS_KIND_DIR; -} - -/************************************************************************* -|* -|* FileStat::Update() -|* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 11.06.91 -|* Letzte Aenderung MA 07.11.91 -|* -*************************************************************************/ - -struct _FSYS_FSQBUFFER -{ - FSQBUFFER2 aBuf; - UCHAR sBuf[256]; -}; - -BOOL FileStat::Update( const DirEntry& rDirEntry, BOOL bAccessRemovableDevice ) -{ - nSize = 0; - FSysPathStyle eStyle = FSYS_STYLE_UNKNOWN; - aCreator.Erase(); - aType.Erase(); - aDateCreated = Date(0); - aTimeCreated = Time(0); - aDateModified = Date(0); - aTimeModified = Time(0); - aDateAccessed = Date(0); - aTimeAccessed = Time(0); - - if ( !rDirEntry.IsValid() ) - { - nError = FSYS_ERR_NOTEXISTS; - return FALSE; - } - - // Sonderbehandlung falls es sich um eine Root ohne Laufwerk handelt - if ( !rDirEntry.aName.Len() && rDirEntry.eFlag == FSYS_FLAG_ABSROOT ) - { - nKindFlags = FSYS_KIND_DIR; - nError = FSYS_ERR_OK; - return TRUE; - } - - // Sonderbehandlung falls es sich um eine Wildcard handelt - ByteString aTempName( rDirEntry.GetName(), osl_getThreadTextEncoding() ); - if ( strchr( aTempName.GetBuffer(), '?' ) || - strchr( aTempName.GetBuffer(), '*' ) || - strchr( aTempName.GetBuffer(), ';' ) ) - { - nKindFlags = FSYS_KIND_WILD; - nError = FSYS_ERR_OK; - return TRUE; - } - - // Sonderbehandlung falls es sich um eine Root handelt - if ( rDirEntry.eFlag == FSYS_FLAG_VOLUME || - rDirEntry.eFlag == FSYS_FLAG_ABSROOT ) - { - if ( rDirEntry.eFlag == FSYS_FLAG_VOLUME ) - nKindFlags = FSYS_KIND_DEV; - else - nKindFlags = FSYS_KIND_DIR; - - if ( rDirEntry.aName.Len() == 2 ) - { - if ( !bDriveMap ) - CreateDriveMapImpl(); - - ByteString rDirEntryUpperCase = ByteString( rDirEntry.aName ).ToUpperAscii(); - DriveMapItem &rItem = aDriveMap[rDirEntryUpperCase.GetChar(0) - 'A']; - if ( !rItem.nKind ) - { - nError = ERRCODE_IO_INVALIDDEVICE; - nKindFlags = FSYS_KIND_UNKNOWN; - return FALSE; - } - else - { - if ( rDirEntry.eFlag == FSYS_FLAG_VOLUME ) - nKindFlags |= FSYS_KIND_BLOCK | rItem.nKind; - eStyle = rItem.nStyle; - } - } - - nError = FSYS_ERR_OK; - return TRUE; - } - - // disable error-boxes for hard-errors - DosError(FERR_DISABLEHARDERR); - - // Statusinformation vom Betriebssystem holen - DirEntry aTempDirEntry( rDirEntry ); - char* p; - - aTempDirEntry.ToAbs(); - ByteString aFullName( aTempDirEntry.GetFull(), osl_getThreadTextEncoding() ); - -#if 0 // YD - if (Folder::IsAvailable() && aTempDirEntry.IsLongNameOnFAT()) - { - // in String mit kurzem Pfad wandeln - ItemIDPath aItemIDPath(aTempDirEntry.GetFull()); - aFullName = ByteString( aItemIDPath.GetHostNotationPath(), osl_getThreadTextEncoding() ); - } -#endif - - p = (char *) aFullName.GetBuffer(); - - FILESTATUS3 filestat; - memset( &filestat, 0, sizeof( filestat ) ); - if( DosQueryPathInfo( (PSZ)p, 1, &filestat, sizeof( filestat ) ) ) - { - nError = FSYS_ERR_NOTEXISTS; - nKindFlags = FSYS_KIND_UNKNOWN; - return FALSE; - } - - nError = FSYS_ERR_OK; - nSize = filestat.cbFile; - - nKindFlags = FSYS_KIND_UNKNOWN; - if( filestat.attrFile & FILE_DIRECTORY ) - nKindFlags |= FSYS_KIND_DIR; - if ( nKindFlags == FSYS_KIND_UNKNOWN ) - nKindFlags = nKindFlags | FSYS_KIND_FILE; - - aDateModified = Date( filestat.fdateLastWrite.day, - filestat.fdateLastWrite.month, - filestat.fdateLastWrite.year + 1980 ); - - aTimeModified = Time( filestat.ftimeLastWrite.hours, - filestat.ftimeLastWrite.minutes, - filestat.ftimeLastWrite.twosecs*2 ); - - if ( filestat.fdateCreation.day ) - { - aDateCreated = Date( filestat.fdateCreation.day, - filestat.fdateCreation.month, - filestat.fdateCreation.year + 1980 ); - - aTimeCreated = Time( filestat.ftimeCreation.hours, - filestat.ftimeCreation.minutes, - filestat.ftimeCreation.twosecs*2 ); - } - else - { - aDateCreated = aDateModified; - aTimeCreated = aTimeModified; - } - - if ( filestat.fdateLastAccess.day > 0 ) - { - aDateAccessed = Date( filestat.fdateLastAccess.day, - filestat.fdateLastAccess.month, - filestat.fdateLastAccess.year + 1980 ); - - aTimeAccessed = Time( filestat.ftimeLastAccess.hours, - filestat.ftimeLastAccess.minutes, - filestat.ftimeLastAccess.twosecs*2 ); - } - else - { - aDateAccessed = aDateModified; - aTimeAccessed = aTimeModified; - } - - return TRUE; -} - -BOOL IsRedirectable_Impl( const ByteString &rPath ) -{ - if ( rPath.Len() >= 3 && ':' == rPath.GetBuffer()[1] ) - { - ByteString aVolume = rPath.Copy( 0, 3 ); - DriveMapItem &rItem = aDriveMap[toupper(aVolume.GetChar(0)) - 'A']; - return FSYS_KIND_FIXED != rItem.nKind; - } - return FALSE; -} - -#if 0 -BOOL IsRedirectable_Impl( const String &rPath ) -{ - if ( rPath.Len() >= 3 && ':' == rPath.GetStr()[1] ) - { - DriveMapItem &rItem = aDriveMap[toupper(rPath[0]) - 'A']; - return FSYS_KIND_FIXED != rItem.nKind; - } - return FALSE; -} -#endif - - -/************************************************************************* -|* -|* TempDirImpl() -|* -|* Beschreibung liefert den Namens des Directories fuer temporaere -|* Dateien -|* Ersterstellung MI 16.03.94 -|* Letzte Aenderung MI 16.03.94 -|* -*************************************************************************/ - -const char* TempDirImpl( char *pBuf ) -{ - PSZ pVar; - USHORT nRet; - BOOL bAppendTemp = FALSE; // mu\s noch \\temp angeh"angt werden - - // Erstmal sehen, ob TEMP oder TMP gesetzt sind - nRet = DosScanEnv( (PSZ)"TEMP", &pVar ); - if( nRet ) - nRet = DosScanEnv( (PSZ)"temp", &pVar ); - if( nRet ) - nRet = DosScanEnv( (PSZ)"TMP", &pVar ); - if( nRet ) - nRet = DosScanEnv( (PSZ)"tmp", &pVar ); - if( nRet ) - nRet = DosScanEnv( (PSZ)"TMPDIR", &pVar ); - - // falls das geklappt hat, und ein Backslash dranhaengt, - // oder falls es bisher nicht geklappt hat, - // muessen wir nachher einen Backslash entfernen - BOOL bRemoveBS = nRet || *(pVar+strlen(pVar)-1) == '\\'; - - // Keine temp-Variable gefunden, dann gehen wir mal auf die Suche - // nach dem System-Laufwerk - if( nRet ) - { - nRet = DosScanEnv( (PSZ)"USER_INI",&pVar ); - bAppendTemp = (0 == nRet); - } - if( nRet ) - { - nRet = DosScanEnv( (PSZ)"SYSTEM_INI", &pVar ); - bAppendTemp = (0 == nRet); - } - if( nRet ) - // Wenn das immer noch nicht reicht nehmen wir eben die Root von C: -#ifdef __BORLANDC__ - pVar = (PSZ)"c:\\temp\\"; -#else - pVar = (PCSZ)"c:\\temp\\"; -#endif - strcpy( pBuf, (const char*)pVar ); - - // jetzt haengt ggf. ein Backlash dran, den wir abschneiden, - // ggf. inklusive dahinter haengendem Dateinamen - if ( bRemoveBS ) - { - char *pTail = pBuf + strlen(pBuf) - 1; - for ( char cLast = *pTail; cLast != '\\'; cLast = *(--pTail) ) - *pTail = 0; - } - - if ( bAppendTemp ) - strcat( pBuf, "\\temp" ); - DirEntry( pBuf ).MakeDir(); - - return pBuf; -} - -#define CURRENT_COUNTRY 0 -#define NLS_CODEPAGE 850 - -/*==================================================================== - * CreateCaseMapImpl() - * creates a map of each character to convert to lower - *--------------------------------------------------------------------*/ - -#if 0 -void CreateCaseMapImpl() -{ - // build a string starting with code 0 as first character upto 255 - char sTemp[256]; - USHORT n; - - for ( n = 0; n < 256; ++n ) - sTemp[n] = (char) n; - - // convert string to upper case - COUNTRYCODE aCountry; - aCountry.country = CURRENT_COUNTRY; /* Country code */ - aCountry.codepage = NLS_CODEPAGE; /* Code page */ - DosMapCase( 255, &aCountry, sTemp+1 ); - - // fill a global buffer starting with code 0 as first character upto 255 - for ( n = 0; n < 256; ++n ) - sCaseMap[n] = (char) n; - - // reorder by upper-code and store in a global buffer - for ( n = 255; n > 0; --n ) - // was this character converted? - if ( sTemp[n] != (char) n ) - // we found a convertion from upper to lower - sCaseMap[ (unsigned char) sTemp[n] ] = (char) n; - - bCaseMap = TRUE; -} - -String ToLowerImpl( const String& rSource ) -{ - if ( !bCaseMap ) - CreateCaseMapImpl(); - - // TH sagt: International ist zu langsam, also mit einer eigenen Map - ByteString aLower( rSource ); - for ( USHORT n = 0; n < aLower.Len(); ++n ) - aLower[n] = sCaseMap[ (unsigned char) aLower[n] ]; - return aLower; -} -#endif // 0 - -/*==================================================================== - * CreateDriveMapImpl() - * creates a map of drive-infos like FileSystem (style) and Kind (remote) - *--------------------------------------------------------------------*/ -typedef struct _FSQBUFFER_ -{ - FSQBUFFER2 aBuf; - UCHAR sBuf[64]; -} FSQBUFFER_; - -void CreateDriveMapImpl() -{ -#ifdef POWERPC - // !!!!! Hack, da der untere Teil mit Beta 2 noch abstuertzt !!!!! - BYTE nFloppies = 1; - for ( USHORT nDrive = 0; nDrive < 26; ++nDrive ) - { - if ( nDrive < nFloppies ) - { - aDriveMap[nDrive].nKind = FSYS_KIND_REMOVEABLE; - aDriveMap[nDrive].nStyle = FSYS_STYLE_FAT; - } - else - { - aDriveMap[nDrive].nKind = FSYS_KIND_UNKNOWN; - aDriveMap[nDrive].nStyle = FSYS_STYLE_UNKNOWN; - } - } - - aDriveMap[2].nKind = FSYS_KIND_FIXED; - aDriveMap[2].nStyle = FSYS_STYLE_FAT; -#else - FSQBUFFER_ aBuf; - ULONG nBufLen; - APIRET nRet; - USHORT nDrive; - - // disable error-boxes for hard-errors - DosError(FERR_DISABLEHARDERR); - - // determine number of floppy-drives - BYTE nFloppies; - nRet = DosDevConfig( (void*) &nFloppies, DEVINFO_FLOPPY ); - - // reset the map - for ( nDrive = 0; nDrive < 26; ++nDrive ) - { - if ( nDrive < nFloppies ) - { - aDriveMap[nDrive].nKind = FSYS_KIND_REMOVEABLE; - aDriveMap[nDrive].nStyle = FSYS_STYLE_FAT; - } - else - { - aDriveMap[nDrive].nKind = FSYS_KIND_UNKNOWN; - aDriveMap[nDrive].nStyle = FSYS_STYLE_UNKNOWN; - } - } - - // determine file-system via DosOpen/DocDevIOCtrl - for ( nDrive = 2; nDrive < 26; ++nDrive ) - { - // open drive - BOOL bFixed; - HFILE nDevHandle; - char pDriveName[3] = "#:"; - pDriveName[0] = nDrive+'a'; - ULONG nAction; - nRet = DosOpen( (PSZ) pDriveName, &nDevHandle, - &nAction, 0, 0, OPEN_ACTION_OPEN_IF_EXISTS, - OPEN_FLAGS_DASD|OPEN_SHARE_DENYNONE|OPEN_ACCESS_READONLY, - 0 ); - - // exists? - if ( !nRet ) - { - // removeable? - BYTE nDriveId = nDrive; - ULONG nParaOutLen, nDataOutLen; - nRet = DosDevIOCtl(nDevHandle, 8, 0x20, - &nDriveId, sizeof(nDriveId), &nParaOutLen, - &bFixed, sizeof(bFixed), &nDataOutLen ); - - // prepare the drive-map - if ( !nRet && !bFixed ) - aDriveMap[nDrive].nKind = FSYS_KIND_REMOVEABLE; - - // close drive - DosClose(nDevHandle); - } - else if ( nRet == ERROR_NOT_READY ) - aDriveMap[nDrive].nKind = FSYS_KIND_REMOVEABLE | FSYS_KIND_CDROM; - } - - // determine file-system via FSAttach - nRet = 0; - for ( USHORT n = 3; nRet != ERROR_NO_MORE_ITEMS; ++n ) - { - nBufLen = sizeof( aBuf ); - nRet = DosQueryFSAttach( 0, n, FSAIL_DRVNUMBER, - (_FSQBUFFER2*) &aBuf, &nBufLen ); - if ( !nRet ) - { - nDrive = toupper(aBuf.aBuf.szName[0]) - 'A'; - - if ( aDriveMap[nDrive].nKind == FSYS_KIND_UNKNOWN ) - aDriveMap[nDrive].nKind = - aBuf.aBuf.iType == 3 ? FSYS_KIND_FIXED : - aBuf.aBuf.iType == 4 ? FSYS_KIND_REMOTE : - FSYS_KIND_UNKNOWN; - - char *pType = (char*)(aBuf.aBuf.szName + aBuf.aBuf.cbName + 1); - aDriveMap[nDrive].nStyle = - strcmp( pType, "FAT" ) == 0 ? FSYS_STYLE_FAT : - strcmp( pType, "FAT32" ) == 0 ? FSYS_STYLE_VFAT : - strcmp( pType, "NTFS" ) == 0 ? FSYS_STYLE_NTFS : - strcmp( pType, "HPFS" ) == 0 ? FSYS_STYLE_HPFS : - strcmp( pType, "JFS" ) == 0 ? FSYS_STYLE_HPFS : - strcmp( pType, "RAMFS" ) == 0 ? FSYS_STYLE_HPFS : - strcmp( pType, "NDFS32" ) == 0 ? FSYS_STYLE_HPFS : - strcmp( pType, "NWFS" ) == 0 ? FSYS_STYLE_NWFS : - strcmp( pType, "EXT2" ) == 0 ? FSYS_STYLE_UNX : - strcmp( pType, "NFS" ) == 0 ? FSYS_STYLE_UNX : - FSYS_STYLE_UNKNOWN; - if ( strcmp( pType, "CDFS" ) == 0 ) - aDriveMap[nDrive].nKind = FSYS_KIND_CDROM|FSYS_KIND_REMOVEABLE; - } - } -#endif - - bDriveMap = TRUE; -} - -Time MsDos2Time( const time_t *pTimeT ) -{ - tm *pTm = localtime( pTimeT ); - if ( pTm ) - return Time( pTm->tm_hour, pTm->tm_min, pTm->tm_sec ); - else - return Time(0); -} - -Date MsDos2Date( const time_t *pTimeT ) -{ - tm *pTm = localtime( pTimeT ); - if ( pTm ) - return Date( pTm->tm_mday, pTm->tm_mon + 1, pTm->tm_year ); - else - return Date(0); -} - -/************************************************************************* -|* -|* DirEntry::GetPathStyle() const -|* -|* Beschreibung -|* Ersterstellung MI 11.05.95 -|* Letzte Aenderung MI 11.05.95 -|* -*************************************************************************/ - -FSysPathStyle DirEntry::GetPathStyle( const String &rDevice ) -{ - ByteString aRootDir(rDevice, osl_getThreadTextEncoding()); - // UNC-Pathname? - if ( aRootDir.Len()==0 || ( aRootDir.Len() > 1 && aRootDir.GetChar(1) != ':' ) ) - return FSYS_STYLE_UNKNOWN; - - if ( !bDriveMap ) - CreateDriveMapImpl(); - return aDriveMap[toupper(aRootDir.GetChar(0)) - 'A'].nStyle; -} - -/************************************************************************* -|* -|* DirEntry::IsCaseSensitive() const -|* -|* Beschreibung -|* Ersterstellung TPF 26.02.1999 -|* Letzte Aenderung -|* -*************************************************************************/ - -BOOL DirEntry::IsCaseSensitive( FSysPathStyle eFormatter ) const -{ - if (eFormatter==FSYS_STYLE_HOST) - { - if (GetPathStyle(GetDevice().GetName()) == FSYS_STYLE_UNX) - { - return TRUE; - } - else - { - return FALSE; - } - } - else - { - BOOL isCaseSensitive = FALSE; // ich bin unter OS2, also ist der default im Zweifelsfall case insensitiv - switch ( eFormatter ) - { - case FSYS_STYLE_MAC: - case FSYS_STYLE_FAT: - case FSYS_STYLE_VFAT: - case FSYS_STYLE_NTFS: - case FSYS_STYLE_NWFS: - case FSYS_STYLE_HPFS: - case FSYS_STYLE_DETECT: - { - isCaseSensitive = FALSE; - break; - } - case FSYS_STYLE_SYSV: - case FSYS_STYLE_BSD: - { - isCaseSensitive = TRUE; - break; - } - default: - { - isCaseSensitive = FALSE; // ich bin unter OS2, also ist der default im Zweifelsfall case insensitiv - break; - } - } - return isCaseSensitive; - } -} - - - - -//========================================================================= - -ErrCode FileStat::QueryDiskSpace( const String &rPath, - BigInt &rFreeBytes, BigInt &rTotalBytes ) -{ - FSALLOCATE aFSInfoBuf; - ByteString aVol( DirEntry(rPath).ImpGetTopPtr()->GetName(), osl_getThreadTextEncoding()); - ULONG nDriveNumber = toupper( aVol.GetChar(0) ) - 'A' + 1; - - APIRET rc = DosQueryFSInfo( nDriveNumber, FSIL_ALLOC, - &aFSInfoBuf, sizeof(aFSInfoBuf) ); - if ( rc ) - return Sys2SolarError_Impl( rc ); - - BigInt aBytesPerCluster( BigInt(aFSInfoBuf.cbSector) * - BigInt(aFSInfoBuf.cSectorUnit) ); - rFreeBytes = aBytesPerCluster * BigInt(aFSInfoBuf.cUnitAvail); - rTotalBytes = aBytesPerCluster * BigInt(aFSInfoBuf.cUnit); - return 0; -} - -//========================================================================= - -void FSysEnableSysErrorBox( BOOL bEnable ) -{ - DosError( bEnable ? 0 : FERR_DISABLEHARDERR ); -} - diff --git a/tools/source/fsys/os2.hxx b/tools/source/fsys/os2.hxx deleted file mode 100644 index c5e54ba0ad47..000000000000 --- a/tools/source/fsys/os2.hxx +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _os2_hxx -#define _os2_hxx - - -#define INCL_DOSEXCEPTIONS -#define INCL_DOSFILEMGR -#define INCL_DOSPROCESS -#define INCL_DOSDEVICES -#define INCL_DOSERRORS -#define INCL_DOSMISC -#define INCL_DOSNLS /* National Language Support values */ -#include <svpm.h> - -#include <dirent.h> -#include <string.h> - -#include <sys\types.h> -#include <sys\stat.h> -#include <stdio.h> -#include <ctype.h> -#include <emx/syscalls.h> - -#define FSYS_UNIX FALSE - -#define DOS_DIRECT _A_SUBDIR -#define DOS_VOLUMEID _A_VOLID - -#define _mkdir(p) mkdir(p, 0777) - -const char* TempDirImpl( char *pBuf ); -String ToLowerImpl( const String& ); - -#define DEFSTYLE FSYS_STYLE_OS2 -#define MKDIR( p ) mkdir( (unsigned char*) p ) -#define CMP_LOWER(s) ( s.ToLowerAscii() ) - -#define START_DRV 'a' - -inline BOOL DRIVE_EXISTS( char c ) -{ - ULONG nCur, nMap; - APIRET nRet = DosQueryCurrentDisk( &nCur, &nMap ); - return ( nMap & 1 << (c - 'a') ) != 0; -} - -#include <time.h> -//#include <datetime.hxx> - -inline Time MsDos2Time( FTIME* aTime ) -{ - return Time( aTime->hours, aTime->minutes, 2*aTime->twosecs ); -} - -inline Date MsDos2Date( FDATE* aDate ) -{ - return Date( aDate->day, aDate->month, aDate->year ); -} - -Time MsDos2Time( const time_t *pTimeT ); - -Date MsDos2Date( const time_t *pTimeT ); - -#define FSysFailOnErrorImpl() - -#endif - diff --git a/tools/source/fsys/tdir.cxx b/tools/source/fsys/tdir.cxx index c0ebe64114b8..6d16a5ed605a 100755..100644 --- a/tools/source/fsys/tdir.cxx +++ b/tools/source/fsys/tdir.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,20 +35,12 @@ #include <cstdarg> #include <limits.h> #include <tools/debug.hxx> -#include <tools/list.hxx> -#ifndef _COMPED_HXX #include "comdep.hxx" -#endif #include <tools/fsys.hxx> - DBG_NAME( Dir ) -DECLARE_LIST( DirEntryList, DirEntry* ) -DECLARE_LIST( FSysSortList, FSysSort* ) -DECLARE_LIST( FileStatList, FileStat* ) - #define APPEND (sal_uInt16) 65535 /************************************************************************* @@ -55,28 +48,26 @@ DECLARE_LIST( FileStatList, FileStat* ) |* Dir::InsertPointReached() |* |* Beschreibung stellt fest, ob eingefuegt werden musz -|* Ersterstellung MA 05.11.91 -|* Letzte Aenderung MI 05.02.92 |* *************************************************************************/ sal_Bool Dir::ImpInsertPointReached( const DirEntry& rNewEntry, const FileStat& rNewStat, - sal_uIntPtr nCurPos, sal_uIntPtr nSortIndex ) const + size_t nCurPos, size_t nSortIndex ) const { #define VALUE( nKindFlags ) \ ( ( FSYS_KIND_FILE | FSYS_KIND_DIR | FSYS_KIND_DEV | \ FSYS_KIND_CHAR | FSYS_KIND_BLOCK ) & nKindFlags ) // einfache Dinge erfordern einfache Loesungen - if ( !pLst->Count() ) + if ( pLst->empty() ) return sal_True; - FSysSort nSort = *( pSortLst->GetObject( nSortIndex ) ); + FSysSort nSort = (*pSortLst)[ nSortIndex ]; FileStat *pOldStat = NULL; - DirEntry *pCurLstObj = pLst->GetObject( nCurPos ); + DirEntry *pCurLstObj = (*pLst)[ nCurPos ]; if ( pStatLst ) - pOldStat = pStatLst->GetObject( nCurPos ); + pOldStat = (*pStatLst)[ nCurPos ]; switch( nSort ) { @@ -196,7 +187,7 @@ sal_Bool Dir::ImpInsertPointReached( const DirEntry& rNewEntry, default: /* Kann nicht sein */; } - if ( nSortIndex == ( pSortLst->Count() - 1 ) ) + if ( nSortIndex == ( pSortLst->size() - 1 ) ) return sal_True; else //Rekursion @@ -210,8 +201,6 @@ sal_Bool Dir::ImpInsertPointReached( const DirEntry& rNewEntry, |* Dir::ImpSortedInsert() |* |* Beschreibung fuegt sortiert ein -|* Ersterstellung MA 05.11.91 -|* Letzte Aenderung MA 03.12.91 |* *************************************************************************/ @@ -219,25 +208,29 @@ void Dir::ImpSortedInsert( const DirEntry *pNewEntry, const FileStat *pNewStat ) { //Sonderfall, keine Sortierung gewuenscht. if ( !pSortLst ) { - pLst->Insert( (DirEntry*)pNewEntry, APPEND ); + pLst->push_back( (DirEntry*)pNewEntry ); return; } - pLst->First(); - do { - if ( ImpInsertPointReached( *pNewEntry, *pNewStat, pLst->GetCurPos(), - (sal_uIntPtr)0 ) ) + for ( size_t i = 0, n = pLst->size(); i < n; ++i ) + { + if ( ImpInsertPointReached( *pNewEntry, *pNewStat, i, 0 ) ) { - if ( pStatLst ) - pStatLst->Insert( (FileStat*)pNewStat, pLst->GetCurPos() ); - pLst->Insert( (DirEntry*)pNewEntry ); + if ( pStatLst ) { + FileStatList::iterator it = pStatLst->begin(); + ::std::advance( it, i ); + pStatLst->insert( it, (FileStat*)pNewStat ); + } + DirEntryList::iterator it = pLst->begin(); + ::std::advance( it, i ); + pLst->insert( it, (DirEntry*)pNewEntry ); return; } - } while( pLst->Next() ); + } if ( pStatLst ) - pStatLst->Insert( (FileStat*)pNewStat, APPEND ); - pLst->Insert( (DirEntry*)pNewEntry, APPEND ); + pStatLst->push_back( (FileStat*)pNewStat ); + pLst->push_back( (DirEntry*)pNewEntry ); } /************************************************************************* @@ -245,8 +238,6 @@ void Dir::ImpSortedInsert( const DirEntry *pNewEntry, const FileStat *pNewStat ) |* Dir::Construct() |* |* Beschreibung gemeinsame Implementation der Ctoren -|* Ersterstellung MI 02.06.93 -|* Letzte Aenderung MI 02.06.93 |* *************************************************************************/ @@ -259,7 +250,7 @@ void Dir::Construct( DirEntryKind nKindFlags ) ByteString aTempName( GetName(), osl_getThreadTextEncoding() ); if ( aTempName.Search( "*" ) != STRING_NOTFOUND || aTempName.Search( "?" ) != STRING_NOTFOUND ) -#if defined( WNT ) && !defined( WTC ) +#if defined( WNT ) { ByteString aTStr(CutName(), osl_getThreadTextEncoding()); char* pBuffer = new char[aTStr.Len()+1]; @@ -279,10 +270,6 @@ void Dir::Construct( DirEntryKind nKindFlags ) |* |* Dir::Update() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 16.05.91 -|* Letzte Aenderung MI 19.09.96 -|* *************************************************************************/ sal_Bool Dir::Update() @@ -295,10 +282,6 @@ sal_Bool Dir::Update() |* |* Dir::Reset() |* -|* Beschreibung -|* Ersterstellung MI 22.10.96 -|* Letzte Aenderung MI 22.10.96 -|* *************************************************************************/ void Dir::Reset() @@ -310,14 +293,10 @@ void Dir::Reset() // alle DirEntries aus der Liste entfernen und deren Speicher freigeben if ( pLst ) { - DirEntry* pEntry = pLst->First(); - while (pEntry) - { - DirEntry* pNext = pLst->Next(); - delete pEntry; - pEntry = pNext; + for ( size_t i = 0, n = pLst->size(); i < n; ++i ) { + delete (*pLst)[ i ]; } - pLst->Clear(); + pLst->clear(); } else pLst = new DirEntryList(); @@ -325,29 +304,27 @@ void Dir::Reset() // Alte File-Stat's Loeschen if ( pStatLst ) { - //Erstmal die alten Loeschen - FileStat* pEntry = pStatLst->First(); - while (pEntry) - { - FileStat* pNext = pStatLst->Next(); - delete pEntry; - pEntry = pNext; + for ( size_t i = 0, n = pStatLst->size(); i < n; ++i ) { + delete (*pStatLst)[ i ]; } - pStatLst->Clear(); + pStatLst->clear(); delete pStatLst; + pStatLst = NULL; } // Verlangen die Sortierkriterien FileStat's? if ( pSortLst ) { - pSortLst->First(); - do - { - if ( *( pSortLst->GetCurObject() ) & - ( FSYS_SORT_KIND | FSYS_SORT_SIZE | - FSYS_SORT_CREATED | FSYS_SORT_MODIFYED | FSYS_SORT_ACCESSED ) ) + for ( size_t i = 0, n = pSortLst->size(); i < n; ++i ) { + if ( (*pSortLst)[ i ] + & ( FSYS_SORT_KIND | FSYS_SORT_SIZE | FSYS_SORT_CREATED + | FSYS_SORT_MODIFYED | FSYS_SORT_ACCESSED + ) + ) { pStatLst = new FileStatList(); - } while ( !pStatLst && pSortLst->Next() ); + break; + } + } } #ifndef BOOTSTRAP @@ -357,7 +334,7 @@ void Dir::Reset() #endif // gibt es das zu oeffnende Verzeichnis ueberhaupt? -#if !defined(UNX) && !defined(OS2) //explanation: see DirReader_Impl::Read() in unx.cxx +#if !defined(UNX) //explanation: see DirReader_Impl::Read() in unx.cxx if( !pReader->pDosDir ) { nError = FSYS_ERR_NOTADIRECTORY; @@ -371,10 +348,6 @@ void Dir::Reset() |* |* Dir::Scan() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 18.09.96 -|* Letzte Aenderung MI 19.09.96 -|* *************************************************************************/ sal_uInt16 Dir::Scan( sal_uInt16 nCount ) @@ -387,7 +360,7 @@ sal_uInt16 Dir::Scan( sal_uInt16 nCount ) if ( pReader ) { // frischer Reader? - if ( !pLst->Count() ) + if ( pLst->empty() ) { // dann ggf. Laufwerke scannen pReader->bInUse = sal_True; @@ -411,10 +384,6 @@ sal_uInt16 Dir::Scan( sal_uInt16 nCount ) |* |* Dir::Dir() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 16.05.91 -|* Letzte Aenderung MI 04.03.92 -|* *************************************************************************/ Dir::Dir( const DirEntry& rDirEntry, DirEntryKind nKindFlags, FSysSort nSort, ... ): @@ -436,10 +405,6 @@ Dir::Dir( const DirEntry& rDirEntry, DirEntryKind nKindFlags, FSysSort nSort, .. |* |* Dir::Dir() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 02.06.93 -|* Letzte Aenderung MI 02.06.93 -|* *************************************************************************/ Dir::Dir( const DirEntry& rDirEntry, DirEntryKind nKindFlags ): @@ -456,10 +421,6 @@ Dir::Dir( const DirEntry& rDirEntry, DirEntryKind nKindFlags ): |* |* Dir::Dir() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 16.05.91 -|* Letzte Aenderung MA 04.11.91 -|* *************************************************************************/ Dir::Dir(): @@ -478,10 +439,6 @@ Dir::Dir(): |* |* Dir::~Dir() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 16.05.91 -|* Letzte Aenderung MA 04.11.91 -|* *************************************************************************/ Dir::~Dir() @@ -491,44 +448,27 @@ Dir::~Dir() // alle DirEntries aus der Liste entfernen und deren Speicher freigeben if ( pLst ) { - DirEntry* pEntry = pLst->First(); - while (pEntry) - { - DirEntry* pNext = pLst->Next(); - delete pEntry; - pEntry = pNext; + for ( size_t i = 0, n = pLst->size(); i < n; ++i ) { + delete (*pLst)[ i ]; } - pLst->Clear(); - + pLst->clear(); delete pLst; } // alle Sorts aus der Liste entfernen und deren Speicher freigeben if ( pSortLst ) { - FSysSort* pEntry = pSortLst->First(); - while (pEntry) - { - FSysSort* pNext = pSortLst->Next(); - delete pEntry; - pEntry = pNext; - } - pSortLst->Clear(); - + pSortLst->clear(); delete pSortLst; } // alle FileStat's aus der Liste entfernen und deren Speicher freigeben if ( pStatLst ) { - FileStat* pEntry = pStatLst->First(); - while (pEntry) - { - FileStat* pNext = pStatLst->Next(); - delete pEntry; - pEntry = pNext; + for ( size_t i = 0, n = pStatLst->size(); i < n; ++i ) { + delete (*pStatLst)[ i ]; } - pStatLst->Clear(); + pStatLst->clear(); delete pStatLst; } @@ -540,27 +480,23 @@ Dir::~Dir() |* |* Dir::ImpSetSort() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MA 04.11.91 -|* Letzte Aenderung MI 05.02.92 -|* *************************************************************************/ FSysError Dir::ImpSetSort( std::va_list pArgs, int nFirstSort ) { sal_Bool bLast; - FSysSort *pSort; + FSysSort aSort; FSysSortList *pNewSortLst = new FSysSortList; - *( pSort = new FSysSort ) = nFirstSort; + aSort = nFirstSort; do { // letztes Kriterium? - bLast = FSYS_SORT_END == (*pSort & FSYS_SORT_END); - *pSort &= ~FSYS_SORT_END; + bLast = FSYS_SORT_END == (aSort & FSYS_SORT_END); + aSort &= ~FSYS_SORT_END; - FSysSort nSort = *pSort & ~(sal_uInt16)FSYS_SORT_ASCENDING - & ~(sal_uInt16)FSYS_SORT_DESCENDING; + FSysSort nSort = aSort & ~(sal_uInt16)FSYS_SORT_ASCENDING + & ~(sal_uInt16)FSYS_SORT_DESCENDING; // g"utliges Sortierkriterium? if ( ( nSort == FSYS_SORT_NAME ) || @@ -571,49 +507,34 @@ FSysError Dir::ImpSetSort( std::va_list pArgs, int nFirstSort ) ( nSort == FSYS_SORT_ACCESSED ) || ( nSort == FSYS_SORT_KIND ) ) { - pNewSortLst->Insert( pSort, APPEND ); - *(pSort = new FSysSort) = va_arg( pArgs, FSysSort ); + pNewSortLst->push_back( aSort ); + aSort = va_arg( pArgs, FSysSort ); } else { // ungueltiger Sort oder FSYS_SORT_NONE - FSysSort* pEntry = pNewSortLst->First(); - while (pEntry) - { - FSysSort* pNext = pNewSortLst->Next(); - delete pEntry; - pEntry = pNext; - } - pNewSortLst->Clear(); + pNewSortLst->clear(); delete pNewSortLst; - if ( *pSort == FSYS_SORT_NONE ) + if ( aSort == FSYS_SORT_NONE ) { - delete pSort; - if ( pSortLst ) + if ( pSortLst ) { delete pSortLst; + pSortLst = NULL; + } return FSYS_ERR_OK; } else { - delete pSort; return FSYS_ERR_NOTSUPPORTED; } } } while ( !bLast ); va_end( pArgs ); - delete pSort; // JP:6.3.00 - delete the initial pointer //Enfernen der alten Sort-Elemente if ( pSortLst ) { - FSysSort* pEntry = pSortLst->First(); - while (pEntry) - { - FSysSort* pNext = pSortLst->Next(); - delete pEntry; - pEntry = pNext; - } - pSortLst->Clear(); + pSortLst->clear(); delete pSortLst; } pSortLst = pNewSortLst; @@ -624,17 +545,17 @@ FSysError Dir::ImpSetSort( std::va_list pArgs, int nFirstSort ) //ist der Aufruf von Update() die einfachste Moeglichkeit if ( !pStatLst && pSortLst ) { - pSortLst->First(); - do + for ( size_t i = 0, n = pSortLst->size(); i < n && !pStatLst; ++i ) { - if ( *(pSortLst->GetCurObject()) & - ( FSYS_SORT_CREATED | FSYS_SORT_MODIFYED | FSYS_SORT_SIZE | - FSYS_SORT_ACCESSED | FSYS_SORT_KIND ) ) - { + if ( (*pSortLst)[ i ] + & ( FSYS_SORT_CREATED | FSYS_SORT_MODIFYED | FSYS_SORT_SIZE + | FSYS_SORT_ACCESSED | FSYS_SORT_KIND + ) + ) { Update(); return FSYS_ERR_OK; } - } while ( !pStatLst && pSortLst->Next() ); + } } if ( pLst ) { //Keine DirEntry's, kein Sort. @@ -646,17 +567,16 @@ FSysError Dir::ImpSetSort( std::va_list pArgs, int nFirstSort ) pOldStatLst = pStatLst; pStatLst = new FileStatList(); //neue StatListe (zu Sortieren) } - pOldLst->First(); - do + + for ( size_t i = 0, n = pOldLst->size(); i < n; ++i ) { //Sortiertes Einfuegen der Elemente aus den gemerkten Listen //in die 'richtigen' Listen if ( pOldStatLst ) - ImpSortedInsert( pOldLst->GetCurObject(), - pOldStatLst->GetObject( pOldLst->GetCurPos() ) ); + ImpSortedInsert( (*pOldLst)[ i ], (*pOldStatLst)[ i ] ); else - ImpSortedInsert( pOldLst->GetCurObject(), NULL ); - } while( pOldLst->Next() ); + ImpSortedInsert( (*pOldLst)[ i ], NULL ); + } delete pOldLst; if ( pOldStatLst ) @@ -669,10 +589,6 @@ FSysError Dir::ImpSetSort( std::va_list pArgs, int nFirstSort ) |* |* Dir::SetSort() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MA 04.11.91 -|* Letzte Aenderung MI 05.02.92 -|* *************************************************************************/ FSysError Dir::SetSort( FSysSort nSort, ... ) @@ -686,17 +602,13 @@ FSysError Dir::SetSort( FSysSort nSort, ... ) |* |* Dir::operator[]() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 16.05.91 -|* Letzte Aenderung MI 16.05.91 -|* *************************************************************************/ -DirEntry& Dir::operator[] ( sal_uInt16 nIndex ) const +DirEntry& Dir::operator[] ( size_t nIndex ) const { DBG_ASSERT( nIndex < Count(), "Dir::operator[] : nIndex > Count()" ); - DirEntry *pEntry = pLst->GetObject( nIndex ); + DirEntry *pEntry = (*pLst)[ nIndex ]; return *pEntry; } @@ -704,10 +616,6 @@ DirEntry& Dir::operator[] ( sal_uInt16 nIndex ) const |* |* Dir::operator+= () |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 16.05.91 -|* Letzte Aenderung MI 16.05.91 -|* *************************************************************************/ Dir& Dir::operator+=( const Dir& rDir ) @@ -724,21 +632,23 @@ Dir& Dir::operator+=( const Dir& rDir ) //Verlangen die Sortierkriterien FileStat's? sal_Bool bStat = sal_False; if ( pSortLst ) { - pSortLst->First(); - do { - if ( *(pSortLst->GetCurObject()) & - ( FSYS_SORT_CREATED | FSYS_SORT_MODIFYED | FSYS_SORT_SIZE | - FSYS_SORT_ACCESSED | FSYS_SORT_KIND ) ) + for ( size_t i = 0, n = pSortLst->size(); i < n && !bStat; ++i ) { + if ( (*pSortLst)[ i ] + & ( FSYS_SORT_CREATED | FSYS_SORT_MODIFYED | FSYS_SORT_SIZE + | FSYS_SORT_ACCESSED | FSYS_SORT_KIND + ) + ) { bStat = sal_True; - } while ( !bStat && pSortLst->Next() ); + } + } } - FileStat * stat = NULL; - for ( sal_uInt16 nNr = 0; nNr < rDir.Count(); nNr++ ) + FileStat* stat = NULL; + for ( size_t nNr = 0; nNr < rDir.Count(); nNr++ ) { if ( bStat ) { if ( rDir.pStatLst ) - stat = new FileStat( *rDir.pStatLst->GetObject(nNr) ); + stat = new FileStat( *(*rDir.pStatLst)[ nNr ] ); else stat = new FileStat( rDir[nNr] ); } @@ -751,18 +661,16 @@ Dir& Dir::operator+=( const Dir& rDir ) |* |* Dir::Count() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 16.05.91 -|* Letzte Aenderung MI 18.09.96 -|* *************************************************************************/ -sal_uInt16 Dir::Count( sal_Bool bUpdated ) const +size_t Dir::Count( sal_Bool bUpdated ) const { // ggf. erst den Rest lesen if ( bUpdated && pReader ) ((Dir*)this)->Scan( USHRT_MAX ); - return pLst == NULL ? 0 : (sal_uInt16) pLst->Count(); + return pLst == NULL ? 0 : pLst->size(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/fsys/tempfile.cxx b/tools/source/fsys/tempfile.cxx index b3f53d882467..078e91834975 100644 --- a/tools/source/fsys/tempfile.cxx +++ b/tools/source/fsys/tempfile.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -299,3 +300,4 @@ String TempFile::GetTempNameBaseDirectory() return aTmp; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/fsys/unx.cxx b/tools/source/fsys/unx.cxx index 94e2ce5950a4..b04a2e64904a 100644 --- a/tools/source/fsys/unx.cxx +++ b/tools/source/fsys/unx.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,19 +34,17 @@ #include <stdlib.h> #include <unistd.h> #include <utime.h> -#if defined HPUX || defined LINUX +#if defined LINUX || defined ANDROID #include <mntent.h> #define mnttab mntent -#elif defined SCO -#include <mnttab.h> #elif defined AIX #include <sys/mntctl.h> #include <sys/vmount.h> extern "C" int mntctl( int cmd, size_t size, char* buf ); #elif defined(NETBSD) #include <sys/mount.h> -#elif defined(FREEBSD) || defined(MACOSX) -#elif defined DECUNIX +#elif defined(FREEBSD) || defined(MACOSX) || defined(OPENBSD) || \ + defined(DRAGONFLY) struct mnttab { char *mnt_dir; @@ -60,24 +59,15 @@ struct mnttab #endif #include <tools/debug.hxx> -#include <tools/list.hxx> #include <tools/fsys.hxx> #include "comdep.hxx" #include <rtl/instance.hxx> -DECLARE_LIST( DirEntryList, DirEntry* ) -DECLARE_LIST( FSysSortList, FSysSort* ) -DECLARE_LIST( FileStatList, FileStat* ) - -#if defined SOLARIS || defined SINIX +#if defined SOLARIS #define MOUNTSPECIAL mnt_special #define MOUNTPOINT mnt_mountp #define MOUNTOPTS mnt_mntopts #define MOUNTFS mnt_fstype -#elif defined SCO -#define MNTTAB "/etc/mnttab" -#define MOUNTSPECIAL mt_dev -#define MOUNTPOINT mt_filsys #else #define MOUNTSPECIAL mnt_fsname #define MOUNTPOINT mnt_dir @@ -94,7 +84,8 @@ struct mymnttab }; -#if defined(NETBSD) || defined(FREEBSD) || defined(MACOSX) +#if defined(NETBSD) || defined(FREEBSD) || defined(MACOSX) || \ + defined(OPENBSD) || defined(DRAGONFLY) sal_Bool GetMountEntry(dev_t /* dev */, struct mymnttab * /* mytab */ ) { DBG_WARNING( "Sorry, not implemented: GetMountEntry" ); @@ -139,19 +130,13 @@ sal_Bool GetMountEntry(dev_t dev, struct mymnttab *mytab) static sal_Bool GetMountEntry(dev_t dev, struct mymnttab *mytab) { -#if defined SOLARIS || defined SINIX +#if defined SOLARIS FILE *fp = fopen (MNTTAB, "r"); if (! fp) return sal_False; struct mnttab mnt[1]; while (getmntent (fp, mnt) != -1) -#elif defined SCO - FILE *fp = fopen (MNTTAB, "r"); - if (! fp) - return sal_False; - struct mnttab mnt[1]; - while (fread (&mnt, sizeof mnt, 1, fp) > 0) -#elif defined DECUNIX || defined AIX +#elif defined AIX || defined ANDROID FILE *fp = NULL; if (! fp) return sal_False; @@ -191,11 +176,8 @@ static sal_Bool GetMountEntry(dev_t dev, struct mymnttab *mytab) mytab->mountspecial = mnt->MOUNTSPECIAL; mytab->mountpoint = mnt->MOUNTPOINT; mytab->mountdevice = dev; -#ifndef SCO mytab->mymnttab_filesystem = mnt->MOUNTFS; -#else - mytab->mymnttab_filesystem = "ext2"; //default ist case sensitiv unter unix -#endif + return sal_True; } # ifdef LINUX @@ -209,94 +191,11 @@ static sal_Bool GetMountEntry(dev_t dev, struct mymnttab *mytab) #endif -/************************************************************************ -|* -|* DirEntry::IsCaseSensitive() -|* -|* Beschreibung -|* Ersterstellung TPF 25.02.1999 -|* Letzte Aenderung TPF 25.02.1999 -|* -*************************************************************************/ - -sal_Bool DirEntry::IsCaseSensitive( FSysPathStyle eFormatter ) const -{ - - if (eFormatter==FSYS_STYLE_HOST) - { -#ifdef NETBSD - return sal_True; -#else - struct stat buf; - DirEntry aPath(*this); - aPath.ToAbs(); - - while (stat (ByteString(aPath.GetFull(), osl_getThreadTextEncoding()).GetBuffer(), &buf)) - { - if (aPath.Level() == 1) - { - return sal_True; // ich bin unter UNIX, also ist der default im Zweifelsfall case sensitiv - } - aPath = aPath [1]; - } - - struct mymnttab fsmnt; - GetMountEntry(buf.st_dev, &fsmnt); - if ((fsmnt.mymnttab_filesystem.CompareTo("msdos")==COMPARE_EQUAL) || - (fsmnt.mymnttab_filesystem.CompareTo("umsdos")==COMPARE_EQUAL) || - (fsmnt.mymnttab_filesystem.CompareTo("vfat")==COMPARE_EQUAL) || - (fsmnt.mymnttab_filesystem.CompareTo("hpfs")==COMPARE_EQUAL) || - (fsmnt.mymnttab_filesystem.CompareTo("smb") ==COMPARE_EQUAL) || - (fsmnt.mymnttab_filesystem.CompareTo("ncpfs")==COMPARE_EQUAL)) - { - return sal_False; - } - else - { - return sal_True; - } -#endif - } - else - { - sal_Bool isCaseSensitive = sal_True; // ich bin unter UNIX, also ist der default im Zweifelsfall case sensitiv - switch ( eFormatter ) - { - case FSYS_STYLE_MAC: - case FSYS_STYLE_FAT: - case FSYS_STYLE_VFAT: - case FSYS_STYLE_NTFS: - case FSYS_STYLE_NWFS: - case FSYS_STYLE_HPFS: - { - isCaseSensitive = sal_False; - break; - } - case FSYS_STYLE_SYSV: - case FSYS_STYLE_BSD: - case FSYS_STYLE_DETECT: - { - isCaseSensitive = sal_True; - break; - } - default: - { - isCaseSensitive = sal_True; // ich bin unter UNIX, also ist der default im Zweifelsfall case sensitiv - break; - } - } - return isCaseSensitive; - } -} /************************************************************************ |* |* DirEntry::ToAbs() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 13:30 -|* *************************************************************************/ sal_Bool DirEntry::ToAbs() @@ -319,10 +218,6 @@ sal_Bool DirEntry::ToAbs() |* |* DirEntry::GetVolume() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 04.03.92 -|* Letzte Aenderung -|* *************************************************************************/ namespace { struct mymnt : public rtl::Static< mymnttab, mymnt > {}; } @@ -373,10 +268,6 @@ DirEntry DirEntry::GetDevice() const |* |* DirEntry::SetCWD() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung DV 04.11.92 -|* *************************************************************************/ sal_Bool DirEntry::SetCWD( sal_Bool bSloppy ) const @@ -465,10 +356,6 @@ sal_uInt16 DirReader_Impl::Read() |* |* FileStat::FileStat() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MA 05.11.91 -|* Letzte Aenderung MA 07.11.91 -|* *************************************************************************/ FileStat::FileStat( const void *, const void * ): @@ -485,10 +372,6 @@ FileStat::FileStat( const void *, const void * ): |* |* FileStat::Update() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 11.06.91 -|* Letzte Aenderung MA 07.11.91 -|* *************************************************************************/ sal_Bool FileStat::Update( const DirEntry& rDirEntry, sal_Bool ) { @@ -593,10 +476,6 @@ const char *TempDirImpl( char *pBuf ) |* |* DirEntry::GetPathStyle() const |* -|* Beschreibung -|* Ersterstellung MI 11.05.95 -|* Letzte Aenderung MI 11.05.95 -|* *************************************************************************/ FSysPathStyle DirEntry::GetPathStyle( const String & ) @@ -608,9 +487,6 @@ FSysPathStyle DirEntry::GetPathStyle( const String & ) |* |* FileStat::SetDateTime |* -|* Ersterstellung PB 27.06.97 -|* Letzte Aenderung -|* *************************************************************************/ void FileStat::SetDateTime( const String& rFileName, @@ -658,3 +534,4 @@ void FSysEnableSysErrorBox( sal_Bool ) { } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/fsys/unx.hxx b/tools/source/fsys/unx.hxx index b6723e8709a3..b0cb3d2e77c9 100644 --- a/tools/source/fsys/unx.hxx +++ b/tools/source/fsys/unx.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,11 +47,7 @@ #define _getcwd getcwd #define _access access -#ifdef SYSV3 -#define DEFSTYLE FSYS_STYLE_SYSV -#else #define DEFSTYLE FSYS_STYLE_BSD -#endif #define CMP_LOWER(s) (s) #define TEMPNAME() tmpnam(0) @@ -93,3 +90,5 @@ const char* TempDirImpl( char *pBuf ); #define FSysFailOnErrorImpl() #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 56e6b8ef47cc..6a855d7d85c8 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -426,7 +427,10 @@ static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END] { "smb", "smb://", 139, true, true, false, true, true, true, true, true }, { "hid", "hid:", 0, false, false, false, false, false, false, - false, true } }; + false, true }, + { "sftp", "sftp://", 22, true, true, false, true, true, true, true, + true } }; + // static inline INetURLObject::SchemeInfo const & @@ -1169,7 +1173,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, break; default: - DBG_ERROR( + OSL_FAIL( "INetURLObject::setAbsURIRef():" " Bad guessFSysStyleByCounting"); break; @@ -1445,10 +1449,48 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, m_aAbsURIRef = aSynAbsURIRef; + // At this point references of type "\\server\paths" have + // been converted to file:://server/path". +#ifdef LINUX + if (m_eScheme==INET_PROT_FILE && !m_aHost.isEmpty()) { + // Change "file:://server/path" URIs to "smb:://server/path" on + // Linux + // Leave "file::path" URIs unchanged. + changeScheme(INET_PROT_SMB); + } +#endif + +#ifdef WIN + if (m_eScheme==INET_PROT_SMB) { + // Change "smb://server/path" URIs to "file://server/path" + // URIs on Windows, since Windows doesn't understand the + // SMB scheme. + changeScheme(INET_PROT_FILE); + } +#endif + return true; } //============================================================================ +void INetURLObject::changeScheme(INetProtocol eTargetScheme) { + ::rtl::OUString aTmpStr=m_aAbsURIRef.makeStringAndClear(); + int oldSchemeLen=strlen(getSchemeInfo().m_pScheme); + m_eScheme=eTargetScheme; + int newSchemeLen=strlen(getSchemeInfo().m_pScheme); + m_aAbsURIRef.appendAscii(getSchemeInfo().m_pScheme); + m_aAbsURIRef.append(aTmpStr.getStr()+oldSchemeLen); + int delta=newSchemeLen-oldSchemeLen; + m_aUser+=delta; + m_aAuth+=delta; + m_aHost+=delta; + m_aPort+=delta; + m_aPath+=delta; + m_aQuery+=delta; + m_aFragment+=delta; +} + +//============================================================================ bool INetURLObject::convertRelToAbs(rtl::OUString const & rTheRelURIRef, bool bOctets, INetURLObject & rTheAbsURIRef, @@ -1556,7 +1598,7 @@ bool INetURLObject::convertRelToAbs(rtl::OUString const & rTheRelURIRef, break; default: - DBG_ERROR("INetURLObject::convertRelToAbs():" + OSL_FAIL("INetURLObject::convertRelToAbs():" " Bad guessFSysStyleByCounting"); break; } @@ -2123,6 +2165,7 @@ INetURLObject::getPrefix(sal_Unicode const *& rBegin, INET_PROT_PRIV_SOFFICE, PrefixInfo::INTERNAL }, { "private:trashcan:", "staroffice.trashcan:", INET_PROT_PRIV_SOFFICE, PrefixInfo::INTERNAL }, + { "sftp:", 0, INET_PROT_SFTP, PrefixInfo::OFFICIAL }, { "slot:", "staroffice.slot:", INET_PROT_SLOT, PrefixInfo::INTERNAL }, { "smb:", 0, INET_PROT_SMB, PrefixInfo::OFFICIAL }, @@ -2176,6 +2219,8 @@ INetURLObject::getPrefix(sal_Unicode const *& rBegin, PrefixInfo::OFFICIAL }, { "vnd.sun.star.webdav:", 0, INET_PROT_VND_SUN_STAR_WEBDAV, PrefixInfo::OFFICIAL } }; + /* This list needs to be sorted, or you'll introduce serious bugs */ + PrefixInfo const * pFirst = aMap + 1; PrefixInfo const * pLast = aMap + sizeof aMap / sizeof (PrefixInfo) - 1; PrefixInfo const * pMatch = 0; @@ -2341,7 +2386,7 @@ bool INetURLObject::setPassword(rtl::OUString const & rThePassword, else if (m_aHost.isPresent()) { m_aAbsURIRef.insert(m_aHost.getBegin(), - rtl::OUString::createFromAscii(":@")); + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ":@" ))); m_aUser.set(m_aAbsURIRef, rtl::OUString(), m_aHost.getBegin()); nDelta = m_aAuth.set(m_aAbsURIRef, aNewAuth, m_aHost.getBegin() + 1) + 2; @@ -2396,7 +2441,7 @@ bool INetURLObject::parseHost( aTheCanonic.append(sal_Unicode('[')); eState = STATE_IP6; } - else if (INetMIME::isAlpha(*p)) + else if (INetMIME::isAlpha(*p) || *p == '_') eState = STATE_TOPLABEL; else if (INetMIME::isDigit(*p)) { @@ -2414,19 +2459,19 @@ bool INetURLObject::parseHost( eState = STATE_LABEL_DOT; else if (*p == '-') eState = STATE_LABEL_HYPHEN; - else if (!INetMIME::isAlphanumeric(*p)) + else if (!INetMIME::isAlphanumeric(*p) && *p != '_') goto done; break; case STATE_LABEL_HYPHEN: - if (INetMIME::isAlphanumeric(*p)) + if (INetMIME::isAlphanumeric(*p) || *p == '_') eState = STATE_LABEL; else if (*p != '-') goto done; break; case STATE_LABEL_DOT: - if (INetMIME::isAlpha(*p)) + if (INetMIME::isAlpha(*p) || *p == '_') eState = STATE_TOPLABEL; else if (INetMIME::isDigit(*p)) eState = STATE_LABEL; @@ -2439,19 +2484,19 @@ bool INetURLObject::parseHost( eState = STATE_TOPLABEL_DOT; else if (*p == '-') eState = STATE_TOPLABEL_HYPHEN; - else if (!INetMIME::isAlphanumeric(*p)) + else if (!INetMIME::isAlphanumeric(*p) && *p != '_') goto done; break; case STATE_TOPLABEL_HYPHEN: - if (INetMIME::isAlphanumeric(*p)) + if (INetMIME::isAlphanumeric(*p) || *p == '_') eState = STATE_TOPLABEL; else if (*p != '-') goto done; break; case STATE_TOPLABEL_DOT: - if (INetMIME::isAlpha(*p)) + if (INetMIME::isAlpha(*p) || *p == '_') eState = STATE_TOPLABEL; else if (INetMIME::isDigit(*p)) eState = STATE_LABEL; @@ -2473,7 +2518,7 @@ bool INetURLObject::parseHost( eState = STATE_LABEL_DOT; else if (*p == '-') eState = STATE_LABEL_HYPHEN; - else if (INetMIME::isAlpha(*p)) + else if (INetMIME::isAlpha(*p) || *p == '_') eState = STATE_LABEL; else if (INetMIME::isDigit(*p)) if (nDigits < 3) @@ -2488,7 +2533,7 @@ bool INetURLObject::parseHost( break; case STATE_IP4_DOT: - if (INetMIME::isAlpha(*p)) + if (INetMIME::isAlpha(*p) || *p == '_') eState = STATE_TOPLABEL; else if (INetMIME::isDigit(*p)) { @@ -3249,9 +3294,9 @@ bool INetURLObject::parsePath(INetProtocol eScheme, } bool bInbox; rtl::OUString sCompare(aTheSynPath); - if (sCompare.equalsAscii("/inbox")) + if (sCompare.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("/inbox"))) bInbox = true; - else if (sCompare.equalsAscii("/newsgroups")) + else if (sCompare.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("/newsgroups"))) bInbox = false; else return false; @@ -3394,6 +3439,7 @@ bool INetURLObject::parsePath(INetProtocol eScheme, break; case INET_PROT_GENERIC: + case INET_PROT_SFTP: while (pPos < pEnd && *pPos != nFragmentDelimiter) { EscapeType eEscapeType; @@ -3437,8 +3483,8 @@ bool INetURLObject::setPath(rtl::OUString const & rThePath, bool bOctets, //============================================================================ bool INetURLObject::checkHierarchical() const { if (m_eScheme == INET_PROT_VND_SUN_STAR_EXPAND) { - OSL_ENSURE( - false, "INetURLObject::checkHierarchical vnd.sun.star.expand"); + OSL_FAIL( + "INetURLObject::checkHierarchical vnd.sun.star.expand"); return true; } else { return getSchemeInfo().m_bHierarchical; @@ -5214,7 +5260,7 @@ void INetURLObject::appendUCS4(rtl::OUStringBuffer& rTheText, sal_uInt32 nUCS4, switch (eTargetCharset) { default: - DBG_ERROR("INetURLObject::appendUCS4(): Unsupported charset"); + OSL_FAIL("INetURLObject::appendUCS4(): Unsupported charset"); case RTL_TEXTENCODING_ASCII_US: case RTL_TEXTENCODING_ISO_8859_1: appendEscape(rTheText, cEscapePrefix, nUCS4); @@ -5260,7 +5306,7 @@ sal_uInt32 INetURLObject::getUTF32(sal_Unicode const *& rBegin, switch (eCharset) { default: - DBG_ERROR( + OSL_FAIL( "INetURLObject::getUTF32(): Unsupported charset"); case RTL_TEXTENCODING_ASCII_US: rEscapeType = INetMIME::isUSASCII(nUTF32) ? @@ -5379,7 +5425,7 @@ sal_uInt32 INetURLObject::scanDomain(sal_Unicode const *& rBegin, switch (eState) { case STATE_DOT: - if (p != pEnd && INetMIME::isAlphanumeric(*p)) + if (p != pEnd && (INetMIME::isAlphanumeric(*p) || *p == '_')) { ++nLabels; eState = STATE_LABEL; @@ -5393,7 +5439,7 @@ sal_uInt32 INetURLObject::scanDomain(sal_Unicode const *& rBegin, case STATE_LABEL: if (p != pEnd) { - if (INetMIME::isAlphanumeric(*p)) + if (INetMIME::isAlphanumeric(*p) || *p == '_') break; else if (*p == '.') { @@ -5413,7 +5459,7 @@ sal_uInt32 INetURLObject::scanDomain(sal_Unicode const *& rBegin, case STATE_HYPHEN: if (p != pEnd) { - if (INetMIME::isAlphanumeric(*p)) + if (INetMIME::isAlphanumeric(*p) || *p == '_') { eState = STATE_LABEL; break; @@ -5577,3 +5623,5 @@ bool INetURLObject::IsCaseSensitive() const { return true; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/fsys/wldcrd.cxx b/tools/source/fsys/wldcrd.cxx index 16c71cbc51d5..acc1ce9a2071 100755..100644 --- a/tools/source/fsys/wldcrd.cxx +++ b/tools/source/fsys/wldcrd.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,10 +34,6 @@ |* |* WildCard::Match() |* -|* Beschreibung WLDCRD.SDW -|* Ersterstellung MA 19.06.91 -|* Letzte Aenderung MA 03.07.91 -|* *************************************************************************/ /* Diese Methode ueberprueft, ob die Wilde Karte in pWild mit dem String @@ -111,10 +108,6 @@ sal_uInt16 WildCard::ImpMatch( const char *pWild, const char *pStr ) const |* |* WildCard::Matches() |* -|* Beschreibung WLDCRD.SDW -|* Ersterstellung MA 19.06.91 -|* Letzte Aenderung TH 02.02.96 -|* *************************************************************************/ sal_Bool WildCard::Matches( const String& rString ) const @@ -141,3 +134,5 @@ sal_Bool WildCard::Matches( const String& rString ) const else return sal_False; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/fsys/wntmsc.cxx b/tools/source/fsys/wntmsc.cxx index 17421d83feaa..fa18aa46fcf1 100755..100644 --- a/tools/source/fsys/wntmsc.cxx +++ b/tools/source/fsys/wntmsc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,15 +42,10 @@ #include "wntmsc.hxx" #include <tools/errinf.hxx> #include <tools/debug.hxx> -#include <tools/list.hxx> #include <tools/wldcrd.hxx> #include <tools/fsys.hxx> #include <tools/bigint.hxx> -DECLARE_LIST( DirEntryList, DirEntry* ); -DECLARE_LIST( FSysSortList, FSysSort* ); -DECLARE_LIST( FileStatList, FileStat* ); - int Sys2SolarError_Impl( int nSysErr ); static sal_Bool bLastCaseSensitive = sal_False; @@ -116,162 +112,17 @@ int closedir( DIR *pDir ) |* |* DirEntry::GetPathStyle() const |* -|* Beschreibung -|* Ersterstellung MI 11.05.95 -|* Letzte Aenderung MI 11.05.95 -|* *************************************************************************/ -ErrCode GetPathStyle_Impl( const String &rDevice, FSysPathStyle &rStyle ) -{ - ByteString aRootDir(rDevice, osl_getThreadTextEncoding()); - if ( aRootDir.Len() && aRootDir.GetBuffer()[aRootDir.Len()-1] != '\\' ) - aRootDir += '\\'; - - char sVolumeName[256]; - char sFileSysName[16]; - DWORD nSerial[2]; - DWORD nMaxCompLen[2]; - DWORD nFlags[2]; - - // Windows95 hat VFAT, WindowsNT nicht - DWORD nVer = GetVersion(); - sal_Bool bW95 = ( nVer & 0xFF ) >= 4; - - FSysFailOnErrorImpl(); - rStyle = FSYS_STYLE_UNKNOWN; - if ( GetVolumeInformation( - (char*) aRootDir.GetBuffer(), - sVolumeName, 256, (LPDWORD) &nSerial, (LPDWORD) &nMaxCompLen, - (LPDWORD) &nFlags, sFileSysName, 16 ) ) - { - // FAT/VFAT? - if ( 0 == strcmp( "FAT", sFileSysName ) ) - rStyle = bW95 ? FSYS_STYLE_VFAT : FSYS_STYLE_FAT; - - // NTFS? - else if ( 0 == strcmp( "NTFS", sFileSysName ) ) - rStyle = FSYS_STYLE_NTFS; - - // HPFS? - else if ( 0 == strcmp( "HPFS", sFileSysName ) ) - rStyle = FSYS_STYLE_HPFS; - - // NWCOMPA/NWFS? - else if ( 0 == strncmp( "NW", sFileSysName, 2 ) ) - rStyle = FSYS_STYLE_NWFS; - - return ERRCODE_NONE; - } - - return ERRCODE_IO_INVALIDDEVICE; -} - -FSysPathStyle DirEntry::GetPathStyle( const String &rDevice ) +FSysPathStyle DirEntry::GetPathStyle( const String & ) { - - FSysPathStyle eStyle; - GetPathStyle_Impl( rDevice, eStyle ); - return eStyle; -} - -/************************************************************************* -|* -|* DirEntry::IsCaseSensitive() -|* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 10.06.93 -|* Letzte Aenderung TPF 26.02.1999 -|* -*************************************************************************/ - -sal_Bool DirEntry::IsCaseSensitive( FSysPathStyle eFormatter ) const -{ - - if (eFormatter==FSYS_STYLE_HOST) - { -/* - DirEntry aRoot(*this); - aRoot.ToAbs(); - aRoot = aRoot[Level()-1]; - String aRootDir = aRoot.GetFull(FSYS_STYLE_HOST, sal_True); - - char sVolumeName[256]; - DWORD nVolumeSerial; - DWORD nMaxCompLen; - DWORD nFlags; - char sFileSysName[16]; - - if ( GetVolumeInformation( (char*) aRootDir.GetStr(), - sVolumeName, - 256, - (LPDWORD) &nVolumeSerial, - (LPDWORD) &nMaxCompLen, - (LPDWORD) &nFlags, - sFileSysName, - 16 )) - { - return (nFlags & FS_CASE_SENSITIVE) ? sal_True : sal_False; - } - else - { - return sal_False; - } -*/ - // - // guter versuch, aber FS_CASE_SENSITIVE ist D?nnsinn in T?ten: - // - // sFileSysName FS_CASE_SENSITIVE - // FAT sal_False - // NTFS sal_True !!! - // NWCompat sal_False - // Samba sal_False - // - // NT spricht auch NTFS lediglich case preserving an, also ist unter NT alles case insensitiv - // - - return sal_False; - } - else - { - sal_Bool isCaseSensitive = sal_False; // ich bin unter win32, also ist der default case insensitiv - switch ( eFormatter ) - { - case FSYS_STYLE_MAC: - case FSYS_STYLE_FAT: - case FSYS_STYLE_VFAT: - case FSYS_STYLE_NTFS: - case FSYS_STYLE_NWFS: - case FSYS_STYLE_HPFS: - case FSYS_STYLE_DETECT: - { - isCaseSensitive = sal_False; - break; - } - case FSYS_STYLE_SYSV: - case FSYS_STYLE_BSD: - { - isCaseSensitive = sal_True; - break; - } - default: - { - isCaseSensitive = sal_False; // ich bin unter win32, also ist der default case insensitiv - break; - } - } - return isCaseSensitive; - } + return FSYS_STYLE_NTFS; } /************************************************************************* |* |* DirEntry::ToAbs() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MA 02.12.91 -|* *************************************************************************/ sal_Bool DirEntry::ToAbs() @@ -306,10 +157,6 @@ sal_Bool DirEntry::ToAbs() |* |* DirEntry::GetVolume() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 27.08.92 -|* Letzte Aenderung MI 28.08.92 -|* *************************************************************************/ String DirEntry::GetVolume() const @@ -358,10 +205,6 @@ String DirEntry::GetVolume() const |* |* DirEntry::SetCWD() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 26.04.91 -|* Letzte Aenderung MI 21.05.92 -|* *************************************************************************/ sal_Bool DirEntry::SetCWD( sal_Bool bSloppy ) const @@ -511,8 +354,6 @@ USHORT DirReader_Impl::Read() |* InitFileStat() |* |* Beschreibung gemeinsamer Teil der Ctoren fuer FileStat -|* Ersterstellung MI 28.08.92 -|* Letzte Aenderung MI 28.08.92 |* *************************************************************************/ @@ -569,10 +410,6 @@ void FileStat::ImpInit( void* p ) |* |* FileStat::FileStat() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 27.08.92 -|* Letzte Aenderung MI 28.08.92 -|* *************************************************************************/ FileStat::FileStat( const void *pInfo, // struct dirent @@ -591,10 +428,6 @@ FileStat::FileStat( const void *pInfo, // struct dirent |* |* FileStat::Update() |* -|* Beschreibung FSYS.SDW -|* Ersterstellung MI 27.08.92 -|* Letzte Aenderung MI 28.08.92 -|* *************************************************************************/ #ifdef _MSC_VER @@ -640,8 +473,8 @@ HRESULT SHGetIDListFromPath( HWND hwndOwner, LPCTSTR pszPath, LPITEMIDLIST *ppid if ( FAILED(hResult) ) return hResult; - ULONG chEaten = lstrlen( pszPath ); - DWORD dwAttributes = FILE_ATTRIBUTE_DIRECTORY; + ULONG chEaten = lstrlen( pszPath ); + DWORD dwAttributes = FILE_ATTRIBUTE_DIRECTORY; #ifdef UNICODE LPOLESTR wszPath = pszPath; @@ -859,7 +692,7 @@ sal_Bool FileStat::Update( const DirEntry& rDirEntry, sal_Bool bForceAccess ) if ( aName == "a:" || aName == "b:" ) bAccess = sal_False; else - DBG_TRACE( "FSys: will access removable device!" ); + OSL_TRACE( "FSys: will access removable device!" ); if ( bAccess && ( aName == "a:" || aName == "b:" ) ) { DBG_WARNING( "floppy will clatter" ); } @@ -919,7 +752,7 @@ sal_Bool FileStat::Update( const DirEntry& rDirEntry, sal_Bool bForceAccess ) // MI: dann gehen Umlaute auf Novell-Servern nicht / wozu ueberhaupt // CharUpperBuff( (char*) aFilePath.GetStr(), aFilePath.Len() ); - DBG_TRACE1( "FileStat: %s", aFilePath.GetBuffer() ); + OSL_TRACE( "FileStat: %s", aFilePath.GetBuffer() ); h = aFilePath.Len() < 230 // die Win32-API ist hier sehr schwammig ? FindFirstFile( (char *) aFilePath.GetBuffer(), &aEntry )//TPF: 2i @@ -1026,8 +859,6 @@ sal_Bool IsRedirectable_Impl( const ByteString &rPath ) |* |* Beschreibung liefert den Namens des Directories fuer temporaere |* Dateien -|* Ersterstellung MI 16.03.94 -|* Letzte Aenderung MI 16.03.94 |* *************************************************************************/ @@ -1079,3 +910,4 @@ void FSysEnableSysErrorBox( sal_Bool bEnable ) +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/fsys/wntmsc.hxx b/tools/source/fsys/wntmsc.hxx index d84e5af9680b..ba88e4eaf020 100755..100644 --- a/tools/source/fsys/wntmsc.hxx +++ b/tools/source/fsys/wntmsc.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,14 +38,7 @@ #include <sys\stat.h> #include <direct.h> -#include <tools/svwin.h> -#ifdef _MSC_VER -#pragma warning (push,1) -#endif -#include <winbase.h> -#ifdef _MSC_VER -#pragma warning (pop) -#endif +#include <windows.h> #include <tools/solar.h> #include <tools/string.hxx> @@ -65,15 +59,6 @@ #define d_name cFileName #define d_type dwFileAttributes -#if defined (TCPP) || defined (tcpp) -#define _mkdir mkdir -#define _rmdir rmdir -#define _chdir chdir -#define _unlink unlink -#define _getcwd getcwd -#define _access access -#endif - typedef struct { _WIN32_FIND_DATAA aDirEnt; @@ -100,3 +85,5 @@ const char* TempDirImpl( char *pBuf ); #define FSysFailOnErrorImpl() #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/b3dtrans.cxx b/tools/source/generic/b3dtrans.cxx index 9ed887457035..4af4b3edcb85 100644 --- a/tools/source/generic/b3dtrans.cxx +++ b/tools/source/generic/b3dtrans.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -111,18 +112,18 @@ void B3dTransformationSet::Ortho(basegfx::B3DHomMatrix& rTarget, double fLeft, d { if(fNear == fFar) { - DBG_ERROR("Near and far clipping plane in Ortho definition are identical"); + OSL_FAIL("Near and far clipping plane in Ortho definition are identical"); fFar = fNear + 1.0; } if(fLeft == fRight) { - DBG_ERROR("Left and right in Ortho definition are identical"); + OSL_FAIL("Left and right in Ortho definition are identical"); fLeft -= 1.0; fRight += 1.0; } if(fTop == fBottom) { - DBG_ERROR("Top and bottom in Ortho definition are identical"); + OSL_FAIL("Top and bottom in Ortho definition are identical"); fBottom -= 1.0; fTop += 1.0; } @@ -1012,3 +1013,5 @@ sal_Bool B3dCamera::CalcFocalLength() } // eof + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/bigint.cxx b/tools/source/generic/bigint.cxx index 027105767063..4392e56d5e44 100644 --- a/tools/source/generic/bigint.cxx +++ b/tools/source/generic/bigint.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -77,12 +78,7 @@ void BigInt::MakeBigInt( const BigInt& rVal ) nNum[0] = (sal_uInt16)(nTmp & 0xffffL); nNum[1] = (sal_uInt16)(nTmp >> 16); -#ifndef _WIN16 if ( nTmp & 0xffff0000L ) -#else - long l = 0xffff0000L; - if ( nTmp & l ) -#endif nLen = 2; else nLen = 1; @@ -529,35 +525,7 @@ BigInt::BigInt( const BigInt& rBigInt ) // ----------------------------------------------------------------------- -BigInt::BigInt( const ByteString& rString ) -{ - bIsSet = sal_True; - bIsNeg = sal_False; - bIsBig = sal_False; - nVal = 0; - - sal_Bool bNeg = sal_False; - const sal_Char* p = rString.GetBuffer(); - if ( *p == '-' ) - { - bNeg = sal_True; - p++; - } - while( *p >= '0' && *p <= '9' ) - { - *this *= 10; - *this += *p - '0'; - p++; - } - if ( bIsBig ) - bIsNeg = bNeg; - else if( bNeg ) - nVal = -nVal; -} - -// ----------------------------------------------------------------------- - -BigInt::BigInt( const UniString& rString ) +BigInt::BigInt( const String& rString ) { bIsSet = sal_True; bIsNeg = sal_False; @@ -690,55 +658,12 @@ BigInt::operator double() const // ----------------------------------------------------------------------- -ByteString BigInt::GetByteString() const -{ - ByteString aString; - - if ( !bIsBig ) - aString = ByteString::CreateFromInt32( nVal ); - else - { - BigInt aTmp( *this ); - BigInt a1000000000( 1000000000L ); - aTmp.Abs(); - - do - { - BigInt a = aTmp; - a %= a1000000000; - aTmp /= a1000000000; - - ByteString aStr = aString; - if ( a.nVal < 100000000L ) - { // leading 0s - aString = ByteString::CreateFromInt32( a.nVal + 1000000000L ); - aString.Erase( 0, 1 ); - } - else - aString = ByteString::CreateFromInt32( a.nVal ); - aString += aStr; - } - while( aTmp.bIsBig ); - - ByteString aStr = aString; - if ( bIsNeg ) - aString = ByteString::CreateFromInt32( -aTmp.nVal ); - else - aString = ByteString::CreateFromInt32( aTmp.nVal ); - aString += aStr; - } - - return aString; -} - -// ----------------------------------------------------------------------- - -UniString BigInt::GetString() const +String BigInt::GetString() const { - UniString aString; + String aString; if ( !bIsBig ) - aString = UniString::CreateFromInt32( nVal ); + aString = String::CreateFromInt32( nVal ); else { BigInt aTmp( *this ); @@ -751,23 +676,23 @@ UniString BigInt::GetString() const a %= a1000000000; aTmp /= a1000000000; - UniString aStr = aString; + String aStr = aString; if ( a.nVal < 100000000L ) { // leading 0s - aString = UniString::CreateFromInt32( a.nVal + 1000000000L ); + aString = String::CreateFromInt32( a.nVal + 1000000000L ); aString.Erase(0,1); } else - aString = UniString::CreateFromInt32( a.nVal ); + aString = String::CreateFromInt32( a.nVal ); aString += aStr; } while( aTmp.bIsBig ); - UniString aStr = aString; + String aStr = aString; if ( bIsNeg ) - aString = UniString::CreateFromInt32( -aTmp.nVal ); + aString = String::CreateFromInt32( -aTmp.nVal ); else - aString = UniString::CreateFromInt32( aTmp.nVal ); + aString = String::CreateFromInt32( aTmp.nVal ); aString += aStr; } @@ -875,7 +800,7 @@ BigInt& BigInt::operator/=( const BigInt& rVal ) { if ( rVal.nVal == 0 ) { - DBG_ERROR( "BigInt::operator/ --> divide by zero" ); + OSL_FAIL( "BigInt::operator/ --> divide by zero" ); return *this; } @@ -936,7 +861,7 @@ void BigInt::DivMod( const BigInt& rVal, BigInt& rMod ) { if ( rVal.nVal == 0 ) { - DBG_ERROR( "BigInt::operator/ --> divide by zero" ); + OSL_FAIL( "BigInt::operator/ --> divide by zero" ); return; } @@ -1005,7 +930,7 @@ BigInt& BigInt::operator%=( const BigInt& rVal ) { if ( rVal.nVal == 0 ) { - DBG_ERROR( "BigInt::operator/ --> divide by zero" ); + OSL_FAIL( "BigInt::operator/ --> divide by zero" ); return *this; } @@ -1139,3 +1064,5 @@ sal_Bool operator >(const BigInt& rVal1, const BigInt& rVal2 ) return rVal1.nVal > rVal2.nVal; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/color.cxx b/tools/source/generic/color.cxx index ec325b9ca3d3..5560e631767a 100644 --- a/tools/source/generic/color.cxx +++ b/tools/source/generic/color.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,16 +30,13 @@ #include "precompiled_tools.hxx" #include <stdlib.h> -#include <vos/macros.hxx> #include <tools/color.hxx> #include <tools/debug.hxx> #include <tools/stream.hxx> #include <tools/rc.hxx> #include <tools/rcid.h> #include <tools/resid.hxx> -#ifndef _SV_RC_H #include <tools/rc.h> -#endif // ----------- // - Inlines - @@ -90,18 +88,18 @@ sal_uInt8 Color::GetColorError( const Color& rCompareColor ) const void Color::IncreaseLuminance( sal_uInt8 cLumInc ) { - SetRed( (sal_uInt8) VOS_BOUND( (long) COLORDATA_RED( mnColor ) + cLumInc, 0L, 255L ) ); - SetGreen( (sal_uInt8) VOS_BOUND( (long) COLORDATA_GREEN( mnColor ) + cLumInc, 0L, 255L ) ); - SetBlue( (sal_uInt8) VOS_BOUND( (long) COLORDATA_BLUE( mnColor ) + cLumInc, 0L, 255L ) ); + SetRed( (sal_uInt8) SAL_BOUND( (long) COLORDATA_RED( mnColor ) + cLumInc, 0L, 255L ) ); + SetGreen( (sal_uInt8) SAL_BOUND( (long) COLORDATA_GREEN( mnColor ) + cLumInc, 0L, 255L ) ); + SetBlue( (sal_uInt8) SAL_BOUND( (long) COLORDATA_BLUE( mnColor ) + cLumInc, 0L, 255L ) ); } // ----------------------------------------------------------------------- void Color::DecreaseLuminance( sal_uInt8 cLumDec ) { - SetRed( (sal_uInt8) VOS_BOUND( (long) COLORDATA_RED( mnColor ) - cLumDec, 0L, 255L ) ); - SetGreen( (sal_uInt8) VOS_BOUND( (long) COLORDATA_GREEN( mnColor ) - cLumDec, 0L, 255L ) ); - SetBlue( (sal_uInt8) VOS_BOUND( (long) COLORDATA_BLUE( mnColor ) - cLumDec, 0L, 255L ) ); + SetRed( (sal_uInt8) SAL_BOUND( (long) COLORDATA_RED( mnColor ) - cLumDec, 0L, 255L ) ); + SetGreen( (sal_uInt8) SAL_BOUND( (long) COLORDATA_GREEN( mnColor ) - cLumDec, 0L, 255L ) ); + SetBlue( (sal_uInt8) SAL_BOUND( (long) COLORDATA_BLUE( mnColor ) - cLumDec, 0L, 255L ) ); } // ----------------------------------------------------------------------- @@ -113,9 +111,9 @@ void Color::IncreaseContrast( sal_uInt8 cContInc ) const double fM = 128.0 / ( 128.0 - 0.4985 * cContInc ); const double fOff = 128.0 - fM * 128.0; - SetRed( (sal_uInt8) VOS_BOUND( _FRound( COLORDATA_RED( mnColor ) * fM + fOff ), 0L, 255L ) ); - SetGreen( (sal_uInt8) VOS_BOUND( _FRound( COLORDATA_GREEN( mnColor ) * fM + fOff ), 0L, 255L ) ); - SetBlue( (sal_uInt8) VOS_BOUND( _FRound( COLORDATA_BLUE( mnColor ) * fM + fOff ), 0L, 255L ) ); + SetRed( (sal_uInt8) SAL_BOUND( _FRound( COLORDATA_RED( mnColor ) * fM + fOff ), 0L, 255L ) ); + SetGreen( (sal_uInt8) SAL_BOUND( _FRound( COLORDATA_GREEN( mnColor ) * fM + fOff ), 0L, 255L ) ); + SetBlue( (sal_uInt8) SAL_BOUND( _FRound( COLORDATA_BLUE( mnColor ) * fM + fOff ), 0L, 255L ) ); } } @@ -128,9 +126,9 @@ void Color::DecreaseContrast( sal_uInt8 cContDec ) const double fM = ( 128.0 - 0.4985 * cContDec ) / 128.0; const double fOff = 128.0 - fM * 128.0; - SetRed( (sal_uInt8) VOS_BOUND( _FRound( COLORDATA_RED( mnColor ) * fM + fOff ), 0L, 255L ) ); - SetGreen( (sal_uInt8) VOS_BOUND( _FRound( COLORDATA_GREEN( mnColor ) * fM + fOff ), 0L, 255L ) ); - SetBlue( (sal_uInt8) VOS_BOUND( _FRound( COLORDATA_BLUE( mnColor ) * fM + fOff ), 0L, 255L ) ); + SetRed( (sal_uInt8) SAL_BOUND( _FRound( COLORDATA_RED( mnColor ) * fM + fOff ), 0L, 255L ) ); + SetGreen( (sal_uInt8) SAL_BOUND( _FRound( COLORDATA_GREEN( mnColor ) * fM + fOff ), 0L, 255L ) ); + SetBlue( (sal_uInt8) SAL_BOUND( _FRound( COLORDATA_BLUE( mnColor ) * fM + fOff ), 0L, 255L ) ); } } @@ -263,6 +261,53 @@ ColorData Color::HSBtoRGB( sal_uInt16 nHue, sal_uInt16 nSat, sal_uInt16 nBri ) // ----------------------------------------------------------------------- +// CMYK values from 0 to 1 +ColorData Color::CMYKtoRGB( double fCyan, double fMagenta, double fYellow, double fKey ) +{ + fCyan = (fCyan * ( 1.0 - fKey )) + fKey; + fMagenta = (fMagenta * ( 1.0 - fKey )) + fKey; + fYellow = (fYellow * ( 1.0 - fKey )) + fKey; + + sal_uInt8 nRed = static_cast< sal_uInt8 >( std::max( std::min( ( 1.0 - fCyan ) * 255.0, 255.0), 0.0 ) ); + sal_uInt8 nGreen = static_cast< sal_uInt8 >( std::max( std::min( ( 1.0 - fMagenta ) * 255.0, 255.0), 0.0 ) ); + sal_uInt8 nBlue = static_cast< sal_uInt8 >( std::max( std::min( ( 1.0 - fYellow ) * 255.0, 255.0), 0.0 ) ); + + return RGB_COLORDATA( nRed, nGreen, nBlue ); +} + +// ----------------------------------------------------------------------- + +// RGB values from 0 to 255 +// CMY results from 0 to 1 +void Color::RGBtoCMYK( double& fCyan, double& fMagenta, double& fYellow, double& fKey ) +{ + fCyan = 1 - ( GetRed() / 255.0 ); + fMagenta = 1 - ( GetGreen() / 255.0 ); + fYellow = 1 - ( GetBlue() / 255.0 ); + + //CMYK and CMY values from 0 to 1 + fKey = 1.0; + if( fCyan < fKey ) fKey = fCyan; + if( fMagenta < fKey ) fKey = fMagenta; + if( fYellow < fKey ) fKey = fYellow; + + if ( fKey == 1.0 ) + { + //Black + fCyan = 0.0; + fMagenta = 0.0; + fYellow = 0.0; + } + else + { + fCyan = ( fCyan - fKey ) / ( 1.0 - fKey ); + fMagenta = ( fMagenta - fKey ) / ( 1.0 - fKey ); + fYellow = ( fYellow - fKey ) / ( 1.0 - fKey ); + } +} + +// ----------------------------------------------------------------------- + SvStream& Color::Read( SvStream& rIStm, sal_Bool bNewFormat ) { if ( bNewFormat ) @@ -508,3 +553,5 @@ SvStream& operator<<( SvStream& rOStream, const Color& rColor ) return rOStream; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/config.cxx b/tools/source/generic/config.cxx index ff919fcf2505..6c533459f2a7 100644 --- a/tools/source/generic/config.cxx +++ b/tools/source/generic/config.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -129,7 +130,7 @@ static sal_uInt8* ImplSysReadConfig( const XubString& rFileName, if( aFile.open( osl_File_OpenFlag_Read ) == ::osl::FileBase::E_None ) { - sal_uInt64 nPos = 0, nRead = 0; + sal_uInt64 nPos = 0; if( aFile.getSize( nPos ) == ::osl::FileBase::E_None ) { if (nPos > std::numeric_limits< std::size_t >::max()) { @@ -137,6 +138,7 @@ static sal_uInt8* ImplSysReadConfig( const XubString& rFileName, return 0; } pBuf = new sal_uInt8[static_cast< std::size_t >(nPos)]; + sal_uInt64 nRead = 0; if( aFile.read( pBuf, nPos, nRead ) == ::osl::FileBase::E_None && nRead == nPos ) { //skip the byte-order-mark 0xEF 0xBB 0xBF, if it was UTF8 files @@ -216,20 +218,20 @@ static String ImplMakeConfigName( const XubString* pFileName, if ( pFileName ) { #ifdef UNX - aFileName = ::rtl::OUString::createFromAscii( "." ); + aFileName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "." )); aFileName += *pFileName; - aFileName += ::rtl::OUString::createFromAscii( "rc" ); + aFileName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "rc" )); #else aFileName = *pFileName; - aFileName += ::rtl::OUString::createFromAscii( ".ini" ); + aFileName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".ini" )); #endif } else { #ifdef UNX - aFileName = ::rtl::OUString::createFromAscii( ".sversionrc" ); + aFileName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".sversionrc" )); #else - aFileName = ::rtl::OUString::createFromAscii( "sversion.ini" ); + aFileName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "sversion.ini" )); #endif } @@ -248,7 +250,7 @@ static String ImplMakeConfigName( const XubString* pFileName, } ::rtl::OUString aName( aPathName ); - aName += ::rtl::OUString::createFromAscii( "/" ); + aName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" )); aName += aFileName; return aName; @@ -633,7 +635,7 @@ static void ImplWriteConfig( ImplConfigData* pData ) { if ( pData->mnTimeStamp != ImplSysGetConfigTimeStamp( pData->maFileName ) ) { - DBG_ERROR1( "Config overwrites modified configfile:\n %s", ByteString( pData->maFileName, RTL_TEXTENCODING_UTF8 ).GetBuffer() ); + OSL_TRACE( "Config overwrites modified configfile:\n %s", ByteString( pData->maFileName, RTL_TEXTENCODING_UTF8 ).GetBuffer() ); } } #endif @@ -777,7 +779,7 @@ Config::Config() mbPersistence = sal_True; #ifdef DBG_UTIL - DBG_TRACE( "Config::Config()" ); + OSL_TRACE( "Config::Config()" ); #endif } @@ -797,7 +799,7 @@ Config::Config( const XubString& rFileName ) ByteString aTraceStr( "Config::Config( " ); aTraceStr += ByteString( maFileName, RTL_TEXTENCODING_UTF8 ); aTraceStr += " )"; - DBG_TRACE( aTraceStr.GetBuffer() ); + OSL_TRACE( "%s", aTraceStr.GetBuffer() ); #endif } @@ -806,7 +808,7 @@ Config::Config( const XubString& rFileName ) Config::~Config() { #ifdef DBG_UTIL - DBG_TRACE( "Config::~Config()" ); + OSL_TRACE( "Config::~Config()" ); #endif Flush(); @@ -998,7 +1000,7 @@ ByteString Config::ReadKey( const ByteString& rKey, const ByteString& rDefault ) aTraceStr += GetGroup(); aTraceStr += " in "; aTraceStr += ByteString( maFileName, RTL_TEXTENCODING_UTF8 ); - DBG_TRACE( aTraceStr.GetBuffer() ); + OSL_TRACE( "%s", aTraceStr.GetBuffer() ); #endif // Config-Daten evt. updaten @@ -1035,7 +1037,7 @@ void Config::WriteKey( const ByteString& rKey, const ByteString& rStr ) aTraceStr += GetGroup(); aTraceStr += " in "; aTraceStr += ByteString( maFileName, RTL_TEXTENCODING_UTF8 ); - DBG_TRACE( aTraceStr.GetBuffer() ); + OSL_TRACE( "%s", aTraceStr.GetBuffer() ); DBG_ASSERTWARNING( rStr != ReadKey( rKey ), "Config::WriteKey() with the same Value" ); #endif @@ -1156,7 +1158,7 @@ sal_uInt16 Config::GetKeyCount() const aTraceStr += GetGroup(); aTraceStr += " in "; aTraceStr += ByteString( maFileName, RTL_TEXTENCODING_UTF8 ); - DBG_TRACE( aTraceStr.GetBuffer() ); + OSL_TRACE( "%s", aTraceStr.GetBuffer() ); #endif // Config-Daten evt. updaten @@ -1192,7 +1194,7 @@ ByteString Config::GetKeyName( sal_uInt16 nKey ) const aTraceStr += GetGroup(); aTraceStr += " in "; aTraceStr += ByteString( maFileName, RTL_TEXTENCODING_UTF8 ); - DBG_TRACE( aTraceStr.GetBuffer() ); + OSL_TRACE( "%s", aTraceStr.GetBuffer() ); #endif // Key suchen und Name zurueckgeben @@ -1227,7 +1229,7 @@ ByteString Config::ReadKey( sal_uInt16 nKey ) const aTraceStr += GetGroup(); aTraceStr += " in "; aTraceStr += ByteString( maFileName, RTL_TEXTENCODING_UTF8 ); - DBG_TRACE( aTraceStr.GetBuffer() ); + OSL_TRACE( "%s", aTraceStr.GetBuffer() ); #endif // Key suchen und Value zurueckgeben @@ -1302,3 +1304,4 @@ LineEnd Config::GetLineEnd() const return mpData->meLineEnd; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/fract.cxx b/tools/source/generic/fract.cxx index 8481fef32e05..104662b4ff7b 100644 --- a/tools/source/generic/fract.cxx +++ b/tools/source/generic/fract.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_tools.hxx" -#ifndef _LIMITS_H #include <limits.h> -#endif #include <tools/debug.hxx> #include <tools/fract.hxx> #include <tools/stream.hxx> @@ -44,15 +43,13 @@ |* Beschreibung Berechnet den groessten gemeinsamen Teiler von |* nVal1 und nVal2 |* Parameter long nVal1, long nVal2 -|* Ersterstellung DV 20.09.90 -|* Letzte Aenderung DV 21.12.92 |* *************************************************************************/ // Die Funktion GetGGT berechnet den groessten gemeinsamen Teiler der // beiden als Parameter uebergebenen Werte nVal1 und nVal2 nach dem // Algorithmus von Euklid. Hat einer der beiden Parameter den Wert 0 oder -// 1, so wird als Ergebnis der Wert 1 zurckgegeben. Da der Algorithmus +// 1, so wird als Ergebnis der Wert 1 zur�ckgegeben. Da der Algorithmus // nur mit positiven Zahlen arbeitet, werden die beiden Parameter // entsprechend umgewandelt. // Zum Algorithmus: die beiden Parameter werden solange ducheinander @@ -129,10 +126,6 @@ static void Reduce( BigInt &rVal1, BigInt &rVal2 ) |* |* Fraction::Fraction() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung WP 07.03.97 -|* Letzte Aenderung -|* *************************************************************************/ Fraction::Fraction( long nN1, long nN2, long nD1, long nD2 ) @@ -178,10 +171,6 @@ Fraction::Fraction( long nN1, long nN2, long nD1, long nD2 ) |* |* Fraction::Fraction() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung DV 20.09.90 -|* Letzte Aenderung DV 21.12.92 -|* *************************************************************************/ // Zur Initialisierung eines Bruches wird nNum dem Zaehler und nDen dem @@ -210,10 +199,6 @@ Fraction::Fraction( long nNum, long nDen ) |* |* Fraction::Fraction() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung DV 20.09.90 -|* Letzte Aenderung DV 21.12.92 -|* *************************************************************************/ // Wenn der Wert von dVal groesser ist als LONG_MAX, dann wird der Bruch @@ -252,10 +237,6 @@ Fraction::Fraction( double dVal ) |* |* Fraction::operator double() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung DV 20.09.90 -|* Letzte Aenderung DV 14.05.91 -|* *************************************************************************/ Fraction::operator double() const @@ -270,10 +251,6 @@ Fraction::operator double() const |* |* Fraction::operator+=() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung DV 20.09.90 -|* Letzte Aenderung DV 21.12.92 -|* *************************************************************************/ // Zunaechst werden die beiden Parameter auf ihre Gueltigkeit ueberprueft. @@ -326,10 +303,6 @@ Fraction& Fraction::operator += ( const Fraction& rVal ) |* |* Fraction::operator-=() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung DV 20.09.90 -|* Letzte Aenderung DV 21.12.92 -|* *************************************************************************/ // Zunaechst werden die beiden Parameter auf ihre Gueltigkeit ueberprueft. @@ -382,10 +355,6 @@ Fraction& Fraction::operator -= ( const Fraction& rVal ) |* |* Fraction::operator*=() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung DV 20.09.90 -|* Letzte Aenderung TH 19.08.92 -|* *************************************************************************/ // Zunaechst werden die beiden Parameter auf ihre Gueltigkeit ueberprueft. @@ -434,10 +403,6 @@ Fraction& Fraction::operator *= ( const Fraction& rVal ) |* |* Fraction::operator/=() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung DV 20.09.90 -|* Letzte Aenderung DV 21.12.92 -|* *************************************************************************/ // Zunaechst werden die beiden Parameter auf ihre Gueltigkeit ueberprueft. @@ -494,10 +459,6 @@ Fraction& Fraction::operator /= ( const Fraction& rVal ) |* |* Fraction::ReduceInaccurate() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung JOE 17.09.95 -|* Letzte Aenderung kendy 2007-06-13 -|* *************************************************************************/ @@ -608,7 +569,7 @@ void Fraction::ReduceInaccurate( unsigned nSignificantBits ) if ( !nMul || !nDiv ) { // Return without reduction - DBG_ERROR( "Oops, we reduced too much..." ); + OSL_FAIL( "Oops, we reduced too much..." ); return; } @@ -628,16 +589,12 @@ void Fraction::ReduceInaccurate( unsigned nSignificantBits ) |* |* Fraction::operator ==() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung DV 20.09.90 -|* Letzte Aenderung TH 19.08.92 -|* *************************************************************************/ -sal_Bool operator == ( const Fraction& rVal1, const Fraction& rVal2 ) +bool operator == ( const Fraction& rVal1, const Fraction& rVal2 ) { if ( !rVal1.IsValid() || !rVal2.IsValid() ) - return sal_False; + return false; return rVal1.nNumerator == rVal2.nNumerator && rVal1.nDenominator == rVal2.nDenominator; @@ -647,10 +604,6 @@ sal_Bool operator == ( const Fraction& rVal1, const Fraction& rVal2 ) |* |* Fraction::operator <() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung DV 20.09.90 -|* Letzte Aenderung DV 21.12.92 -|* *************************************************************************/ // Beide Operanden werden zunaechst auf ihre Gueltigkeit ueberprueft und @@ -660,10 +613,10 @@ sal_Bool operator == ( const Fraction& rVal1, const Fraction& rVal2 ) // und (c*b) zu vergleichen. Das Ergebnis dieses Vergleichs wird // zurueckgegeben. -sal_Bool operator < ( const Fraction& rVal1, const Fraction& rVal2 ) +bool operator < ( const Fraction& rVal1, const Fraction& rVal2 ) { if ( !rVal1.IsValid() || !rVal2.IsValid() ) - return sal_False; + return false; BigInt nN( rVal1.nNumerator ); nN *= BigInt( rVal2.nDenominator ); @@ -677,10 +630,6 @@ sal_Bool operator < ( const Fraction& rVal1, const Fraction& rVal2 ) |* |* Fraction::operator >() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung DV 20.09.90 -|* Letzte Aenderung TH 19.08.92 -|* *************************************************************************/ // Beide Operanden werden zunaechst auf ihre Gueltigkeit ueberprueft und @@ -690,10 +639,10 @@ sal_Bool operator < ( const Fraction& rVal1, const Fraction& rVal2 ) // und (c*b) zu vergleichen. Das Ergebnis dieses Vergleichs wird // zurueckgegeben. -sal_Bool operator > ( const Fraction& rVal1, const Fraction& rVal2 ) +bool operator > ( const Fraction& rVal1, const Fraction& rVal2 ) { if ( !rVal1.IsValid() || !rVal2.IsValid() ) - return sal_False; + return false; BigInt nN( rVal1.nNumerator ); nN *= BigInt( rVal2.nDenominator ); @@ -707,10 +656,6 @@ sal_Bool operator > ( const Fraction& rVal1, const Fraction& rVal2 ) |* |* SvStream& operator>>( SvStream& rIStream, Fraction& rFract ) |* -|* Beschreibung FRACT.SDW -|* Ersterstellung MM 08.01.96 -|* Letzte Aenderung MM 08.01.96 -|* *************************************************************************/ SvStream& operator >> ( SvStream& rIStream, Fraction& rFract ) { @@ -723,10 +668,6 @@ SvStream& operator >> ( SvStream& rIStream, Fraction& rFract ) |* |* SvStream& operator<<( SvStream& rIStream, Fraction& rFract ) |* -|* Beschreibung FRACT.SDW -|* Ersterstellung MM 08.01.96 -|* Letzte Aenderung MM 08.01.96 -|* *************************************************************************/ SvStream& operator << ( SvStream& rOStream, const Fraction& rFract ) { @@ -734,3 +675,5 @@ SvStream& operator << ( SvStream& rOStream, const Fraction& rFract ) rOStream << rFract.nDenominator; return rOStream; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx index e4ef3ed58c82..8d72b1ab4cff 100644 --- a/tools/source/generic/gen.cxx +++ b/tools/source/generic/gen.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -193,10 +194,6 @@ SvStream& operator<<( SvStream& rOStream, const Pair& rPair ) |* |* Rectangle::SetSize() |* -|* Beschreibung GEN.SDW -|* Ersterstellung DV 29.10.91 -|* Letzte Aenderung MM 21.04.94 -|* *************************************************************************/ void Rectangle::SetSize( const Size& rSize ) @@ -220,10 +217,6 @@ void Rectangle::SetSize( const Size& rSize ) |* |* Rectangle::Union() |* -|* Beschreibung GEN.SDW -|* Ersterstellung TH 20.10.92 -|* Letzte Aenderung MM 21.04.94 -|* *************************************************************************/ Rectangle& Rectangle::Union( const Rectangle& rRect ) @@ -248,10 +241,6 @@ Rectangle& Rectangle::Union( const Rectangle& rRect ) |* |* Rectangle::Intersection() |* -|* Beschreibung GEN.SDW -|* Ersterstellung TH 20.10.92 -|* Letzte Aenderung MM 21.04.94 -|* *************************************************************************/ Rectangle& Rectangle::Intersection( const Rectangle& rRect ) @@ -286,10 +275,6 @@ Rectangle& Rectangle::Intersection( const Rectangle& rRect ) |* |* Rectangle::Justify() |* -|* Beschreibung GEN.SDW -|* Ersterstellung DV 07.03.91 -|* Letzte Aenderung DV 07.03.91 -|* *************************************************************************/ void Rectangle::Justify() @@ -317,10 +302,6 @@ void Rectangle::Justify() |* |* Rectangle::IsInside() |* -|* Beschreibung GEN.SDW -|* Ersterstellung TH 19.03.90 -|* Letzte Aenderung MM 21.04.94 -|* *************************************************************************/ sal_Bool Rectangle::IsInside( const Point& rPoint ) const @@ -356,10 +337,6 @@ sal_Bool Rectangle::IsInside( const Point& rPoint ) const |* |* Rectangle::IsInside() |* -|* Beschreibung GEN.SDW -|* Ersterstellung TH 19.03.90 -|* Letzte Aenderung MM 21.04.94 -|* *************************************************************************/ sal_Bool Rectangle::IsInside( const Rectangle& rRect ) const @@ -374,10 +351,6 @@ sal_Bool Rectangle::IsInside( const Rectangle& rRect ) const |* |* Rectangle::IsOver() |* -|* Beschreibung GEN.SDW -|* Ersterstellung TH 19.03.90 -|* Letzte Aenderung MM 21.04.94 -|* *************************************************************************/ sal_Bool Rectangle::IsOver( const Rectangle& rRect ) const @@ -659,3 +632,5 @@ SvStream& operator<<( SvStream& rOStream, const Rectangle& rRect ) return rOStream; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/line.cxx b/tools/source/generic/line.cxx index ea3b92ad9005..c8558b7bf949 100644 --- a/tools/source/generic/line.cxx +++ b/tools/source/generic/line.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -361,3 +362,5 @@ void Line::Enum( const Link& rEnumLink ) rEnumLink.Call( &aEnum ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/link.cxx b/tools/source/generic/link.cxx index 2d485a5036c4..8b5615e964bd 100644 --- a/tools/source/generic/link.cxx +++ b/tools/source/generic/link.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,10 +34,6 @@ |* |* Link::operator==() |* -|* Beschreibung LINK.SDW -|* Ersterstellung AM 14.02.91 -|* Letzte Aenderung TH 07.11.95 -|* *************************************************************************/ sal_Bool Link::operator==( const Link& rLink ) const @@ -56,3 +53,5 @@ sal_Bool Link::operator==( const Link& rLink ) const else return sal_False; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 73e89c73900f..ea1fbb3b8e14 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,12 +37,8 @@ #include <tools/vcompat.hxx> #include <poly.h> #include <tools/line.hxx> -#ifndef _VECTOR2D_H #include <tools/vector2d.hxx> -#endif -#ifndef _POLY_HXX #include <tools/poly.hxx> -#endif #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/point/b2dpoint.hxx> #include <basegfx/vector/b2dvector.hxx> @@ -2176,6 +2173,7 @@ basegfx::B2DPolygon Polygon::getB2DPolygon() const // assert invalid polygons OSL_ENSURE(bControlA == bControlB, "Polygon::getB2DPolygon: Invalid source polygon (!)"); + (void)bControlB; if(a < nCount) { @@ -2250,7 +2248,7 @@ Polygon::Polygon(const basegfx::B2DPolygon& rPolygon) // #127979# Reduce source point count hard to the limit of the tools Polygon if(nB2DLocalCount > ((0x0000ffff / 3L) - 1L)) { - DBG_ERROR("Polygon::Polygon: Too many points in given B2DPolygon, need to reduce hard to maximum of tools Polygon (!)"); + OSL_FAIL("Polygon::Polygon: Too many points in given B2DPolygon, need to reduce hard to maximum of tools Polygon (!)"); nB2DLocalCount = ((0x0000ffff / 3L) - 1L); } @@ -2344,7 +2342,7 @@ Polygon::Polygon(const basegfx::B2DPolygon& rPolygon) // #127979# Reduce source point count hard to the limit of the tools Polygon if(nB2DLocalCount > (0x0000ffff - 1L)) { - DBG_ERROR("Polygon::Polygon: Too many points in given B2DPolygon, need to reduce hard to maximum of tools Polygon (!)"); + OSL_FAIL("Polygon::Polygon: Too many points in given B2DPolygon, need to reduce hard to maximum of tools Polygon (!)"); nB2DLocalCount = (0x0000ffff - 1L); } @@ -2378,3 +2376,5 @@ Polygon::Polygon(const basegfx::B2DPolygon& rPolygon) } // eof + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx index a995c66f9cf0..fac5cf8c2d20 100644 --- a/tools/source/generic/poly2.cxx +++ b/tools/source/generic/poly2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -889,3 +890,5 @@ PolyPolygon::PolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon) } // eof + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/svborder.cxx b/tools/source/generic/svborder.cxx index fa302384745f..86df3dcffd82 100644 --- a/tools/source/generic/svborder.cxx +++ b/tools/source/generic/svborder.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -75,3 +76,4 @@ Rectangle & operator -= ( Rectangle & rRect, const SvBorder & rBorder ) return rRect; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/svlibrary.cxx b/tools/source/generic/svlibrary.cxx index 6ebfd0086b5c..fdf714933342 100644 --- a/tools/source/generic/svlibrary.cxx +++ b/tools/source/generic/svlibrary.cxx @@ -1,129 +1,132 @@ -/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_tools.hxx"
-
-#include <tools/svlibrary.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/util/XMacroExpander.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <comphelper/processfactory.hxx>
-#include <tools/string.hxx>
-#include <rtl/uri.hxx>
-
-using namespace com::sun::star;
-
-static uno::Sequence< rtl::OUString > GetMultiPaths_Impl()
-{
- uno::Sequence< rtl::OUString > aRes;
- uno::Sequence< rtl::OUString > aInternalPaths;
- uno::Sequence< rtl::OUString > aUserPaths;
-
- bool bSuccess = true;
- uno::Reference< lang::XMultiServiceFactory > xMgr( comphelper::getProcessServiceFactory() );
- if (xMgr.is())
- {
- try
- {
- String aInternal;
- aInternal.AppendAscii("Libraries");
- String aUser;
- aUser.AppendAscii("Libraries");
- aInternal .AppendAscii( "_internal" );
- aUser .AppendAscii( "_user" );
-
- uno::Reference< beans::XPropertySet > xPathSettings( xMgr->createInstance(
- rtl::OUString::createFromAscii( "com.sun.star.util.PathSettings" ) ), uno::UNO_QUERY_THROW );
- xPathSettings->getPropertyValue( aInternal ) >>= aInternalPaths;
- xPathSettings->getPropertyValue( aUser ) >>= aUserPaths;
- }
- catch (uno::Exception &)
- {
- bSuccess = false;
- }
- }
- if (bSuccess)
- {
- sal_Int32 nMaxEntries = aInternalPaths.getLength() + aUserPaths.getLength();
- aRes.realloc( nMaxEntries );
- rtl::OUString *pRes = aRes.getArray();
- sal_Int32 nCount = 0; // number of actually added entries
- for (int i = 0; i < 2; ++i)
- {
- const uno::Sequence< rtl::OUString > &rPathSeq = i == 0 ? aUserPaths : aInternalPaths;
- const rtl::OUString *pPathSeq = rPathSeq.getConstArray();
- for (sal_Int32 k = 0; k < rPathSeq.getLength(); ++k)
- {
- const bool bAddUser = (&rPathSeq == &aUserPaths);
- const bool bAddInternal = (&rPathSeq == &aInternalPaths);
- if ((bAddUser || bAddInternal) && pPathSeq[k].getLength() > 0)
- pRes[ nCount++ ] = pPathSeq[k];
- }
- }
- aRes.realloc( nCount );
- }
-
- return aRes;
-}
-
-bool SvLibrary::LoadModule( osl::Module& rModule, const rtl::OUString& rLibName, ::oslGenericFunction baseModule, ::sal_Int32 mode )
-{
- static uno::Sequence < rtl::OUString > aPaths = GetMultiPaths_Impl();
- bool bLoaded = false;
-
- for (sal_Int32 n=0; n<aPaths.getLength(); n++)
- {
- rtl::OUString aMod = aPaths[n];
- if ( aPaths[n].indexOfAsciiL("vnd.sun.star.expand",19) == 0)
- {
- uno::Reference< uno::XComponentContext > xComponentContext = comphelper::getProcessComponentContext();
- uno::Reference< util::XMacroExpander > xMacroExpander;
- xComponentContext->getValueByName(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.util.theMacroExpander") ) )
- >>= xMacroExpander;
-
- aMod = aMod.copy( sizeof("vnd.sun.star.expand:") -1 );
- aMod = ::rtl::Uri::decode( aMod, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
- aMod = xMacroExpander->expandMacros( aMod );
- }
-
- aMod += ::rtl::OUString( sal_Unicode('/') );
- aMod += rLibName;
- bLoaded = rModule.load( aMod, mode );
- if ( bLoaded )
- break;
- }
-
- if (!bLoaded )
- bLoaded = rModule.loadRelative( baseModule, rLibName, mode );
-
- return bLoaded;
-}
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_tools.hxx" + +#include <tools/svlibrary.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/util/XMacroExpander.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <comphelper/processfactory.hxx> +#include <tools/string.hxx> +#include <rtl/uri.hxx> + +using namespace com::sun::star; + +static uno::Sequence< rtl::OUString > GetMultiPaths_Impl() +{ + uno::Sequence< rtl::OUString > aRes; + uno::Sequence< rtl::OUString > aInternalPaths; + uno::Sequence< rtl::OUString > aUserPaths; + + bool bSuccess = true; + uno::Reference< lang::XMultiServiceFactory > xMgr( comphelper::getProcessServiceFactory() ); + if (xMgr.is()) + { + try + { + String aInternal; + aInternal.AppendAscii("Libraries"); + String aUser; + aUser.AppendAscii("Libraries"); + aInternal .AppendAscii( "_internal" ); + aUser .AppendAscii( "_user" ); + + uno::Reference< beans::XPropertySet > xPathSettings( xMgr->createInstance( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.PathSettings" )) ), uno::UNO_QUERY_THROW ); + xPathSettings->getPropertyValue( aInternal ) >>= aInternalPaths; + xPathSettings->getPropertyValue( aUser ) >>= aUserPaths; + } + catch (const uno::Exception &) + { + bSuccess = false; + } + } + if (bSuccess) + { + sal_Int32 nMaxEntries = aInternalPaths.getLength() + aUserPaths.getLength(); + aRes.realloc( nMaxEntries ); + rtl::OUString *pRes = aRes.getArray(); + sal_Int32 nCount = 0; // number of actually added entries + for (int i = 0; i < 2; ++i) + { + const uno::Sequence< rtl::OUString > &rPathSeq = i == 0 ? aUserPaths : aInternalPaths; + const rtl::OUString *pPathSeq = rPathSeq.getConstArray(); + for (sal_Int32 k = 0; k < rPathSeq.getLength(); ++k) + { + const bool bAddUser = (&rPathSeq == &aUserPaths); + const bool bAddInternal = (&rPathSeq == &aInternalPaths); + if ((bAddUser || bAddInternal) && pPathSeq[k].getLength() > 0) + pRes[ nCount++ ] = pPathSeq[k]; + } + } + aRes.realloc( nCount ); + } + + return aRes; +} + +bool SvLibrary::LoadModule( osl::Module& rModule, const rtl::OUString& rLibName, ::oslGenericFunction baseModule, ::sal_Int32 mode ) +{ + static uno::Sequence < rtl::OUString > aPaths = GetMultiPaths_Impl(); + bool bLoaded = false; + + for (sal_Int32 n=0; n<aPaths.getLength(); n++) + { + rtl::OUString aMod = aPaths[n]; + if ( aPaths[n].indexOfAsciiL("vnd.sun.star.expand",19) == 0) + { + uno::Reference< uno::XComponentContext > xComponentContext = comphelper::getProcessComponentContext(); + uno::Reference< util::XMacroExpander > xMacroExpander; + xComponentContext->getValueByName( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.util.theMacroExpander") ) ) + >>= xMacroExpander; + + aMod = aMod.copy( sizeof("vnd.sun.star.expand:") -1 ); + aMod = ::rtl::Uri::decode( aMod, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); + aMod = xMacroExpander->expandMacros( aMod ); + } + + aMod += ::rtl::OUString( sal_Unicode('/') ); + aMod += rLibName; + bLoaded = rModule.load( aMod, mode ); + if ( bLoaded ) + break; + } + + if (!bLoaded ) + bLoaded = rModule.loadRelative( baseModule, rLibName, mode ); + + return bLoaded; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/toolsin.cxx b/tools/source/generic/toolsin.cxx index 50c9c0187b16..36ae30096f59 100644 --- a/tools/source/generic/toolsin.cxx +++ b/tools/source/generic/toolsin.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,7 +36,7 @@ #include <tools/debug.hxx> #include <toolsin.hxx> -#if defined WNT || defined OS2 +#if defined WNT #include <dll.hxx> #endif @@ -89,7 +90,6 @@ void GlobalDeInitTools() #if defined WNT ImpDeInitWinTools(); #endif -#ifdef OS2 - ImpDeInitOS2Tools(); -#endif } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx index 80b6987d041f..78032e7d376e 100644 --- a/tools/source/inet/inetmime.cxx +++ b/tools/source/inet/inetmime.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -372,12 +373,11 @@ bool parseParameters(ParameterList const & rInput, break; }; } - pOutput->Insert(new INetContentTypeParameter(p->m_aAttribute, + pOutput->Append(new INetContentTypeParameter(p->m_aAttribute, p->m_aCharset, p->m_aLanguage, aValue, - !bBadEncoding), - LIST_APPEND); + !bBadEncoding)); p = pNext; } return true; @@ -1144,8 +1144,6 @@ sal_Char const * INetMIME::scanParameters(sal_Char const * pBegin, bool bPresent; Parameter ** pPos = aList.find(aAttribute, nSection, bPresent); - if (bPresent) - break; bool bExtended = false; if (p != pEnd && *p == '*') @@ -1302,7 +1300,8 @@ sal_Char const * INetMIME::scanParameters(sal_Char const * pBegin, pTokenBegin, static_cast< xub_StrLen >(p - pTokenBegin)); } - *pPos = new Parameter(*pPos, aAttribute, aCharset, aLanguage, aValue, + if (!bPresent) + *pPos = new Parameter(*pPos, aAttribute, aCharset, aLanguage, aValue, nSection, bExtended); } return parseParameters(aList, pParameters) ? pParameterBegin : pBegin; @@ -1549,7 +1548,7 @@ const sal_Char * INetMIME::getCharsetName(rtl_TextEncoding eEncoding) return "ISO-10646-UCS-2"; default: - DBG_ERROR("INetMIME::getCharsetName(): Unsupported encoding"); + OSL_FAIL("INetMIME::getCharsetName(): Unsupported encoding"); return 0; } } @@ -2039,7 +2038,7 @@ INetMIME::createPreferredCharsetList(rtl_TextEncoding eEncoding) break; default: //@@@ more cases are missing! - DBG_ERROR("INetMIME::createPreferredCharsetList():" + OSL_FAIL("INetMIME::createPreferredCharsetList():" " Unsupported encoding"); break; } @@ -3057,25 +3056,6 @@ bool INetMIME::translateUTF8Char(const sal_Char *& rBegin, //============================================================================ // static -ByteString INetMIME::decodeUTF8(const ByteString & rText, - rtl_TextEncoding eEncoding) -{ - const sal_Char * p = rText.GetBuffer(); - const sal_Char * pEnd = p + rText.Len(); - ByteString sDecoded; - while (p != pEnd) - { - sal_uInt32 nCharacter; - if (translateUTF8Char(p, pEnd, eEncoding, nCharacter)) - sDecoded += sal_Char(nCharacter); - else - sDecoded += sal_Char(*p++); - } - return sDecoded; -} - -//============================================================================ -// static UniString INetMIME::decodeHeaderFieldBody(HeaderFieldType eType, const ByteString & rBody) { @@ -3498,7 +3478,7 @@ UniString INetMIME::decodeHeaderFieldBody(HeaderFieldType eType, { const sal_Char * pUTF8Begin = p - 1; const sal_Char * pUTF8End = pUTF8Begin; - sal_uInt32 nCharacter; + sal_uInt32 nCharacter = 0; if (translateUTF8Char(pUTF8End, pEnd, RTL_TEXTENCODING_UCS4, nCharacter)) { @@ -3618,68 +3598,6 @@ ErrCode INetMIMEStringOutputSink::getError() const //============================================================================ // -// INetMIMEUnicodeOutputSink -// -//============================================================================ - -// virtual -void INetMIMEUnicodeOutputSink::writeSequence(const sal_Char * pBegin, - const sal_Char * pEnd) -{ - DBG_ASSERT(pBegin && pBegin <= pEnd, - "INetMIMEUnicodeOutputSink::writeSequence(): Bad sequence"); - - sal_Unicode * pBufferBegin = new sal_Unicode[pEnd - pBegin]; - sal_Unicode * pBufferEnd = pBufferBegin; - while (pBegin != pEnd) - *pBufferEnd++ = sal_uChar(*pBegin++); - writeSequence(pBufferBegin, pBufferEnd); - delete[] pBufferBegin; -} - -//============================================================================ -// virtual -void INetMIMEUnicodeOutputSink::writeSequence(const sal_uInt32 * pBegin, - const sal_uInt32 * pEnd) -{ - DBG_ASSERT(pBegin && pBegin <= pEnd, - "INetMIMEUnicodeOutputSink::writeSequence(): Bad sequence"); - - sal_Unicode * pBufferBegin = new sal_Unicode[pEnd - pBegin]; - sal_Unicode * pBufferEnd = pBufferBegin; - while (pBegin != pEnd) - { - DBG_ASSERT(*pBegin < 256, - "INetMIMEOutputSink::writeSequence(): Bad octet"); - *pBufferEnd++ = sal_Unicode(*pBegin++); - } - writeSequence(pBufferBegin, pBufferEnd); - delete[] pBufferBegin; -} - -//============================================================================ -// virtual -void INetMIMEUnicodeOutputSink::writeSequence(const sal_Unicode * pBegin, - const sal_Unicode * pEnd) -{ - DBG_ASSERT(pBegin && pBegin <= pEnd, - "INetMIMEUnicodeOutputSink::writeSequence(): Bad sequence"); - - m_bOverflow = m_bOverflow - || pEnd - pBegin > STRING_MAXLEN - m_aBuffer.Len(); - if (!m_bOverflow) - m_aBuffer.Append(pBegin, static_cast< xub_StrLen >(pEnd - pBegin)); -} - -//============================================================================ -// virtual -ErrCode INetMIMEUnicodeOutputSink::getError() const -{ - return m_bOverflow ? ERRCODE_IO_OUTOFMEMORY : ERRCODE_NONE; -} - -//============================================================================ -// // INetMIMEEncodedWordOutputSink // //============================================================================ @@ -4544,20 +4462,21 @@ INetMIMEEncodedWordOutputSink::operator <<(sal_uInt32 nChar) void INetContentTypeParameterList::Clear() { - while (Count() > 0) - delete static_cast< INetContentTypeParameter * >(Remove(Count() - 1)); + maEntries.clear(); } //============================================================================ const INetContentTypeParameter * INetContentTypeParameterList::find(const ByteString & rAttribute) const { - for (sal_uIntPtr i = 0; i < Count(); ++i) + boost::ptr_vector<INetContentTypeParameter>::const_iterator iter; + for (iter = maEntries.begin(); iter != maEntries.end(); ++iter) { - const INetContentTypeParameter * pParameter = GetObject(i); - if (pParameter->m_sAttribute.EqualsIgnoreCaseAscii(rAttribute)) - return pParameter; + if (iter->m_sAttribute.EqualsIgnoreCaseAscii(rAttribute)) + return &(*iter); } - return 0; + + return NULL; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/inet/inetmsg.cxx b/tools/source/inet/inetmsg.cxx index 8432bb52e23d..2fc9f5fcb8e3 100644 --- a/tools/source/inet/inetmsg.cxx +++ b/tools/source/inet/inetmsg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,9 +30,7 @@ #include "precompiled_tools.hxx" #include <sal/types.h> #include <tools/datetime.hxx> -#ifndef _TOOLS_INETMIME_HXX #include <tools/inetmime.hxx> -#endif #include <tools/inetmsg.hxx> #include <tools/inetstrm.hxx> #include <rtl/instance.hxx> @@ -689,13 +688,6 @@ sal_uIntPtr INetRFC822Message::SetHeaderField ( nIdx = INETMSG_RFC822_X_MAILER; break; -#if 0 /* NYI */ - case 'p': - check = "riority"; - eOkState = INETMSG_RFC822_X_PRIORITY; - break; -#endif /* NYI */ - default: eState = INETMSG_RFC822_JUNK; break; @@ -906,14 +898,6 @@ void INetRFC822Message::SetTo (const UniString& rTo) m_nIndex[INETMSG_RFC822_TO]); } -void INetRFC822Message::SetXMailer (const UniString& rXMailer) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_TEXT, - HDR(INETMSG_RFC822_X_MAILER), rXMailer, - m_nIndex[INETMSG_RFC822_X_MAILER]); -} - /* * operator<< */ @@ -1651,3 +1635,4 @@ SvStream& INetMIMEMessage::operator>> (SvStream& rStrm) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/inet/inetstrm.cxx b/tools/source/inet/inetstrm.cxx index 33ed7c8dc41f..07d404b090ad 100644 --- a/tools/source/inet/inetstrm.cxx +++ b/tools/source/inet/inetstrm.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -1685,9 +1686,9 @@ int INetMIMEMessageStream::PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize) for( pOldPos = pChar = (const sal_Char *) pMsgBuffer->GetData(); nBufSize--; pChar++ ) { - int status; if( *pChar == '\r' || *pChar == '\n' ) { + int status; if( aDelim.CompareTo (pOldPos, aDelim.Len()) != COMPARE_EQUAL && aClose.CompareTo (pOldPos, aClose.Len()) @@ -1819,3 +1820,4 @@ int INetMIMEMessageStream::PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize) +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/memtools/contnr.cxx b/tools/source/memtools/contnr.cxx index 63dc74e37441..9fe9babc5f05 100755..100644 --- a/tools/source/memtools/contnr.cxx +++ b/tools/source/memtools/contnr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,17 +29,11 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_tools.hxx" -#ifndef _LIMITS_H #include <limits.h> -#endif -#ifndef _STRING_H #include <string.h> -#endif -#ifndef _STDIO_H #include <stdio.h> -#endif #include <tools/solar.h> #include <impcont.hxx> #include <tools/contnr.hxx> @@ -54,8 +49,6 @@ DBG_NAME( Container ) |* DbgCheckCBlock() |* |* Beschreibung Pruefung eines CBlock fuer Debug-Utilities -|* Ersterstellung MI 30.01.92 -|* Letzte Aenderung TH 24.01.96 |* *************************************************************************/ @@ -79,8 +72,6 @@ const char* CBlock::DbgCheckCBlock( const void* pBlock ) |* CBlock::CBlock() |* |* Beschreibung Construktor des Verwaltungsblocks -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 |* *************************************************************************/ @@ -102,8 +93,6 @@ CBlock::CBlock( sal_uInt16 nInitSize, CBlock* _pPrev, CBlock* _pNext ) |* CBlock::CBlock() |* |* Beschreibung Construktor des Verwaltungsblocks -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 |* *************************************************************************/ @@ -127,8 +116,6 @@ CBlock::CBlock( sal_uInt16 _nSize, CBlock* _pPrev ) |* CBlock::CBlock() |* |* Beschreibung Copy-Construktor des Verwaltungsblocks -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 |* *************************************************************************/ @@ -152,8 +139,6 @@ CBlock::CBlock( const CBlock& r, CBlock* _pPrev ) |* CBlock::~CBlock() |* |* Beschreibung Destruktor des Verwaltungsblocks -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 |* *************************************************************************/ @@ -170,8 +155,6 @@ inline CBlock::~CBlock() |* CBlock::Insert() |* |* Beschreibung Fuegt einen Pointer ein -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 |* *************************************************************************/ @@ -226,8 +209,6 @@ void CBlock::Insert( void* p, sal_uInt16 nIndex, sal_uInt16 nReSize ) |* CBlock::Split() |* |* Beschreibung Fuegt einen Pointer ein und splittet den Block -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 |* *************************************************************************/ @@ -363,8 +344,6 @@ CBlock* CBlock::Split( void* p, sal_uInt16 nIndex, sal_uInt16 nReSize ) |* CBlock::Remove() |* |* Beschreibung Entfernt einen Pointer -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 |* *************************************************************************/ @@ -422,8 +401,6 @@ void* CBlock::Remove( sal_uInt16 nIndex, sal_uInt16 nReSize ) |* CBlock::Replace() |* |* Beschreibung Ersetzt einen Pointer -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 |* *************************************************************************/ @@ -443,8 +420,6 @@ inline void* CBlock::Replace( void* p, sal_uInt16 nIndex ) |* |* Beschreibung Gibt einen Pointer auf den Pointer aus dem Block |* zurueck -|* Ersterstellung TH 26.01.93 -|* Letzte Aenderung TH 26.01.93 |* *************************************************************************/ @@ -460,8 +435,6 @@ inline void** CBlock::GetObjectPtr( sal_uInt16 nIndex ) |* CBlock::SetSize() |* |* Beschreibung Aendert die Groesse des Blocks -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 |* *************************************************************************/ @@ -502,8 +475,6 @@ void CBlock::SetSize( sal_uInt16 nNewSize ) |* DbgCheckContainer() |* |* Beschreibung Pruefung eines Container fuer Debug-Utilities -|* Ersterstellung MI 30.01.92 -|* Letzte Aenderung TH 24.01.96 |* *************************************************************************/ @@ -524,8 +495,6 @@ const char* Container::DbgCheckContainer( const void* pCont ) |* ImpCopyContainer() |* |* Beschreibung Kopiert alle Daten des Containers -|* Ersterstellung TH 24.01.96 -|* Letzte Aenderung TH 24.01.96 |* *************************************************************************/ @@ -583,10 +552,6 @@ void Container::ImpCopyContainer( const Container* pCont2 ) |* |* Container::Container() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ Container::Container( sal_uInt16 _nBlockSize, sal_uInt16 _nInitSize, sal_uInt16 _nReSize ) @@ -648,10 +613,6 @@ Container::Container( sal_uInt16 _nBlockSize, sal_uInt16 _nInitSize, sal_uInt16 |* |* Container::Container() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ Container::Container( sal_uIntPtr nSize ) @@ -708,10 +669,6 @@ Container::Container( sal_uIntPtr nSize ) |* |* Container::Container() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ Container::Container( const Container& r ) @@ -726,10 +683,6 @@ Container::Container( const Container& r ) |* |* Container::~Container() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ Container::~Container() @@ -751,8 +704,6 @@ Container::~Container() |* Container::ImpInsert() |* |* Beschreibung Interne Methode zum Einfuegen eines Pointers -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung DV 01.07.97 |* *************************************************************************/ @@ -835,10 +786,6 @@ void Container::ImpInsert( void* p, CBlock* pBlock, sal_uInt16 nIndex ) |* |* Container::Insert() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ void Container::Insert( void* p ) @@ -850,10 +797,6 @@ void Container::Insert( void* p ) |* |* Container::Insert() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ void Container::Insert( void* p, sal_uIntPtr nIndex ) @@ -883,10 +826,6 @@ void Container::Insert( void* p, sal_uIntPtr nIndex ) |* |* Container::Insert() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ void Container::Insert( void* pNew, void* pOld ) @@ -901,8 +840,6 @@ void Container::Insert( void* pNew, void* pOld ) |* Container::ImpRemove() |* |* Beschreibung Interne Methode zum Entfernen eines Pointers -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 |* *************************************************************************/ @@ -977,10 +914,6 @@ void* Container::ImpRemove( CBlock* pBlock, sal_uInt16 nIndex ) |* |* Container::Remove() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ void* Container::Remove() @@ -996,10 +929,6 @@ void* Container::Remove() |* |* Container::Remove() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ void* Container::Remove( sal_uIntPtr nIndex ) @@ -1025,10 +954,6 @@ void* Container::Remove( sal_uIntPtr nIndex ) |* |* Container::Replace() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ void* Container::Replace( void* p ) @@ -1045,10 +970,6 @@ void* Container::Replace( void* p ) |* |* Container::Replace() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ void* Container::Replace( void* p, sal_uIntPtr nIndex ) @@ -1076,10 +997,6 @@ void* Container::Replace( void* p, sal_uIntPtr nIndex ) |* |* Container::SetSize() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ void Container::SetSize( sal_uIntPtr nNewSize ) @@ -1220,10 +1137,6 @@ void Container::SetSize( sal_uIntPtr nNewSize ) |* |* Container::Clear() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ void Container::Clear() @@ -1251,10 +1164,6 @@ void Container::Clear() |* |* Container::GetCurObject() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ void* Container::GetCurObject() const @@ -1272,10 +1181,6 @@ void* Container::GetCurObject() const |* |* Container::GetCurPos() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ sal_uIntPtr Container::GetCurPos() const @@ -1305,8 +1210,6 @@ sal_uIntPtr Container::GetCurPos() const |* Container::GetObjectPtr() |* |* Beschreibung Interne Methode fuer Referenz-Container -|* Ersterstellung TH 26.01.93 -|* Letzte Aenderung TH 26.01.93 |* *************************************************************************/ @@ -1336,10 +1239,6 @@ void** Container::GetObjectPtr( sal_uIntPtr nIndex ) |* |* Container::GetObject() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ void* Container::GetObject( sal_uIntPtr nIndex ) const @@ -1368,10 +1267,6 @@ void* Container::GetObject( sal_uIntPtr nIndex ) const |* |* Container::GetPos() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ sal_uIntPtr Container::GetPos( const void* p ) const @@ -1410,10 +1305,6 @@ sal_uIntPtr Container::GetPos( const void* p ) const |* |* Container::GetPos() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 14.09.94 -|* Letzte Aenderung TH 14.09.94 -|* *************************************************************************/ sal_uIntPtr Container::GetPos( const void* p, sal_uIntPtr nStartIndex, @@ -1505,10 +1396,6 @@ sal_uIntPtr Container::GetPos( const void* p, sal_uIntPtr nStartIndex, |* |* Container::Seek() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ void* Container::Seek( sal_uIntPtr nIndex ) @@ -1539,10 +1426,6 @@ void* Container::Seek( sal_uIntPtr nIndex ) |* |* Container::First() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ void* Container::First() @@ -1565,10 +1448,6 @@ void* Container::First() |* |* Container::Last() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ void* Container::Last() @@ -1591,10 +1470,6 @@ void* Container::Last() |* |* Container::Next() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ void* Container::Next() @@ -1623,10 +1498,6 @@ void* Container::Next() |* |* Container::Prev() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ void* Container::Prev() @@ -1655,10 +1526,6 @@ void* Container::Prev() |* |* Container::operator =() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ Container& Container::operator =( const Container& r ) @@ -1683,10 +1550,6 @@ Container& Container::operator =( const Container& r ) |* |* Container::operator ==() |* -|* Beschreibung CONTNR.SDW -|* Ersterstellung TH 17.09.91 -|* Letzte Aenderung TH 17.09.91 -|* *************************************************************************/ sal_Bool Container::operator ==( const Container& r ) const @@ -1706,3 +1569,5 @@ sal_Bool Container::operator ==( const Container& r ) const return sal_True; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/memtools/mempool.cxx b/tools/source/memtools/mempool.cxx index e8be417b15a2..55856d90bc0f 100755..100644 --- a/tools/source/memtools/mempool.cxx +++ b/tools/source/memtools/mempool.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,9 +33,7 @@ #include "osl/diagnose.h" #include "rtl/alloc.h" -#ifndef INCLUDED_STDIO_H #include <stdio.h> -#endif /************************************************************************* |* @@ -85,3 +84,5 @@ void FixedMemPool::Free( void* pFree ) { rtl_cache_free ((rtl_cache_type*)(m_pImpl), pFree); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/memtools/multisel.cxx b/tools/source/memtools/multisel.cxx index 8fd94361d2a3..295b8376d366 100755..100644 --- a/tools/source/memtools/multisel.cxx +++ b/tools/source/memtools/multisel.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,7 +47,7 @@ #define DBG(x) #endif -using namespace rtl; +using ::rtl::OUString; //================================================================== @@ -82,41 +83,41 @@ void MultiSelection::ImplClear() // no selected indexes nSelCount = 0; - Range* pRange = aSels.First(); - while ( pRange ) - { - delete pRange; - pRange = aSels.Next(); + for ( size_t i = 0, n = aSels.size(); i < n; ++i ) { + delete aSels[ i ]; } - aSels.Clear(); + aSels.clear(); } // ----------------------------------------------------------------------- -sal_uIntPtr MultiSelection::ImplFindSubSelection( long nIndex ) const +size_t MultiSelection::ImplFindSubSelection( long nIndex ) const { // iterate through the sub selections - sal_uIntPtr n = 0; + size_t n = 0; for ( ; - n < aSels.Count() && nIndex > aSels.GetObject(n)->Max(); + n < aSels.size() && nIndex > aSels[ n ]->Max(); ++n ) {} /* empty loop */ return n; } // ----------------------------------------------------------------------- -sal_Bool MultiSelection::ImplMergeSubSelections( sal_uIntPtr nPos1, sal_uIntPtr nPos2 ) +sal_Bool MultiSelection::ImplMergeSubSelections( size_t nPos1, size_t nPos2 ) { // didn't a sub selection at nPos2 exist? - if ( nPos2 >= aSels.Count() ) + if ( nPos2 >= aSels.size() ) return sal_False; // did the sub selections touch each other? - if ( (aSels.GetObject(nPos1)->Max() + 1) == aSels.GetObject(nPos2)->Min() ) + if ( (aSels[ nPos1 ]->Max() + 1) == aSels[ nPos2 ]->Min() ) { // merge them - aSels.GetObject(nPos1)->Max() = aSels.GetObject(nPos2)->Max(); - delete aSels.Remove(nPos2); + aSels[ nPos1 ]->Max() = aSels[ nPos2 ]->Max(); + ImpSelList::iterator it = aSels.begin(); + ::std::advance( it, nPos2 ); + delete *it; + aSels.erase( it ); return sal_True; } @@ -307,8 +308,8 @@ MultiSelection::MultiSelection( const MultiSelection& rOrig ) : } // copy the sub selections - for ( sal_uIntPtr n = 0; n < rOrig.aSels.Count(); ++n ) - aSels.Insert( new Range( *rOrig.aSels.GetObject(n) ), LIST_APPEND ); + for ( size_t n = 0; n < rOrig.aSels.size(); ++n ) + aSels.push_back( new Range( *rOrig.aSels[ n ] ) ); } // ----------------------------------------------------------------------- @@ -326,12 +327,9 @@ MultiSelection::MultiSelection( const Range& rRange ): MultiSelection::~MultiSelection() { - Range* pRange = aSels.First(); - while ( pRange ) - { - delete pRange; - pRange = aSels.Next(); - } + for ( size_t i = 0, n = aSels.size(); i < n; ++i ) + delete aSels[ i ]; + aSels.clear(); } // ----------------------------------------------------------------------- @@ -348,8 +346,8 @@ MultiSelection& MultiSelection::operator= ( const MultiSelection& rOrig ) // clear the old and copy the sub selections ImplClear(); - for ( sal_uIntPtr n = 0; n < rOrig.aSels.Count(); ++n ) - aSels.Insert( new Range( *rOrig.aSels.GetObject(n) ), LIST_APPEND ); + for ( size_t n = 0; n < rOrig.aSels.size(); ++n ) + aSels.push_back( new Range( *rOrig.aSels[ n ] ) ); nSelCount = rOrig.nSelCount; return *this; @@ -360,12 +358,12 @@ MultiSelection& MultiSelection::operator= ( const MultiSelection& rOrig ) sal_Bool MultiSelection::operator== ( MultiSelection& rWith ) { if ( aTotRange != rWith.aTotRange || nSelCount != rWith.nSelCount || - aSels.Count() != rWith.aSels.Count() ) + aSels.size() != rWith.aSels.size() ) return sal_False; // compare the sub seletions - for ( sal_uIntPtr n = 0; n < aSels.Count(); ++n ) - if ( *aSels.GetObject(n) != *rWith.aSels.GetObject(n) ) + for ( size_t n = 0; n < aSels.size(); ++n ) + if ( *aSels[ n ] != *rWith.aSels[ n ] ) return sal_False; return sal_True; } @@ -379,7 +377,7 @@ void MultiSelection::SelectAll( sal_Bool bSelect ) ImplClear(); if ( bSelect ) { - aSels.Insert( new Range(aTotRange), LIST_APPEND ); + aSels.push_back( new Range(aTotRange) ); nSelCount = aTotRange.Len(); } @@ -397,13 +395,12 @@ sal_Bool MultiSelection::Select( long nIndex, sal_Bool bSelect ) return sal_False; // find the virtual target position - sal_uIntPtr nSubSelPos = ImplFindSubSelection( nIndex ); + size_t nSubSelPos = ImplFindSubSelection( nIndex ); if ( bSelect ) { // is it included in the found sub selection? - if ( nSubSelPos < aSels.Count() && - aSels.GetObject(nSubSelPos)->IsInside( nIndex ) ) + if ( nSubSelPos < aSels.size() && aSels[ nSubSelPos ]->IsInside( nIndex ) ) // already selected, nothing to do return sal_False; @@ -412,23 +409,30 @@ sal_Bool MultiSelection::Select( long nIndex, sal_Bool bSelect ) // is it at the end of the previous sub selection if ( nSubSelPos > 0 && - aSels.GetObject(nSubSelPos-1)->Max() == (nIndex-1) ) + aSels[ nSubSelPos-1 ]->Max() == (nIndex-1) ) { // expand the previous sub selection - aSels.GetObject(nSubSelPos-1)->Max() = nIndex; + aSels[ nSubSelPos-1 ]->Max() = nIndex; // try to merge the previous sub selection ImplMergeSubSelections( nSubSelPos-1, nSubSelPos ); } // is is at the beginning of the found sub selection - else if ( nSubSelPos < aSels.Count() && - aSels.GetObject(nSubSelPos)->Min() == (nIndex+1) ) + else if ( nSubSelPos < aSels.size() + && aSels[ nSubSelPos ]->Min() == (nIndex+1) + ) // expand the found sub selection - aSels.GetObject(nSubSelPos)->Min() = nIndex; + aSels[ nSubSelPos ]->Min() = nIndex; else { // create a new sub selection - aSels.Insert( new Range( nIndex, nIndex ), nSubSelPos ); + if ( nSubSelPos < aSels.size() ) { + ImpSelList::iterator it = aSels.begin(); + ::std::advance( it, nSubSelPos ); + aSels.insert( it, new Range( nIndex, nIndex ) ); + } else { + aSels.push_back( new Range( nIndex, nIndex ) ); + } if ( bCurValid && nCurSubSel >= nSubSelPos ) ++nCurSubSel; } @@ -436,9 +440,9 @@ sal_Bool MultiSelection::Select( long nIndex, sal_Bool bSelect ) else { // is it excluded from the found sub selection? - if ( nSubSelPos >= aSels.Count() || - !aSels.GetObject(nSubSelPos)->IsInside( nIndex ) ) - { + if ( nSubSelPos >= aSels.size() + || !aSels[ nSubSelPos ]->IsInside( nIndex ) + ) { // not selected, nothing to do DBG(Print( this )); return sal_False; @@ -448,28 +452,35 @@ sal_Bool MultiSelection::Select( long nIndex, sal_Bool bSelect ) --nSelCount; // is it the only index in the found sub selection? - if ( aSels.GetObject(nSubSelPos)->Len() == 1 ) + if ( aSels[ nSubSelPos ]->Len() == 1 ) { // remove the complete sub selection - delete aSels.Remove( nSubSelPos ); + ImpSelList::iterator it = aSels.begin(); + ::std::advance( it, nSubSelPos ); + delete *it; + aSels.erase( it ); DBG(Print( this )); return sal_True; } // is it at the beginning of the found sub selection? - if ( aSels.GetObject(nSubSelPos)->Min() == nIndex ) - ++aSels.GetObject(nSubSelPos)->Min(); + if ( aSels[ nSubSelPos ]->Min() == nIndex ) + ++aSels[ nSubSelPos ]->Min(); // is it at the end of the found sub selection? - else if ( aSels.GetObject(nSubSelPos)->Max() == nIndex ) - --aSels.GetObject(nSubSelPos)->Max(); + else if ( aSels[ nSubSelPos ]->Max() == nIndex ) + --aSels[ nSubSelPos ]->Max(); // it is in the middle of the found sub selection? else { // split the sub selection - aSels.Insert( - new Range( aSels.GetObject(nSubSelPos)->Min(), nIndex-1 ), - nSubSelPos ); - aSels.GetObject(nSubSelPos+1)->Min() = nIndex + 1; + if ( nSubSelPos < aSels.size() ) { + ImpSelList::iterator it = aSels.begin(); + ::std::advance( it, nSubSelPos ); + aSels.insert( it, new Range( aSels[ nSubSelPos ]->Min(), nIndex-1 ) ); + } else { + aSels.push_back( new Range( aSels[ nSubSelPos ]->Min(), nIndex-1 ) ); + } + aSels[ nSubSelPos+1 ]->Min() = nIndex + 1; } } @@ -498,7 +509,7 @@ void MultiSelection::Select( const Range& rIndexRange, sal_Bool bSelect ) ImplClear(); if ( bSelect ) { - aSels.Insert( new Range(rIndexRange), LIST_APPEND ); + aSels.push_back( new Range(rIndexRange) ); nSelCount = rIndexRange.Len(); } return; @@ -512,12 +523,12 @@ void MultiSelection::Select( const Range& rIndexRange, sal_Bool bSelect ) if( nCurMin > (nTmpMax+1) ) { pRange = new Range( rIndexRange ); - aSels.Insert( pRange, (sal_uIntPtr)0 ); + aSels.insert( aSels.begin() , pRange ); nSelCount += pRange->Len(); } else { - pRange = aSels.First(); + pRange = aSels.front(); nOld = pRange->Min(); pRange->Min() = (long)nTmpMin; nSelCount += ( nOld - nTmpMin ); @@ -535,12 +546,12 @@ void MultiSelection::Select( const Range& rIndexRange, sal_Bool bSelect ) if( nTmpMin > (nCurMax+1) ) { pRange = new Range( rIndexRange ); - aSels.Insert( pRange, LIST_APPEND ); + aSels.push_back( pRange ); nSelCount += pRange->Len(); } else { - pRange = aSels.Last(); + pRange = aSels.back(); nOld = pRange->Max(); pRange->Max() = (long)nTmpMax; nSelCount += ( nTmpMax - nOld ); @@ -563,10 +574,9 @@ void MultiSelection::Select( const Range& rIndexRange, sal_Bool bSelect ) sal_Bool MultiSelection::IsSelected( long nIndex ) const { // find the virtual target position - sal_uIntPtr nSubSelPos = ImplFindSubSelection( nIndex ); + size_t nSubSelPos = ImplFindSubSelection( nIndex ); - return nSubSelPos < aSels.Count() && - aSels.GetObject(nSubSelPos)->IsInside(nIndex); + return nSubSelPos < aSels.size() && aSels[ nSubSelPos ]->IsInside(nIndex); } // ----------------------------------------------------------------------- @@ -576,42 +586,46 @@ void MultiSelection::Insert( long nIndex, long nCount ) DBG(DbgOutf( "::Insert(%ld, %ld)\n", nIndex, nCount )); // find the virtual target position - sal_uIntPtr nSubSelPos = ImplFindSubSelection( nIndex ); + size_t nSubSelPos = ImplFindSubSelection( nIndex ); // did we need to shift the sub selections? - if ( nSubSelPos < aSels.Count() ) - { - // did we insert an unselected into an existing sub selection? - if ( !bSelectNew && aSels.GetObject(nSubSelPos)->Min() != nIndex && - aSels.GetObject(nSubSelPos)->IsInside(nIndex) ) - { - // split the sub selection - aSels.Insert( - new Range( aSels.GetObject(nSubSelPos)->Min(), nIndex-1 ), - nSubSelPos ); + if ( nSubSelPos < aSels.size() ) + { // did we insert an unselected into an existing sub selection? + if ( !bSelectNew + && aSels[ nSubSelPos ]->Min() != nIndex + && aSels[ nSubSelPos ]->IsInside(nIndex) + ) { // split the sub selection + if ( nSubSelPos < aSels.size() ) { + ImpSelList::iterator it = aSels.begin(); + ::std::advance( it, nSubSelPos ); + aSels.insert( it, new Range( aSels[ nSubSelPos ]->Min(), nIndex-1 ) ); + } else { + aSels.push_back( new Range( aSels[ nSubSelPos ]->Min(), nIndex-1 ) ); + } ++nSubSelPos; - aSels.GetObject(nSubSelPos)->Min() = nIndex; + aSels[ nSubSelPos ]->Min() = nIndex; } // did we append an selected to an existing sub selection? - else if ( bSelectNew && nSubSelPos > 0 && - aSels.GetObject(nSubSelPos)->Max() == nIndex-1 ) - // expand the previous sub selection - aSels.GetObject(nSubSelPos-1)->Max() += nCount; + else if ( bSelectNew + && nSubSelPos > 0 + && aSels[ nSubSelPos ]->Max() == nIndex-1 + ) // expand the previous sub selection + aSels[ nSubSelPos-1 ]->Max() += nCount; // did we insert an selected into an existing sub selection? - else if ( bSelectNew && aSels.GetObject(nSubSelPos)->Min() == nIndex ) - { - // expand the sub selection - aSels.GetObject(nSubSelPos)->Max() += nCount; + else if ( bSelectNew + && aSels[ nSubSelPos ]->Min() == nIndex + ) { // expand the sub selection + aSels[ nSubSelPos ]->Max() += nCount; ++nSubSelPos; } // shift the sub selections behind the inserting position - for ( sal_uIntPtr nPos = nSubSelPos; nPos < aSels.Count(); ++nPos ) + for ( size_t nPos = nSubSelPos; nPos < aSels.size(); ++nPos ) { - aSels.GetObject(nPos)->Min() += nCount; - aSels.GetObject(nPos)->Max() += nCount; + aSels[ nPos ]->Min() += nCount; + aSels[ nPos ]->Max() += nCount; } } @@ -630,29 +644,33 @@ void MultiSelection::Remove( long nIndex ) DBG(DbgOutf( "::Remove(%ld)\n", nIndex )); // find the virtual target position - sal_uIntPtr nSubSelPos = ImplFindSubSelection( nIndex ); + size_t nSubSelPos = ImplFindSubSelection( nIndex ); // did we remove from an existing sub selection? - if ( nSubSelPos < aSels.Count() && - aSels.GetObject(nSubSelPos)->IsInside(nIndex) ) - { + if ( nSubSelPos < aSels.size() + && aSels[ nSubSelPos ]->IsInside(nIndex) + ) { // does this sub selection only contain the index to be deleted - if ( aSels.GetObject(nSubSelPos)->Len() == 1 ) + if ( aSels[ nSubSelPos ]->Len() == 1 ) { // completely remove the sub selection - aSels.Remove(nSubSelPos); - else + ImpSelList::iterator it = aSels.begin(); + ::std::advance( it, nSubSelPos ); + delete *it; + aSels.erase( it ); + } else { // shorten this sub selection - --( aSels.GetObject(nSubSelPos++)->Max() ); + --( aSels[ nSubSelPos++ ]->Max() ); + } // adjust the selected counter --nSelCount; } // shift the sub selections behind the removed index - for ( sal_uIntPtr nPos = nSubSelPos; nPos < aSels.Count(); ++nPos ) + for ( size_t nPos = nSubSelPos; nPos < aSels.size(); ++nPos ) { - --( aSels.GetObject(nPos)->Min() ); - --( aSels.GetObject(nPos)->Max() ); + --( aSels[ nPos ]->Min() ); + --( aSels[ nPos ]->Max() ); } bCurValid = sal_False; @@ -670,10 +688,9 @@ void MultiSelection::Append( long nCount ) if ( bSelectNew ) { nSelCount += nCount; - aSels.Insert( new Range( nPrevLast+1, nPrevLast + nCount ), - LIST_APPEND ); - if ( aSels.Count() > 1 ) - ImplMergeSubSelections( aSels.Count() - 2, aSels.Count() ); + aSels.push_back( new Range( nPrevLast+1, nPrevLast + nCount ) ); + if ( aSels.size() > 1 ) + ImplMergeSubSelections( aSels.size() - 2, aSels.size() ); } } @@ -684,9 +701,10 @@ long MultiSelection::ImplFwdUnselected() if ( !bCurValid ) return SFX_ENDOFSELECTION; - if ( ( nCurSubSel < aSels.Count() ) && - ( aSels.GetObject(nCurSubSel)->Min() <= nCurIndex ) ) - nCurIndex = aSels.GetObject(nCurSubSel++)->Max() + 1; + if ( ( nCurSubSel < aSels.size() ) + && ( aSels[ nCurSubSel ]->Min() <= nCurIndex ) + ) + nCurIndex = aSels[ nCurSubSel++ ]->Max() + 1; if ( nCurIndex <= aTotRange.Max() ) return nCurIndex; @@ -701,10 +719,10 @@ long MultiSelection::ImplBwdUnselected() if ( !bCurValid ) return SFX_ENDOFSELECTION; - if ( aSels.GetObject(nCurSubSel)->Max() < nCurIndex ) + if ( aSels[ nCurSubSel ]->Max() < nCurIndex ) return nCurIndex; - nCurIndex = aSels.GetObject(nCurSubSel--)->Min() - 1; + nCurIndex = aSels[ nCurSubSel-- ]->Min() - 1; if ( nCurIndex >= 0 ) return nCurIndex; else @@ -729,9 +747,9 @@ long MultiSelection::FirstSelected( sal_Bool bInverse ) } else { - bCurValid = aSels.Count() > 0; + bCurValid = !aSels.empty(); if ( bCurValid ) - return nCurIndex = aSels.GetObject(0)->Min(); + return nCurIndex = aSels[ 0 ]->Min(); } return SFX_ENDOFSELECTION; @@ -741,11 +759,11 @@ long MultiSelection::FirstSelected( sal_Bool bInverse ) long MultiSelection::LastSelected() { - nCurSubSel = aSels.Count() - 1; - bCurValid = aSels.Count() > 0; + nCurSubSel = aSels.size() - 1; + bCurValid = !aSels.empty(); if ( bCurValid ) - return nCurIndex = aSels.GetObject(nCurSubSel)->Max(); + return nCurIndex = aSels[ nCurSubSel ]->Max(); return SFX_ENDOFSELECTION; } @@ -765,12 +783,12 @@ long MultiSelection::NextSelected() else { // is the next index in the current sub selection too? - if ( nCurIndex < aSels.GetObject(nCurSubSel)->Max() ) + if ( nCurIndex < aSels[ nCurSubSel ]->Max() ) return ++nCurIndex; // are there further sub selections? - if ( ++nCurSubSel < aSels.Count() ) - return nCurIndex = aSels.GetObject(nCurSubSel)->Min(); + if ( ++nCurSubSel < aSels.size() ) + return nCurIndex = aSels[ nCurSubSel ]->Min(); // we are at the end! return SFX_ENDOFSELECTION; @@ -792,14 +810,14 @@ long MultiSelection::PrevSelected() else { // is the previous index in the current sub selection too? - if ( nCurIndex > aSels.GetObject(nCurSubSel)->Min() ) + if ( nCurIndex > aSels[ nCurSubSel ]->Min() ) return --nCurIndex; // are there previous sub selections? if ( nCurSubSel > 0 ) { --nCurSubSel; - return nCurIndex = aSels.GetObject(nCurSubSel)->Max(); + return nCurIndex = aSels[ nCurSubSel ]->Max(); } // we are at the beginning! @@ -814,13 +832,13 @@ void MultiSelection::SetTotalRange( const Range& rTotRange ) aTotRange = rTotRange; // die untere Bereichsgrenze anpassen - Range* pRange = aSels.GetObject( 0 ); + Range* pRange = aSels.empty() ? NULL : aSels.front(); while( pRange ) { if( pRange->Max() < aTotRange.Min() ) { delete pRange; - aSels.Remove( (sal_uIntPtr)0 ); + aSels.erase( aSels.begin() ); } else if( pRange->Min() < aTotRange.Min() ) { @@ -830,18 +848,18 @@ void MultiSelection::SetTotalRange( const Range& rTotRange ) else break; - pRange = aSels.GetObject( 0 ); + pRange = aSels.empty() ? NULL : aSels.front(); } // die obere Bereichsgrenze anpassen - sal_uIntPtr nCount = aSels.Count(); + size_t nCount = aSels.size(); while( nCount ) { - pRange = aSels.GetObject( nCount - 1 ); + pRange = aSels[ nCount - 1 ]; if( pRange->Min() > aTotRange.Max() ) { delete pRange; - aSels.Remove( (sal_uIntPtr)(nCount - 1) ); + aSels.pop_back(); } else if( pRange->Max() > aTotRange.Max() ) { @@ -851,16 +869,13 @@ void MultiSelection::SetTotalRange( const Range& rTotRange ) else break; - nCount = aSels.Count(); + nCount = aSels.size(); } // Selection-Count neu berechnen nSelCount = 0; - pRange = aSels.First(); - while( pRange ) - { + for ( size_t i = 0, n = aSels.size(); i < n; ++ i ) { nSelCount += pRange->Len(); - pRange = aSels.Next(); } bCurValid = sal_False; @@ -1160,3 +1175,4 @@ bool StringRangeEnumerator::getRangesFromString( const OUString& i_rPageRange, return bRes; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/memtools/table.cxx b/tools/source/memtools/table.cxx index 80b2c9747966..75119ba6f142 100755..100644 --- a/tools/source/memtools/table.cxx +++ b/tools/source/memtools/table.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -122,7 +123,6 @@ sal_Bool Table::Insert( sal_uIntPtr nKey, void* p ) { sal_uInt16 n = 0; sal_uInt16 nTempCount = (sal_uInt16)nCount * 2; - //<!--Modified by PengYunQuan for resolving a NULL pointer access if( void** pNodes = Container::ImpGetOnlyNodes() ) { @@ -152,7 +152,6 @@ sal_Bool Table::Insert( sal_uIntPtr nKey, void* p ) if ( ImplGetIndex( nKey, &i ) != TABLE_ENTRY_NOTFOUND ) return sal_False; } - //-->Modified by PengYunQuan for resolving a NULL pointer access } else { @@ -411,3 +410,5 @@ void* Table::Prev() // Pointer vom vorherigen Key zurueckgeben return p; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/memtools/unqidx.cxx b/tools/source/memtools/unqidx.cxx index 020ae64dde95..278199333e37 100755..100644 --- a/tools/source/memtools/unqidx.cxx +++ b/tools/source/memtools/unqidx.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,10 +36,6 @@ |* |* UniqueIndex::UniqueIndex() |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung TH 24.09.91 -|* Letzte Aenderung TH 24.09.91 -|* *************************************************************************/ UniqueIndex::UniqueIndex( sal_uIntPtr _nStartIndex, @@ -55,10 +52,6 @@ UniqueIndex::UniqueIndex( sal_uIntPtr _nStartIndex, |* |* UniqueIndex::UniqueIndex() |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung TH 24.09.91 -|* Letzte Aenderung TH 24.09.91 -|* *************************************************************************/ UniqueIndex::UniqueIndex( const UniqueIndex& rIdx ) : @@ -74,10 +67,6 @@ UniqueIndex::UniqueIndex( const UniqueIndex& rIdx ) : |* |* UniqueIndex::Insert() |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung TH 24.09.91 -|* Letzte Aenderung TH 24.09.91 -|* *************************************************************************/ sal_uIntPtr UniqueIndex::Insert( void* p ) @@ -110,10 +99,6 @@ sal_uIntPtr UniqueIndex::Insert( void* p ) |* |* UniqueIndex::Insert() |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung MM 21.04.96 -|* Letzte Aenderung MM 21.04.96 -|* *************************************************************************/ sal_uIntPtr UniqueIndex::Insert( sal_uIntPtr nIndex, void* p ) @@ -139,10 +124,6 @@ sal_uIntPtr UniqueIndex::Insert( sal_uIntPtr nIndex, void* p ) |* |* UniqueIndex::Remove() |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung TH 24.09.91 -|* Letzte Aenderung TH 24.09.91 -|* *************************************************************************/ void* UniqueIndex::Remove( sal_uIntPtr nIndex ) @@ -166,10 +147,6 @@ void* UniqueIndex::Remove( sal_uIntPtr nIndex ) |* |* UniqueIndex::Replace() |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung TH 24.09.91 -|* Letzte Aenderung TH 24.09.91 -|* *************************************************************************/ void* UniqueIndex::Replace( sal_uIntPtr nIndex, void* p ) @@ -192,10 +169,6 @@ void* UniqueIndex::Replace( sal_uIntPtr nIndex, void* p ) |* |* UniqueIndex::Get() |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung TH 24.09.91 -|* Letzte Aenderung TH 24.09.91 -|* *************************************************************************/ void* UniqueIndex::Get( sal_uIntPtr nIndex ) const @@ -212,10 +185,6 @@ void* UniqueIndex::Get( sal_uIntPtr nIndex ) const |* |* UniqueIndex::GetCurIndex() |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung TH 24.09.91 -|* Letzte Aenderung TH 24.09.91 -|* *************************************************************************/ sal_uIntPtr UniqueIndex::GetCurIndex() const @@ -233,10 +202,6 @@ sal_uIntPtr UniqueIndex::GetCurIndex() const |* |* UniqueIndex::GetIndex() |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung TH 24.09.91 -|* Letzte Aenderung TH 24.09.91 -|* *************************************************************************/ sal_uIntPtr UniqueIndex::GetIndex( const void* p ) const @@ -257,10 +222,6 @@ sal_uIntPtr UniqueIndex::GetIndex( const void* p ) const |* |* UniqueIndex::IsIndexValid() |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung TH 24.09.91 -|* Letzte Aenderung TH 24.09.91 -|* *************************************************************************/ sal_Bool UniqueIndex::IsIndexValid( sal_uIntPtr nIndex ) const @@ -283,10 +244,6 @@ sal_Bool UniqueIndex::IsIndexValid( sal_uIntPtr nIndex ) const |* |* UniqueIndex::Seek() |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung TH 24.09.91 -|* Letzte Aenderung TH 24.09.91 -|* *************************************************************************/ void* UniqueIndex::Seek( sal_uIntPtr nIndex ) @@ -302,10 +259,6 @@ void* UniqueIndex::Seek( sal_uIntPtr nIndex ) |* |* UniqueIndex::Seek() |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung TH 24.09.91 -|* Letzte Aenderung TH 24.09.91 -|* *************************************************************************/ void* UniqueIndex::Seek( void* p ) @@ -327,10 +280,6 @@ void* UniqueIndex::Seek( void* p ) |* |* UniqueIndex::First() |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung TH 24.09.91 -|* Letzte Aenderung TH 24.09.91 -|* *************************************************************************/ void* UniqueIndex::First() @@ -347,10 +296,6 @@ void* UniqueIndex::First() |* |* UniqueIndex::Last() |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung TH 24.09.91 -|* Letzte Aenderung TH 24.09.91 -|* *************************************************************************/ void* UniqueIndex::Last() @@ -367,10 +312,6 @@ void* UniqueIndex::Last() |* |* UniqueIndex::Next() |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung TH 24.09.91 -|* Letzte Aenderung TH 24.09.91 -|* *************************************************************************/ void* UniqueIndex::Next() @@ -387,10 +328,6 @@ void* UniqueIndex::Next() |* |* UniqueIndex::Prev() |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung TH 24.09.91 -|* Letzte Aenderung TH 24.09.91 -|* *************************************************************************/ void* UniqueIndex::Prev() @@ -407,10 +344,6 @@ void* UniqueIndex::Prev() |* |* UniqueIndex::operator =() |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung TH 24.09.91 -|* Letzte Aenderung TH 24.09.91 -|* *************************************************************************/ UniqueIndex& UniqueIndex::operator =( const UniqueIndex& rIdx ) @@ -428,10 +361,6 @@ UniqueIndex& UniqueIndex::operator =( const UniqueIndex& rIdx ) |* |* UniqueIndex::operator ==() |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung TH 24.09.91 -|* Letzte Aenderung TH 24.09.91 -|* *************************************************************************/ sal_Bool UniqueIndex::operator ==( const UniqueIndex& rIdx ) const @@ -448,10 +377,6 @@ sal_Bool UniqueIndex::operator ==( const UniqueIndex& rIdx ) const |* |* UniqueIdContainer::UniqueIdContainer () |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung MM 29.04.96 -|* Letzte Aenderung MM 29.04.96 -|* *************************************************************************/ UniqueIdContainer::UniqueIdContainer( const UniqueIdContainer& rObj ) @@ -473,10 +398,6 @@ UniqueIdContainer::UniqueIdContainer( const UniqueIdContainer& rObj ) |* |* UniqueIdContainer::operator = () |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung MM 01.08.94 -|* Letzte Aenderung MM 01.08.94 -|* *************************************************************************/ UniqueIdContainer& UniqueIdContainer::operator = ( const UniqueIdContainer & rObj ) @@ -500,10 +421,6 @@ UniqueIdContainer& UniqueIdContainer::operator = ( const UniqueIdContainer & rOb |* |* UniqueIdContainer::Clear() |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung MM 01.08.94 -|* Letzte Aenderung MM 01.08.94 -|* *************************************************************************/ void UniqueIdContainer::Clear( sal_Bool bAll ) @@ -534,10 +451,6 @@ void UniqueIdContainer::Clear( sal_Bool bAll ) |* |* UniqueIdContainer::CreateId() |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung MM 01.08.94 -|* Letzte Aenderung MM 01.08.94 -|* *************************************************************************/ UniqueItemId UniqueIdContainer::CreateId() @@ -559,10 +472,6 @@ UniqueItemId UniqueIdContainer::CreateId() |* |* UniqueIdContainer::CreateIdProt() |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung MM 01.08.94 -|* Letzte Aenderung MM 01.08.94 -|* *************************************************************************/ UniqueItemId UniqueIdContainer::CreateFreeId( sal_uIntPtr nId ) @@ -578,10 +487,6 @@ UniqueItemId UniqueIdContainer::CreateFreeId( sal_uIntPtr nId ) |* |* UniqueIdContainer::CreateIdProt() |* -|* Beschreibung UNQIDX.SDW -|* Ersterstellung MM 01.08.94 -|* Letzte Aenderung MM 01.08.94 -|* *************************************************************************/ UniqueItemId UniqueIdContainer::CreateIdProt( sal_uIntPtr nId ) @@ -599,3 +504,5 @@ UniqueItemId UniqueIdContainer::CreateIdProt( sal_uIntPtr nId ) while( pId->nId != nId ); return UniqueItemId( pId ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/misc/appendunixshellword.cxx b/tools/source/misc/appendunixshellword.cxx index af2a05b00716..025dd7251e56 100644 --- a/tools/source/misc/appendunixshellword.cxx +++ b/tools/source/misc/appendunixshellword.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -74,3 +75,5 @@ void appendUnixShellWord( } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/misc/extendapplicationenvironment.cxx b/tools/source/misc/extendapplicationenvironment.cxx index 440f5a5cb207..1502158c09b0 100644 --- a/tools/source/misc/extendapplicationenvironment.cxx +++ b/tools/source/misc/extendapplicationenvironment.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -90,3 +91,5 @@ void extendApplicationEnvironment() { } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/misc/getprocessworkingdir.cxx b/tools/source/misc/getprocessworkingdir.cxx index 8cad594befca..a64e882e33f6 100644 --- a/tools/source/misc/getprocessworkingdir.cxx +++ b/tools/source/misc/getprocessworkingdir.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,25 +41,30 @@ namespace tools { -bool getProcessWorkingDir(rtl::OUString * url) { - OSL_ASSERT(url != NULL); +bool getProcessWorkingDir(rtl::OUString &rUrl) +{ + rUrl = rtl::OUString(); rtl::OUString s(RTL_CONSTASCII_USTRINGPARAM("$OOO_CWD")); rtl::Bootstrap::expandMacros(s); - if (s.getLength() == 0) { - if (osl_getProcessWorkingDir(&url->pData) == osl_Process_E_None) { + if (s.getLength() == 0) + { + if (osl_getProcessWorkingDir(&rUrl.pData) == osl_Process_E_None) return true; - } - } else if (s[0] == '1') { - *url = s.copy(1); + } + else if (s[0] == '1') + { + rUrl = s.copy(1); return true; - } else if (s[0] == '2' && - (osl::FileBase::getFileURLFromSystemPath(s.copy(1), *url) == + } + else if (s[0] == '2' && + (osl::FileBase::getFileURLFromSystemPath(s.copy(1), rUrl) == osl::FileBase::E_None)) { return true; } - *url = rtl::OUString(); return false; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/misc/pathutils.cxx b/tools/source/misc/pathutils.cxx index 4685f96ca187..0f0d0b767356 100644 --- a/tools/source/misc/pathutils.cxx +++ b/tools/source/misc/pathutils.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -216,3 +217,5 @@ WCHAR * resolveLink(WCHAR * path) { } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/misc/solarmutex.cxx b/tools/source/misc/solarmutex.cxx index 5abdfef5e37f..8bede4e6869a 100644 --- a/tools/source/misc/solarmutex.cxx +++ b/tools/source/misc/solarmutex.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,14 +32,14 @@ namespace tools { - static ::vos::IMutex* pSolarMutex = 0; + static ::osl::SolarMutex* pSolarMutex = 0; - ::vos::IMutex* SolarMutex::GetSolarMutex() + ::osl::SolarMutex* SolarMutex::GetSolarMutex() { return pSolarMutex; } - void SolarMutex::SetSolarMutex( ::vos::IMutex* pMutex ) + void SolarMutex::SetSolarMutex( ::osl::SolarMutex* pMutex ) { pSolarMutex = pMutex; } @@ -58,3 +59,5 @@ namespace tools pSolarMutex->release(); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/rc/isofallback.cxx b/tools/source/rc/isofallback.cxx index 002a90f580aa..e2a82a865b94 100644 --- a/tools/source/rc/isofallback.cxx +++ b/tools/source/rc/isofallback.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,35 +34,39 @@ // ----------------------------------------------------------------------- // Return true if valid fallback found -sal_Bool GetIsoFallback( ByteString& rLanguage ) +bool GetIsoFallback(rtl::OString& rLanguage) { - rLanguage.EraseLeadingAndTrailingChars(); - if( rLanguage.Len() ){ - xub_StrLen nSepPos = rLanguage.Search( '-' ); - if ( nSepPos == STRING_NOTFOUND ){ - if ( rLanguage.Equals("en")) + rLanguage = rLanguage.trim(); + if (!rLanguage.isEmpty()) + { + sal_Int32 nSepPos = rLanguage.indexOf('-'); + if (nSepPos == -1) + { + if (rLanguage == rtl::OString(RTL_CONSTASCII_STRINGPARAM("en"))) { // en -> "" - rLanguage.Erase(); + rLanguage = rtl::OString(); return false; } else { // de -> en-US ; - rLanguage = ByteString("en-US"); + rLanguage = rtl::OString(RTL_CONSTASCII_STRINGPARAM("en-US")); return true; } } - else if( !( nSepPos == 1 && ( rLanguage.GetChar(0) == 'x' || rLanguage.GetChar(0) == 'X' ) ) ) + else if( !(nSepPos == 1 && (rLanguage.toChar() == 'x' || rLanguage.toChar() == 'X')) ) { // de-CH -> de ; // try erase from - - rLanguage = rLanguage.GetToken( 0, '-'); + sal_Int32 nIndex = 0; + rLanguage = rLanguage.getToken(0, '-', nIndex); return true; } } // "" -> ""; x-no-translate -> "" - rLanguage.Erase(); + rLanguage = rtl::OString(); return false; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/rc/rc.cxx b/tools/source/rc/rc.cxx index f9a08a5525e6..e2ada0d111ac 100644 --- a/tools/source/rc/rc.cxx +++ b/tools/source/rc/rc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -95,3 +96,5 @@ Date::Date( const ResId& rResId ) : nDate(0) if ( 0x04 & nObjMask ) SetDay( (sal_uInt16)pResMgr->ReadShort() ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/rc/resary.cxx b/tools/source/rc/resary.cxx index a55a4f644a9f..c435a0627713 100644 --- a/tools/source/rc/resary.cxx +++ b/tools/source/rc/resary.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -76,3 +77,5 @@ sal_uInt32 ResStringArray::FindIndex( long nValue ) const } return RESARRAY_INDEX_NOTFOUND; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx index 4ddb753a0df3..d4b7225a22d4 100644 --- a/tools/source/rc/resmgr.cxx +++ b/tools/source/rc/resmgr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,11 +32,7 @@ #include <string.h> #include <stdio.h> #include <stdlib.h> -#include <vos/signal.hxx> #include <tools/debug.hxx> -#ifndef _TABLE_HXX -#include <tools/table.hxx> -#endif #include <tools/stream.hxx> #include <tools/resmgr.hxx> #include <tools/rc.hxx> @@ -45,6 +42,7 @@ #include <osl/thread.h> #include <osl/file.hxx> #include <osl/mutex.hxx> +#include <osl/signal.h> #include <rtl/ustrbuf.hxx> #include <rtl/strbuf.hxx> #include <tools/urlobj.hxx> @@ -57,7 +55,7 @@ #include <functional> #include <algorithm> -#include <hash_map> +#include <boost/unordered_map.hpp> #include <list> #include <set> @@ -71,7 +69,11 @@ #define SEARCH_PATH_DELIMITER_STRING ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SEARCH_PATH_DELIMITER_CHAR_STRING ) ) -using namespace rtl; +using ::rtl::OUString; +using ::rtl::OString; +using ::rtl::OUStringBuffer; +using ::rtl::OUStringHash; + using namespace osl; // for thread safety @@ -105,7 +107,7 @@ class InternalResMgr OUString aResName; bool bSingular; com::sun::star::lang::Locale aLocale; - std::hash_map<sal_uInt64, int>* pResUseDump; + boost::unordered_map<sal_uInt64, int>* pResUseDump; InternalResMgr( const OUString& rFileURL, const OUString& aPrefix, @@ -118,7 +120,7 @@ class InternalResMgr void * LoadGlobalRes( RESOURCE_TYPE nRT, sal_uInt32 nId, void **pResHandle ); public: - void FreeGlobalRes( void *, void * ); + static void FreeGlobalRes( void *, void * ); SvStream * GetBitmapStream( sal_uInt32 nResId ); }; @@ -143,7 +145,7 @@ class ResMgrContainer {} }; - std::hash_map< OUString, ContainerElement, OUStringHash> m_aResFiles; + boost::unordered_map< OUString, ContainerElement, OUStringHash> m_aResFiles; com::sun::star::lang::Locale m_aDefLocale; ResMgrContainer() { init(); } @@ -180,7 +182,7 @@ ResMgrContainer& ResMgrContainer::get() ResMgrContainer::~ResMgrContainer() { - for( std::hash_map< OUString, ContainerElement, OUStringHash >::iterator it = + for( boost::unordered_map< OUString, ContainerElement, OUStringHash >::iterator it = m_aResFiles.begin(); it != m_aResFiles.end(); ++it ) { OSL_TRACE( "Resource file %s loaded %d times\n", @@ -239,7 +241,7 @@ void ResMgrContainer::init() DirectoryItem aItem; while( aDir.getNextItem( aItem ) == FileBase::E_None ) { - FileStatus aStatus(FileStatusMask_FileName); + FileStatus aStatus(osl_FileStatus_Mask_FileName); if( aItem.getFileStatus( aStatus ) == FileBase::E_None ) { OUString aFileName = aStatus.getFileName(); @@ -265,7 +267,7 @@ void ResMgrContainer::init() #endif } #if OSL_DEBUG_LEVEL > 1 - for( std::hash_map< OUString, ContainerElement, OUStringHash >::const_iterator it = + for( boost::unordered_map< OUString, ContainerElement, OUStringHash >::const_iterator it = m_aResFiles.begin(); it != m_aResFiles.end(); ++it ) { OSL_TRACE( "ResMgrContainer: %s -> %s\n", @@ -279,6 +281,18 @@ void ResMgrContainer::init() MsLangId::convertLanguageToLocale(nLang, m_aDefLocale); } +namespace +{ + bool isAlreadyPureenUS(const com::sun::star::lang::Locale &rLocale) + { + return ( + rLocale.Language.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("en")) && + rLocale.Country.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("US")) && + rLocale.Variant.getLength() == 0 + ); + } +} + InternalResMgr* ResMgrContainer::getResMgr( const OUString& rPrefix, com::sun::star::lang::Locale& rLocale, bool bForceNewInstance @@ -286,7 +300,7 @@ InternalResMgr* ResMgrContainer::getResMgr( const OUString& rPrefix, { com::sun::star::lang::Locale aLocale( rLocale ); OUStringBuffer aSearch( rPrefix.getLength() + 16 ); - std::hash_map< OUString, ContainerElement, OUStringHash >::iterator it = m_aResFiles.end(); + boost::unordered_map< OUString, ContainerElement, OUStringHash >::iterator it = m_aResFiles.end(); int nTries = 0; if( aLocale.Language.getLength() > 0 ) @@ -329,7 +343,7 @@ InternalResMgr* ResMgrContainer::getResMgr( const OUString& rPrefix, } break; } - if( nTries == 0 && !aLocale.Language.equalsIgnoreAsciiCaseAscii( "en" ) ) + if( nTries == 0 && !isAlreadyPureenUS(aLocale) ) { // locale fallback failed // fallback to en-US locale @@ -446,7 +460,7 @@ InternalResMgr* ResMgrContainer::getNextFallback( InternalResMgr* pMgr ) aLocale.Variant = OUString(); else if( aLocale.Country.getLength() ) aLocale.Country = OUString(); - else if( ! aLocale.Language.equalsIgnoreAsciiCaseAscii( "en" ) ) + else if( !isAlreadyPureenUS(aLocale) ) { aLocale.Language = OUString( RTL_CONSTASCII_USTRINGPARAM( "en" ) ); aLocale.Country = OUString( RTL_CONSTASCII_USTRINGPARAM( "US" ) ); @@ -468,7 +482,7 @@ void ResMgrContainer::freeResMgr( InternalResMgr* pResMgr ) delete pResMgr; else { - std::hash_map< OUString, ContainerElement, OUStringHash >::iterator it = + boost::unordered_map< OUString, ContainerElement, OUStringHash >::iterator it = m_aResFiles.find( pResMgr->aResName ); if( it != m_aResFiles.end() ) { @@ -580,7 +594,7 @@ InternalResMgr::~InternalResMgr() aLine.Append( ByteString( OUStringToOString( aFileName, RTL_TEXTENCODING_UTF8 ) ) ); aStm.WriteLine( aLine ); - for( std::hash_map<sal_uInt64, int>::const_iterator it = pResUseDump->begin(); + for( boost::unordered_map<sal_uInt64, int>::const_iterator it = pResUseDump->begin(); it != pResUseDump->end(); ++it ) { sal_uInt64 nKeyId = it->first; @@ -637,7 +651,7 @@ sal_Bool InternalResMgr::Create() const sal_Char* pLogFile = getenv( "STAR_RESOURCE_LOGGING" ); if ( pLogFile ) { - pResUseDump = new std::hash_map<sal_uInt64, int>; + pResUseDump = new boost::unordered_map<sal_uInt64, int>; for( sal_uInt32 i = 0; i < nEntries; ++i ) (*pResUseDump)[pContent[i].nTypeAndId] = 1; } @@ -659,9 +673,7 @@ sal_Bool InternalResMgr::Create() } } rtl_freeMemory( pContentBuf ); -#ifndef OS2 OSL_ENSURE( bSorted, "content not sorted" ); -#endif OSL_ENSURE( bEqual2Content, "resource structure wrong" ); if( !bSorted ) ::std::sort(pContent,pContent+nEntries,ImpContentLessCompare()); @@ -829,7 +841,7 @@ void ResMgr::RscError_Impl( const sal_Char* pMessage, ResMgr* pResMgr, // clean up delete pNewResMgr; - DBG_ERROR( aStr.GetBuffer() ); + OSL_FAIL( aStr.GetBuffer() ); } #endif @@ -838,19 +850,20 @@ void ResMgr::RscError_Impl( const sal_Char* pMessage, ResMgr* pResMgr, static void RscException_Impl() { - switch ( vos::OSignalHandler::raise( OSL_SIGNAL_USER_RESOURCEFAILURE, (void*)"" ) ) + switch ( osl_raiseSignal( OSL_SIGNAL_USER_RESOURCEFAILURE, (void*)"" ) ) { - case vos::OSignalHandler::TAction_CallNextHandler: - abort(); + case osl_Signal_ActCallNextHdl: + abort(); - case vos::OSignalHandler::TAction_Ignore: - return; + case osl_Signal_ActIgnore: + return; - case vos::OSignalHandler::TAction_AbortApplication: - abort(); + case osl_Signal_ActAbortApp: + abort(); - case vos::OSignalHandler::TAction_KillApplication: - exit(-1); + default: + case osl_Signal_ActKillApp: + exit(-1); } } @@ -948,7 +961,7 @@ void ResMgr::Init( const OUString& rFileName ) #ifdef DBG_UTIL ByteString aStr( "Resourcefile not found:\n" ); aStr += ByteString( OUStringToOString( rFileName, RTL_TEXTENCODING_UTF8 ) ); - DBG_ERROR( aStr.GetBuffer() ); + OSL_FAIL( aStr.GetBuffer() ); #endif RscException_Impl(); } @@ -961,7 +974,7 @@ void ResMgr::Init( const OUString& rFileName ) pVoid = pImpRes->LoadGlobalRes( RSC_VERSIONCONTROL, RSCVERSION_ID, &aResHandle ); if ( pVoid ) - pImpRes->FreeGlobalRes( aResHandle, pVoid ); + InternalResMgr::FreeGlobalRes( aResHandle, pVoid ); else { ByteString aStr( "Wrong version:\n" ); @@ -996,7 +1009,7 @@ ResMgr::~ResMgr() while( nCurStack > 0 ) { if( ( aStack[nCurStack].Flags & (RC_GLOBAL | RC_NOTFOUND) ) == RC_GLOBAL ) - pImpRes->FreeGlobalRes( aStack[nCurStack].aResHandle, + InternalResMgr::FreeGlobalRes( aStack[nCurStack].aResHandle, aStack[nCurStack].pResource ); nCurStack--; } @@ -1283,7 +1296,7 @@ void ResMgr::PopContext( const Resource* pResObj ) // Resource freigeben if( (pTop->Flags & (RC_GLOBAL | RC_NOTFOUND)) == RC_GLOBAL ) // kann auch Fremd-Ressource sein - pImpRes->FreeGlobalRes( pTop->aResHandle, pTop->pResource ); + InternalResMgr::FreeGlobalRes( pTop->aResHandle, pTop->pResource ); decStack(); } } @@ -1965,7 +1978,7 @@ SimpleResMgr* SimpleResMgr::Create( const sal_Char* pPrefixName, com::sun::star: // ----------------------------------------------------------------------- bool SimpleResMgr::IsAvailable( RESOURCE_TYPE _resourceType, sal_uInt32 _resourceId ) { - vos::OGuard aGuard(m_aAccessSafety); + osl::MutexGuard aGuard(m_aAccessSafety); if ( ( RSC_STRING != _resourceType ) && ( RSC_RESOURCE != _resourceType ) ) return false; @@ -1977,7 +1990,7 @@ bool SimpleResMgr::IsAvailable( RESOURCE_TYPE _resourceType, sal_uInt32 _resourc // ----------------------------------------------------------------------- UniString SimpleResMgr::ReadString( sal_uInt32 nId ) { - vos::OGuard aGuard(m_aAccessSafety); + osl::MutexGuard aGuard(m_aAccessSafety); DBG_ASSERT( m_pResImpl, "SimpleResMgr::ReadString : have no impl class !" ); // perhaps constructed with an invalid filename ? @@ -2026,7 +2039,7 @@ UniString SimpleResMgr::ReadString( sal_uInt32 nId ) // not neccessary with te current implementation which holds the string table permanently, but to be sure .... // note: pFallback cannot be NULL here and is either the fallback or m_pResImpl - pFallback->FreeGlobalRes( pResHeader, pResHandle ); + InternalResMgr::FreeGlobalRes( pResHeader, pResHandle ); if( m_pResImpl != pFallback ) { osl::Guard<osl::Mutex> aGuard2( getResMgrMutex() ); @@ -2048,7 +2061,7 @@ const ::com::sun::star::lang::Locale& SimpleResMgr::GetLocale() const sal_uInt32 SimpleResMgr::ReadBlob( sal_uInt32 nId, void** pBuffer ) { - vos::OGuard aGuard(m_aAccessSafety); + osl::MutexGuard aGuard(m_aAccessSafety); DBG_ASSERT( m_pResImpl, "SimpleResMgr::ReadBlob : have no impl class !" ); @@ -2118,3 +2131,5 @@ void SimpleResMgr::FreeBlob( void* pBuffer ) void* pCompleteBuffer = (void*)(((sal_uInt8*)pBuffer) - sizeof(RSHEADER_TYPE)); rtl_freeMemory(pCompleteBuffer); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/ref/errinf.cxx b/tools/source/ref/errinf.cxx index 1587f7324556..9ad9b71dcba3 100644 --- a/tools/source/ref/errinf.cxx +++ b/tools/source/ref/errinf.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -216,7 +217,7 @@ static void aDspFunc(const String &rErr, const String &rAction) aErr+= ByteString( rAction, RTL_TEXTENCODING_ASCII_US ); aErr+=" Fehler: "; aErr+= ByteString( rErr, RTL_TEXTENCODING_ASCII_US ); - DBG_ERROR(aErr.GetBuffer()); + OSL_FAIL(aErr.GetBuffer()); } @@ -346,7 +347,7 @@ sal_uInt16 ErrorHandler::HandleError_Impl( aStr += ByteString( aAction, RTL_TEXTENCODING_ASCII_US ); aStr += ByteString("\nFehler: "); aStr += ByteString( aErr, RTL_TEXTENCODING_ASCII_US ); - DBG_ERROR( aStr.GetBuffer() ); + OSL_FAIL( aStr.GetBuffer() ); } else { @@ -366,13 +367,13 @@ sal_uInt16 ErrorHandler::HandleError_Impl( } } } - DBG_ERROR("Error nicht behandelt"); + OSL_FAIL("Error nicht behandelt"); // Error 1 ist General Error im Sfx if(pInfo->GetErrorCode()!=1) { HandleError_Impl(1, USHRT_MAX, bJustCreateString, rError); } else { - DBG_ERROR("Error 1 nicht gehandeled"); + OSL_FAIL("Error 1 nicht gehandeled"); } delete pInfo; return 0; @@ -460,3 +461,4 @@ SimpleErrorHandler::SimpleErrorHandler() { } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/ref/globname.cxx b/tools/source/ref/globname.cxx index 0228aeef9e81..05c7709931e6 100755..100644 --- a/tools/source/ref/globname.cxx +++ b/tools/source/ref/globname.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -94,9 +95,9 @@ SvGlobalName::SvGlobalName( sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3, pImp = new ImpSvGlobalName(); pImp->nRefCount++; - *(sal_uInt32 *)pImp->szData = n1; - *(sal_uInt16 *)&pImp->szData[ 4 ] = n2; - *(sal_uInt16 *)&pImp->szData[ 6 ] = n3; + memcpy(pImp->szData, &n1, sizeof(n1)); + memcpy(pImp->szData+4, &n2, sizeof(n2)); + memcpy(pImp->szData+6, &n3, sizeof(n3)); pImp->szData[ 8 ] = b8; pImp->szData[ 9 ] = b9; pImp->szData[ 10 ] = b10; @@ -149,9 +150,17 @@ void SvGlobalName::NewImp() *************************************************************************/ SvStream& operator << ( SvStream& rOStr, const SvGlobalName & rObj ) { - rOStr << *(sal_uInt32 *)rObj.pImp->szData; - rOStr << *(sal_uInt16 *)&rObj.pImp->szData[ 4 ]; - rOStr << *(sal_uInt16 *)&rObj.pImp->szData[ 6 ]; + sal_uInt32 a; + memcpy(&a, rObj.pImp->szData, sizeof(sal_uInt32)); + rOStr << a; + + sal_uInt16 b; + memcpy(&b, rObj.pImp->szData+4, sizeof(sal_uInt16)); + rOStr << b; + + memcpy(&b, rObj.pImp->szData+6, sizeof(sal_uInt16)); + rOStr << b; + rOStr.Write( (sal_Char *)&rObj.pImp->szData[ 8 ], 8 ); return rOStr; } @@ -159,9 +168,18 @@ SvStream& operator << ( SvStream& rOStr, const SvGlobalName & rObj ) SvStream& operator >> ( SvStream& rStr, SvGlobalName & rObj ) { rObj.NewImp(); // kopieren, falls noetig - rStr >> *(sal_uInt32 *)rObj.pImp->szData; - rStr >> *(sal_uInt16 *)&rObj.pImp->szData[ 4 ]; - rStr >> *(sal_uInt16 *)&rObj.pImp->szData[ 6 ]; + + sal_uInt32 a; + rStr >> a; + memcpy(rObj.pImp->szData, &a, sizeof(sal_uInt32)); + + sal_uInt16 b; + rStr >> b; + memcpy(rObj.pImp->szData+4, &b, sizeof(sal_uInt16)); + + rStr >> b; + memcpy(rObj.pImp->szData+6, &b, sizeof(sal_uInt16)); + rStr.Read( (sal_Char *)&rObj.pImp->szData[ 8 ], 8 ); return rStr; } @@ -178,10 +196,25 @@ sal_Bool SvGlobalName::operator < ( const SvGlobalName & rObj ) const return sal_True; else if( n > 0 ) return sal_False; - else if( *(sal_uInt16 *)&pImp->szData[ 4 ] < *(sal_uInt16 *)&rObj.pImp->szData[ 4 ] ) + + sal_uInt16 Data2_a; + memcpy(&Data2_a, pImp->szData+4, sizeof(sal_uInt16)); + + sal_uInt16 Data2_b; + memcpy(&Data2_b, rObj.pImp->szData+4, sizeof(sal_uInt16)); + + if( Data2_a < Data2_b ) return sal_True; - else if( *(sal_uInt16 *)&pImp->szData[ 4 ] == *(sal_uInt16 *)&rObj.pImp->szData[ 4 ] ) - return *(sal_uInt32 *)pImp->szData < *(sal_uInt32 *)rObj.pImp->szData; + else if( Data2_a == Data2_b ) + { + sal_uInt32 Data1_a; + memcpy(&Data1_a, pImp->szData+4, sizeof(sal_uInt32)); + + sal_uInt32 Data1_b; + memcpy(&Data1_b, rObj.pImp->szData+4, sizeof(sal_uInt32)); + + return Data1_a < Data1_b; + } else return sal_False; @@ -193,11 +226,20 @@ sal_Bool SvGlobalName::operator < ( const SvGlobalName & rObj ) const SvGlobalName & SvGlobalName::operator += ( sal_uInt32 n ) { NewImp(); - sal_uInt32 nOld = (*(sal_uInt32 *)pImp->szData); - (*(sal_uInt32 *)pImp->szData) += n; - if( nOld > *(sal_uInt32 *)pImp->szData ) - // ueberlauf - (*(sal_uInt16 *)&pImp->szData[ 4 ])++; + + sal_uInt32 nOld; + memcpy(&nOld, pImp->szData, sizeof(sal_uInt32)); + sal_uInt32 nNew = nOld + n; + memcpy(pImp->szData, &nNew, sizeof(sal_uInt32)); + + if( nOld > nNew ) + { + // overflow + sal_uInt16 Data2; + memcpy(&Data2, pImp->szData + 4, sizeof(sal_uInt16)); + ++Data2; + memcpy(pImp->szData + 4, &Data2, sizeof(sal_uInt16)); + } return *this; } @@ -286,10 +328,10 @@ sal_Bool SvGlobalName::MakeId( const String & rIdStr ) } NewImp(); - *(sal_uInt32 *)pImp->szData = nFirst; - *(sal_uInt16 *)&pImp->szData[ 4 ] = nSec; - *(sal_uInt16 *)&pImp->szData[ 6 ] = nThird; - memcpy( &pImp->szData[ 8 ], szRemain, 8 ); + memcpy(&pImp->szData[0], &nFirst, sizeof(nFirst)); + memcpy(&pImp->szData[4], &nSec, sizeof(nSec)); + memcpy(&pImp->szData[6], &nThird, sizeof(nThird)); + memcpy(&pImp->szData[ 8 ], szRemain, 8); return sal_True; } return sal_False; @@ -303,13 +345,17 @@ String SvGlobalName::GetctorName() const ByteString aRet; sal_Char buf[ 20 ]; - sprintf( buf, "0x%8.8lX", (sal_uIntPtr)*(sal_uInt32 *)pImp->szData ); + sal_uInt32 Data1; + memcpy(&Data1, pImp->szData, sizeof(sal_uInt32)); + sprintf( buf, "0x%8.8" SAL_PRIXUINT32, Data1 ); aRet += buf; sal_uInt16 i; for( i = 4; i < 8; i += 2 ) { aRet += ','; - sprintf( buf, "0x%4.4X", *(sal_uInt16 *)&pImp->szData[ i ] ); + sal_uInt16 Data2; + memcpy(&Data2, pImp->szData+i, sizeof(sal_uInt16)); + sprintf( buf, "0x%4.4X", Data2 ); aRet += buf; } for( i = 8; i < 16; i++ ) @@ -329,13 +375,17 @@ String SvGlobalName::GetHexName() const ByteString aRet; sal_Char buf[ 10 ]; - sprintf( buf, "%8.8lX", (sal_uIntPtr)*(sal_uInt32 *)pImp->szData ); + sal_uInt32 Data1; + memcpy(&Data1, pImp->szData, sizeof(sal_uInt32)); + sprintf( buf, "%8.8" SAL_PRIXUINT32, Data1 ); aRet += buf; aRet += '-'; sal_uInt16 i ; for( i = 4; i < 8; i += 2 ) { - sprintf( buf, "%4.4X", *(sal_uInt16 *)&pImp->szData[ i ] ); + sal_uInt16 Data2; + memcpy(&Data2, pImp->szData+i, sizeof(sal_uInt16)); + sprintf( buf, "%4.4X", Data2 ); aRet += buf; aRet += '-'; } @@ -359,7 +409,6 @@ String SvGlobalName::GetHexName() const |* SvGlobalNameList::SvGlobalNameList() *************************************************************************/ SvGlobalNameList::SvGlobalNameList() - : aList( 1, 1 ) { } @@ -368,10 +417,14 @@ SvGlobalNameList::SvGlobalNameList() *************************************************************************/ SvGlobalNameList::~SvGlobalNameList() { - for( sal_uIntPtr i = Count(); i > 0; i-- ) + ImpSvGlobalName *pImp = 0; + std::vector<ImpSvGlobalName*>::iterator piter; + + for (piter = aList.begin(); piter != aList.end(); ++piter) { - ImpSvGlobalName * pImp = (ImpSvGlobalName *)aList.GetObject( i -1 ); - pImp->nRefCount--; + pImp = *piter; + + --pImp->nRefCount; if( !pImp->nRefCount ) delete pImp; } @@ -383,7 +436,7 @@ SvGlobalNameList::~SvGlobalNameList() void SvGlobalNameList::Append( const SvGlobalName & rName ) { rName.pImp->nRefCount++; - aList.Insert( rName.pImp, LIST_APPEND ); + aList.push_back(rName.pImp); } /************************************************************************* @@ -391,7 +444,7 @@ void SvGlobalNameList::Append( const SvGlobalName & rName ) *************************************************************************/ SvGlobalName SvGlobalNameList::GetObject( sal_uLong nPos ) { - return SvGlobalName( (ImpSvGlobalName *)aList.GetObject( nPos ) ); + return SvGlobalName(nPos < aList.size() ? aList[nPos] : NULL); } /************************************************************************* @@ -399,11 +452,13 @@ SvGlobalName SvGlobalNameList::GetObject( sal_uLong nPos ) *************************************************************************/ sal_Bool SvGlobalNameList::IsEntry( const SvGlobalName & rName ) { - for( sal_uIntPtr i = Count(); i > 0; i-- ) + std::vector<ImpSvGlobalName*>::iterator piter; + for (piter = aList.begin(); piter != aList.end(); ++piter) { - if( *rName.pImp == *(ImpSvGlobalName *)aList.GetObject( i -1 ) ) + if (*rName.pImp == *(*piter)) return sal_True; } + return sal_False; } @@ -413,14 +468,20 @@ com::sun::star::uno::Sequence < sal_Int8 > SvGlobalName::GetByteSequence() const // maybe transported remotely com::sun::star::uno::Sequence< sal_Int8 > aResult( 16 ); - aResult[0] = (sal_Int8) (*(sal_uInt32 *)pImp->szData >> 24); - aResult[1] = (sal_Int8) ((*(sal_uInt32 *)pImp->szData << 8 ) >> 24); - aResult[2] = (sal_Int8) ((*(sal_uInt32 *)pImp->szData << 16 ) >> 24); - aResult[3] = (sal_Int8) ((*(sal_uInt32 *)pImp->szData << 24 ) >> 24); - aResult[4] = (sal_Int8) (*(sal_uInt16 *)&pImp->szData[ 4 ] >> 8); - aResult[5] = (sal_Int8) ((*(sal_uInt16 *)&pImp->szData[ 4 ] << 8 ) >> 8); - aResult[6] = (sal_Int8) (*(sal_uInt16 *)&pImp->szData[ 6 ] >> 8); - aResult[7] = (sal_Int8) ((*(sal_uInt16 *)&pImp->szData[ 6 ] << 8 ) >> 8); + sal_uInt32 Data1; + memcpy(&Data1, pImp->szData, sizeof(sal_uInt32)); + aResult[0] = (sal_Int8) (Data1 >> 24); + aResult[1] = (sal_Int8) ((Data1 << 8 ) >> 24); + aResult[2] = (sal_Int8) ((Data1 << 16 ) >> 24); + aResult[3] = (sal_Int8) ((Data1 << 24 ) >> 24); + sal_uInt16 Data2; + memcpy(&Data2, pImp->szData+4, sizeof(sal_uInt16)); + aResult[4] = (sal_Int8) (Data2 >> 8); + aResult[5] = (sal_Int8) ((Data2 << 8 ) >> 8); + sal_uInt16 Data3; + memcpy(&Data3, pImp->szData+6, sizeof(sal_uInt16)); + aResult[6] = (sal_Int8) (Data3 >> 8); + aResult[7] = (sal_Int8) ((Data3 << 8 ) >> 8); aResult[8] = pImp->szData[ 8 ]; aResult[9] = pImp->szData[ 9 ]; aResult[10] = pImp->szData[ 10 ]; @@ -451,3 +512,5 @@ SvGlobalName::SvGlobalName( const com::sun::star::uno::Sequence < sal_Int8 >& aS pImp->nRefCount++; memcpy( pImp->szData, &aResult, sizeof( pImp->szData ) ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/ref/pstm.cxx b/tools/source/ref/pstm.cxx index b2a5600075cc..75781b427c89 100644 --- a/tools/source/ref/pstm.cxx +++ b/tools/source/ref/pstm.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -132,7 +133,7 @@ SvPersistStream& operator >> ( SvPersistStream & rStm, if( (nVer & ~PERSIST_LIST_DBGUTIL) != PERSIST_LIST_VER ) { rStm.SetError( SVSTREAM_GENERALERROR ); - DBG_ERROR( "persist list, false version" ); + OSL_FAIL( "persist list, false version" ); } sal_uInt32 nObjLen(0), nObjPos(0); @@ -155,8 +156,10 @@ SvPersistStream& operator >> ( SvPersistStream & rStm, aStr += ByteString::CreateFromInt32( (long)(rStm.Tell() - nObjPos) ); aStr += ", should = "; aStr += ByteString::CreateFromInt64(nObjLen); - DBG_ERROR( aStr.GetBuffer() ); + OSL_FAIL( aStr.GetBuffer() ); } +#else + (void)nObjLen; #endif return rStm; } @@ -439,14 +442,14 @@ sal_uInt32 SvPersistStream::ReadCompressed if( nMask & 0x0F ) { rStm.SetError( SVSTREAM_FILEFORMAT_ERROR ); - DBG_ERROR( "format error" ); + OSL_FAIL( "format error" ); } rStm >> nRet; } else { rStm.SetError( SVSTREAM_FILEFORMAT_ERROR ); - DBG_ERROR( "format error" ); + OSL_FAIL( "format error" ); } return nRet; } @@ -740,7 +743,7 @@ sal_uInt32 SvPersistStream::ReadObj if( P_VER < (nHdr & P_VER_MASK) ) { SetError( SVSTREAM_FILEFORMAT_ERROR ); - DBG_ERROR( "false version" ); + OSL_FAIL( "false version" ); } if( !(nHdr & P_ID_0) && GetError() == SVSTREAM_OK ) @@ -761,6 +764,8 @@ sal_uInt32 SvPersistStream::ReadObj aStr += ByteString::CreateFromInt32( nClassId ); aStr += " registered"; DBG_WARNING( aStr.GetBuffer() ); +#else + (void)nObjLen; #endif SetError( ERRCODE_IO_NOFACTORY ); return 0; @@ -787,7 +792,7 @@ sal_uInt32 SvPersistStream::ReadObj aStr += ByteString::CreateFromInt32( (long)(Tell() - nObjPos) ); aStr += ", should = "; aStr += ByteString::CreateFromInt32( nObjLen ); - DBG_ERROR( aStr.GetBuffer() ); + OSL_FAIL( aStr.GetBuffer() ); } #endif rpObj->RestoreNoDelete(); @@ -880,7 +885,7 @@ SvStream& operator >> { SvPersistBase * pEle; // Lesen, ohne in die Tabellen einzutragen - sal_uInt32 nId = rThis.ReadObj( pEle, sal_False ); + sal_uIntPtr nId = rThis.ReadObj( pEle, sal_False ); if( rThis.GetError() ) break; @@ -913,3 +918,4 @@ sal_uIntPtr SvPersistStream::RemoveObj( SvPersistBase * pObj ) return nIdx; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/ref/ref.cxx b/tools/source/ref/ref.cxx index eeee931f9182..a8fd05b9da83 100644 --- a/tools/source/ref/ref.cxx +++ b/tools/source/ref/ref.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -49,3 +50,4 @@ void SvRefBase::QueryDelete() delete this; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/reversemap/Makefile b/tools/source/reversemap/Makefile new file mode 100644 index 000000000000..a88b395b7441 --- /dev/null +++ b/tools/source/reversemap/Makefile @@ -0,0 +1,32 @@ +# 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 +# Bjoern Michaelsen <bjoern.michaelsen@canonical.com> (Canonical Ltd.) +# Portions created by the Initial Developer are Copyright (C) 2011 the +# Initial Developer. All Rights Reserved. +# +# Contributor(s): Bjoern Michaelsen <bjoern.michaelsen@canonical.com> (Canonical Ltd.) +# +# 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. + +all : reversemap.hxx + +reversemap.hxx : $(OUTDIR_FOR_BUILD)/bin/bestreversemap + $(gb_Helper_execute)bestreversemap > $@ + +.PHONY : all +# vim: set noet sw=4 ts=4: diff --git a/tools/source/reversemap/bestreversemap.cxx b/tools/source/reversemap/bestreversemap.cxx new file mode 100644 index 000000000000..d937724b126d --- /dev/null +++ b/tools/source/reversemap/bestreversemap.cxx @@ -0,0 +1,168 @@ +/* -*- 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> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. 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/config.h" +#include "rtl/textcvt.h" + +#include <stdio.h> + +struct Encoder +{ + rtl_UnicodeToTextConverter m_aConverter; + bool m_bCapable; + rtl_TextEncoding m_nEncoding; + const char *m_pEncoding; + Encoder(rtl_TextEncoding nEncoding, const char *pEncoding) + : m_bCapable(true) + , m_nEncoding(nEncoding) + , m_pEncoding(pEncoding) + { + m_aConverter = rtl_createUnicodeToTextConverter(m_nEncoding); + } + ~Encoder() + { + rtl_destroyUnicodeToTextConverter(m_aConverter); + } + void checkSupports(sal_Unicode c) + { + sal_Char aTempArray[8]; + sal_Size nTempSize; + sal_uInt32 nCvtInfo; + + sal_Size nChars = rtl_convertUnicodeToText(m_aConverter, + NULL, &c, 1, aTempArray, sizeof(aTempArray), + RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR, + &nCvtInfo, &nTempSize); + m_bCapable = nChars > 0; + } + void reset() + { + m_bCapable = true; + } + bool isOK() const + { + return m_bCapable; + } + const char* getName() const + { + return m_pEncoding; + } + +}; + + +int main(int, char**) +{ +# define EXP(x) Encoder(x, #x) + + Encoder aConverters[15] = + { + EXP(RTL_TEXTENCODING_MS_1361), + EXP(RTL_TEXTENCODING_MS_950), + EXP(RTL_TEXTENCODING_MS_949), + EXP(RTL_TEXTENCODING_MS_936), + EXP(RTL_TEXTENCODING_MS_932), + EXP(RTL_TEXTENCODING_MS_874), + EXP(RTL_TEXTENCODING_MS_1258), + EXP(RTL_TEXTENCODING_MS_1257), + EXP(RTL_TEXTENCODING_MS_1256), + EXP(RTL_TEXTENCODING_MS_1255), + EXP(RTL_TEXTENCODING_MS_1254), + EXP(RTL_TEXTENCODING_MS_1253), + EXP(RTL_TEXTENCODING_MS_1251), + EXP(RTL_TEXTENCODING_MS_1250), + EXP(RTL_TEXTENCODING_MS_1252) + }; + + printf("//Do not edit manually, generated from bestreversemap.cxx\n"); + printf("rtl_TextEncoding getBestMSEncodingByChar(sal_Unicode c)\n"); + printf("{\n"); + + sal_Unicode c = 0; + while (c < 0xFFFF) + { + for (size_t i = 0; i < SAL_N_ELEMENTS(aConverters); ++i) + aConverters[i].reset(); + + int nMostCapable = -1; + + while(c < 0xFFFF) + { + bool bSomethingCapable = false; + for (size_t i = 0; i < SAL_N_ELEMENTS(aConverters); ++i) + { + if (aConverters[i].isOK()) + aConverters[i].checkSupports(c); + if (aConverters[i].isOK()) + { + bSomethingCapable = true; + nMostCapable = i; + } + } + if (!bSomethingCapable) + break; + ++c; + } + sal_Unicode cEnd = c; + printf(" if (c < 0x%x)\n", c); + printf(" return %s;\n", aConverters[nMostCapable].getName()); + while(c < 0xFFFF) + { + bool bNothingCapable = true; + for (size_t i = 0; i < SAL_N_ELEMENTS(aConverters); ++i) + { + aConverters[i].checkSupports(c); + if (aConverters[i].isOK()) + { + bNothingCapable = false; + break; + } + } + if (!bNothingCapable) + break; + ++c; + } + if (cEnd != c) + { + if (c < 0xFFFF) + { + printf(" if (c < 0x%x)\n", c); + printf(" return RTL_TEXTENCODING_DONTKNOW;\n"); + } + else + printf(" return RTL_TEXTENCODING_DONTKNOW;\n"); + } + } + + printf("}\n"); + fflush(stdout); + + return EXIT_SUCCESS; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/stream/cachestr.cxx b/tools/source/stream/cachestr.cxx index 17270048fcf4..ab8a2e7c7806 100644 --- a/tools/source/stream/cachestr.cxx +++ b/tools/source/stream/cachestr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,10 +38,6 @@ |* |* SvCacheStream::SvCacheStream() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 27.09.94 -|* Letzte Aenderung OV 27.09.94 -|* *************************************************************************/ SvCacheStream::SvCacheStream( sal_uIntPtr nMaxMemSize ) @@ -59,10 +56,6 @@ SvCacheStream::SvCacheStream( sal_uIntPtr nMaxMemSize ) |* |* SvCacheStream::SvCacheStream() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 27.09.94 -|* Letzte Aenderung OV 27.09.94 -|* *************************************************************************/ SvCacheStream::SvCacheStream( const String &rFileName, @@ -90,10 +83,6 @@ SvCacheStream::SvCacheStream( const String &rFileName, |* |* SvCacheStream::~SvCacheStream() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 27.09.94 -|* Letzte Aenderung OV 27.09.94 -|* *************************************************************************/ SvCacheStream::~SvCacheStream() @@ -115,10 +104,6 @@ SvCacheStream::~SvCacheStream() |* |* SvCacheStream::SwapOut() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 27.09.94 -|* Letzte Aenderung OV 27.09.94 -|* *************************************************************************/ void SvCacheStream::SwapOut() @@ -161,10 +146,6 @@ void SvCacheStream::SwapOut() |* |* SvCacheStream::GetData() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 27.09.94 -|* Letzte Aenderung OV 27.09.94 -|* *************************************************************************/ sal_uIntPtr SvCacheStream::GetData( void* pData, sal_uIntPtr nSize ) @@ -176,10 +157,6 @@ sal_uIntPtr SvCacheStream::GetData( void* pData, sal_uIntPtr nSize ) |* |* SvCacheStream::PutData() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 27.09.94 -|* Letzte Aenderung OV 27.09.94 -|* *************************************************************************/ sal_uIntPtr SvCacheStream::PutData( const void* pData, sal_uIntPtr nSize ) @@ -195,10 +172,6 @@ sal_uIntPtr SvCacheStream::PutData( const void* pData, sal_uIntPtr nSize ) |* |* SvCacheStream::SeekPos() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 27.09.94 -|* Letzte Aenderung OV 27.09.94 -|* *************************************************************************/ sal_uIntPtr SvCacheStream::SeekPos( sal_uIntPtr nPos ) @@ -210,10 +183,6 @@ sal_uIntPtr SvCacheStream::SeekPos( sal_uIntPtr nPos ) |* |* SvCacheStream::FlushData() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 27.09.94 -|* Letzte Aenderung OV 27.09.94 -|* *************************************************************************/ void SvCacheStream::FlushData() @@ -228,10 +197,6 @@ void SvCacheStream::FlushData() |* |* SvCacheStream::GetStr() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 27.09.94 -|* Letzte Aenderung OV 27.09.94 -|* *************************************************************************/ const void* SvCacheStream::GetBuffer() @@ -247,10 +212,6 @@ const void* SvCacheStream::GetBuffer() |* |* SvCacheStream::SetSize() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 27.09.94 -|* Letzte Aenderung OV 27.09.94 -|* *************************************************************************/ void SvCacheStream::SetSize( sal_uIntPtr nSize ) @@ -262,10 +223,6 @@ void SvCacheStream::SetSize( sal_uIntPtr nSize ) |* |* SvCacheStream::GetSize() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 27.09.94 -|* Letzte Aenderung OV 27.09.94 -|* *************************************************************************/ sal_uIntPtr SvCacheStream::GetSize() @@ -288,3 +245,5 @@ const Link& SvCacheStream::GetFilenameHdl() const { return aFilenameLinkHdl; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index 5d0da0f3e29d..bf0c2f49b24c 100755..100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,24 +41,13 @@ #include "boost/static_assert.hpp" -/* -#if defined( DBG_UTIL ) && (OSL_DEBUG_LEVEL > 1) -// prueft Synchronisation des Buffers nach allen Read, Write, Seek -#define OV_DEBUG -#endif -*/ - #include <tools/solar.h> -#if defined(BLC) -#define SWAPNIBBLES(c) c=_crotl(c,4); -#else #define SWAPNIBBLES(c) \ unsigned char nSwapTmp=c; \ nSwapTmp <<= 4; \ c >>= 4; \ c |= nSwapTmp; -#endif #include <tools/debug.hxx> #define ENABLE_BYTESTRING_STREAM_OPERATORS @@ -71,14 +61,6 @@ DBG_NAME( Stream ) // ----------------------------------------------------------------------- -// sprintf Param-Mode -#define SPECIAL_PARAM_NONE 0 // Format-Str, Number -#define SPECIAL_PARAM_WIDTH 1 // Format-Str, Width, Number -#define SPECIAL_PARAM_PRECISION 2 // Format-Str, Precision, Number -#define SPECIAL_PARAM_BOTH 3 // Format-Str, Width, Precision, Number - -// ----------------------------------------------------------------------- - // !!! Nicht inline, wenn Operatoren <<,>> inline sind inline static void SwapUShort( sal_uInt16& r ) { r = SWAPSHORT(r); } @@ -92,11 +74,38 @@ inline static void SwapLongInt( int& r ) { r = SWAPLONG(r); } inline static void SwapLongUInt( unsigned int& r ) { r = SWAPLONG(r); } + +inline static void SwapUInt64( sal_uInt64& r ) + { + union + { + sal_uInt64 n; + sal_uInt32 c[2]; + } s; + + s.n = r; + s.c[0] ^= s.c[1]; // swap the 32 bit words + s.c[1] ^= s.c[0]; + s.c[0] ^= s.c[1]; + // swap the bytes in the words + s.c[0] = SWAPLONG(s.c[0]); + s.c[1] = SWAPLONG(s.c[1]); + r = s.n; + } #ifdef UNX inline static void SwapFloat( float& r ) { - *((sal_uInt32*)(void*)&r) = SWAPLONG( *((sal_uInt32*)(void*)&r) ); + union + { + float f; + sal_uInt32 c; + } s; + + s.f = r; + s.c = SWAPLONG( s.c ); + r = s.f; } + inline static void SwapDouble( double& r ) { if( sizeof(double) != 8 ) @@ -105,12 +114,19 @@ inline static void SwapDouble( double& r ) } else { - sal_uInt32* c = (sal_uInt32*)(void*)&r; - c[0] ^= c[1]; // zwei 32-Bit-Werte in situ vertauschen - c[1] ^= c[0]; - c[0] ^= c[1]; - c[0] = SWAPLONG(c[0]); // und die beiden 32-Bit-Werte selbst in situ drehen - c[1] = SWAPLONG(c[1]); + union + { + double d; + sal_uInt32 c[2]; + } s; + + s.d = r; + s.c[0] ^= s.c[1]; // zwei 32-Bit-Werte in situ vertauschen + s.c[1] ^= s.c[0]; + s.c[0] ^= s.c[1]; + s.c[0] = SWAPLONG(s.c[0]); // und die beiden 32-Bit-Werte selbst in situ drehen + s.c[1] = SWAPLONG(s.c[1]); + r = s.d; } } #endif @@ -173,7 +189,7 @@ ErrCode SvLockBytes::ReadAt(sal_Size nPos, void * pBuffer, sal_Size nCount, { if (!m_pStream) { - DBG_ERROR("SvLockBytes::ReadAt(): Bad stream"); + OSL_FAIL("SvLockBytes::ReadAt(): Bad stream"); return ERRCODE_NONE; } @@ -191,7 +207,7 @@ ErrCode SvLockBytes::WriteAt(sal_Size nPos, const void * pBuffer, sal_Size nCoun { if (!m_pStream) { - DBG_ERROR("SvLockBytes::WriteAt(): Bad stream"); + OSL_FAIL("SvLockBytes::WriteAt(): Bad stream"); return ERRCODE_NONE; } @@ -208,7 +224,7 @@ ErrCode SvLockBytes::Flush() const { if (!m_pStream) { - DBG_ERROR("SvLockBytes::Flush(): Bad stream"); + OSL_FAIL("SvLockBytes::Flush(): Bad stream"); return ERRCODE_NONE; } @@ -222,7 +238,7 @@ ErrCode SvLockBytes::SetSize(sal_Size nSize) { if (!m_pStream) { - DBG_ERROR("SvLockBytes::SetSize(): Bad stream"); + OSL_FAIL("SvLockBytes::SetSize(): Bad stream"); return ERRCODE_NONE; } @@ -233,7 +249,7 @@ ErrCode SvLockBytes::SetSize(sal_Size nSize) //============================================================================ ErrCode SvLockBytes::LockRegion(sal_Size, sal_Size, LockType) { - DBG_ERROR("SvLockBytes::LockRegion(): Not implemented"); + OSL_FAIL("SvLockBytes::LockRegion(): Not implemented"); return ERRCODE_NONE; } @@ -241,7 +257,7 @@ ErrCode SvLockBytes::LockRegion(sal_Size, sal_Size, LockType) ErrCode SvLockBytes::UnlockRegion(sal_Size, sal_Size, LockType) { - DBG_ERROR("SvLockBytes::UnlockRegion(): Not implemented"); + OSL_FAIL("SvLockBytes::UnlockRegion(): Not implemented"); return ERRCODE_NONE; } @@ -250,7 +266,7 @@ ErrCode SvLockBytes::Stat(SvLockBytesStat * pStat, SvLockBytesStatFlag) const { if (!m_pStream) { - DBG_ERROR("SvLockBytes::Stat(): Bad stream"); + OSL_FAIL("SvLockBytes::Stat(): Bad stream"); return ERRCODE_NONE; } @@ -442,13 +458,7 @@ void SvStream::ImpInit() eIOMode = STREAM_IO_DONTKNOW; nBufFree = 0; - nRadix = 10; - nPrecision = 0; // all significant digits - nWidth = 0; // default width - cFiller = ' '; - nJustification = JUSTIFY_RIGHT; eStreamMode = 0; - CreateFormatString(); nVersion = 0; @@ -459,10 +469,6 @@ void SvStream::ImpInit() |* |* Stream::Stream() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ SvStream::SvStream( SvLockBytes* pLockBytesP ) @@ -492,10 +498,6 @@ SvStream::SvStream() |* |* Stream::~Stream() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ SvStream::~SvStream() @@ -513,10 +515,6 @@ SvStream::~SvStream() |* |* Stream::IsA() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ sal_uInt16 SvStream::IsA() const @@ -528,10 +526,6 @@ sal_uInt16 SvStream::IsA() const |* |* Stream::ClearError() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ void SvStream::ClearError() @@ -544,10 +538,6 @@ void SvStream::ClearError() |* |* Stream::SetError() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ void SvStream::SetError( sal_uInt32 nErrorCode ) @@ -561,10 +551,6 @@ void SvStream::SetError( sal_uInt32 nErrorCode ) |* |* Stream::SetNumberFormatInt() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ void SvStream::SetNumberFormatInt( sal_uInt16 nNewFormat ) @@ -584,10 +570,6 @@ void SvStream::SetNumberFormatInt( sal_uInt16 nNewFormat ) |* |* Stream::SetBufferSize() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ void SvStream::SetBufferSize( sal_uInt16 nBufferSize ) @@ -621,10 +603,6 @@ void SvStream::SetBufferSize( sal_uInt16 nBufferSize ) |* |* Stream::ClearBuffer() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ void SvStream::ClearBuffer() @@ -644,10 +622,6 @@ void SvStream::ClearBuffer() |* |* Stream::ResetError() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ void SvStream::ResetError() @@ -659,10 +633,6 @@ void SvStream::ResetError() |* |* Stream::ReadLine() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ sal_Bool SvStream::ReadByteStringLine( String& rStr, rtl_TextEncoding eSrcCharSet ) @@ -933,10 +903,6 @@ sal_Bool SvStream::WriteUnicodeOrByteText( const String& rStr, rtl_TextEncoding |* |* Stream::WriteLine() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ sal_Bool SvStream::WriteByteStringLine( const String& rStr, rtl_TextEncoding eDestCharSet ) @@ -958,29 +924,12 @@ sal_Bool SvStream::WriteUniStringLine( const String& rStr ) return nError == SVSTREAM_OK; } -sal_Bool SvStream::WriteUniOrByteStringLine( const String& rStr, rtl_TextEncoding eDestCharSet ) -{ - if ( eDestCharSet == RTL_TEXTENCODING_UNICODE ) - return WriteUniStringLine( rStr ); - else - return WriteByteStringLine( rStr, eDestCharSet ); -} - /************************************************************************* |* |* Stream::WriteLines() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 17.07.95 -|* Letzte Aenderung OV 17.07.95 -|* *************************************************************************/ -sal_Bool SvStream::WriteByteStringLines( const String& rStr, rtl_TextEncoding eDestCharSet ) -{ - return WriteLines( ByteString( rStr, eDestCharSet ) ); -} - sal_Bool SvStream::WriteLines( const ByteString& rStr ) { ByteString aStr( rStr ); @@ -998,14 +947,6 @@ sal_Bool SvStream::WriteUniStringLines( const String& rStr ) return nError == SVSTREAM_OK; } -sal_Bool SvStream::WriteUniOrByteStringLines( const String& rStr, rtl_TextEncoding eDestCharSet ) -{ - if ( eDestCharSet == RTL_TEXTENCODING_UNICODE ) - return WriteUniStringLines( rStr ); - else - return WriteByteStringLines( rStr, eDestCharSet ); -} - /************************************************************************* |* |* Stream::WriteUniOrByteChar() @@ -1131,6 +1072,10 @@ sal_Bool SvStream::ReadCsvLine( String& rStr, sal_Bool bEmbeddedLineBreak, if (bEmbeddedLineBreak) { const sal_Unicode* pSeps = rFieldSeparators.GetBuffer(); + + // See if the separator(s) include tab. + bool bTabSep = lcl_UnicodeStrChr(pSeps, '\t') != NULL; + xub_StrLen nLastOffset = 0; xub_StrLen nQuotes = 0; while (!IsEof() && rStr.Len() < STRING_MAXLEN) @@ -1143,6 +1088,16 @@ sal_Bool SvStream::ReadCsvLine( String& rStr, sal_Bool bEmbeddedLineBreak, { if (nQuotes) { + if (bTabSep && *p == '\t') + { + // When tab-delimited, tab char ends quoted sequence + // even if we haven't reached the end quote. Doing + // this helps keep mal-formed rows from damaging + // other, well-formed rows. + nQuotes = 0; + break; + } + if (*p == cFieldQuote && !bBackslashEscaped) ++nQuotes; else if (bAllowBackslashEscape) @@ -1180,10 +1135,6 @@ sal_Bool SvStream::ReadCsvLine( String& rStr, sal_Bool bEmbeddedLineBreak, |* |* Stream::SeekRel() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ sal_Size SvStream::SeekRel( sal_sSize nPos ) @@ -1210,10 +1161,6 @@ sal_Size SvStream::SeekRel( sal_sSize nPos ) |* |* Stream::operator>>() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ SvStream& SvStream::operator >> ( sal_uInt16& r ) @@ -1232,6 +1179,15 @@ SvStream& SvStream::operator>> ( sal_uInt32& r ) return *this; } + +SvStream& SvStream::operator>> ( sal_uInt64& r ) +{ + READNUMBER_WITHOUT_SWAP(sal_uInt64,r) + if( bSwap ) + SwapUInt64(r); + return *this; +} + SvStream& SvStream::operator >> ( long& r ) { #if(SAL_TYPES_SIZEOFLONG != 4) @@ -1350,10 +1306,6 @@ SvStream& SvStream::operator>> ( SvStream& rStream ) |* |* Stream::operator<<() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ SvStream& SvStream::operator<< ( sal_uInt16 v ) @@ -1372,6 +1324,14 @@ SvStream& SvStream::operator<< ( sal_uInt32 v ) return *this; } +SvStream& SvStream::operator<< ( sal_uInt64 v ) +{ + if( bSwap ) + SwapUInt64(v); + WRITENUMBER_WITHOUT_SWAP(sal_uInt64,v) + return *this; +} + SvStream& SvStream::operator<< ( long v ) { #if(SAL_TYPES_SIZEOFLONG != 4) @@ -1614,10 +1574,6 @@ SvStream& SvStream::WriteByteString( const ByteString& rStr) |* |* Stream::Read() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ sal_Size SvStream::Read( void* pData, sal_Size nCount ) @@ -1712,10 +1668,6 @@ sal_Size SvStream::Read( void* pData, sal_Size nCount ) |* |* Stream::Write() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ sal_Size SvStream::Write( const void* pData, sal_Size nCount ) @@ -1802,10 +1754,6 @@ sal_Size SvStream::Write( const void* pData, sal_Size nCount ) |* |* Stream::Seek() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ sal_Size SvStream::Seek( sal_Size nFilePos ) @@ -1858,10 +1806,6 @@ sal_Size SvStream::Seek( sal_Size nFilePos ) |* |* Stream::Flush() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ void SvStream::Flush() @@ -1885,10 +1829,6 @@ void SvStream::Flush() |* |* Stream::PutBack() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 01.08.94 -|* Letzte Aenderung OV 01.08.94 -|* *************************************************************************/ /* @@ -1957,10 +1897,6 @@ SvStream& SvStream::PutBack( char aCh ) |* |* Stream::EatWhite() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 01.08.94 -|* Letzte Aenderung OV 01.08.94 -|* *************************************************************************/ void SvStream::EatWhite() @@ -1977,10 +1913,6 @@ void SvStream::EatWhite() |* |* Stream::RefreshBuffer() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 01.08.94 -|* Letzte Aenderung OV 01.08.94 -|* *************************************************************************/ void SvStream::RefreshBuffer() @@ -2004,223 +1936,19 @@ void SvStream::RefreshBuffer() eIOMode = STREAM_IO_DONTKNOW; } - -/************************************************************************* -|* -|* Stream::CreateFormatString() -|* -|* Beschreibung Baut Formatstring zusammen -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* -*************************************************************************/ - -void SvStream::CreateFormatString() -{ - aFormatString = '%'; - nPrintfParams = SPECIAL_PARAM_NONE; - - if( nJustification ) - { - aFormatString += '-'; - } - - if( nWidth ) - { - if( cFiller != ' ' ) - aFormatString += '0'; - aFormatString += '*'; - nPrintfParams = SPECIAL_PARAM_WIDTH; - } - - if( nPrecision ) - { - aFormatString += ".*"; - if( nWidth ) - nPrintfParams = SPECIAL_PARAM_BOTH; - else - nPrintfParams = SPECIAL_PARAM_PRECISION; - } -} - -/************************************************************************* -|* -|* Stream::ReadNumber() -|* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* -*************************************************************************/ - -#define BUFSIZE_LONG 21 // log( 2 hoch 64 ) + 1 - -SvStream& SvStream::ReadNumber( long& rLong ) +SvStream& SvStream::WriteNumber(sal_Int32 nInt32) { - EatWhite(); - if( bIsEof || nError ) - { - SetError( SVSTREAM_GENERALERROR ); - return *this; - } - sal_Size nFPtr = Tell(); - char buf[ BUFSIZE_LONG ]; - memset( buf, 0, BUFSIZE_LONG ); - sal_Size nTemp = Read( buf, BUFSIZE_LONG-1 ); - if( !nTemp || nError ) - { - SetError( SVSTREAM_GENERALERROR ); - return *this; - } - char *pEndPtr; - rLong = strtol( buf, &pEndPtr, (int)nRadix ); - nFPtr += ( (sal_Size)pEndPtr - (sal_Size)(&(buf[0])) ); - Seek( nFPtr ); - bIsEof = sal_False; - return *this; -} - -SvStream& SvStream::ReadNumber( sal_uInt32& rUInt32 ) -{ - EatWhite(); - if( bIsEof || nError ) - { - SetError( SVSTREAM_GENERALERROR ); - return *this; - } - sal_Size nFPtr = Tell(); - char buf[ BUFSIZE_LONG ]; - memset( buf, 0, BUFSIZE_LONG ); - sal_Size nTemp = Read( buf, BUFSIZE_LONG-1 ); - if( !nTemp || nError ) - { - SetError( SVSTREAM_GENERALERROR ); - return *this; - } - char *pEndPtr; - rUInt32 = strtoul( buf, &pEndPtr, (int)nRadix ); - nFPtr += ( (sal_uIntPtr)pEndPtr - (sal_uIntPtr)buf ); - Seek( nFPtr ); - bIsEof = sal_False; + char buffer[12]; + sal_Size nLen = sprintf(buffer, "%"SAL_PRIdINT32, nInt32); + Write(buffer, nLen); return *this; } -SvStream& SvStream::ReadNumber( double& rDouble ) +SvStream& SvStream::WriteNumber(sal_uInt32 nUInt32) { - EatWhite(); - if( bIsEof || nError ) - { - SetError( SVSTREAM_GENERALERROR ); - return *this; - } - sal_Size nFPtr = Tell(); - char buf[ BUFSIZE_LONG ]; - memset( buf, 0, BUFSIZE_LONG ); - sal_Size nTemp = Read( buf, BUFSIZE_LONG-1 ); - if( !nTemp || nError ) - { - SetError( SVSTREAM_GENERALERROR ); - return *this; - } - char *pEndPtr; - rDouble = strtod( buf, &pEndPtr ); - nFPtr += ( (sal_Size)pEndPtr - (sal_Size)buf ); - Seek( nFPtr ); - bIsEof = sal_False; - return *this; -} - - -/************************************************************************* -|* -|* Stream::WriteNumber() -|* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* -*************************************************************************/ - -SvStream& SvStream::WriteNumber( long nLong ) -{ - char buffer[256+12]; - char pType[] = "ld"; // Nicht static! - if( nRadix == 16 ) - pType[1] = 'x'; - else if( nRadix == 8 ) - pType[1] = 'o'; - ByteString aFStr( aFormatString); - aFStr += pType; - int nLen; - switch ( nPrintfParams ) - { - case SPECIAL_PARAM_NONE : - nLen = sprintf( buffer, aFStr.GetBuffer(), nLong ); - break; - case SPECIAL_PARAM_WIDTH : - nLen = sprintf( buffer, aFStr.GetBuffer(), nWidth, nLong ); - break; - case SPECIAL_PARAM_PRECISION : - nLen = sprintf( buffer, aFStr.GetBuffer(), nPrecision,nLong); - break; - default: - nLen=sprintf(buffer, aFStr.GetBuffer(),nWidth,nPrecision,nLong); - } - Write( buffer, (long)nLen ); - return *this; -} - -SvStream& SvStream::WriteNumber( sal_uInt32 nUInt32 ) -{ - char buffer[256+12]; - char pType[] = "lu"; // Nicht static! - if( nRadix == 16 ) - pType[1] = 'x'; - else if( nRadix == 8 ) - pType[1] = 'o'; - ByteString aFStr( aFormatString); - aFStr += pType; - int nLen; - switch ( nPrintfParams ) - { - case SPECIAL_PARAM_NONE : - nLen = sprintf( buffer, aFStr.GetBuffer(), nUInt32 ); - break; - case SPECIAL_PARAM_WIDTH : - nLen = sprintf( buffer, aFStr.GetBuffer(), nWidth, nUInt32 ); - break; - case SPECIAL_PARAM_PRECISION : - nLen = sprintf( buffer, aFStr.GetBuffer(), nPrecision, nUInt32 ); - break; - default: - nLen=sprintf(buffer,aFStr.GetBuffer(),nWidth,nPrecision,nUInt32 ); - } - Write( buffer, (long)nLen ); - return *this; -} - - -SvStream& SvStream::WriteNumber( const double& rDouble ) -{ - char buffer[256+24]; - ByteString aFStr( aFormatString); - aFStr += "lf"; - int nLen; - switch ( nPrintfParams ) - { - case SPECIAL_PARAM_NONE : - nLen = sprintf( buffer, aFStr.GetBuffer(), rDouble ); - break; - case SPECIAL_PARAM_WIDTH : - nLen = sprintf( buffer, aFStr.GetBuffer(), nWidth, rDouble ); - break; - case SPECIAL_PARAM_PRECISION : - nLen = sprintf( buffer, aFStr.GetBuffer(), nPrecision, rDouble); - break; - default: - nLen=sprintf(buffer, aFStr.GetBuffer(),nWidth,nPrecision,rDouble); - } - Write( buffer, (long)nLen ); + char buffer[11]; + sal_Size nLen = sprintf(buffer, "%"SAL_PRIuUINT32, nUInt32); + Write(buffer, nLen); return *this; } @@ -2229,8 +1957,6 @@ SvStream& SvStream::WriteNumber( const double& rDouble ) |* Stream::CryptAndWriteBuffer() |* |* Beschreibung Verschluesseln und Schreiben -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 |* *************************************************************************/ @@ -2272,8 +1998,6 @@ sal_Size SvStream::CryptAndWriteBuffer( const void* pStart, sal_Size nLen) |* Stream::EncryptBuffer() |* |* Beschreibung Buffer entschluesseln -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 |* *************************************************************************/ @@ -2296,10 +2020,6 @@ sal_Bool SvStream::EncryptBuffer(void* pStart, sal_Size nLen) |* |* Stream::SetKey() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ unsigned char implGetCryptMask(const sal_Char* pStr, sal_Int32 nLen, long nVersion) @@ -2337,20 +2057,17 @@ unsigned char implGetCryptMask(const sal_Char* pStr, sal_Int32 nLen, long nVersi return nCryptMask; } -void SvStream::SetKey( const ByteString& rKey ) +void SvStream::SetCryptMaskKey(const rtl::OString& rCryptMaskKey) { - aKey = rKey; - nCryptMask = implGetCryptMask( aKey.GetBuffer(), aKey.Len(), GetVersion() ); + m_aCryptMaskKey = rCryptMaskKey; + nCryptMask = implGetCryptMask(m_aCryptMaskKey.getStr(), + m_aCryptMaskKey.getLength(), GetVersion()); } /************************************************************************* |* |* Stream::SyncSvStream() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ void SvStream::SyncSvStream( sal_Size nNewStreamPos ) @@ -2363,10 +2080,6 @@ void SvStream::SyncSvStream( sal_Size nNewStreamPos ) |* |* Stream::SyncSysStream() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ void SvStream::SyncSysStream() @@ -2379,10 +2092,6 @@ void SvStream::SyncSysStream() |* |* Stream::SetStreamSize() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ sal_Bool SvStream::SetStreamSize( sal_Size nSize ) @@ -2398,26 +2107,10 @@ sal_Bool SvStream::SetStreamSize( sal_Size nSize ) return (sal_Bool)(nError == 0); } -//============================================================================ - -void SvStream::AddMark( sal_Size ) -{ -} - -//============================================================================ - -void SvStream::RemoveMark( sal_Size ) -{ -} - /************************************************************************* |* |* endl() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung TH 13.11.96 -|* *************************************************************************/ SvStream& endl( SvStream& rStr ) @@ -2460,10 +2153,6 @@ SvStream& endlub( SvStream& rStrm ) |* |* SvMemoryStream::SvMemoryStream() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 20.06.94 -|* Letzte Aenderung OV 20.06.94 -|* *************************************************************************/ SvMemoryStream::SvMemoryStream( void* pBuffer, sal_Size bufSize, @@ -2486,10 +2175,6 @@ SvMemoryStream::SvMemoryStream( void* pBuffer, sal_Size bufSize, |* |* SvMemoryStream::SvMemoryStream() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 20.06.94 -|* Letzte Aenderung OV 20.06.94 -|* *************************************************************************/ SvMemoryStream::SvMemoryStream( sal_Size nInitSize, sal_Size nResizeOffset ) @@ -2516,10 +2201,6 @@ SvMemoryStream::SvMemoryStream( sal_Size nInitSize, sal_Size nResizeOffset ) |* |* SvMemoryStream::~SvMemoryStream() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 20.06.94 -|* Letzte Aenderung OV 20.06.94 -|* *************************************************************************/ SvMemoryStream::~SvMemoryStream() @@ -2537,10 +2218,6 @@ SvMemoryStream::~SvMemoryStream() |* |* SvMemoryStream::IsA() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 20.06.94 -|* Letzte Aenderung OV 20.06.94 -|* *************************************************************************/ sal_uInt16 SvMemoryStream::IsA() const @@ -2552,10 +2229,6 @@ sal_uInt16 SvMemoryStream::IsA() const |* |* SvMemoryStream::SetBuffer() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 20.06.94 -|* Letzte Aenderung OV 20.06.94 -|* *************************************************************************/ void* SvMemoryStream::SetBuffer( void* pNewBuf, sal_Size nCount, @@ -2593,10 +2266,6 @@ void* SvMemoryStream::SetBuffer( void* pNewBuf, sal_Size nCount, |* |* SvMemoryStream::GetData() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 20.06.94 -|* Letzte Aenderung OV 20.06.94 -|* *************************************************************************/ sal_Size SvMemoryStream::GetData( void* pData, sal_Size nCount ) @@ -2613,10 +2282,6 @@ sal_Size SvMemoryStream::GetData( void* pData, sal_Size nCount ) |* |* SvMemoryStream::PutData() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 20.06.94 -|* Letzte Aenderung OV 20.06.94 -|* *************************************************************************/ sal_Size SvMemoryStream::PutData( const void* pData, sal_Size nCount ) @@ -2678,10 +2343,6 @@ sal_Size SvMemoryStream::PutData( const void* pData, sal_Size nCount ) |* |* SvMemoryStream::SeekPos() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 20.06.94 -|* Letzte Aenderung OV 20.06.94 -|* *************************************************************************/ // nEndOfData: Erste Position im Stream, die nicht gelesen werden darf @@ -2724,10 +2385,6 @@ sal_Size SvMemoryStream::SeekPos( sal_Size nNewPos ) |* |* SvMemoryStream::FlushData() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 20.06.94 -|* Letzte Aenderung OV 20.06.94 -|* *************************************************************************/ void SvMemoryStream::FlushData() @@ -2738,10 +2395,6 @@ void SvMemoryStream::FlushData() |* |* SvMemoryStream::ResetError() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 20.06.94 -|* Letzte Aenderung OV 20.06.94 -|* *************************************************************************/ void SvMemoryStream::ResetError() @@ -2753,10 +2406,6 @@ void SvMemoryStream::ResetError() |* |* SvMemoryStream::AllocateMemory() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 20.06.94 -|* Letzte Aenderung OV 20.06.94 -|* *************************************************************************/ sal_Bool SvMemoryStream::AllocateMemory( sal_Size nNewSize ) @@ -2769,10 +2418,6 @@ sal_Bool SvMemoryStream::AllocateMemory( sal_Size nNewSize ) |* |* SvMemoryStream::ReAllocateMemory() (Bozo-Algorithmus) |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 20.06.94 -|* Letzte Aenderung OV 20.06.94 -|* *************************************************************************/ sal_Bool SvMemoryStream::ReAllocateMemory( long nDiff ) @@ -2830,10 +2475,6 @@ void SvMemoryStream::FreeMemory() |* |* SvMemoryStream::SwitchBuffer() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 26.07.94 -|* Letzte Aenderung OV 26.07.94 -|* *************************************************************************/ void* SvMemoryStream::SwitchBuffer( sal_Size nInitSize, sal_Size nResizeOffset) @@ -2877,3 +2518,5 @@ TYPEINIT0 ( SvDataCopyStream ) void SvDataCopyStream::Assign( const SvDataCopyStream& ) { } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/stream/strmos2.cxx b/tools/source/stream/strmos2.cxx deleted file mode 100644 index bfe1f9750f4d..000000000000 --- a/tools/source/stream/strmos2.cxx +++ /dev/null @@ -1,758 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <string.h> -#include <limits.h> - -#define INCL_PM -#define INCL_DOS -#define INCL_DOSERRORS -#include <svpm.h> - -#include <tools/debug.hxx> -#include <tools/fsys.hxx> -#include <tools/stream.hxx> - -// class FileBase -#include <osl/file.hxx> - -using namespace osl; - -// class FileBase -#ifndef _OSL_FILE_HXX_ -#include <osl/file.hxx> -#endif - -using namespace osl; - -// ----------------------------------------------------------------------- - -// -------------- -// - StreamData - -// -------------- - -class StreamData -{ -public: - HFILE hFile; - sal_Bool bIsEof; - - StreamData() - { - hFile = 0; - bIsEof = sal_True; - } -}; - -// ----------------------------------------------------------------------- - -sal_uIntPtr GetSvError( APIRET nPMError ) -{ - static struct { APIRET pm; sal_uIntPtr sv; } errArr[] = - { - { ERROR_FILE_NOT_FOUND, SVSTREAM_FILE_NOT_FOUND }, - { ERROR_PATH_NOT_FOUND, SVSTREAM_PATH_NOT_FOUND }, - { ERROR_TOO_MANY_OPEN_FILES, SVSTREAM_TOO_MANY_OPEN_FILES }, - { ERROR_ACCESS_DENIED, SVSTREAM_ACCESS_DENIED }, - { ERROR_INVALID_ACCESS, SVSTREAM_INVALID_ACCESS }, - { ERROR_SHARING_VIOLATION, SVSTREAM_SHARING_VIOLATION }, - { ERROR_SHARING_BUFFER_EXCEEDED,SVSTREAM_SHARE_BUFF_EXCEEDED }, - { ERROR_CANNOT_MAKE, SVSTREAM_CANNOT_MAKE }, - { ERROR_INVALID_PARAMETER, SVSTREAM_INVALID_PARAMETER }, - { ERROR_DRIVE_LOCKED, SVSTREAM_LOCKING_VIOLATION }, - { ERROR_LOCK_VIOLATION, SVSTREAM_LOCKING_VIOLATION }, - { ERROR_FILENAME_EXCED_RANGE, SVSTREAM_INVALID_PARAMETER }, - { ERROR_ATOMIC_LOCK_NOT_SUPPORTED, SVSTREAM_INVALID_PARAMETER }, - { ERROR_READ_LOCKS_NOT_SUPPORTED, SVSTREAM_INVALID_PARAMETER }, - - - { 0xFFFF, SVSTREAM_GENERALERROR } - }; - - sal_uIntPtr nRetVal = SVSTREAM_GENERALERROR; // Standardfehler - int i=0; - do - { - if( errArr[i].pm == nPMError ) - { - nRetVal = errArr[i].sv; - break; - } - i++; - } - while( errArr[i].pm != 0xFFFF ); - return nRetVal; -} - -/************************************************************************* -|* -|* SvFileStream::SvFileStream() -|* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* -*************************************************************************/ - -SvFileStream::SvFileStream( const String& rFileName, StreamMode nOpenMode ) -{ - bIsOpen = sal_False; - nLockCounter = 0; - bIsWritable = sal_False; - pInstanceData = new StreamData; - - SetBufferSize( 8192 ); - // convert URL to SystemPath, if necessary - ::rtl::OUString aFileName, aNormPath; - - if ( FileBase::getSystemPathFromFileURL( rFileName, aFileName ) != FileBase::E_None ) - aFileName = rFileName; - Open( aFileName, nOpenMode ); -} - -/************************************************************************* -|* -|* SvFileStream::SvFileStream() -|* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 22.11.94 -|* Letzte Aenderung OV 22.11.94 -|* -*************************************************************************/ - -SvFileStream::SvFileStream() -{ - bIsOpen = sal_False; - nLockCounter = 0; - bIsWritable = sal_False; - pInstanceData = new StreamData; - SetBufferSize( 8192 ); -} - -/************************************************************************* -|* -|* SvFileStream::~SvFileStream() -|* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 14.06.94 -|* Letzte Aenderung OV 14.06.94 -|* -*************************************************************************/ - -SvFileStream::~SvFileStream() -{ - Close(); - if( pInstanceData ) - delete pInstanceData; -} - -/************************************************************************* -|* -|* SvFileStream::GetFileHandle() -|* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 14.06.94 -|* Letzte Aenderung OV 14.06.94 -|* -*************************************************************************/ - -sal_uIntPtr SvFileStream::GetFileHandle() const -{ - return (sal_uIntPtr)pInstanceData->hFile; -} - -/************************************************************************* -|* -|* SvFileStream::IsA() -|* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 14.06.94 -|* Letzte Aenderung OV 14.06.94 -|* -*************************************************************************/ - -sal_uInt16 SvFileStream::IsA() const -{ - return ID_FILESTREAM; -} - -/************************************************************************* -|* -|* SvFileStream::GetData() -|* -|* Beschreibung STREAM.SDW, Prueft nicht Eof; IsEof danach rufbar -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* -*************************************************************************/ - -sal_uIntPtr SvFileStream::GetData( void* pData, sal_uIntPtr nSize ) -{ -#ifdef DBG_UTIL - ByteString aTraceStr( "SvFileStream::GetData(): " ); - aTraceStr += ByteString::CreateFromInt64(nSize); - aTraceStr += " Bytes from "; - aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding()); - DBG_TRACE( aTraceStr.GetBuffer() ); -#endif - - sal_uIntPtr nCount = 0L; - if( IsOpen() ) - { - APIRET nResult; - nResult = DosRead( pInstanceData->hFile,(PVOID)pData,nSize,&nCount ); - if( nResult ) - SetError(::GetSvError(nResult) ); - } - return nCount; -} - -/************************************************************************* -|* -|* SvFileStream::PutData() -|* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* -*************************************************************************/ - -sal_uIntPtr SvFileStream::PutData( const void* pData, sal_uIntPtr nSize ) -{ -#ifdef DBG_UTIL - ByteString aTraceStr( "SvFileStrean::PutData: " ); - aTraceStr += ByteString::CreateFromInt64(nSize); - aTraceStr += " Bytes to "; - aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding()); - DBG_TRACE( aTraceStr.GetBuffer() ); -#endif - - sal_uIntPtr nCount = 0L; - if( IsOpen() ) - { - APIRET nResult; - nResult = DosWrite( pInstanceData->hFile,(PVOID)pData,nSize,&nCount ); - if( nResult ) - SetError(::GetSvError(nResult) ); - else if( !nCount ) - SetError( SVSTREAM_DISK_FULL ); - } - return nCount; -} - -/************************************************************************* -|* -|* SvFileStream::SeekPos() -|* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* -*************************************************************************/ - -sal_uIntPtr SvFileStream::SeekPos( sal_uIntPtr nPos ) -{ - sal_uIntPtr nNewPos = 0L; - if( IsOpen() ) - { - APIRET nResult; - - if( nPos != STREAM_SEEK_TO_END ) - nResult = DosSetFilePtr( pInstanceData->hFile,(long)nPos, - FILE_BEGIN, &nNewPos ); - else - nResult = DosSetFilePtr( pInstanceData->hFile,0L, - FILE_END, &nNewPos ); - - if( nResult ) - SetError(::GetSvError(nResult) ); - } - else - SetError( SVSTREAM_GENERALERROR ); - return nNewPos; -} - -/************************************************************************* -|* -|* SvFileStream::Tell() -|* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* -*************************************************************************/ -/* -sal_uIntPtr SvFileStream::Tell() -{ - sal_uIntPtr nPos = 0L; - - if( IsOpen() ) - { - APIRET nResult; - nResult = DosSetFilePtr(pInstanceData->hFile,0L,FILE_CURRENT,&nPos); - if( nResult ) - SetError(::GetSvError(nResult) ); - } - return nPos; -} -*/ - -/************************************************************************* -|* -|* SvFileStream::FlushData() -|* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* -*************************************************************************/ - -void SvFileStream::FlushData() -{ - if( IsOpen() ) - { - APIRET nResult; - nResult = DosResetBuffer(pInstanceData->hFile ); - if( nResult ) - SetError(::GetSvError(nResult) ); - } -} - -/************************************************************************* -|* -|* SvFileStream::LockRange() -|* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* -*************************************************************************/ - -sal_Bool SvFileStream::LockRange( sal_uIntPtr nByteOffset, sal_uIntPtr nBytes ) -{ - sal_Bool bRetVal = sal_False; - if( IsOpen() ) - { - APIRET nResult; - FILELOCK aLockArea, aUnlockArea; - aUnlockArea.lOffset = 0L; - aUnlockArea.lRange = 0L; - aLockArea.lOffset = (long)nByteOffset; - aLockArea.lRange = (long)nBytes; - - nResult = DosSetFileLocks(pInstanceData->hFile, - &aUnlockArea, &aLockArea, - 1000UL, // Zeit in ms bis Abbruch - 0L // kein Atomic-Lock - ); - - if( nResult ) - SetError(::GetSvError(nResult) ); - else - bRetVal = sal_True; - } - return bRetVal; -} - -/************************************************************************* -|* -|* SvFileStream::UnlockRange() -|* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* -*************************************************************************/ - -sal_Bool SvFileStream::UnlockRange( sal_uIntPtr nByteOffset, sal_uIntPtr nBytes ) -{ - sal_Bool bRetVal = sal_False; - if( IsOpen() ) - { - APIRET nResult; - FILELOCK aLockArea, aUnlockArea; - aLockArea.lOffset = 0L; - aLockArea.lRange = 0L; - aUnlockArea.lOffset = (long)nByteOffset; - aUnlockArea.lRange = (long)nBytes; - - nResult = DosSetFileLocks(pInstanceData->hFile, - &aUnlockArea, &aLockArea, - 1000UL, // Zeit in ms bis Abbruch - 0L // kein Atomic-Lock - ); - - if( nResult ) - SetError(::GetSvError(nResult) ); - else - bRetVal = sal_True; - } - return bRetVal; -} - -/************************************************************************* -|* -|* SvFileStream::LockFile() -|* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* -*************************************************************************/ - -sal_Bool SvFileStream::LockFile() -{ - sal_Bool bRetVal = sal_False; - if( !nLockCounter ) - { - if( LockRange( 0L, LONG_MAX ) ) - { - nLockCounter = 1; - bRetVal = sal_True; - } - } - else - { - nLockCounter++; - bRetVal = sal_True; - } - return bRetVal; -} - -/************************************************************************* -|* -|* SvFileStream::UnlockFile() -|* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* -*************************************************************************/ - -sal_Bool SvFileStream::UnlockFile() -{ - sal_Bool bRetVal = sal_False; - if( nLockCounter > 0) - { - if( nLockCounter == 1) - { - if( UnlockRange( 0L, LONG_MAX ) ) - { - nLockCounter = 0; - bRetVal = sal_True; - } - } - else - { - nLockCounter--; - bRetVal = sal_True; - } - } - return bRetVal; -} - -/************************************************************************* -|* -|* SvFileStream::Open() -|* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* -*************************************************************************/ - -#if 0 -sal_Bool createLongNameEA ( const PCSZ pszPath, sal_uIntPtr ulAttributes, const String& aLongName ); -#endif - -void SvFileStream::Open( const String& rFilename, StreamMode nOpenMode ) -{ - String aParsedFilename; - -#if 0 - if ( Folder::IsAvailable() && (rFilename.Search('{') < 9) ) - { - String aVirtualPart; - String aRealPart; - String aVirtualPath; - ItemIDPath aVirtualURL; - sal_uIntPtr nDivider = 0; - - String aVirtualString(rFilename); - - for (int x=aVirtualString.Len(); x>0; x--) - { - if (aVirtualString.Copy(x,1).Compare("}")==COMPARE_EQUAL) - { - nDivider = x; - break; - } - } - - aVirtualPart = aVirtualString.Copy(0,nDivider+1); - aRealPart = aVirtualString.Copy(nDivider+2); - - aVirtualURL = aVirtualPart; - aVirtualPath = aVirtualURL.GetHostNotationPath(); - - DirEntry aTempDirEntry(aVirtualPath); - - aTempDirEntry += aRealPart; - - aParsedFilename = aTempDirEntry.GetFull(); - } - else -#endif // 0 - { - aParsedFilename = rFilename; - } - - Close(); - SvStream::ClearBuffer(); - - sal_uIntPtr nActionTaken; - sal_uIntPtr nOpenAction = 0L; - sal_uIntPtr nShareBits = 0L; - sal_uIntPtr nReadWriteBits = 0L; - - eStreamMode = nOpenMode; - eStreamMode &= ~STREAM_TRUNC; // beim ReOpen nicht cutten - - nOpenMode |= STREAM_SHARE_DENYNONE; // definierten Zustand garantieren - - // ********* Zugriffsflags *********** - if( nOpenMode & STREAM_SHARE_DENYNONE) - nShareBits = OPEN_SHARE_DENYNONE; - - if( nOpenMode & STREAM_SHARE_DENYREAD) - nShareBits = OPEN_SHARE_DENYREAD; - - if( nOpenMode & STREAM_SHARE_DENYWRITE) - nShareBits = OPEN_SHARE_DENYWRITE; - - if( nOpenMode & STREAM_SHARE_DENYALL) - nShareBits = OPEN_SHARE_DENYREADWRITE; - - if( (nOpenMode & STREAM_READ) ) - { - if( nOpenMode & STREAM_WRITE ) - nReadWriteBits |= OPEN_ACCESS_READWRITE; - else - { - nReadWriteBits |= OPEN_ACCESS_READONLY; - nOpenMode |= STREAM_NOCREATE; - } - } - else - nReadWriteBits |= OPEN_ACCESS_WRITEONLY; - - - if( nOpenMode & STREAM_NOCREATE ) - { - // Datei nicht erzeugen - nOpenAction = OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS; - } - else - { - // Datei erzeugen, wenn nicht vorhanden - nOpenAction = OPEN_ACTION_CREATE_IF_NEW; - if( nOpenMode & STREAM_TRUNC ) - // Auf Nullaenge kuerzen, wenn existiert - nOpenAction |= OPEN_ACTION_REPLACE_IF_EXISTS; - else - // Inhalt der Datei nicht wegwerfen - nOpenAction |= OPEN_ACTION_OPEN_IF_EXISTS; - } - -#if 0 // YD - // - // resolves long FAT names used by OS2 - // - sal_Bool bIsLongOS2=sal_False; - if (Folder::IsAvailable()) - { - DirEntry aDirEntry(rFilename); - if (aDirEntry.IsLongNameOnFAT()) - { - // in kurzen Pfad wandeln - ItemIDPath aItemIDPath(rFilename); - aParsedFilename = aItemIDPath.GetHostNotationPath(); - bIsLongOS2 = sal_True; - } - } -#endif - - aFilename = aParsedFilename; - ByteString aFileNameA( aFilename, gsl_getSystemTextEncoding()); - FSysRedirector::DoRedirect( aFilename ); - -#ifdef DBG_UTIL - ByteString aTraceStr( "SvFileStream::Open(): " ); - aTraceStr += aFileNameA; - DBG_TRACE( aTraceStr.GetBuffer() ); -#endif - - APIRET nRet = DosOpen( aFileNameA.GetBuffer(), &pInstanceData->hFile, - &nActionTaken, 0L, FILE_NORMAL, nOpenAction, - nReadWriteBits | nShareBits | OPEN_FLAGS_NOINHERIT, 0L); - - if( nRet == ERROR_TOO_MANY_OPEN_FILES ) - { - long nToAdd = 10; - sal_uIntPtr nCurMaxFH; - nRet = DosSetRelMaxFH( &nToAdd, &nCurMaxFH ); - nRet = DosOpen( aFileNameA.GetBuffer(), &pInstanceData->hFile, - &nActionTaken, 0L, FILE_NORMAL, nOpenAction, - nReadWriteBits | nShareBits | OPEN_FLAGS_NOINHERIT, 0L); - } - - // Bei Fehler pruefen, ob wir lesen duerfen - if( nRet==ERROR_ACCESS_DENIED || nRet==ERROR_SHARING_VIOLATION ) - { - nReadWriteBits = OPEN_ACCESS_READONLY; - nRet = DosOpen( aFileNameA.GetBuffer(), &pInstanceData->hFile, - &nActionTaken, 0L, FILE_NORMAL, nOpenAction, - nReadWriteBits | nShareBits | OPEN_FLAGS_NOINHERIT, 0L); - } - - if( nRet ) - { - bIsOpen = sal_False; - SetError(::GetSvError(nRet) ); - } - else - { - bIsOpen = sal_True; - pInstanceData->bIsEof = sal_False; - if( nReadWriteBits != OPEN_ACCESS_READONLY ) - bIsWritable = sal_True; - } - -#if 0 - if (bIsOpen && bIsLongOS2) - { - //file schlieen, da sonst createLongName u.U. nicht mglich - Close(); - - // erzeugtem File langen Namen geben - DirEntry aDirEntry(rFilename); - createLongNameEA(aFileNameA.GetBuffer(), FILE_NORMAL, aDirEntry.GetName()); - - // und wieder oeffnen - ReOpen(); - } -#endif - -} - -/************************************************************************* -|* -|* SvFileStream::ReOpen() -|* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* -*************************************************************************/ - -void SvFileStream::ReOpen() -{ - if( !bIsOpen && aFilename.Len() ) - Open( aFilename, eStreamMode ); -} - -/************************************************************************* -|* -|* SvFileStream::Close() -|* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* -*************************************************************************/ - -void SvFileStream::Close() -{ - if( IsOpen() ) - { -#ifdef DBG_UTIL - ByteString aTraceStr( "SvFileStream::Close(): " ); - aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding()); - DBG_TRACE( aTraceStr.GetBuffer() ); -#endif - - if( nLockCounter ) - { - nLockCounter = 1; - UnlockFile(); - } - Flush(); - DosClose( pInstanceData->hFile ); - } - - bIsOpen = sal_False; - nLockCounter= 0; - bIsWritable = sal_False; - pInstanceData->bIsEof = sal_True; - SvStream::ClearBuffer(); - SvStream::ClearError(); -} - -/************************************************************************* -|* -|* SvFileStream::ResetError() -|* -|* Beschreibung STREAM.SDW; Setzt Filepointer auf Dateianfang -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* -*************************************************************************/ - -void SvFileStream::ResetError() -{ - SvStream::ClearError(); -} - -/************************************************************************* -|* -|* SvFileStream::SetSize() -|* -|* Beschreibung -|* Ersterstellung OV 19.10.95 -|* Letzte Aenderung OV 19.10.95 -|* -*************************************************************************/ - -void SvFileStream::SetSize( sal_uIntPtr nSize ) -{ - if( IsOpen() ) - { - APIRET nRet = DosSetFileSize( pInstanceData->hFile, nSize ); - if( nRet ) - SetError( ::GetSvError( nRet ) ); - } -} diff --git a/tools/source/stream/strmsys.cxx b/tools/source/stream/strmsys.cxx index a373ad985214..65b4eb454387 100644 --- a/tools/source/stream/strmsys.cxx +++ b/tools/source/stream/strmsys.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,6 +33,6 @@ #include "strmwnt.cxx" #elif defined UNX #include "strmunx.cxx" -#elif defined OS2 -#include "strmos2.cxx" #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx index 87e3cea4c0c7..1e8b75c5fe37 100644 --- a/tools/source/stream/strmunx.cxx +++ b/tools/source/stream/strmunx.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -25,7 +26,7 @@ * ************************************************************************/ -// no include "precompiled_tools.hxx" because this file is included in strmsys.cxx +// don't include "precompiled_tools.hxx" because this file is included in strmsys.cxx #include <stdio.h> #include <string.h> @@ -39,8 +40,9 @@ #include <tools/debug.hxx> #include <tools/fsys.hxx> #include <tools/stream.hxx> +#include <vector> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <osl/thread.h> // osl_getThreadTextEncoding // class FileBase @@ -55,12 +57,8 @@ using namespace osl; // - InternalLock - // ---------------- -class InternalStreamLock; -DECLARE_LIST( InternalStreamLockList, InternalStreamLock* ) -namespace { struct LockList : public rtl::Static< InternalStreamLockList, LockList > {}; } - #ifndef BOOTSTRAP -namespace { struct LockMutex : public rtl::Static< vos::OMutex, LockMutex > {}; } +namespace { struct LockMutex : public rtl::Static< osl::Mutex, LockMutex > {}; } #endif class InternalStreamLock @@ -77,6 +75,9 @@ public: static void UnlockFile( sal_Size nStart, sal_Size nEnd, SvFileStream* ); }; +typedef ::std::vector< InternalStreamLock* > InternalStreamLockList; +namespace { struct LockList : public rtl::Static< InternalStreamLockList, LockList > {}; } + InternalStreamLock::InternalStreamLock( sal_Size nStart, sal_Size nEnd, @@ -87,7 +88,7 @@ InternalStreamLock::InternalStreamLock( { ByteString aFileName(m_pStream->GetFileName(), osl_getThreadTextEncoding()); stat( aFileName.GetBuffer(), &m_aStat ); - LockList::get().Insert( this, LIST_APPEND ); + LockList::get().push_back( this ); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "locked %s", aFileName.GetBuffer() ); if( m_nStartPos || m_nEndPos ) @@ -98,7 +99,15 @@ InternalStreamLock::InternalStreamLock( InternalStreamLock::~InternalStreamLock() { - LockList::get().Remove( this ); + for ( InternalStreamLockList::iterator it = LockList::get().begin(); + it < LockList::get().end(); + ++it + ) { + if ( this == *it ) { + LockList::get().erase( it ); + break; + } + } #if OSL_DEBUG_LEVEL > 1 ByteString aFileName(m_pStream->GetFileName(), osl_getThreadTextEncoding()); fprintf( stderr, "unlocked %s", aFileName.GetBuffer() ); @@ -111,7 +120,7 @@ InternalStreamLock::~InternalStreamLock() sal_Bool InternalStreamLock::LockFile( sal_Size nStart, sal_Size nEnd, SvFileStream* pStream ) { #ifndef BOOTSTRAP - vos:: OGuard aGuard( LockMutex::get() ); + osl::MutexGuard aGuard( LockMutex::get() ); #endif ByteString aFileName(pStream->GetFileName(), osl_getThreadTextEncoding()); struct stat aStat; @@ -123,9 +132,9 @@ sal_Bool InternalStreamLock::LockFile( sal_Size nStart, sal_Size nEnd, SvFileStr InternalStreamLock* pLock = NULL; InternalStreamLockList &rLockList = LockList::get(); - for( sal_uIntPtr i = 0; i < rLockList.Count(); ++i ) + for( size_t i = 0; i < rLockList.size(); ++i ) { - pLock = rLockList.GetObject( i ); + pLock = rLockList[ i ]; if( aStat.st_ino == pLock->m_aStat.st_ino ) { sal_Bool bDenyByOptions = sal_False; @@ -154,6 +163,7 @@ sal_Bool InternalStreamLock::LockFile( sal_Size nStart, sal_Size nEnd, SvFileStr } } } + // hint: new InternalStreamLock() adds the entry to the global list pLock = new InternalStreamLock( nStart, nEnd, pStream ); return sal_True; } @@ -161,33 +171,38 @@ sal_Bool InternalStreamLock::LockFile( sal_Size nStart, sal_Size nEnd, SvFileStr void InternalStreamLock::UnlockFile( sal_Size nStart, sal_Size nEnd, SvFileStream* pStream ) { #ifndef BOOTSTRAP - vos:: OGuard aGuard( LockMutex::get() ); + osl::MutexGuard aGuard( LockMutex::get() ); #endif InternalStreamLock* pLock = NULL; InternalStreamLockList &rLockList = LockList::get(); if( nStart == 0 && nEnd == 0 ) { - for( sal_uIntPtr i = 0; i < rLockList.Count(); ++i ) + // nStart & nEnd = 0, so delete all locks + for( size_t i = 0; i < rLockList.size(); ++i ) { - if( ( pLock = rLockList.GetObject( i ) )->m_pStream == pStream ) + if( ( pLock = rLockList[ i ] )->m_pStream == pStream ) { + // hint: delete will remove pLock from the global list delete pLock; i--; } } return; } - for( sal_uIntPtr i = 0; i < rLockList.Count(); ++i ) + for( size_t i = 0; i < rLockList.size(); ++i ) { - if( ( pLock = rLockList.GetObject( i ) )->m_pStream == pStream && - nStart == pLock->m_nStartPos && nEnd == pLock->m_nEndPos ) - { + if ( ( pLock = rLockList[ i ] )->m_pStream == pStream + && nStart == pLock->m_nStartPos + && nEnd == pLock->m_nEndPos + ) { + // hint: delete will remove pLock from the global list delete pLock; return; } } } + // -------------- // - StreamData - // -------------- @@ -209,7 +224,9 @@ static sal_uInt32 GetSvError( int nErrno ) { 0, SVSTREAM_OK }, { EACCES, SVSTREAM_ACCESS_DENIED }, { EBADF, SVSTREAM_INVALID_HANDLE }, -#if defined( RS6000 ) || defined( ALPHA ) || defined( HP9000 ) || defined( NETBSD ) || defined(FREEBSD) || defined(MACOSX) || defined(__FreeBSD_kernel__) +#if defined(RS6000) || defined(ALPHA) || defined(NETBSD) || \ + defined(FREEBSD) || defined(MACOSX) || defined(OPENBSD) || \ + defined(__FreeBSD_kernel__) || defined (AIX) || defined(DRAGONFLY) { EDEADLK, SVSTREAM_LOCKING_VIOLATION }, #else { EDEADLOCK, SVSTREAM_LOCKING_VIOLATION }, @@ -223,7 +240,9 @@ static sal_uInt32 GetSvError( int nErrno ) { EAGAIN, SVSTREAM_LOCKING_VIOLATION }, { EISDIR, SVSTREAM_PATH_NOT_FOUND }, { ELOOP, SVSTREAM_PATH_NOT_FOUND }, -#if ! defined( RS6000 ) && ! defined( ALPHA ) && ! defined( NETBSD ) && ! defined (FREEBSD) && ! defined (MACOSX) && ! defined(__FreeBSD_kernel__) +#if !defined(RS6000) && !defined(ALPHA) && !defined(NETBSD) && !defined (FREEBSD) && \ + !defined(MACOSX) && !defined(OPENBSD) && !defined(__FreeBSD_kernel__) && \ + !defined(DRAGONFLY) { EMULTIHOP, SVSTREAM_PATH_NOT_FOUND }, { ENOLINK, SVSTREAM_PATH_NOT_FOUND }, #endif @@ -253,10 +272,6 @@ static sal_uInt32 GetSvError( int nErrno ) |* |* SvFileStream::SvFileStream() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 08.06.94 -|* Letzte Aenderung OV 08.06.94 -|* *************************************************************************/ SvFileStream::SvFileStream( const String& rFileName, StreamMode nOpenMode ) @@ -281,10 +296,6 @@ SvFileStream::SvFileStream( const String& rFileName, StreamMode nOpenMode ) |* |* SvFileStream::SvFileStream() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 22.11.94 -|* Letzte Aenderung OV 22.11.94 -|* *************************************************************************/ SvFileStream::SvFileStream() @@ -300,10 +311,6 @@ SvFileStream::SvFileStream() |* |* SvFileStream::~SvFileStream() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 22.11.94 -|* Letzte Aenderung OV 22.11.94 -|* *************************************************************************/ SvFileStream::~SvFileStream() @@ -320,10 +327,6 @@ SvFileStream::~SvFileStream() |* |* SvFileStream::GetFileHandle() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 22.11.94 -|* Letzte Aenderung OV 22.11.94 -|* *************************************************************************/ sal_uInt32 SvFileStream::GetFileHandle() const @@ -335,10 +338,6 @@ sal_uInt32 SvFileStream::GetFileHandle() const |* |* SvFileStream::IsA() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 14.06.94 -|* Letzte Aenderung OV 14.06.94 -|* *************************************************************************/ sal_uInt16 SvFileStream::IsA() const @@ -350,10 +349,6 @@ sal_uInt16 SvFileStream::IsA() const |* |* SvFileStream::GetData() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* *************************************************************************/ sal_Size SvFileStream::GetData( void* pData, sal_Size nSize ) @@ -363,7 +358,7 @@ sal_Size SvFileStream::GetData( void* pData, sal_Size nSize ) aTraceStr += ByteString::CreateFromInt64(nSize); aTraceStr += " Bytes from "; aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding()); - DBG_TRACE( aTraceStr.GetBuffer() ); + OSL_TRACE( "%s", aTraceStr.GetBuffer() ); #endif int nRead = 0; @@ -380,10 +375,6 @@ sal_Size SvFileStream::GetData( void* pData, sal_Size nSize ) |* |* SvFileStream::PutData() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* *************************************************************************/ sal_Size SvFileStream::PutData( const void* pData, sal_Size nSize ) @@ -393,7 +384,7 @@ sal_Size SvFileStream::PutData( const void* pData, sal_Size nSize ) aTraceStr += ByteString::CreateFromInt64(nSize); aTraceStr += " Bytes to "; aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding()); - DBG_TRACE( aTraceStr.GetBuffer() ); + OSL_TRACE( "%s", aTraceStr.GetBuffer() ); #endif int nWrite = 0; @@ -412,10 +403,6 @@ sal_Size SvFileStream::PutData( const void* pData, sal_Size nSize ) |* |* SvFileStream::SeekPos() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* *************************************************************************/ sal_Size SvFileStream::SeekPos( sal_Size nPos ) @@ -446,10 +433,6 @@ sal_Size SvFileStream::SeekPos( sal_Size nPos ) |* |* SvFileStream::FlushData() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* *************************************************************************/ void SvFileStream::FlushData() @@ -463,10 +446,6 @@ static char *pFileLockEnvVar = (char*)1; |* |* SvFileStream::LockRange() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* *************************************************************************/ sal_Bool SvFileStream::LockRange( sal_Size nByteOffset, sal_Size nBytes ) @@ -525,8 +504,6 @@ sal_Bool SvFileStream::LockRange( sal_Size nByteOffset, sal_Size nBytes ) // NFS-2-Server (kein Lockdaemon) zu verhindern. // File-Locking ?ber NFS ist generell ein Performancekiller. // HR, 22.10.1997 fuer SOLARIS - // CP, 30.11.1997 fuer HPUX - // ER, 18.12.1997 fuer IRIX // HR, 18.05.1998 Environmentvariable if ( pFileLockEnvVar == (char*)1 ) @@ -537,17 +514,6 @@ sal_Bool SvFileStream::LockRange( sal_Size nByteOffset, sal_Size nBytes ) aflock.l_type = nLockMode; if (fcntl(pInstanceData->nHandle, F_GETLK, &aflock) == -1) { - #if ( defined HPUX && defined BAD_UNION ) - #ifdef DBG_UTIL - fprintf( stderr, "***** FCNTL(lock):errno = %d\n", errno ); - #endif - if ( errno == EINVAL || errno == ENOSYS ) - return sal_True; - #endif - #if defined SINIX - if (errno == EINVAL) - return sal_True; - #endif #if defined SOLARIS if (errno == ENOSYS) return sal_True; @@ -574,10 +540,6 @@ sal_Bool SvFileStream::LockRange( sal_Size nByteOffset, sal_Size nBytes ) |* |* SvFileStream::UnlockRange() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* *************************************************************************/ sal_Bool SvFileStream::UnlockRange( sal_Size nByteOffset, sal_Size nBytes ) @@ -605,18 +567,6 @@ sal_Bool SvFileStream::UnlockRange( sal_Size nByteOffset, sal_Size nBytes ) if (fcntl(pInstanceData->nHandle, F_SETLK, &aflock) != -1) return sal_True; -#if ( defined HPUX && defined BAD_UNION ) -#ifdef DBG_UTIL - fprintf( stderr, "***** FCNTL(unlock):errno = %d\n", errno ); -#endif - if ( errno == EINVAL || errno == ENOSYS ) - return sal_True; -#endif -#if ( defined SINIX ) - if (errno == EINVAL) - return sal_True; -#endif - SetError( ::GetSvError( errno )); return sal_False; } @@ -625,10 +575,6 @@ sal_Bool SvFileStream::UnlockRange( sal_Size nByteOffset, sal_Size nBytes ) |* |* SvFileStream::LockFile() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* *************************************************************************/ sal_Bool SvFileStream::LockFile() @@ -640,10 +586,6 @@ sal_Bool SvFileStream::LockFile() |* |* SvFileStream::UnlockFile() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* *************************************************************************/ sal_Bool SvFileStream::UnlockFile() @@ -655,10 +597,6 @@ sal_Bool SvFileStream::UnlockFile() |* |* SvFileStream::Open() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* *************************************************************************/ void SvFileStream::Open( const String& rFilename, StreamMode nOpenMode ) @@ -686,7 +624,7 @@ void SvFileStream::Open( const String& rFilename, StreamMode nOpenMode ) #ifdef DBG_UTIL ByteString aTraceStr( "SvFileStream::Open(): " ); aTraceStr += aLocalFilename; - DBG_TRACE( aTraceStr.GetBuffer() ); + OSL_TRACE( "%s", aTraceStr.GetBuffer() ); #endif if ( lstat( aLocalFilename.GetBuffer(), &buf ) == 0 ) @@ -716,10 +654,10 @@ void SvFileStream::Open( const String& rFilename, StreamMode nOpenMode ) if ( nOpenMode & STREAM_TRUNC ) nAccess |= O_TRUNC; - nMode = S_IREAD | S_IROTH | S_IRGRP; + nMode = S_IRUSR | S_IROTH | S_IRGRP; if ( nOpenMode & STREAM_WRITE) { - nMode |= (S_IWRITE | S_IWOTH | S_IWGRP); + nMode |= (S_IWUSR | S_IWOTH | S_IWGRP); if ( nOpenMode & STREAM_COPY_ON_SYMLINK ) { @@ -757,7 +695,7 @@ void SvFileStream::Open( const String& rFilename, StreamMode nOpenMode ) // auf Lesen runterschalten nAccessRW = O_RDONLY; nAccess = 0; - nMode = S_IREAD | S_IROTH | S_IRGRP; + nMode = S_IRUSR | S_IROTH | S_IRGRP; nHandleTmp =open( aLocalFilename.GetBuffer(), nAccessRW|nAccess, nMode ); @@ -786,10 +724,6 @@ void SvFileStream::Open( const String& rFilename, StreamMode nOpenMode ) |* |* SvFileStream::ReOpen() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* *************************************************************************/ void SvFileStream::ReOpen() @@ -802,10 +736,6 @@ void SvFileStream::ReOpen() |* |* SvFileStream::Close() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* *************************************************************************/ void SvFileStream::Close() @@ -817,7 +747,7 @@ void SvFileStream::Close() #ifdef DBG_UTIL ByteString aTraceStr( "SvFileStream::Close(): " ); aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding()); - DBG_TRACE( aTraceStr.GetBuffer() ); + OSL_TRACE( "%s", aTraceStr.GetBuffer() ); #endif Flush(); @@ -836,8 +766,6 @@ void SvFileStream::Close() |* SvFileStream::ResetError() |* |* Beschreibung STREAM.SDW; Setzt Filepointer auf Dateianfang -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 |* *************************************************************************/ @@ -852,8 +780,6 @@ void SvFileStream::ResetError() |* SvFileStream::SetSize() |* |* Beschreibung STREAM.SDW; -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 |* *************************************************************************/ @@ -917,4 +843,4 @@ void SvFileStream::SetSize (sal_Size nSize) } } - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/stream/strmwnt.cxx b/tools/source/stream/strmwnt.cxx index 20443e268964..0e2caca40f62 100644 --- a/tools/source/stream/strmwnt.cxx +++ b/tools/source/stream/strmwnt.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,7 +35,9 @@ #include <string.h> #include <limits.h> -#include <tools/svwin.h> +#ifdef WNT +#include <windows.h> +#endif #include <tools/debug.hxx> #include <tools/fsys.hxx> @@ -123,10 +126,6 @@ static sal_uIntPtr GetSvError( DWORD nWntError ) |* |* SvFileStream::SvFileStream() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 17.06.94 -|* Letzte Aenderung TPF 15.07.98 -|* *************************************************************************/ SvFileStream::SvFileStream( const String& rFileName, StreamMode nMode ) @@ -149,10 +148,6 @@ SvFileStream::SvFileStream( const String& rFileName, StreamMode nMode ) |* |* SvFileStream::SvFileStream() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 22.11.94 -|* Letzte Aenderung TPF 15.07.98 -|* *************************************************************************/ SvFileStream::SvFileStream() @@ -169,10 +164,6 @@ SvFileStream::SvFileStream() |* |* SvFileStream::~SvFileStream() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 14.06.94 -|* Letzte Aenderung OV 14.06.94 -|* *************************************************************************/ SvFileStream::~SvFileStream() @@ -186,10 +177,6 @@ SvFileStream::~SvFileStream() |* |* SvFileStream::GetFileHandle() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 14.06.94 -|* Letzte Aenderung OV 14.06.94 -|* *************************************************************************/ sal_uIntPtr SvFileStream::GetFileHandle() const @@ -201,10 +188,6 @@ sal_uIntPtr SvFileStream::GetFileHandle() const |* |* SvFileStream::IsA() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 14.06.94 -|* Letzte Aenderung OV 14.06.94 -|* *************************************************************************/ sal_uInt16 SvFileStream::IsA() const @@ -217,8 +200,6 @@ sal_uInt16 SvFileStream::IsA() const |* SvFileStream::GetData() |* |* Beschreibung STREAM.SDW, Prueft nicht Eof; IsEof danach rufbar -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung TPF 15.07.98 |* *************************************************************************/ @@ -241,10 +222,6 @@ sal_uIntPtr SvFileStream::GetData( void* pData, sal_uIntPtr nSize ) |* |* SvFileStream::PutData() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung TPF 15.07.98 -|* *************************************************************************/ sal_uIntPtr SvFileStream::PutData( const void* pData, sal_uIntPtr nSize ) @@ -262,10 +239,6 @@ sal_uIntPtr SvFileStream::PutData( const void* pData, sal_uIntPtr nSize ) |* |* SvFileStream::SeekPos() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung TPF 15.07.98 -|* *************************************************************************/ sal_uIntPtr SvFileStream::SeekPos( sal_uIntPtr nPos ) @@ -292,40 +265,8 @@ sal_uIntPtr SvFileStream::SeekPos( sal_uIntPtr nPos ) /************************************************************************* |* -|* SvFileStream::Tell() -|* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* -*************************************************************************/ -/* -sal_uIntPtr SvFileStream::Tell() -{ - sal_uIntPtr nPos = 0L; - - if( IsOpen() ) - { - DWORD nPos; - nPos = SetFilePointer(pInstanceData->hFile,0L,NULL,FILE_CURRENT); - if( nPos = 0xFFFFFFFF ) - { - SetError( ::GetSvError( GetLastError() ) ); - nPos = 0L; - } - } - return nPos; -} -*/ - -/************************************************************************* -|* |* SvFileStream::FlushData() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung TPF 15.07.98 -|* *************************************************************************/ void SvFileStream::FlushData() @@ -341,10 +282,6 @@ void SvFileStream::FlushData() |* |* SvFileStream::LockRange() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung TPF 15.07.98 -|* *************************************************************************/ sal_Bool SvFileStream::LockRange( sal_uIntPtr nByteOffset, sal_uIntPtr nBytes ) @@ -363,10 +300,6 @@ sal_Bool SvFileStream::LockRange( sal_uIntPtr nByteOffset, sal_uIntPtr nBytes ) |* |* SvFileStream::UnlockRange() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung TPF 15.07.98 -|* *************************************************************************/ sal_Bool SvFileStream::UnlockRange( sal_uIntPtr nByteOffset, sal_uIntPtr nBytes ) @@ -385,10 +318,6 @@ sal_Bool SvFileStream::UnlockRange( sal_uIntPtr nByteOffset, sal_uIntPtr nBytes |* |* SvFileStream::LockFile() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* *************************************************************************/ sal_Bool SvFileStream::LockFile() @@ -414,10 +343,6 @@ sal_Bool SvFileStream::LockFile() |* |* SvFileStream::UnlockFile() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* *************************************************************************/ sal_Bool SvFileStream::UnlockFile() @@ -447,10 +372,6 @@ sal_Bool SvFileStream::UnlockFile() |* |* SvFileStream::Open() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung TPF 15.07.98 -|* *************************************************************************/ /* NOCREATE TRUNC NT-Action @@ -484,14 +405,6 @@ void SvFileStream::Open( const String& rFilename, StreamMode nMode ) #endif SetLastError( ERROR_SUCCESS ); // ggf. durch Redirector geaendert! - /* - #ifdef DBG_UTIL - String aTraceStr( "SvFileStream::Open(): " ); - aTraceStr += aFilename; - DBG_TRACE( aTraceStr ); - #endif - */ - DWORD nOpenAction; DWORD nShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; DWORD nAccessMode = 0L; @@ -597,10 +510,6 @@ void SvFileStream::Open( const String& rFilename, StreamMode nMode ) |* |* SvFileStream::ReOpen() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 -|* *************************************************************************/ void SvFileStream::ReOpen() @@ -613,10 +522,6 @@ void SvFileStream::ReOpen() |* |* SvFileStream::Close() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung TPF 15.07.98 -|* *************************************************************************/ void SvFileStream::Close() @@ -643,8 +548,6 @@ void SvFileStream::Close() |* SvFileStream::ResetError() |* |* Beschreibung STREAM.SDW; Setzt Filepointer auf Dateianfang -|* Ersterstellung OV 15.06.94 -|* Letzte Aenderung OV 15.06.94 |* *************************************************************************/ @@ -657,10 +560,6 @@ void SvFileStream::ResetError() |* |* SvFileStream::SetSize() |* -|* Beschreibung STREAM.SDW -|* Ersterstellung OV 19.10.95 -|* Letzte Aenderung TPF 15.07.98 -|* *************************************************************************/ void SvFileStream::SetSize( sal_uIntPtr nSize ) @@ -687,3 +586,4 @@ void SvFileStream::SetSize( sal_uIntPtr nSize ) } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/stream/vcompat.cxx b/tools/source/stream/vcompat.cxx index fcbab9b98826..227c3e05ddca 100644 --- a/tools/source/stream/vcompat.cxx +++ b/tools/source/stream/vcompat.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -78,3 +79,5 @@ VersionCompat::~VersionCompat() mpRWStm->SeekRel( mnTotalSize - nReadSize ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/string/debugprint.cxx b/tools/source/string/debugprint.cxx index 7acff963b1b9..b95e8ce50c23 100644 --- a/tools/source/string/debugprint.cxx +++ b/tools/source/string/debugprint.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,4 +46,4 @@ const sal_Char *dbg_dump(const UniString &rStr) return dbg_dump(ByteString(rStr, RTL_TEXTENCODING_UTF8)); } -/* vi:set tabstop=4 shiftwidth=4 expandtab: */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/string/reversemap.cxx b/tools/source/string/reversemap.cxx new file mode 100644 index 000000000000..8fa46aaf9fb3 --- /dev/null +++ b/tools/source/string/reversemap.cxx @@ -0,0 +1,39 @@ +/* -*- 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> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. 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. + */ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_tools.hxx" + +#include <rtl/textenc.h> +#include <tools/tenccvt.hxx> + +//Use reverse map generated at buildtime via bestreversemap + +#include "reversemap.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/string/strascii.cxx b/tools/source/string/strascii.cxx index e47517d93412..f7729c99b305 100644 --- a/tools/source/string/strascii.cxx +++ b/tools/source/string/strascii.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #/************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -260,7 +261,7 @@ UniString& UniString::AssignAscii( const sal_Char* pAsciiStr, xub_StrLen nLen ) { if ( !pAsciiStr[i] ) { - DBG_ERROR( "UniString::AssignAscii() : nLen is wrong" ); + OSL_FAIL( "UniString::AssignAscii() : nLen is wrong" ); } } } @@ -337,7 +338,7 @@ UniString& UniString::AppendAscii( const sal_Char* pAsciiStr, xub_StrLen nLen ) { if ( !pAsciiStr[i] ) { - DBG_ERROR( "UniString::AppendAscii() : nLen is wrong" ); + OSL_FAIL( "UniString::AppendAscii() : nLen is wrong" ); } } } @@ -635,3 +636,5 @@ void UniString::SearchAndReplaceAllAscii( const sal_Char* pAsciiStr, const UniSt nSPos = SearchAscii( pAsciiStr, nSPos ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/string/strcvt.cxx b/tools/source/string/strcvt.cxx index ce5c7ecdcad0..54169c3c0716 100644 --- a/tools/source/string/strcvt.cxx +++ b/tools/source/string/strcvt.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -611,3 +612,5 @@ ByteString& ByteString::Assign( const rtl::OString& rStr ) return *this; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/string/strimp.cxx b/tools/source/string/strimp.cxx index 8712733c0851..21065f999958 100644 --- a/tools/source/string/strimp.cxx +++ b/tools/source/string/strimp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -354,7 +355,7 @@ STRING::STRING( const STRCODE* pCharStr, xub_StrLen nLen ) { if ( !pCharStr[i] ) { - DBG_ERROR( "String::String() : nLen is wrong" ); + OSL_FAIL( "String::String() : nLen is wrong" ); } } } @@ -458,7 +459,7 @@ STRING& STRING::Assign( const STRCODE* pCharStr, xub_StrLen nLen ) { if ( !pCharStr[i] ) { - DBG_ERROR( "String::Assign() : nLen is wrong" ); + OSL_FAIL( "String::Assign() : nLen is wrong" ); } } } @@ -589,7 +590,7 @@ STRING& STRING::Append( const STRCODE* pCharStr, xub_StrLen nCharLen ) { if ( !pCharStr[i] ) { - DBG_ERROR( "String::Append() : nLen is wrong" ); + OSL_FAIL( "String::Append() : nLen is wrong" ); } } } @@ -2113,3 +2114,5 @@ STRCODE* STRING::AllocBuffer( xub_StrLen nLen ) return mpData->maStr; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/string/strucvt.cxx b/tools/source/string/strucvt.cxx index 9c9ef1dc4b5a..70b9784f73db 100644 --- a/tools/source/string/strucvt.cxx +++ b/tools/source/string/strucvt.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -211,3 +212,10 @@ UniString::UniString( const ResId& rResId ) pImplResHookProc( *this ); } +rtl::OUString ResId::toString(const ResId& aId) +{ + // TODO: Optimize this. + return rtl::OUString(UniString(aId)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/string/tenccvt.cxx b/tools/source/string/tenccvt.cxx index f1f023a90502..e4ffa7791180 100644 --- a/tools/source/string/tenccvt.cxx +++ b/tools/source/string/tenccvt.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -95,3 +96,5 @@ rtl_TextEncoding GetSOStoreTextEncoding( rtl_TextEncoding eEncoding, sal_uInt16 { return GetExtendedTextEncoding( GetOneByteTextEncoding( eEncoding ) ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/string/tstring.cxx b/tools/source/string/tstring.cxx index 734e729ceccb..c7a5f380fb72 100644 --- a/tools/source/string/tstring.cxx +++ b/tools/source/string/tstring.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,15 +34,9 @@ #include "boost/static_assert.hpp" #include "osl/diagnose.h" -#ifndef _OSL_INTERLCK_H #include <osl/interlck.h> -#endif -#ifndef _RTL_ALLOC_H #include <rtl/alloc.h> -#endif -#ifndef _RTL_MEMORY_H #include <rtl/memory.h> -#endif #include <rtl/tencinfo.h> #include <rtl/instance.hxx> @@ -49,9 +44,7 @@ #include <impstrg.hxx> // For shared byte convert tables -#ifndef _TOOLS_TOOLSIN_HXX #include <toolsin.hxx> -#endif #include <tools/debug.hxx> @@ -172,7 +165,7 @@ float ByteString::ToFloat() const { DBG_CHKTHIS( ByteString, DbgCheckByteString ); - OSL_ENSURE(false, "ByteString::ToFloat unusable"); + OSL_FAIL("ByteString::ToFloat unusable"); return 0; } @@ -182,7 +175,7 @@ double ByteString::ToDouble() const { DBG_CHKTHIS( ByteString, DbgCheckByteString ); - OSL_ENSURE(false, "ByteString::ToDouble unusable"); + OSL_FAIL("ByteString::ToDouble unusable"); return 0; } @@ -293,3 +286,5 @@ sal_Bool ByteString::IsAlphaNumericAscii() const return sal_True; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx index 27dab841124d..5edd160b5d69 100644 --- a/tools/source/string/tustring.cxx +++ b/tools/source/string/tustring.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,15 +33,9 @@ #include "boost/static_assert.hpp" -#ifndef _OSL_INTERLCK_H #include <osl/interlck.h> -#endif -#ifndef _RTL_ALLOC_H #include <rtl/alloc.h> -#endif -#ifndef _RTL_MEMORY_H #include <rtl/memory.h> -#endif #include <rtl/tencinfo.h> #include <rtl/instance.hxx> @@ -160,3 +155,4 @@ double UniString::ToDouble() const return rtl_ustr_toDouble( mpData->maStr ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/testtoolloader/testtoolloader.cxx b/tools/source/testtoolloader/testtoolloader.cxx index 59be94a02f4c..f479faa5aa07 100644 --- a/tools/source/testtoolloader/testtoolloader.cxx +++ b/tools/source/testtoolloader/testtoolloader.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,15 +32,14 @@ #include "tools/testtoolloader.hxx" #include <osl/module.h> #include <rtl/logfile.hxx> -#include <vos/process.hxx> +#include <osl/process.h> #include "tools/solar.h" #include "tools/string.hxx" #include "tools/debug.hxx" #include <comphelper/uieventslogger.hxx> -using namespace rtl; - +using ::rtl::OUString; namespace tools { typedef void ( *pfunc_CreateRemoteControl)(); @@ -56,20 +56,18 @@ static bool bLoggerStarted = false; sal_uInt32 GetCommandLineParamCount() { - vos:: OStartupInfo aStartInfo; - return aStartInfo.getCommandArgCount(); + return osl_getCommandArgCount(); } String GetCommandLineParam( sal_uInt32 nParam ) { - vos:: OStartupInfo aStartInfo; ::rtl::OUString aParam; - vos:: OStartupInfo ::TStartupError eError = aStartInfo.getCommandArg( nParam, aParam ); - if ( eError == vos:: OStartupInfo ::E_None ) + oslProcessError eError = osl_getCommandArg( nParam, &aParam.pData ); + if ( eError == osl_Process_E_None ) return String( aParam ); else { - DBG_ERROR( "Unable to get CommandLineParam" ); + OSL_FAIL( "Unable to get CommandLineParam" ); return String(); } } @@ -116,12 +114,12 @@ void InitTestToolLib() (reinterpret_cast< pfunc_CreateRemoteControl >(pInitFunc))(); else { - DBG_ERROR1( "Unable to get Symbol 'CreateRemoteControl' from library %s while loading testtool support.", SVLIBRARY( "sts" ) ); + OSL_TRACE( "Unable to get Symbol 'CreateRemoteControl' from library %s while loading testtool support.", SVLIBRARY( "sts" ) ); } } else { - DBG_ERROR1( "Unable to access library %s while loading testtool support.", SVLIBRARY( "sts" ) ); + OSL_TRACE( "Unable to access library %s while loading testtool support.", SVLIBRARY( "sts" ) ); } } @@ -141,12 +139,12 @@ void InitTestToolLib() } else { - DBG_ERROR1( "Unable to get Symbol 'CreateEventLogger' from library %s while loading testtool support.", SVLIBRARY( "sts" ) ); + OSL_TRACE( "Unable to get Symbol 'CreateEventLogger' from library %s while loading testtool support.", SVLIBRARY( "sts" ) ); } } else { - DBG_ERROR1( "Unable to access library %s while loading testtool support.", SVLIBRARY( "sts" ) ); + OSL_TRACE( "Unable to access library %s while loading testtool support.", SVLIBRARY( "sts" ) ); } } } @@ -183,3 +181,5 @@ void DeInitTestToolLib() } } // namespace tools + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx index cf62c02e0c29..2386415a4266 100644 --- a/tools/source/zcodec/zcodec.cxx +++ b/tools/source/zcodec/zcodec.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -486,3 +487,4 @@ void GZCodec::BeginCompression( sal_uIntPtr nCompressMethod ) }; +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/test/export.map b/tools/test/export.map index 7321bbca16ad..3308588ef6f8 100644 --- a/tools/test/export.map +++ b/tools/test/export.map @@ -27,7 +27,7 @@ UDK_3_0_0 { global: - registerAllTestFunction; + cppunitTestPlugIn; local: *; diff --git a/tools/test/tests.cxx b/tools/test/tests.cxx index 5a1e21f172a4..a814fb2fea83 100644 --- a/tools/test/tests.cxx +++ b/tools/test/tests.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,12 +31,13 @@ #include "precompiled_tools.hxx" // autogenerated file with codegen.pl -#include <testshl/simpleheader.hxx> +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/plugin/TestPlugIn.h> + #include <rtl/math.hxx> #include <tools/fract.hxx> -#include <stdio.h> - namespace tools { @@ -114,13 +116,9 @@ public: }; // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(tools::FractionTest, "FractionTest"); +CPPUNIT_TEST_SUITE_REGISTRATION(FractionTest); } // namespace tools +CPPUNIT_PLUGIN_IMPLEMENT(); -// ----------------------------------------------------------------------------- - -// this macro creates an empty function, which will called by the RegisterAllFunctions() -// to let the user the possibility to also register some functions by hand. -NOADDITIONAL; - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/unx/source/dll/toolsdll.cxx b/tools/unx/source/dll/toolsdll.cxx index c008cbbc001c..c5bf8ecd8282 100644 --- a/tools/unx/source/dll/toolsdll.cxx +++ b/tools/unx/source/dll/toolsdll.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,8 +37,6 @@ static void* aAppData[SHL_COUNT]; |* GetAppData() |* |* Beschreibung Daten fuer andere Libs abfragen -|* Ersterstellung TH 19.01.95 -|* Letzte Aenderung TH 19.01.95 |* ***************************************************************************/ @@ -45,3 +44,5 @@ void** GetAppData( sal_uInt16 nSharedLib ) { return &(aAppData[nSharedLib]); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/win/inc/dll.hxx b/tools/win/inc/dll.hxx index f28b07974c61..7444bba02854 100644 --- a/tools/win/inc/dll.hxx +++ b/tools/win/inc/dll.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,3 +33,5 @@ inline void ImpDeInitWinTools() {} #endif /* _DLL_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/win/source/dll/toolsdll.cxx b/tools/win/source/dll/toolsdll.cxx index 3d934edfe71d..df829745db01 100644 --- a/tools/win/source/dll/toolsdll.cxx +++ b/tools/win/source/dll/toolsdll.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,7 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_tools.hxx" -#include <tools/svwin.h> +#include <windows.h> #include <dll.hxx> #include <tools/shl.hxx> @@ -45,3 +46,5 @@ void** GetAppData( USHORT nSharedLib ) } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/workben/fstest.cxx b/tools/workben/fstest.cxx index 8048f2c166b0..1feb2871af55 100644 --- a/tools/workben/fstest.cxx +++ b/tools/workben/fstest.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_tools.hxx" -#define _FSTEST_CXX "$Revision: 1.5 $" +#define _FSTEST_CXX #include <tools/solar.h> #include <stdio.h> @@ -92,3 +93,5 @@ void CheckTimes(DirEntry aDE) return; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/workben/hashtbl.cxx b/tools/workben/hashtbl.cxx index bcd9f903ab64..c431ea159160 100644 --- a/tools/workben/hashtbl.cxx +++ b/tools/workben/hashtbl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -137,7 +138,7 @@ void* HashTable::GetObjectAt(ULONG lPos) const void HashTable::OnDeleteObject(void*) { - DBG_ERROR("HashTable::OnDeleteObject(void*) nicht berladen"); + OSL_FAIL("HashTable::OnDeleteObject(void*) nicht berladen"); } ULONG HashTable::Hash(String const& Key) const @@ -221,7 +222,7 @@ BOOL HashTable::Insert(String const& Key, void* pObject) if (IsFull()) { - DBG_ERROR("HashTable::Insert() is full"); + OSL_FAIL("HashTable::Insert() is full"); return FALSE; } @@ -513,3 +514,5 @@ void* HashTableIterator::FindValidObject(BOOL bForward) return pObject; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/workben/hashtbl.hxx b/tools/workben/hashtbl.hxx index f4593b8148cf..7c1b89c873cf 100644 --- a/tools/workben/hashtbl.hxx +++ b/tools/workben/hashtbl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -201,3 +202,4 @@ public: #endif // _HASHTBL_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/workben/helloworld.c b/tools/workben/helloworld.c index 5d86cf2db21b..d26d986ba594 100644 --- a/tools/workben/helloworld.c +++ b/tools/workben/helloworld.c @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,3 +32,5 @@ main( ) printf( "%s\n", "hello world"); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/workben/inetmimetest.cxx b/tools/workben/inetmimetest.cxx index e380fb7f6fbe..30b00a9373c3 100644 --- a/tools/workben/inetmimetest.cxx +++ b/tools/workben/inetmimetest.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -54,14 +55,12 @@ bool testDecode(char const * input, char const * expected) { } -int -#if defined WNT -__cdecl -#endif -main() { +int SAL_CALL main() { bool success = true; success &= testDecode("=?iso-8859-1?B?QQ==?=", "A"); success &= testDecode("=?iso-8859-1?B?QUI=?=", "AB"); success &= testDecode("=?iso-8859-1?B?QUJD?=", "ABC"); return success ? EXIT_SUCCESS : EXIT_FAILURE; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/workben/makefile.mk b/tools/workben/makefile.mk index d97156c7f66c..129360e70fba 100644 --- a/tools/workben/makefile.mk +++ b/tools/workben/makefile.mk @@ -42,7 +42,7 @@ OBJFILES = \ APP1TARGET = solar APP1OBJS = $(OBJ)$/solar.obj -.IF "$(GUI)" == "UNX" || "$(GUI)" == "OS2" +.IF "$(GUI)" == "UNX" APP1STDLIBS = $(TOOLSLIB) .ELSE APP1LIBS = $(LB)$/itools.lib @@ -50,7 +50,7 @@ APP1LIBS = $(LB)$/itools.lib APP2TARGET = urltest APP2OBJS = $(OBJ)$/urltest.obj -.IF "$(GUI)" == "UNX" || "$(GUI)" == "OS2" +.IF "$(GUI)" == "UNX" APP2STDLIBS = $(TOOLSLIB) $(VOSLIB) $(SALLIB) $(CPPULIB) $(CPPUHELPERLIB) .ELSE APP2STDLIBS = $(LB)$/itools.lib $(VOSLIB) $(SALLIB) $(CPPULIB) $(CPPUHELPERLIB) diff --git a/tools/workben/mempooltest.cxx b/tools/workben/mempooltest.cxx index bf00343bc9d6..e99e2175d372 100644 --- a/tools/workben/mempooltest.cxx +++ b/tools/workben/mempooltest.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "tools/mempool.hxx" struct MempoolTest @@ -16,3 +17,5 @@ int main() delete p; return 1; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/workben/solar.c b/tools/workben/solar.c index 06c4a787ec72..934278f7ae2c 100644 --- a/tools/workben/solar.c +++ b/tools/workben/solar.c @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,7 +43,7 @@ int GetStackAlignment(void); void PrintArgs( int p, ... ); int check( TestFunc func, Type eT, void* p ); -#if defined (UNX) || defined (WNT) || defined (OS2) +#if defined (UNX) || defined (WNT) #ifdef UNX #include <unistd.h> @@ -122,7 +123,7 @@ int GetStackAlignment() -#if defined (UNX) || defined (WNT) || defined (OS2) +#if defined (UNX) || defined (WNT) #ifdef I_STDARG void PrintArgs( int p, ... ) @@ -153,11 +154,7 @@ va_dcl #ifndef USE_FORK_TO_CHECK static jmp_buf check_env; static int bSignal; -#if defined (UNX) || defined (OS2) -void SignalHandler( int sig ) -#else -void __cdecl SignalHandler( int sig ) -#endif +void SAL_CALL SignalHandler( int sig ) { bSignal = 1; /* @@ -353,11 +350,7 @@ void Description_Print( struct Description* pThis, char* name ) fclose(f); } -int -#ifdef WNT -__cdecl -#endif -main( int argc, char* argv[] ) +int SAL_CALL main( int argc, char* argv[] ) { printTypeSign( char, "char" ); printTypeSign( short, "short" ); @@ -425,3 +418,5 @@ main( int argc, char* argv[] ) exit( 0 ); return 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/workben/tldem.cxx b/tools/workben/tldem.cxx deleted file mode 100644 index 9571d3ff9b94..000000000000 --- a/tools/workben/tldem.cxx +++ /dev/null @@ -1,82 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_tools.hxx" - -#include <tools/fsys.hxx> -#include <tools/stream.hxx> -#include <sstring.hxx> - -int -#ifdef WNT -__cdecl -#endif -main( int argc, char **argv ) -{ - String aString; - aString = "*.*"; - Dir aDir(aString); - SvFileStream aFile; - SvFileStream aSortedFile; - - StringList *pList = new StringList; - SStringList *pSortedList = new SStringList; - ULONG nCount = aDir.Count(); - - for ( ULONG i=0; i<nCount; i++ ) - { - aString = aDir[i].GetName(); - pList->Insert( new String( aString ), LIST_APPEND ); - pSortedList->PutString( new String( aString )); - } - - aFile.Open( "test.dir", STREAM_WRITE ); - for ( ULONG j=0; j<nCount; j++ ) - { - aFile.WriteLine( *pList->GetObject(j) ); - } - aFile.Close(); - - - aSortedFile.Open( "stest.dir", STREAM_WRITE ); - for ( ULONG k=0; k<nCount; k++ ) - { - aSortedFile.WriteLine( *pSortedList->GetObject(k) ); - } - if ( pSortedList->IsString( new String("bloedString")) != NOT_THERE ) - aSortedFile.WriteLine( "Fehler !" ); - if ( pSortedList->IsString( new String(".")) == NOT_THERE ) - aSortedFile.WriteLine( "Fehler ?!?" ); - aSortedFile.Close(); - - delete pList; - delete pSortedList; - return 0; -} - - diff --git a/tools/workben/urltest.cxx b/tools/workben/urltest.cxx index 0930dfcc5239..69a53950507c 100644 --- a/tools/workben/urltest.cxx +++ b/tools/workben/urltest.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,6 +39,7 @@ #include "rtl/textenc.h" #include "rtl/ustring.h" #include "rtl/ustring.hxx" +#include <sal/macros.h> #include <cstddef> #include <cstdlib> @@ -288,11 +290,7 @@ bool test_removeSegment( } -int -#if defined WNT -__cdecl -#endif // WNT -main() +int SAL_CALL main() { bool bSuccess = true; @@ -496,7 +494,7 @@ main() { "vnd.sun.star.help://swriter?foo", "vnd.sun.star.help://swriter/?foo" }, { "vnd.sun.star.help://swriter/?foo", 0 } }; - for (std::size_t i = 0; i < sizeof aTest / sizeof aTest[0]; ++i) + for (std::size_t i = 0; i < SAL_N_ELEMENTS( aTest ); ++i) { INetURLObject aUrl(aTest[i].in); if (aUrl.HasError()) @@ -530,7 +528,7 @@ main() /*TODO "wfs:///c|/xyz/",*/ /*TODO "wfs://xxx/yyy?zzz",*/ /*TODO "wfs:///x/y/z"*/ }; - for (std::size_t i = 0; i < sizeof aTest / sizeof aTest[0]; ++i) + for (std::size_t i = 0; i < SAL_N_ELEMENTS(aTest); ++i) { INetURLObject aUrl(aTest[i]); if (aUrl.HasError()) @@ -565,7 +563,7 @@ main() "vnd.sun.star.pkg://file:%2F%2F%2Fa:%2Fb%20c/xx", /*TODO "vnd.sun.star.pkg://file:%2F%2F%2Fa:%2Fb%20c/xx;yy",*/ "vnd.sun.star.pkg://file:%2F%2F%2Fa:%2Fb%20c/xx//yy" }; - for (std::size_t i = 0; i < sizeof aTest / sizeof aTest[0]; ++i) + for (std::size_t i = 0; i < SAL_N_ELEMENTS(aTest); ++i) { INetURLObject aUrl(aTest[i]); if (aUrl.HasError()) @@ -590,7 +588,7 @@ main() "vnd.sun.star.cmd:log/out", /*TODO "vnd.sun.star.cmd:[logout]",*/ "vnd.sun.star.cmd:log[out]" }; - for (std::size_t i = 0; i < sizeof aTest / sizeof aTest[0]; ++i) + for (std::size_t i = 0; i < SAL_N_ELEMENTS( aTest ); ++i) { INetURLObject aUrl(aTest[i]); if (aUrl.HasError()) @@ -609,7 +607,7 @@ main() if (true) { rtl::OUString - aParameters(rtl::OUString::createFromAscii("; CharSet=UTF-8 ; Blubber=Blob")); + aParameters(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "; CharSet=UTF-8 ; Blubber=Blob" ))); sal_Unicode const * pBegin = aParameters.getStr(); sal_Unicode const * pEnd = pBegin + aParameters.getLength(); INetContentTypeParameterList aList; @@ -1219,7 +1217,7 @@ main() { "smb://foo", "smb://foo/" }, { "smb://x;foo:bar@baz.xyz:12345/ab?cd", "smb://x;foo:bar@baz.xyz:12345/ab?cd" } }; - for (std::size_t i = 0; i < sizeof aTest / sizeof aTest[0]; ++i) + for (std::size_t i = 0; i < SAL_N_ELEMENTS( aTest ); ++i) { INetURLObject aUrl(aTest[i].m_pInput); if (aTest[i].m_pOutput == 0 @@ -1249,7 +1247,7 @@ main() static Test const aTest[] = { { "file://d:\\dir1\\file1", "file:///d:/dir1/file1" }, { "http://as@alaska:8000/test/test.sxw", 0 } }; - for (std::size_t i = 0; i < sizeof aTest / sizeof aTest[0]; ++i) + for (std::size_t i = 0; i < SAL_N_ELEMENTS( aTest ); ++i) { INetURLObject aUrl = INetURLObject( String(aTest[i].m_pInput, RTL_TEXTENCODING_UTF8), @@ -1378,7 +1376,7 @@ main() { INET_PROT_NEWS, "abc@def.ghi@", 0 }, { INET_PROT_NEWS, "!\"#@def", "news:!%22%23@def" }, { INET_PROT_NEWS, " @def", "news:%20@def" } }; - for (std::size_t i = 0; i < sizeof aTest / sizeof aTest[0]; ++i) + for (std::size_t i = 0; i < SAL_N_ELEMENTS( aTest ); ++i) { INetURLObject aUri; bool bOk = aUri.ConcatData(aTest[i].eScheme, String(), String(), @@ -1449,7 +1447,7 @@ main() } if (true) { // #112130# - INetURLObject url1(rtl::OUString::createFromAscii(".uno:abc%3Fdef")); + INetURLObject url1(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:abc%3Fdef" ))); if (url1.GetProtocol() != INET_PROT_UNO) { printf("BAD .uno:abc%%3Fdef\n"); bSuccess = false; @@ -1467,7 +1465,7 @@ main() printf("BAD HasParam(.uno:abc%%3Fdef)\n"); bSuccess = false; } - INetURLObject url2(rtl::OUString::createFromAscii(".uno:abc?def?ghi")); + INetURLObject url2(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:abc?def?ghi" ))); if (url2.GetProtocol() != INET_PROT_UNO) { printf("BAD .uno:abc?def?ghi\n"); bSuccess = false; @@ -1904,3 +1902,5 @@ main() return bSuccess ? EXIT_SUCCESS : EXIT_FAILURE; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |