Files
libreoffice/registry/tools/regcompare.cxx

2067 lines
74 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2012-07-02 17:12:00 +01:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
*/
2001-02-15 15:01:07 +00:00
#include "registry/registry.hxx"
#include "registry/reader.hxx"
#include "registry/version.h"
#include "fileurl.hxx"
#include "options.hxx"
2001-02-15 15:01:07 +00:00
#include <rtl/ustring.hxx>
2001-08-17 12:09:50 +00:00
#include <osl/diagnose.h>
#include <stdio.h>
#include <string.h>
2001-08-17 12:09:50 +00:00
#include <set>
#include <vector>
#include <string>
2001-08-17 12:09:50 +00:00
using namespace registry::tools;
typedef std::set< OUString > StringSet;
2001-08-17 12:09:50 +00:00
class Options_Impl : public Options
2001-08-17 12:09:50 +00:00
{
public:
explicit Options_Impl(char const * program)
: Options(program),
m_bFullCheck(false),
m_bForceOutput(false),
m_bUnoTypeCheck(false),
m_checkUnpublished(false)
{}
2001-08-17 12:09:50 +00:00
std::string const & getRegName1() const { return m_regName1; }
std::string const & getRegName2() const { return m_regName2; }
2001-02-15 15:01:07 +00:00
bool isStartKeyValid() const { return !m_startKey.isEmpty(); }
OUString const & getStartKey() const { return m_startKey; }
bool matchedWithExcludeKey( const OUString& keyName) const;
2001-02-15 15:01:07 +00:00
bool fullCheck() const { return m_bFullCheck; }
bool forceOutput() const { return m_bForceOutput; }
bool unoTypeCheck() const { return m_bUnoTypeCheck; }
bool checkUnpublished() const { return m_checkUnpublished; }
2001-02-15 15:01:07 +00:00
protected:
bool setRegName_Impl(char c, std::string const & param);
2001-02-15 15:01:07 +00:00
virtual void printUsage_Impl() const SAL_OVERRIDE;
virtual bool initOptions_Impl (std::vector< std::string > & rArgs) SAL_OVERRIDE;
2001-02-15 15:01:07 +00:00
std::string m_regName1;
std::string m_regName2;
OUString m_startKey;
StringSet m_excludeKeys;
bool m_bFullCheck;
bool m_bForceOutput;
bool m_bUnoTypeCheck;
bool m_checkUnpublished;
2001-02-15 15:01:07 +00:00
};
#define U2S( s ) OUStringToOString(s, RTL_TEXTENCODING_UTF8).getStr()
2001-02-15 15:01:07 +00:00
inline OUString makeOUString (std::string const & s)
{
return OUString(s.c_str(), s.size(), RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
}
2001-02-15 15:01:07 +00:00
inline OUString shortName(OUString const & fullName)
{
return fullName.copy(fullName.lastIndexOf('/') + 1);
}
2001-02-15 15:01:07 +00:00
bool Options_Impl::setRegName_Impl(char c, std::string const & param)
{
bool one = (c == '1'), two = (c == '2');
if (one)
m_regName1 = param;
if (two)
m_regName2 = param;
return (one || two);
}
2001-02-15 15:01:07 +00:00
//virtual
void Options_Impl::printUsage_Impl() const
{
std::string const & rProgName = getProgramName();
fprintf(stderr,
"Usage: %s -r1<filename> -r2<filename> [-options] | @<filename>\n", rProgName.c_str()
);
fprintf(stderr,
" -r1<filename> = filename specifies the name of the first registry.\n"
" -r2<filename> = filename specifies the name of the second registry.\n"
" @<filename> = filename specifies a command file.\n"
"Options:\n"
" -s<name> = name specifies the name of a start key. If no start key\n"
" |S<name> is specified the comparison starts with the root key.\n"
" -x<name> = name specifies the name of a key which won't be compared. All\n"
" |X<name> subkeys won't be compared also. This option can be used more than once.\n"
" -f|F = force the detailed output of any diffenrences. Default\n"
" is that only the number of differences is returned.\n"
" -c|C = make a complete check, that means any differences will be\n"
" detected. Default is only a compatibility check that means\n"
" only UNO typelibrary entries will be checked.\n"
Many spelling fixes: directories r* - z*. Attempt to clean up most but certainly not all the spelling mistakes that found home in OpenOffice through decades. We could probably blame the international nature of the code but it is somewhat shameful that this wasn't done before. (cherry picked from commit 28206a7cb43aff5adb10f8235ad1680c3941ee3e) Conflicts: include/osl/file.hxx include/osl/pipe_decl.hxx include/osl/socket.h include/osl/socket_decl.hxx include/sal/main.h include/svx/dbaexchange.hxx include/svx/dlgctrl.hxx include/svx/msdffdef.hxx include/svx/sdr/contact/objectcontactofpageview.hxx include/svx/svdpntv.hxx include/ucbhelper/content.hxx include/ucbhelper/interceptedinteraction.hxx include/ucbhelper/resultsethelper.hxx include/unotools/sharedunocomponent.hxx include/unotools/viewoptions.hxx include/vcl/pdfwriter.hxx include/xmloff/txtparae.hxx include/xmloff/uniref.hxx rhino/rhino1_7R3.patch rsc/inc/rscrsc.hxx sal/inc/osl/conditn.h sal/inc/osl/security.h sal/inc/osl/semaphor.h sal/inc/osl/semaphor.hxx sal/inc/rtl/string.hxx sal/inc/rtl/tres.h sal/inc/systools/win32/StrConvert.h sal/osl/os2/file_path_helper.h sal/osl/os2/file_path_helper.hxx sal/osl/os2/file_url.cxx sal/osl/os2/file_url.h sal/osl/os2/makefile.mk sal/osl/os2/pipe.cxx sal/osl/os2/process.c sal/osl/os2/profile.c sal/osl/os2/socket.c sal/osl/os2/system.h sal/osl/unx/asm/interlck_sparc.s sal/osl/unx/file_url.cxx sal/osl/unx/signal.c sal/osl/unx/system.h sal/osl/w32/MAKEFILE.MK sal/osl/w32/interlck.c sal/osl/w32/module.cxx sal/osl/w32/security.c sal/qa/buildall.pl sal/qa/osl/file/osl_File.cxx sal/qa/osl/module/osl_Module_Const.h sal/qa/osl/mutex/osl_Mutex.cxx sal/qa/osl/pipe/osl_Pipe.cxx sal/qa/osl/process/osl_Thread.cxx sal/qa/osl/socket/osl_StreamSocket.cxx sal/qa/osl/socket/sockethelper.cxx sal/qa/rtl_strings/rtl_OUString.cxx sal/rtl/source/unload.cxx sal/systools/win32/kill/kill.cxx sal/systools/win32/uwinapi/MoveFileExA.cpp sal/test/bootstrap.pl sal/typesconfig/typesconfig.c sal/workben/tgetpwnam.cxx sax/inc/sax/parser/saxparser.hxx sc/addin/datefunc/dfa.cl sc/addin/datefunc/dfa.src sc/addin/rot13/rot13.cl sc/addin/rot13/rot13.src sc/inc/attarray.hxx sc/inc/chgtrack.hxx sc/inc/column.hxx sc/inc/compressedarray.hxx sc/inc/document.hxx sc/inc/table.hxx sc/source/core/data/column.cxx sc/source/core/data/dptablecache.cxx sc/source/core/data/dptabres.cxx sc/source/core/data/dptabsrc.cxx sc/source/core/data/global.cxx sc/source/core/tool/chgtrack.cxx sc/source/core/tool/compiler.cxx sc/source/filter/excel/xestyle.cxx sc/source/filter/excel/xichart.cxx sc/source/filter/inc/fapihelper.hxx sc/source/filter/inc/xistyle.hxx sc/source/filter/xml/xmlsubti.cxx sc/source/ui/Accessibility/AccessibleCell.cxx sc/source/ui/Accessibility/AccessibleContextBase.cxx sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx sc/source/ui/Accessibility/AccessibleEditObject.cxx sc/source/ui/Accessibility/AccessiblePreviewCell.cxx sc/source/ui/app/inputwin.cxx sc/source/ui/docshell/docfunc.cxx sc/source/ui/drawfunc/fupoor.cxx sc/source/ui/miscdlgs/linkarea.cxx sc/source/ui/unoobj/chart2uno.cxx sc/source/ui/unoobj/nameuno.cxx sc/source/ui/vba/vbacharacters.hxx sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbawindow.cxx scaddins/source/analysis/analysishelper.cxx scaddins/source/analysis/analysishelper.hxx scaddins/source/datefunc/datefunc.cxx scripting/examples/python/Capitalise.py scripting/source/pyprov/officehelper.py sd/source/filter/eppt/eppt.cxx sd/source/filter/eppt/epptso.cxx sd/source/ui/dlg/prltempl.cxx sd/source/ui/dlg/tpoption.cxx sd/source/ui/func/fuediglu.cxx sd/source/ui/func/fupoor.cxx sd/source/ui/func/fusel.cxx sd/source/ui/func/smarttag.cxx sd/source/ui/inc/OutlinerIteratorImpl.hxx sd/source/ui/inc/SlideViewShell.hxx sd/source/ui/inc/fuediglu.hxx sd/source/ui/inc/fusel.hxx sd/source/ui/slideshow/slideshowimpl.cxx sd/source/ui/slidesorter/cache/SlsQueueProcessorThread.hxx sd/source/ui/slidesorter/controller/SlsHideSlideFunction.cxx sd/source/ui/slidesorter/controller/SlsSelectionCommand.hxx sd/source/ui/slidesorter/inc/controller/SlsAnimationFunction.hxx sd/source/ui/slidesorter/view/SlsButtonBar.cxx sd/source/ui/view/Outliner.cxx sd/source/ui/view/drviewsh.cxx sd/source/ui/view/frmview.cxx sdext/source/presenter/PresenterFrameworkObserver.hxx sdext/source/presenter/PresenterSlideShowView.cxx setup_native/scripts/deregister_extensions setup_native/scripts/register_extensions setup_native/source/opensolaris/bundledextensions/README setup_native/source/opensolaris/bundledextensions/svc-ooo_bundled_extensions setup_native/source/win32/customactions/patch/swappatchfiles.cxx setup_native/source/win32/customactions/reg4msdoc/registrar.cxx setup_native/source/win32/customactions/reg4msdoc/userregistrar.cxx sfx2/inc/sfx2/sfxbasemodel.hxx sfx2/qa/complex/sfx2/DocumentProperties.java sfx2/source/appl/appopen.cxx sfx2/source/appl/appquit.cxx sfx2/source/appl/appserv.cxx sfx2/source/bastyp/sfxhtml.cxx sfx2/source/dialog/dockwin.cxx sfx2/source/doc/docfile.cxx sfx2/source/doc/docvor.cxx sfx2/source/doc/graphhelp.cxx sfx2/source/doc/objcont.cxx sfx2/source/doc/objserv.cxx sfx2/source/doc/objstor.cxx sfx2/source/doc/objuno.cxx sfx2/source/doc/objxtor.cxx sfx2/source/doc/printhelper.cxx sfx2/source/doc/sfxbasemodel.cxx sfx2/source/notify/eventsupplier.cxx sfx2/source/view/frmload.cxx sfx2/source/view/sfxbasecontroller.cxx shell/qa/zip/ziptest.cxx shell/source/backends/wininetbe/wininetbackend.cxx shell/source/win32/shlxthandler/util/utilities.cxx solenv/bin/build.pl solenv/bin/build_release.pl solenv/bin/cws.pl solenv/bin/download_external_dependencies.pl solenv/bin/make_download.pl solenv/bin/make_installer.pl solenv/bin/modules/Cws.pm solenv/bin/modules/ExtensionsLst.pm solenv/bin/modules/installer/control.pm solenv/bin/modules/installer/downloadsigner.pm solenv/bin/modules/installer/javainstaller.pm solenv/bin/modules/installer/packagepool.pm solenv/bin/modules/installer/patch/InstallationSet.pm solenv/bin/modules/installer/scriptitems.pm solenv/bin/modules/installer/windows/feature.pm solenv/bin/modules/installer/windows/msiglobal.pm solenv/bin/modules/installer/windows/sign.pm solenv/bin/modules/installer/worker.pm solenv/bin/modules/installer/xpdinstaller.pm solenv/bin/modules/osarch.pm solenv/bin/modules/packager/work.pm solenv/bin/modules/pre2par/parameter.pm solenv/bin/patch_tool.pl solenv/bin/transform_description.pl solenv/doc/gbuild/doxygen.cfg solenv/gbuild/LinkTarget.mk solenv/gbuild/gbuild.mk solenv/inc/os2gcci.mk solenv/inc/settings.mk solenv/inc/startup/Readme solenv/inc/target.mk solenv/inc/tg_compv.mk solenv/inc/tg_javav.mk solenv/inc/unitools.mk solenv/inc/unxbsdi.mk solenv/inc/unxbsdi2.mk solenv/inc/unxbsds.mk solenv/inc/unxfbsd.mk solenv/inc/unxlng.mk sot/source/sdstor/stg.cxx sot/source/sdstor/stgelem.cxx sot/source/sdstor/ucbstorage.cxx starmath/inc/toolbox.hxx starmath/source/mathmlexport.cxx starmath/source/node.cxx starmath/source/toolbox.cxx starmath/source/view.cxx stoc/source/bootstrap/bootstrap.xml stoc/source/corereflection/criface.cxx stoc/source/invocation/invocation.cxx stoc/source/security/access_controller.cxx stoc/source/servicemanager/servicemanager.cxx stoc/source/tdmanager/tdmgr.cxx stoc/test/javavm/testjavavm.cxx stoc/test/testconv.cxx stoc/test/testcorefl.cxx stoc/test/testintrosp.cxx svl/inc/svl/inettype.hxx svl/inc/svl/urihelper.hxx svl/qa/complex/ConfigItems/helper/HistoryOptTest.cxx svl/qa/complex/ConfigItems/helper/HistoryOptTest.hxx svl/source/config/itemholder2.hxx svl/source/items/itemset.cxx svl/source/numbers/zforlist.cxx svl/source/numbers/zformat.cxx svl/source/numbers/zforscan.cxx svtools/bmpmaker/bmp.cxx svtools/inc/svtools/helpagentwindow.hxx svtools/inc/svtools/menuoptions.hxx svtools/inc/svtools/miscopt.hxx svtools/inc/svtools/optionsdrawinglayer.hxx svtools/inc/svtools/stringtransfer.hxx svtools/inc/svtools/svlbitm.hxx svtools/inc/svtools/svtdata.hxx svtools/inc/svtools/valueset.hxx svtools/source/brwbox/editbrowsebox.cxx svtools/source/config/itemholder2.hxx svtools/source/contnr/contentenumeration.hxx svx/inc/svx/fmsrcimp.hxx svx/inc/svx/svdobj.hxx svx/inc/svx/xtable.hxx svx/source/accessibility/DGColorNameLookUp.cxx svx/source/accessibility/svxrectctaccessiblecontext.cxx svx/source/dialog/pfiledlg.cxx svx/source/fmcomp/fmgridcl.cxx svx/source/fmcomp/fmgridif.cxx svx/source/fmcomp/gridctrl.cxx svx/source/form/filtnav.cxx svx/source/form/fmPropBrw.cxx svx/source/form/fmshimp.cxx svx/source/form/fmsrcimp.cxx svx/source/gallery2/galtheme.cxx svx/source/inc/docrecovery.hxx svx/source/sdr/event/eventhandler.cxx svx/source/svdraw/svdedtv2.cxx svx/source/svdraw/svdedxv.cxx svx/source/svdraw/svdhdl.cxx svx/source/svdraw/svdobj.cxx svx/source/svdraw/svdograf.cxx svx/source/svdraw/svdoole2.cxx svx/source/svdraw/svdotxtr.cxx svx/source/svdraw/svdundo.cxx svx/source/svdraw/svdxcgv.cxx svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx sw/inc/SwNumberTree.hxx sw/inc/ndnotxt.hxx sw/source/core/access/acccell.cxx sw/source/core/access/acccell.hxx sw/source/core/access/accframebase.cxx sw/source/core/access/accframebase.hxx sw/source/core/access/accmap.cxx sw/source/core/access/accpage.cxx sw/source/core/access/accpage.hxx sw/source/core/access/accpara.cxx sw/source/core/access/accpara.hxx sw/source/core/bastyp/swrect.cxx sw/source/core/crsr/findtxt.cxx sw/source/core/doc/docdde.cxx sw/source/core/doc/notxtfrm.cxx sw/source/core/docnode/section.cxx sw/source/core/draw/dcontact.cxx sw/source/core/edit/edlingu.cxx sw/source/core/inc/anchoredobjectposition.hxx sw/source/core/layout/paintfrm.cxx sw/source/core/layout/tabfrm.cxx sw/source/core/layout/trvlfrm.cxx sw/source/core/ole/ndole.cxx sw/source/core/text/atrstck.cxx sw/source/core/text/inftxt.cxx sw/source/core/text/itratr.cxx sw/source/core/text/itrform2.cxx sw/source/core/text/itrform2.hxx sw/source/core/text/porfld.cxx sw/source/core/text/txtfly.cxx sw/source/core/txtnode/thints.cxx sw/source/core/txtnode/txtedt.cxx sw/source/core/uibase/dochdl/swdtflvr.cxx sw/source/core/uibase/docvw/PostItMgr.cxx sw/source/core/uibase/docvw/SidebarWin.cxx sw/source/core/uibase/docvw/edtwin.cxx sw/source/core/uibase/envelp/labimg.cxx sw/source/core/uibase/uiview/pview.cxx sw/source/core/uibase/uno/unomailmerge.cxx sw/source/core/undo/unattr.cxx sw/source/core/undo/untbl.cxx sw/source/core/unocore/unochart.cxx sw/source/core/view/vdraw.cxx sw/source/core/view/vnew.cxx sw/source/filter/basflt/fltini.cxx sw/source/filter/html/wrthtml.cxx sw/source/filter/inc/wwstyles.hxx sw/source/filter/rtf/rtffly.cxx sw/source/filter/rtf/swparrtf.cxx sw/source/filter/ww8/docxattributeoutput.cxx sw/source/filter/ww8/dump/msvbasic.cxx sw/source/filter/ww8/dump/ww8scan.cxx sw/source/filter/ww8/dump/ww8scan.hxx sw/source/filter/ww8/dump/ww8struc.hxx sw/source/filter/ww8/wrtww8.cxx sw/source/filter/ww8/ww8graf.cxx sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par2.cxx sw/source/filter/ww8/ww8par2.hxx sw/source/filter/ww8/ww8par3.cxx sw/source/filter/ww8/ww8par6.cxx sw/source/filter/ww8/ww8scan.cxx sw/source/filter/ww8/ww8scan.hxx sw/source/ui/dbui/dbinsdlg.cxx sw/source/ui/inc/tablemgr.hxx sw/source/ui/inc/uitool.hxx sw/source/ui/lingu/olmenu.cxx sw/source/ui/uiview/viewport.cxx sysui/desktop/productversion.mk sysui/desktop/slackware/makefile.mk testgraphical/source/CallExternals.pm testgraphical/source/fill_documents_loop.pl testgraphical/ui/java/ConvwatchGUIProject/src/IniFile.java toolkit/doc/layout/notes.txt toolkit/doc/layout/oldnotes.txt toolkit/source/awt/vclxtabcontrol.cxx toolkit/src2xml/source/srcparser.py toolkit/workben/layout/editor.cxx tools/inc/tools/simplerm.hxx tools/inc/tools/solar.h tools/source/communi/geninfo.cxx tools/source/fsys/dirent.cxx tools/source/fsys/filecopy.cxx tools/source/fsys/os2.cxx tools/source/inet/inetmime.cxx tools/source/rc/resmgr.cxx ucb/source/core/ucbcmds.cxx ucb/source/ucp/file/filglob.cxx ucb/source/ucp/odma/odma_content.cxx ucb/source/ucp/tdoc/ucptdoc.xml ucb/source/ucp/webdav/makefile.mk ucbhelper/inc/ucbhelper/simplecertificatevalidationrequest.hxx ucbhelper/source/client/content.cxx ucbhelper/source/client/interceptedinteraction.cxx udkapi/com/sun/star/beans/XPropertiesChangeListener.idl udkapi/com/sun/star/io/ObjectOutputStream.idl udkapi/com/sun/star/io/XMarkableStream.idl udkapi/com/sun/star/io/XTextOutputStream.idl udkapi/com/sun/star/reflection/CoreReflection.idl udkapi/com/sun/star/reflection/XTypeDescriptionEnumerationAccess.idl udkapi/com/sun/star/test/XSimpleTest.idl unodevtools/source/skeletonmaker/skeletoncommon.cxx unodevtools/source/skeletonmaker/skeletoncommon.hxx unotools/inc/unotools/cacheoptions.hxx unotools/inc/unotools/cmdoptions.hxx unotools/inc/unotools/dynamicmenuoptions.hxx unotools/inc/unotools/extendedsecurityoptions.hxx unotools/inc/unotools/fontoptions.hxx unotools/inc/unotools/historyoptions.hxx unotools/inc/unotools/idhelper.hxx unotools/inc/unotools/internaloptions.hxx unotools/inc/unotools/localisationoptions.hxx unotools/inc/unotools/moduleoptions.hxx unotools/inc/unotools/printwarningoptions.hxx unotools/inc/unotools/securityoptions.hxx unotools/inc/unotools/startoptions.hxx unotools/inc/unotools/workingsetoptions.hxx unotools/source/config/cmdoptions.cxx unotools/source/config/compatibility.cxx unotools/source/config/configitem.cxx unotools/source/config/configmgr.cxx unotools/source/config/dynamicmenuoptions.cxx unotools/source/config/fontcfg.cxx unotools/source/config/itemholder1.hxx unotools/source/config/moduleoptions.cxx unotools/source/config/pathoptions.cxx unotools/source/config/viewoptions.cxx unotools/source/misc/sharedunocomponent.cxx uui/source/fltdlg.cxx uui/source/iahndl-filter.cxx vbahelper/inc/vbahelper/collectionbase.hxx vbahelper/source/msforms/vbacontrol.cxx vbahelper/source/vbahelper/collectionbase.cxx vcl/aqua/source/gdi/atsfonts.cxx vcl/inc/aqua/salmathutils.hxx vcl/inc/graphite_cache.hxx vcl/inc/jobset.h vcl/inc/os2/salgdi.h vcl/inc/osx/saldata.hxx vcl/inc/salgdi.hxx vcl/inc/salwtype.hxx vcl/inc/unx/wmadaptor.hxx vcl/inc/vcl/print.hxx vcl/inc/vcl/strhelper.hxx vcl/os2/source/app/salinst.cxx vcl/os2/source/app/saltimer.cxx vcl/os2/source/gdi/salgdi2.cxx vcl/osx/salframeview.mm vcl/osx/salprn.cxx vcl/qa/cppunit/dndtest.cxx vcl/source/app/dbggui.cxx vcl/source/control/ilstbox.cxx vcl/source/gdi/cvtsvm.cxx vcl/source/gdi/gdimtf.cxx vcl/source/gdi/outdev4.cxx vcl/source/gdi/outdev6.cxx vcl/source/gdi/pdfwriter_impl.cxx vcl/source/gdi/pdfwriter_impl2.cxx vcl/source/gdi/print.cxx vcl/source/gdi/print2.cxx vcl/source/glyphs/gcach_layout.cxx vcl/source/glyphs/glyphcache.cxx vcl/source/glyphs/graphite_layout.cxx vcl/source/window/printdlg.cxx vcl/source/window/tabdlg.cxx vcl/source/window/window.cxx vcl/source/window/winproc.cxx vcl/unx/generic/app/saldisp.cxx vcl/unx/generic/dtrans/X11_selection.hxx vcl/unx/gtk/app/gtkdata.cxx vcl/win/source/gdi/salgdi2.cxx vcl/win/source/gdi/salgdi3.cxx vcl/win/source/window/salframe.cxx vos/inc/vos/pipe.hxx vos/inc/vos/process.hxx vos/inc/vos/signal.hxx vos/inc/vos/socket.hxx vos/inc/vos/thread.hxx vos/source/pipe.cxx vos/source/socket.cxx wizards/com/sun/star/wizards/agenda/AgendaTemplate.java wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java wizards/com/sun/star/wizards/agenda/TopicsControl.java wizards/com/sun/star/wizards/web/FTPDialog.java wizards/com/sun/star/wizards/web/ImageListDialog.java wizards/com/sun/star/wizards/web/Process.java wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java wizards/com/sun/star/wizards/web/TOCPreview.java wizards/com/sun/star/wizards/web/WWD_Startup.java wizards/com/sun/star/wizards/web/data/TypeDetection.java wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java writerfilter/inc/doctok/WW8Document.hxx writerfilter/source/dmapper/DomainMapper.cxx writerfilter/source/dmapper/NumberingManager.cxx writerfilter/source/dmapper/PropertyMap.cxx writerfilter/source/dmapper/StyleSheetTable.cxx writerfilter/source/doctok/WW8StructBase.hxx writerfilter/source/doctok/resources.xmi writerfilter/source/ooxml/README.efforts xmerge/source/activesync/XMergeFilter.cpp xmerge/source/minicalc/java/org/openoffice/xmerge/converter/xml/sxc/minicalc/SxcDocumentDeserializerImpl.java xmerge/source/palmtests/qa/comparator/pdbcomparison.java xmerge/source/palmtests/qa/test_spec/convertor_test_spec.html xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/DefinedName.java xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Workbook.java xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Worksheet.java xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/formula/SymbolLookup.java xmerge/source/pocketword/java/org/openoffice/xmerge/converter/xml/sxw/pocketword/DocumentDescriptor.java xmerge/workben/jstyle.pl xmlhelp/source/cxxhelp/provider/databases.hxx xmlhelp/source/cxxhelp/provider/provider.cxx xmlhelp/source/treeview/tvread.cxx xmloff/inc/txtfldi.hxx xmloff/inc/xmloff/xmlmultiimagehelper.hxx xmloff/inc/xmloff/xmluconv.hxx xmloff/source/core/xmlexp.cxx xmloff/source/draw/shapeexport2.cxx xmloff/source/draw/shapeexport3.cxx xmloff/source/meta/xmlversion.cxx xmloff/source/style/impastp4.cxx xmloff/source/style/xmlaustp.cxx xmloff/source/text/XMLSectionExport.cxx xmloff/source/text/txtflde.cxx xmloff/source/text/txtimp.cxx xmloff/source/text/txtparae.cxx xmloff/source/text/txtparai.cxx xmloff/source/text/txtvfldi.cxx xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx Change-Id: Ie072e7c3a60c5dae16a67ac36d1f372c5065c99c
2014-04-29 19:25:03 +00:00
" -t|T = make an UNO type compatibility check. This means that registry 2\n"
" will be checked against registry 1. If a interface in r2 contains\n"
" more methods or the methods are in a different order as in r1, r2 is\n"
" incompatible to r1. But if a service in r2 supports more properties as\n"
" in r1 and the new properties are 'optional' it is compatible.\n"
" -u|U = additionally check types that are unpublished in registry 1.\n"
" -h|-? = print this help message and exit.\n"
);
fprintf(stderr,
2011-03-07 16:31:11 +01:00
"\n%s Version 1.0\n\n", rProgName.c_str()
);
}
2001-02-15 15:01:07 +00:00
// virtual
bool Options_Impl::initOptions_Impl (std::vector< std::string > & rArgs)
{
std::vector< std::string >::const_iterator first = rArgs.begin(), last = rArgs.end();
for (; first != last; ++first)
2001-02-15 15:01:07 +00:00
{
if ((*first)[0] != '-')
{
return badOption("invalid", (*first).c_str());
}
switch ((*first)[1])
2001-02-15 15:01:07 +00:00
{
case 'r':
case 'R':
2001-02-15 15:01:07 +00:00
{
if (!((++first != last) && ((*first)[0] != '-')))
2001-02-15 15:01:07 +00:00
{
return badOption("invalid", (*first).c_str());
}
2001-02-15 15:01:07 +00:00
std::string option(*first), param;
if (option.size() == 1)
{
// "-r<n><space><param>"
if (!((++first != last) && ((*first)[0] != '-')))
2001-02-15 15:01:07 +00:00
{
return badOption("invalid", (*first).c_str());
2001-02-15 15:01:07 +00:00
}
param = (*first);
2001-02-15 15:01:07 +00:00
}
else
{
// "-r<n><param>"
param = std::string(&(option[1]), option.size() - 1);
}
if (!setRegName_Impl(option[0], param))
{
return badOption("invalid", option.c_str());
}
break;
2001-02-15 15:01:07 +00:00
}
case 's':
case 'S':
2001-02-15 15:01:07 +00:00
{
if (!((++first != last) && ((*first)[0] != '-')))
2001-02-15 15:01:07 +00:00
{
return badOption("invalid", (*first).c_str());
}
m_startKey = makeOUString(*first);
break;
}
case 'x':
case 'X':
{
if (!((++first != last) && ((*first)[0] != '-')))
{
return badOption("invalid", (*first).c_str());
}
m_excludeKeys.insert(makeOUString(*first));
break;
}
case 'f':
case 'F':
{
if ((*first).size() > 2)
{
return badOption("invalid", (*first).c_str());
}
m_bForceOutput = true;
break;
}
case 'c':
case 'C':
{
if ((*first).size() > 2)
{
return badOption("invalid", (*first).c_str());
}
m_bFullCheck = true;
break;
}
case 't':
case 'T':
{
if ((*first).size() > 2)
{
return badOption("invalid", (*first).c_str());
}
m_bUnoTypeCheck = true;
break;
}
case 'u':
case 'U':
{
if ((*first).size() > 2)
{
return badOption("invalid", (*first).c_str());
2001-02-15 15:01:07 +00:00
}
m_checkUnpublished = true;
break;
}
case 'h':
case '?':
2001-02-15 15:01:07 +00:00
{
if ((*first).size() > 2)
{
return badOption("invalid", (*first).c_str());
}
return printUsage();
}
default:
{
return badOption("unknown", (*first).c_str());
2001-02-15 15:01:07 +00:00
}
}
}
2012-02-19 16:59:40 +04:00
if ( m_regName1.empty() )
2001-02-15 15:01:07 +00:00
{
return badOption("missing", "-r1");
2001-02-15 15:01:07 +00:00
}
2012-02-19 16:59:40 +04:00
if ( m_regName2.empty() )
{
return badOption("missing", "-r2");
}
return true;
2001-02-15 15:01:07 +00:00
}
bool Options_Impl::matchedWithExcludeKey( const OUString& keyName) const
{
if (!m_excludeKeys.empty())
{
StringSet::const_iterator first = m_excludeKeys.begin(), last = m_excludeKeys.end();
for (; first != last; ++first)
{
if (keyName.startsWith(*first))
return true;
}
}
return false;
}
static char const * getTypeClass(RTTypeClass typeClass)
2001-02-15 15:01:07 +00:00
{
switch (typeClass)
{
case RT_TYPE_INTERFACE:
return "INTERFACE";
case RT_TYPE_MODULE:
return "MODULE";
case RT_TYPE_STRUCT:
return "STRUCT";
case RT_TYPE_ENUM:
return "ENUM";
case RT_TYPE_EXCEPTION:
return "EXCEPTION";
case RT_TYPE_TYPEDEF:
return "TYPEDEF";
case RT_TYPE_SERVICE:
return "SERVICE";
case RT_TYPE_OBJECT:
return "OBJECT";
case RT_TYPE_CONSTANTS:
return "CONSTANTS";
default:
return "INVALID";
2001-02-15 15:01:07 +00:00
}
}
static OString getFieldAccess(RTFieldAccess fieldAccess)
{
OString ret;
if ( (fieldAccess & RTFieldAccess::INVALID) == RTFieldAccess::INVALID )
2001-02-15 15:01:07 +00:00
{
ret += OString("INVALID");
}
if ( (fieldAccess & RTFieldAccess::READONLY) == RTFieldAccess::READONLY )
2001-02-15 15:01:07 +00:00
{
ret += OString(ret.isEmpty() ? "READONLY" : ",READONLY");
2001-02-15 15:01:07 +00:00
}
if ( (fieldAccess & RTFieldAccess::OPTIONAL) == RTFieldAccess::OPTIONAL )
2001-02-15 15:01:07 +00:00
{
ret += OString(ret.isEmpty() ? "OPTIONAL" : ",OPTIONAL");
2001-02-15 15:01:07 +00:00
}
if ( (fieldAccess & RTFieldAccess::MAYBEVOID) == RTFieldAccess::MAYBEVOID )
2001-02-15 15:01:07 +00:00
{
ret += OString(ret.isEmpty() ? "MAYBEVOID" : ",MAYBEVOID");
2001-02-15 15:01:07 +00:00
}
if ( (fieldAccess & RTFieldAccess::BOUND) == RTFieldAccess::BOUND )
2001-02-15 15:01:07 +00:00
{
ret += OString(ret.isEmpty() ? "BOUND" : ",BOUND");
2001-02-15 15:01:07 +00:00
}
if ( (fieldAccess & RTFieldAccess::CONSTRAINED) == RTFieldAccess::CONSTRAINED )
2001-02-15 15:01:07 +00:00
{
ret += OString(ret.isEmpty() ? "CONSTRAINED" : ",CONSTRAINED");
2001-02-15 15:01:07 +00:00
}
if ( (fieldAccess & RTFieldAccess::TRANSIENT) == RTFieldAccess::TRANSIENT )
2001-02-15 15:01:07 +00:00
{
ret += OString(ret.isEmpty() ? "TRANSIENT" : ",TRANSIENT");
2001-02-15 15:01:07 +00:00
}
if ( (fieldAccess & RTFieldAccess::MAYBEAMBIGUOUS) == RTFieldAccess::MAYBEAMBIGUOUS )
2001-02-15 15:01:07 +00:00
{
ret += OString(ret.isEmpty() ? "MAYBEAMBIGUOUS" : ",MAYBEAMBIGUOUS");
2001-02-15 15:01:07 +00:00
}
if ( (fieldAccess & RTFieldAccess::MAYBEDEFAULT) == RTFieldAccess::MAYBEDEFAULT )
2001-02-15 15:01:07 +00:00
{
ret += OString(ret.isEmpty() ? "MAYBEDEFAULT" : ",MAYBEDEFAULT");
2001-02-15 15:01:07 +00:00
}
if ( (fieldAccess & RTFieldAccess::REMOVABLE) == RTFieldAccess::REMOVABLE )
2001-02-15 15:01:07 +00:00
{
ret += OString(ret.isEmpty() ? "REMOVABLE" : ",REMOVABLE");
2001-02-15 15:01:07 +00:00
}
if ( (fieldAccess & RTFieldAccess::ATTRIBUTE) == RTFieldAccess::ATTRIBUTE )
2001-02-15 15:01:07 +00:00
{
ret += OString(ret.isEmpty() ? "ATTRIBUTE" : ",ATTRIBUTE");
2001-02-15 15:01:07 +00:00
}
if ( (fieldAccess & RTFieldAccess::PROPERTY) == RTFieldAccess::PROPERTY )
2001-02-15 15:01:07 +00:00
{
ret += OString(ret.isEmpty() ? "PROPERTY" : ",PROPERTY");
2001-02-15 15:01:07 +00:00
}
if ( (fieldAccess & RTFieldAccess::CONST) == RTFieldAccess::CONST )
2001-02-15 15:01:07 +00:00
{
ret += OString(ret.isEmpty() ? "CONST" : ",CONST");
2001-02-15 15:01:07 +00:00
}
if ( (fieldAccess & RTFieldAccess::READWRITE) == RTFieldAccess::READWRITE )
2001-02-15 15:01:07 +00:00
{
ret += OString(ret.isEmpty() ? "READWRITE" : ",READWRITE");
2001-02-15 15:01:07 +00:00
}
return ret;
}
static char const * getConstValueType(RTConstValue& constValue)
2001-02-15 15:01:07 +00:00
{
switch (constValue.m_type)
{
case RT_TYPE_BOOL:
return "sal_Bool";
case RT_TYPE_BYTE:
return "sal_uInt8";
case RT_TYPE_INT16:
return "sal_Int16";
case RT_TYPE_UINT16:
return "sal_uInt16";
case RT_TYPE_INT32:
return "sal_Int32";
case RT_TYPE_UINT32:
return "sal_uInt32";
// case RT_TYPE_INT64:
// return "sal_Int64";
// case RT_TYPE_UINT64:
// return "sal_uInt64";
case RT_TYPE_FLOAT:
return "float";
case RT_TYPE_DOUBLE:
return "double";
case RT_TYPE_STRING:
return "sal_Unicode*";
default:
return "NONE";
2001-02-15 15:01:07 +00:00
}
}
2001-02-15 15:01:07 +00:00
static void printConstValue(RTConstValue& constValue)
{
switch (constValue.m_type)
{
case RT_TYPE_NONE:
2002-11-27 13:19:37 +00:00
fprintf(stdout, "none");
break;
2001-02-15 15:01:07 +00:00
case RT_TYPE_BOOL:
2002-11-27 13:19:37 +00:00
fprintf(stdout, "%s", constValue.m_value.aBool ? "TRUE" : "FALSE");
break;
2001-02-15 15:01:07 +00:00
case RT_TYPE_BYTE:
2002-11-27 13:19:37 +00:00
fprintf(stdout, "%d", constValue.m_value.aByte);
break;
2001-02-15 15:01:07 +00:00
case RT_TYPE_INT16:
2002-11-27 13:19:37 +00:00
fprintf(stdout, "%d", constValue.m_value.aShort);
break;
2001-02-15 15:01:07 +00:00
case RT_TYPE_UINT16:
2002-11-27 13:19:37 +00:00
fprintf(stdout, "%d", constValue.m_value.aUShort);
break;
2001-02-15 15:01:07 +00:00
case RT_TYPE_INT32:
fprintf(
stdout, "%ld",
sal::static_int_cast< long >(constValue.m_value.aLong));
break;
2001-02-15 15:01:07 +00:00
case RT_TYPE_UINT32:
fprintf(
stdout, "%lu",
sal::static_int_cast< unsigned long >(
constValue.m_value.aULong));
break;
2001-02-15 15:01:07 +00:00
// case RT_TYPE_INT64:
2002-11-27 13:19:37 +00:00
// fprintf(stdout, "%d", constValue.m_value.aHyper);
2001-02-15 15:01:07 +00:00
// case RT_TYPE_UINT64:
2002-11-27 13:19:37 +00:00
// fprintf(stdout, "%d", constValue.m_value.aUHyper);
2001-02-15 15:01:07 +00:00
case RT_TYPE_FLOAT:
2002-11-27 13:19:37 +00:00
fprintf(stdout, "%f", constValue.m_value.aFloat);
break;
2001-02-15 15:01:07 +00:00
case RT_TYPE_DOUBLE:
2002-11-27 13:19:37 +00:00
fprintf(stdout, "%f", constValue.m_value.aDouble);
break;
2001-02-15 15:01:07 +00:00
case RT_TYPE_STRING:
fprintf(
stdout, "%s",
(OUStringToOString(
constValue.m_value.aString, RTL_TEXTENCODING_UTF8).
getStr()));
break;
default:
break;
2001-02-15 15:01:07 +00:00
}
}
static void dumpTypeClass(bool & rbDump, RTTypeClass typeClass, OUString const & keyName)
{
if (rbDump)
fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName));
rbDump = false;
}
static sal_uInt32 checkConstValue(Options_Impl const & options,
const OUString& keyName,
2001-02-15 15:01:07 +00:00
RTTypeClass typeClass,
bool & bDump,
2001-02-15 15:01:07 +00:00
RTConstValue& constValue1,
RTConstValue& constValue2,
sal_uInt16 index1)
2001-02-15 15:01:07 +00:00
{
switch (constValue1.m_type)
{
case RT_TYPE_NONE:
break;
2001-02-15 15:01:07 +00:00
case RT_TYPE_BOOL:
if (constValue1.m_value.aBool != constValue2.m_value.aBool)
{
if ( options.forceOutput() && !options.unoTypeCheck() )
2001-02-15 15:01:07 +00:00
{
dumpTypeClass(bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Field %d: Value1 = %s != Value2 = %s\n", index1,
2001-02-15 15:01:07 +00:00
constValue1.m_value.aBool ? "TRUE" : "FALSE",
constValue2.m_value.aBool ? "TRUE" : "FALSE");
}
return 1;
}
break;
case RT_TYPE_BYTE:
if (constValue1.m_value.aByte != constValue2.m_value.aByte)
{
if ( options.forceOutput() && !options.unoTypeCheck() )
2001-02-15 15:01:07 +00:00
{
dumpTypeClass(bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Field %d: Value1 = %d != Value2 = %d\n", index1,
2001-02-15 15:01:07 +00:00
constValue1.m_value.aByte, constValue2.m_value.aByte);
}
return 1;
}
break;
case RT_TYPE_INT16:
if (constValue1.m_value.aShort != constValue2.m_value.aShort)
{
if ( options.forceOutput() && !options.unoTypeCheck() )
2001-02-15 15:01:07 +00:00
{
dumpTypeClass(bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Field %d: Value1 = %d != Value2 = %d\n", index1,
2001-02-15 15:01:07 +00:00
constValue1.m_value.aShort, constValue2.m_value.aShort);
}
return 1;
}
break;
case RT_TYPE_UINT16:
if (constValue1.m_value.aUShort != constValue2.m_value.aUShort)
{
if ( options.forceOutput() && !options.unoTypeCheck() )
2001-02-15 15:01:07 +00:00
{
dumpTypeClass(bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Field %d: Value1 = %d != Value2 = %d\n", index1,
2001-02-15 15:01:07 +00:00
constValue1.m_value.aUShort, constValue2.m_value.aUShort);
}
return 1;
}
break;
case RT_TYPE_INT32:
if (constValue1.m_value.aLong != constValue2.m_value.aLong)
{
if ( options.forceOutput() && !options.unoTypeCheck() )
2001-02-15 15:01:07 +00:00
{
dumpTypeClass(bDump, typeClass, keyName);
fprintf(stdout, " Field %d: Value1 = %ld != Value2 = %ld\n", index1,
sal::static_int_cast< long >(constValue1.m_value.aLong),
sal::static_int_cast< long >(constValue2.m_value.aLong));
2001-02-15 15:01:07 +00:00
}
return 1;
}
break;
case RT_TYPE_UINT32:
if (constValue1.m_value.aULong != constValue2.m_value.aULong)
{
if ( options.forceOutput() && !options.unoTypeCheck() )
2001-02-15 15:01:07 +00:00
{
dumpTypeClass(bDump, typeClass, keyName);
fprintf(stdout, " Field %d: Value1 = %lu != Value2 = %lu\n", index1,
sal::static_int_cast< unsigned long >(constValue1.m_value.aULong),
sal::static_int_cast< unsigned long >(constValue2.m_value.aULong));
2001-02-15 15:01:07 +00:00
}
return 1;
}
break;
case RT_TYPE_INT64:
if (constValue1.m_value.aHyper != constValue2.m_value.aHyper)
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() && !options.unoTypeCheck() )
2001-02-15 15:01:07 +00:00
{
dumpTypeClass(bDump, typeClass, keyName);
fprintf(
stdout, " Field %d: Value1 = %s != Value2 = %s\n",
index1,
OUStringToOString(
OUString::number(constValue1.m_value.aHyper),
RTL_TEXTENCODING_ASCII_US).getStr(),
OUStringToOString(
OUString::number(constValue2.m_value.aHyper),
RTL_TEXTENCODING_ASCII_US).getStr());
2001-02-15 15:01:07 +00:00
}
return 1;
}
break;
case RT_TYPE_UINT64:
if (constValue1.m_value.aUHyper != constValue2.m_value.aUHyper)
{
if ( options.forceOutput() && !options.unoTypeCheck() )
{
dumpTypeClass(bDump, typeClass, keyName);
fprintf(
stdout, " Field %d: Value1 = %s != Value2 = %s\n",
index1,
OUStringToOString(
OUString::number(
constValue1.m_value.aUHyper),
RTL_TEXTENCODING_ASCII_US).getStr(),
OUStringToOString(
OUString::number(
constValue2.m_value.aUHyper),
RTL_TEXTENCODING_ASCII_US).getStr());
// printing the unsigned values as signed should be
// acceptable...
}
return 1;
}
break;
case RT_TYPE_FLOAT:
if (constValue1.m_value.aFloat != constValue2.m_value.aFloat)
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() && !options.unoTypeCheck() )
2001-02-15 15:01:07 +00:00
{
dumpTypeClass(bDump, typeClass, keyName);
fprintf(stdout, " Field %d: Value1 = %f != Value2 = %f\n", index1,
constValue1.m_value.aFloat, constValue2.m_value.aFloat);
2001-02-15 15:01:07 +00:00
}
return 1;
}
break;
case RT_TYPE_DOUBLE:
if (constValue1.m_value.aDouble != constValue2.m_value.aDouble)
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() && !options.unoTypeCheck() )
2001-02-15 15:01:07 +00:00
{
dumpTypeClass(bDump, typeClass, keyName);
fprintf(stdout, " Field %d: Value1 = %f != Value2 = %f\n", index1,
constValue1.m_value.aDouble, constValue2.m_value.aDouble);
2001-02-15 15:01:07 +00:00
}
return 1;
}
break;
default:
OSL_ASSERT(false);
break;
2001-02-15 15:01:07 +00:00
}
return 0;
}
enum verbosity_t {SILENT, REPORT};
static sal_uInt32 checkField(Options_Impl const & options,
const OUString& keyName,
2001-02-15 15:01:07 +00:00
RTTypeClass typeClass,
bool & bDump,
typereg::Reader& reader1,
typereg::Reader& reader2,
sal_uInt16 index1,
sal_uInt16 index2,
verbosity_t const eVerbosity)
2001-02-15 15:01:07 +00:00
{
sal_uInt32 nError = 0;
if ( reader1.getFieldName(index1) != reader2.getFieldName(index2) )
2001-02-15 15:01:07 +00:00
{
if (options.forceOutput() && (REPORT == eVerbosity))
2001-02-15 15:01:07 +00:00
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Field %d: Name1 = %s != Name2 = %s\n", index1,
U2S(reader1.getFieldName(index1)), U2S(reader2.getFieldName(index2)));
2001-02-15 15:01:07 +00:00
}
nError++;
}
if ( reader1.getFieldTypeName(index1) != reader2.getFieldTypeName(index2) )
2001-02-15 15:01:07 +00:00
{
if (options.forceOutput() && (REPORT == eVerbosity))
2001-02-15 15:01:07 +00:00
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Field %d: Type1 = %s != Type2 = %s\n", index1,
U2S(reader1.getFieldTypeName(index1)), U2S(reader2.getFieldTypeName(index2)));
2001-02-15 15:01:07 +00:00
}
nError++;
}
else
2001-02-15 15:01:07 +00:00
{
RTConstValue constValue1 = reader1.getFieldValue(index1);
RTConstValue constValue2 = reader2.getFieldValue(index2);
2001-02-15 15:01:07 +00:00
if ( constValue1.m_type != constValue2.m_type )
{
if (options.forceOutput() && (REPORT == eVerbosity))
2001-02-15 15:01:07 +00:00
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Field %d: Access1 = %s != Access2 = %s\n", index1,
2001-02-15 15:01:07 +00:00
getConstValueType(constValue1), getConstValueType(constValue2));
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Field %d: Value1 = ", index1);
2001-02-15 15:01:07 +00:00
printConstValue(constValue1);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " != Value2 = ");
2001-02-15 15:01:07 +00:00
printConstValue(constValue1);
2002-11-27 13:19:37 +00:00
fprintf(stdout, "\n;");
2001-02-15 15:01:07 +00:00
}
nError++;
}
else
2001-02-15 15:01:07 +00:00
{
nError += checkConstValue(options, keyName, typeClass, bDump, constValue1, constValue2, index1);
2001-02-15 15:01:07 +00:00
}
}
if ( reader1.getFieldFlags(index1) != reader2.getFieldFlags(index2) )
2001-02-15 15:01:07 +00:00
{
if (options.forceOutput() && (REPORT == eVerbosity))
2001-02-15 15:01:07 +00:00
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Field %d: FieldAccess1 = %s != FieldAccess2 = %s\n", index1,
getFieldAccess(reader1.getFieldFlags(index1)).getStr(),
getFieldAccess(reader1.getFieldFlags(index2)).getStr());
2001-02-15 15:01:07 +00:00
}
nError++;
}
if ( options.fullCheck() && (reader1.getFieldDocumentation(index1) != reader2.getFieldDocumentation(index2)) )
2001-02-15 15:01:07 +00:00
{
if (options.forceOutput() && (REPORT == eVerbosity))
2001-02-15 15:01:07 +00:00
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Field %d: Doku1 = %s\n Doku2 = %s\n", index1,
U2S(reader1.getFieldDocumentation(index1)), U2S(reader2.getFieldDocumentation(index2)));
2001-02-15 15:01:07 +00:00
}
nError++;
}
return nError;
}
static char const * getMethodMode(RTMethodMode methodMode)
2001-02-15 15:01:07 +00:00
{
switch ( methodMode )
{
case RTMethodMode::ONEWAY:
2001-02-15 15:01:07 +00:00
return "ONEWAY";
case RTMethodMode::ONEWAY_CONST:
2001-02-15 15:01:07 +00:00
return "ONEWAY,CONST";
case RTMethodMode::TWOWAY:
2001-02-15 15:01:07 +00:00
return "NONE";
case RTMethodMode::TWOWAY_CONST:
2001-02-15 15:01:07 +00:00
return "CONST";
default:
return "INVALID";
2001-02-15 15:01:07 +00:00
}
}
static char const * getParamMode(RTParamMode paramMode)
2001-02-15 15:01:07 +00:00
{
switch ( paramMode )
{
case RT_PARAM_IN:
return "IN";
case RT_PARAM_OUT:
return "OUT";
case RT_PARAM_INOUT:
return "INOUT";
default:
return "INVALID";
2001-02-15 15:01:07 +00:00
}
}
static sal_uInt32 checkMethod(Options_Impl const & options,
const OUString& keyName,
2001-02-15 15:01:07 +00:00
RTTypeClass typeClass,
bool & bDump,
typereg::Reader& reader1,
typereg::Reader& reader2,
2001-02-15 15:01:07 +00:00
sal_uInt16 index)
{
sal_uInt32 nError = 0;
if ( reader1.getMethodName(index) != reader2.getMethodName(index) )
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() )
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Method1 %d: Name1 = %s != Name2 = %s\n", index,
2001-02-15 15:01:07 +00:00
U2S(reader1.getMethodName(index)),
U2S(reader2.getMethodName(index)));
}
nError++;
}
if ( reader1.getMethodReturnTypeName(index) != reader2.getMethodReturnTypeName(index) )
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() )
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Method1 %d: ReturnType1 = %s != ReturnType2 = %s\n", index,
U2S(reader1.getMethodReturnTypeName(index)),
U2S(reader2.getMethodReturnTypeName(index)));
2001-02-15 15:01:07 +00:00
}
nError++;
}
sal_uInt16 nParams1 = (sal_uInt16)reader1.getMethodParameterCount(index);
sal_uInt16 nParams2 = (sal_uInt16)reader2.getMethodParameterCount(index);
2001-02-15 15:01:07 +00:00
if ( nParams1 != nParams2 )
{
if ( options.forceOutput() )
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Method %d : nParameters1 = %d != nParameters2 = %d\n", index, nParams1, nParams2);
2001-02-15 15:01:07 +00:00
}
nError++;
}
sal_uInt16 i=0;
for (i=0; i < nParams1 && i < nParams2; i++)
{
if ( reader1.getMethodParameterTypeName(index, i) != reader2.getMethodParameterTypeName(index, i) )
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() )
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Method %d, Parameter %d: Type1 = %s != Type2 = %s\n", index, i,
U2S(reader1.getMethodParameterTypeName(index, i)),
U2S(reader2.getMethodParameterTypeName(index, i)));
2001-02-15 15:01:07 +00:00
}
nError++;
}
if ( options.fullCheck() && (reader1.getMethodParameterName(index, i) != reader2.getMethodParameterName(index, i)) )
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() )
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Method %d, Parameter %d: Name1 = %s != Name2 = %s\n", index, i,
U2S(reader1.getMethodParameterName(index, i)),
U2S(reader2.getMethodParameterName(index, i)));
2001-02-15 15:01:07 +00:00
}
nError++;
}
if ( reader1.getMethodParameterFlags(index, i) != reader2.getMethodParameterFlags(index, i) )
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() )
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Method %d, Parameter %d: Mode1 = %s != Mode2 = %s\n", index, i,
getParamMode(reader1.getMethodParameterFlags(index, i)),
getParamMode(reader2.getMethodParameterFlags(index, i)));
2001-02-15 15:01:07 +00:00
}
nError++;
}
}
if ( i < nParams1 && options.forceOutput() )
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Registry1: Method %d contains %d more parameters\n", index, nParams1 - i);
2001-02-15 15:01:07 +00:00
}
if ( i < nParams2 && options.forceOutput() )
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Registry2: Method %d contains %d more parameters\n", index, nParams2 - i);
2001-02-15 15:01:07 +00:00
}
sal_uInt16 nExcep1 = (sal_uInt16)reader1.getMethodExceptionCount(index);
sal_uInt16 nExcep2 = (sal_uInt16)reader2.getMethodExceptionCount(index);
2001-02-15 15:01:07 +00:00
if ( nExcep1 != nExcep2 )
{
if ( options.forceOutput() )
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " nExceptions1 = %d != nExceptions2 = %d\n", nExcep1, nExcep2);
2001-02-15 15:01:07 +00:00
}
nError++;
}
for (i=0; i < nExcep1 && i < nExcep2; i++)
{
if ( reader1.getMethodExceptionTypeName(index, i) != reader2.getMethodExceptionTypeName(index, i) )
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() )
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Method %d, Exception %d: Name1 = %s != Name2 = %s\n", index, i,
U2S(reader1.getMethodExceptionTypeName(index, i)),
U2S(reader2.getMethodExceptionTypeName(index, i)));
2001-02-15 15:01:07 +00:00
}
nError++;
}
}
if ( i < nExcep1 && options.forceOutput() )
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Registry1: Method %d contains %d more exceptions\n", index, nExcep1 - i);
2001-02-15 15:01:07 +00:00
}
if ( i < nExcep2 && options.forceOutput() )
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Registry2: Method %d contains %d more exceptions\n", index, nExcep2 - i);
2001-02-15 15:01:07 +00:00
}
if ( reader1.getMethodFlags(index) != reader2.getMethodFlags(index) )
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() )
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Method %d: Mode1 = %s != Mode2 = %s\n", index,
getMethodMode(reader1.getMethodFlags(index)),
getMethodMode(reader2.getMethodFlags(index)));
2001-02-15 15:01:07 +00:00
}
nError++;
}
if ( options.fullCheck() && (reader1.getMethodDocumentation(index) != reader2.getMethodDocumentation(index)) )
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() )
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Method %d: Doku1 = %s\n Doku2 = %s\n", index,
U2S(reader1.getMethodDocumentation(index)),
U2S(reader2.getMethodDocumentation(index)));
2001-02-15 15:01:07 +00:00
}
nError++;
}
return nError;
}
static char const * getReferenceType(RTReferenceType refType)
2001-02-15 15:01:07 +00:00
{
switch (refType)
{
case RTReferenceType::SUPPORTS:
return "RTReferenceType::SUPPORTS";
case RTReferenceType::OBSERVES:
return "RTReferenceType::OBSERVES";
case RTReferenceType::EXPORTS:
return "RTReferenceType::EXPORTS";
case RTReferenceType::NEEDS:
return "RTReferenceType::NEEDS";
default:
return "RTReferenceType::INVALID";
2001-02-15 15:01:07 +00:00
}
}
static sal_uInt32 checkReference(Options_Impl const & options,
const OUString& keyName,
2001-02-15 15:01:07 +00:00
RTTypeClass typeClass,
bool & bDump,
typereg::Reader& reader1,
typereg::Reader& reader2,
sal_uInt16 index1,
sal_uInt16 index2)
2001-02-15 15:01:07 +00:00
{
sal_uInt32 nError = 0;
if ( reader1.getReferenceTypeName(index1) != reader2.getReferenceTypeName(index2) )
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() && !options.unoTypeCheck() )
2001-02-15 15:01:07 +00:00
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Reference %d: Name1 = %s != Name2 = %s\n", index1,
U2S(reader1.getReferenceTypeName(index1)),
U2S(reader2.getReferenceTypeName(index2)));
2001-02-15 15:01:07 +00:00
}
nError++;
}
if ( reader1.getReferenceTypeName(index1) != reader2.getReferenceTypeName(index2) )
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() && !options.unoTypeCheck() )
2001-02-15 15:01:07 +00:00
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Reference %d: Type1 = %s != Type2 = %s\n", index1,
getReferenceType(reader1.getReferenceSort(index1)),
getReferenceType(reader2.getReferenceSort(index2)));
2001-02-15 15:01:07 +00:00
}
nError++;
}
if ( options.fullCheck() && (reader1.getReferenceDocumentation(index1) != reader2.getReferenceDocumentation(index2)) )
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() && !options.unoTypeCheck() )
2001-02-15 15:01:07 +00:00
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Reference %d: Doku1 = %s\n Doku2 = %s\n", index1,
U2S(reader1.getReferenceDocumentation(index1)),
U2S(reader2.getReferenceDocumentation(index2)));
2001-02-15 15:01:07 +00:00
}
nError++;
}
if ( reader1.getReferenceFlags(index1) != reader2.getReferenceFlags(index2) )
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() && !options.unoTypeCheck() )
2001-02-15 15:01:07 +00:00
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Reference %d: Access1 = %s != Access2 = %s\n", index1,
getFieldAccess(reader1.getReferenceFlags(index1)).getStr(),
getFieldAccess(reader1.getReferenceFlags(index2)).getStr());
2001-02-15 15:01:07 +00:00
}
nError++;
}
return nError;
}
static sal_uInt32 checkFieldsWithoutOrder(Options_Impl const & options,
const OUString& keyName,
RTTypeClass typeClass,
bool & bDump,
typereg::Reader& reader1,
typereg::Reader& reader2)
{
sal_uInt32 nError = 0;
sal_uInt16 nFields1 = (sal_uInt16)reader1.getFieldCount();
sal_uInt16 nFields2 = (sal_uInt16)reader2.getFieldCount();
sal_uInt16 i=0, j=0;
if ( nFields1 > nFields2 )
{
if ( options.forceOutput() )
{
dumpTypeClass (bDump, typeClass, keyName);
fprintf(stdout, " %s1 contains %d more properties as %s2\n",
getTypeClass(typeClass), nFields1-nFields2, getTypeClass(typeClass));
}
}
bool bFound = false;
CWS-TOOLING: integrate CWS sb103 2009-01-15 15:28:08 +0100 sb r266375 : #i97629# set UNO_PATH in python start program and use it in bootstrap function in officehelper.py (and do not erroneously encode a vnd.sun.star.pathname URE_BOOTSTRAP value in tools::extendApplicationEnvironment) 2009-01-15 10:40:17 +0100 sb r266338 : #i97424# explicit shut down of ImplImageTree singleton in DeInitVCL still required 2009-01-14 12:07:15 +0100 sb r266276 : CWS-TOOLING: rebase CWS sb103 to trunk@265758 (milestone: DEV300:m38) 2009-01-14 08:53:02 +0100 sb r266266 : #i96284# remove implementation of unused (but expensive) link feature; plus some general cleanup 2009-01-08 14:42:59 +0100 sb r266010 : #i96683# enable dlclose for GCC 3 (based on a patch by cmc) 2009-01-06 14:18:23 +0100 sb r265920 : #i97424# spurious unreferenced local variables 2008-12-19 15:33:39 +0100 sb r265727 : #i57359# no need for a special glibc 2.2.4 based libgcc_s.so.1 for URE any more as the general one used for OOo is guaranteed to be based on at least glibc 2.2.4, anyway 2008-12-19 13:54:37 +0100 sb r265724 : #i97424# clean up and speed up vcl ImplImageTree 2008-12-18 14:28:10 +0100 sb r265690 : #i97132# spread usage of the rtl::Static pattern (patch by cmc) 2008-12-15 14:33:00 +0100 sb r265499 : #i90492# generate UTF-8 encoded output (patch by tora) 2008-12-15 11:45:05 +0100 sb r265469 : #i95593# -Djava.library.path to find libtest_javauno_any.so 2008-12-15 11:23:14 +0100 sb r265468 : #i93769# it appears that Java nowadays expects file URIs in UTF-8, so ExternalUriReferenceTranslator.toExternal must not be called 2008-12-10 12:02:50 +0100 sb r265164 : #i93219# use (corrected) signal handling instead of forking again (to avoid unintended generation of core files)
2009-02-12 09:18:09 +00:00
::std::set< sal_uInt16 > moreProps;
for (i=0; i < nFields1; i++)
{
for (j=0; j < nFields2; j++)
{
if (!checkField(options, keyName, typeClass, bDump, reader1, reader2, i, j, SILENT))
{
bFound = true;
moreProps.insert(j);
break;
}
}
if (!bFound)
{
if (options.forceOutput())
{
dumpTypeClass (bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " incompatible change: Field %d ('%s') of r1 is not longer a property of this %s in r2\n",
i, U2S(shortName(reader1.getFieldName(i))), getTypeClass(typeClass));
}
nError++;
}
else
{
bFound = false;
}
}
if ( typeClass == RT_TYPE_SERVICE && !moreProps.empty() )
{
for (j=0; j < nFields2; j++)
{
if ( moreProps.find(j) == moreProps.end() )
{
if ( (reader2.getFieldFlags(j) & RTFieldAccess::OPTIONAL) != RTFieldAccess::OPTIONAL )
{
if ( options.forceOutput() )
{
dumpTypeClass (bDump, typeClass, keyName);
fprintf(stdout,
" incompatible change: Field %d ('%s') of r2 is a new property"
" compared to this %s in r1 and is not 'optional'\n",
j, U2S(shortName(reader2.getFieldName(j))), getTypeClass(typeClass));
}
nError++;
}
}
}
}
return nError;
}
static sal_uInt32 checkBlob(
Options_Impl const & options,
const OUString& keyName,
typereg::Reader& reader1, sal_uInt32 size1,
typereg::Reader& reader2, sal_uInt32 size2)
2001-02-15 15:01:07 +00:00
{
sal_uInt32 nError = 0;
bool bDump = true;
2001-02-15 15:01:07 +00:00
if ( options.fullCheck() && (size1 != size2) )
{
if ( options.forceOutput() )
{
fprintf(
stdout, " Size1 = %lu Size2 = %lu\n",
sal::static_int_cast< unsigned long >(size1),
sal::static_int_cast< unsigned long >(size2));
2001-02-15 15:01:07 +00:00
}
}
if (reader1.isPublished())
{
if (!reader2.isPublished())
{
if (options.forceOutput())
{
dumpTypeClass(bDump, /*"?"*/ reader1.getTypeClass(), keyName);
fprintf(stdout, " published in 1 but unpublished in 2\n");
}
++nError;
}
}
else if (!options.checkUnpublished())
{
return nError;
}
2001-02-15 15:01:07 +00:00
if ( reader1.getTypeClass() != reader2.getTypeClass() )
{
if ( options.forceOutput() )
{
dumpTypeClass(bDump, /*"?"*/ reader1.getTypeClass(), keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " TypeClass1 = %s != TypeClass2 = %s\n",
2001-02-15 15:01:07 +00:00
getTypeClass(reader1.getTypeClass()),
getTypeClass(reader2.getTypeClass()));
}
return ++nError;
}
RTTypeClass typeClass = reader1.getTypeClass();
if ( reader1.getTypeName() != reader2.getTypeName() )
{
if ( options.forceOutput() )
{
dumpTypeClass(bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " TypeName1 = %s != TypeName2 = %s\n",
2001-02-15 15:01:07 +00:00
U2S(reader1.getTypeName()), U2S(reader2.getTypeName()));
}
nError++;
}
if ( (typeClass == RT_TYPE_INTERFACE ||
typeClass == RT_TYPE_STRUCT ||
typeClass == RT_TYPE_EXCEPTION) )
{
if (reader1.getSuperTypeCount() != reader2.getSuperTypeCount())
{
dumpTypeClass(bDump, typeClass, keyName);
fprintf(
stdout, " SuperTypeCount1 = %d != SuperTypeCount2 = %d\n",
static_cast< int >(reader1.getSuperTypeCount()),
static_cast< int >(reader2.getSuperTypeCount()));
++nError;
} else
{
for (sal_Int16 i = 0; i < reader1.getSuperTypeCount(); ++i)
{
if (reader1.getSuperTypeName(i) != reader2.getSuperTypeName(i))
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() )
{
dumpTypeClass(bDump, typeClass, keyName);
fprintf(stdout, " SuperTypeName1 = %s != SuperTypeName2 = %s\n",
U2S(reader1.getSuperTypeName(i)), U2S(reader2.getSuperTypeName(i)));
}
nError++;
2001-02-15 15:01:07 +00:00
}
}
}
}
2001-02-15 15:01:07 +00:00
sal_uInt16 nFields1 = (sal_uInt16)reader1.getFieldCount();
sal_uInt16 nFields2 = (sal_uInt16)reader2.getFieldCount();
bool bCheckNormal = true;
if ( (typeClass == RT_TYPE_SERVICE ||
typeClass == RT_TYPE_MODULE ||
typeClass == RT_TYPE_CONSTANTS) && options.unoTypeCheck() )
2001-02-15 15:01:07 +00:00
{
bCheckNormal = false;
}
if ( bCheckNormal )
{
if ( nFields1 != nFields2 )
{
if ( options.forceOutput() )
{
dumpTypeClass(bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " nFields1 = %d != nFields2 = %d\n", nFields1, nFields2);
}
nError++;
}
sal_uInt16 i;
for (i=0; i < nFields1 && i < nFields2; i++)
{
nError += checkField(options, keyName, typeClass, bDump, reader1, reader2, i, i, REPORT);
}
if ( i < nFields1 && options.forceOutput() )
2001-02-15 15:01:07 +00:00
{
dumpTypeClass(bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Registry1 contains %d more fields\n", nFields1 - i);
2001-02-15 15:01:07 +00:00
}
if ( i < nFields2 && options.forceOutput() )
2001-02-15 15:01:07 +00:00
{
dumpTypeClass(bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Registry2 contains %d more fields\n", nFields2 - i);
2001-02-15 15:01:07 +00:00
}
}
else
2001-02-15 15:01:07 +00:00
{
nError += checkFieldsWithoutOrder(options, keyName, typeClass, bDump, reader1, reader2);
2001-02-15 15:01:07 +00:00
}
2001-02-15 15:01:07 +00:00
if ( typeClass == RT_TYPE_INTERFACE )
{
sal_uInt16 nMethods1 = (sal_uInt16)reader1.getMethodCount();
sal_uInt16 nMethods2 = (sal_uInt16)reader2.getMethodCount();
if ( nMethods1 != nMethods2 )
{
if ( options.forceOutput() )
{
dumpTypeClass(bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " nMethods1 = %d != nMethods2 = %d\n", nMethods1, nMethods2);
2001-02-15 15:01:07 +00:00
}
nError++;
}
sal_uInt16 i;
2001-02-15 15:01:07 +00:00
for (i=0; i < nMethods1 && i < nMethods2; i++)
{
nError += checkMethod(options, keyName, typeClass, bDump, reader1, reader2, i);
2001-02-15 15:01:07 +00:00
}
if ( i < nMethods1 && options.forceOutput() )
{
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Registry1 contains %d more methods\n", nMethods1 - i);
2001-02-15 15:01:07 +00:00
}
if ( i < nMethods2 && options.forceOutput() )
{
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Registry2 contains %d more methods\n", nMethods2 - i);
2001-02-15 15:01:07 +00:00
}
}
if ( typeClass == RT_TYPE_SERVICE )
{
sal_uInt16 nReference1 = (sal_uInt16)reader1.getReferenceCount();
sal_uInt16 nReference2 = (sal_uInt16)reader2.getReferenceCount();
if ( !bCheckNormal )
2001-02-15 15:01:07 +00:00
{
sal_uInt16 i=0, j=0;
if ( nReference1 > nReference2 )
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() )
2001-02-15 15:01:07 +00:00
{
dumpTypeClass(bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " service1 contains %d more references as service2\n",
nReference1-nReference2);
2001-02-15 15:01:07 +00:00
}
}
bool bFound = false;
CWS-TOOLING: integrate CWS sb103 2009-01-15 15:28:08 +0100 sb r266375 : #i97629# set UNO_PATH in python start program and use it in bootstrap function in officehelper.py (and do not erroneously encode a vnd.sun.star.pathname URE_BOOTSTRAP value in tools::extendApplicationEnvironment) 2009-01-15 10:40:17 +0100 sb r266338 : #i97424# explicit shut down of ImplImageTree singleton in DeInitVCL still required 2009-01-14 12:07:15 +0100 sb r266276 : CWS-TOOLING: rebase CWS sb103 to trunk@265758 (milestone: DEV300:m38) 2009-01-14 08:53:02 +0100 sb r266266 : #i96284# remove implementation of unused (but expensive) link feature; plus some general cleanup 2009-01-08 14:42:59 +0100 sb r266010 : #i96683# enable dlclose for GCC 3 (based on a patch by cmc) 2009-01-06 14:18:23 +0100 sb r265920 : #i97424# spurious unreferenced local variables 2008-12-19 15:33:39 +0100 sb r265727 : #i57359# no need for a special glibc 2.2.4 based libgcc_s.so.1 for URE any more as the general one used for OOo is guaranteed to be based on at least glibc 2.2.4, anyway 2008-12-19 13:54:37 +0100 sb r265724 : #i97424# clean up and speed up vcl ImplImageTree 2008-12-18 14:28:10 +0100 sb r265690 : #i97132# spread usage of the rtl::Static pattern (patch by cmc) 2008-12-15 14:33:00 +0100 sb r265499 : #i90492# generate UTF-8 encoded output (patch by tora) 2008-12-15 11:45:05 +0100 sb r265469 : #i95593# -Djava.library.path to find libtest_javauno_any.so 2008-12-15 11:23:14 +0100 sb r265468 : #i93769# it appears that Java nowadays expects file URIs in UTF-8, so ExternalUriReferenceTranslator.toExternal must not be called 2008-12-10 12:02:50 +0100 sb r265164 : #i93219# use (corrected) signal handling instead of forking again (to avoid unintended generation of core files)
2009-02-12 09:18:09 +00:00
::std::set< sal_uInt16 > moreReferences;
for (i=0; i < nReference1; i++)
{
for (j=0; j < nReference2; j++)
{
if (!checkReference(options, keyName, typeClass, bDump, reader1, reader2, i, j))
{
bFound = true;
moreReferences.insert(j);
break;
}
}
if (!bFound)
{
if (options.forceOutput())
{
dumpTypeClass(bDump, typeClass, keyName);
fprintf(stdout,
" incompatible change: Reference %d ('%s') in 'r1' is not longer a reference"
" of this service in 'r2'\n",
i, U2S(shortName(reader1.getReferenceTypeName(i))));
}
nError++;
}
else
{
bFound = false;
}
}
if ( !moreReferences.empty() )
{
for (j=0; j < nReference2; j++)
{
if ( moreReferences.find(j) == moreReferences.end() )
{
if ( (reader2.getReferenceFlags(j) & RTFieldAccess::OPTIONAL) != RTFieldAccess::OPTIONAL )
{
if ( options.forceOutput() )
{
dumpTypeClass(bDump, typeClass, keyName);
fprintf(stdout,
" incompatible change: Reference %d ('%s') of r2 is a new reference"
" compared to this service in r1 and is not 'optional'\n",
j, U2S(shortName(reader2.getReferenceTypeName(j))));
}
nError++;
}
}
}
}
}
else
2001-02-15 15:01:07 +00:00
{
if ( nReference1 != nReference2 )
{
if ( options.forceOutput() )
{
dumpTypeClass(bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " nReferences1 = %d != nReferences2 = %d\n", nReference1, nReference2);
}
nError++;
}
sal_uInt16 i;
for (i=0; i < nReference1 && i < nReference2; i++)
{
nError += checkReference(options, keyName, typeClass, bDump, reader1, reader2, i, i);
}
if ( i < nReference1 && options.forceOutput() )
{
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Registry1 contains %d more references\n", nReference1 - i);
}
if ( i < nReference2 && options.forceOutput() )
{
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Registry2 contains %d more references\n", nReference2 - i);
}
2001-02-15 15:01:07 +00:00
}
}
if ( options.fullCheck() && (reader1.getDocumentation() != reader2.getDocumentation()) )
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() )
{
dumpTypeClass(bDump, typeClass, keyName);
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Doku1 = %s\n Doku2 = %s\n",
U2S(reader1.getDocumentation()), U2S(reader2.getDocumentation()));
2001-02-15 15:01:07 +00:00
}
nError++;
}
return nError;
}
static sal_uInt32 checkValueDifference(
Options_Impl const & options,
RegistryKey& key1, RegValueType valueType1, sal_uInt32 size1,
RegistryKey& key2, RegValueType valueType2, sal_uInt32 size2)
2001-02-15 15:01:07 +00:00
{
OUString tmpName;
sal_uInt32 nError = 0;
if ( valueType1 == valueType2 )
{
bool bEqual = true;
switch (valueType1)
2001-02-15 15:01:07 +00:00
{
case RegValueType::LONGLIST:
2001-02-15 15:01:07 +00:00
{
RegistryValueList<sal_Int32> valueList1;
RegistryValueList<sal_Int32> valueList2;
key1.getLongListValue(tmpName, valueList1);
key2.getLongListValue(tmpName, valueList2);
sal_uInt32 length1 = valueList1.getLength();
sal_uInt32 length2 = valueList1.getLength();
if ( length1 != length2 )
{
bEqual = false;
2001-02-15 15:01:07 +00:00
break;
}
for (sal_uInt32 i=0; i<length1; i++)
{
if ( valueList1.getElement(i) != valueList2.getElement(i) )
{
bEqual = false;
2001-02-15 15:01:07 +00:00
break;
}
}
}
break;
case RegValueType::STRINGLIST:
{
2001-02-15 15:01:07 +00:00
RegistryValueList<sal_Char*> valueList1;
RegistryValueList<sal_Char*> valueList2;
key1.getStringListValue(tmpName, valueList1);
key2.getStringListValue(tmpName, valueList2);
sal_uInt32 length1 = valueList1.getLength();
sal_uInt32 length2 = valueList1.getLength();
if ( length1 != length2 )
{
bEqual = false;
2001-02-15 15:01:07 +00:00
break;
}
for (sal_uInt32 i=0; i<length1; i++)
{
if ( strcmp(valueList1.getElement(i), valueList2.getElement(i)) != 0 )
{
bEqual = false;
2001-02-15 15:01:07 +00:00
break;
}
}
}
break;
case RegValueType::UNICODELIST:
{
2001-02-15 15:01:07 +00:00
RegistryValueList<sal_Unicode*> valueList1;
RegistryValueList<sal_Unicode*> valueList2;
key1.getUnicodeListValue(tmpName, valueList1);
key2.getUnicodeListValue(tmpName, valueList2);
sal_uInt32 length1 = valueList1.getLength();
sal_uInt32 length2 = valueList1.getLength();
if ( length1 != length2 )
{
bEqual = false;
2001-02-15 15:01:07 +00:00
break;
}
for (sal_uInt32 i=0; i<length1; i++)
{
if ( rtl_ustr_compare(valueList1.getElement(i), valueList2.getElement(i)) != 0 )
{
bEqual = false;
2001-02-15 15:01:07 +00:00
break;
}
}
}
break;
default:
break;
2001-02-15 15:01:07 +00:00
}
if ( bEqual)
{
std::vector< sal_uInt8 > value1(size1);
key1.getValue(tmpName, &value1[0]);
2001-02-15 15:01:07 +00:00
std::vector< sal_uInt8 > value2(size2);
key2.getValue(tmpName, &value2[0]);
2001-02-15 15:01:07 +00:00
bEqual = (memcmp(&value1[0], &value2[0], value1.size()) == 0 );
if ( !bEqual && valueType1 == RegValueType::BINARY && valueType2 == RegValueType::BINARY )
2001-02-15 15:01:07 +00:00
{
typereg::Reader reader1(&value1[0], value1.size(), false, TYPEREG_VERSION_1);
typereg::Reader reader2(&value2[0], value2.size(), false, TYPEREG_VERSION_1);
2001-02-15 15:01:07 +00:00
if ( reader1.isValid() && reader2.isValid() )
{
return checkBlob(options, key1.getName(), reader1, size1, reader2, size2);
2001-02-15 15:01:07 +00:00
}
}
if ( bEqual )
{
return 0;
}
else
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() )
{
fprintf(stdout, "Difference: key values of key \"%s\" are different\n", U2S(key1.getName()));
2001-02-15 15:01:07 +00:00
}
nError++;
}
}
}
if ( options.forceOutput() )
{
switch (valueType1)
{
case RegValueType::NOT_DEFINED:
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Registry 1: key has no value\n");
2001-02-15 15:01:07 +00:00
break;
case RegValueType::LONG:
2001-02-15 15:01:07 +00:00
{
std::vector< sal_uInt8 > value1(size1);
key1.getValue(tmpName, &value1[0]);
fprintf(stdout, " Registry 1: Value: Type = RegValueType::LONG\n");
fprintf(
stdout, " Size = %lu\n",
sal::static_int_cast< unsigned long >(size1));
fprintf(stdout, " Data = %p\n", &value1[0]);
}
break;
case RegValueType::STRING:
{
std::vector< sal_uInt8 > value1(size1);
key1.getValue(tmpName, &value1[0]);
fprintf(stdout, " Registry 1: Value: Type = RegValueType::STRING\n");
fprintf(
stdout, " Size = %lu\n",
sal::static_int_cast< unsigned long >(size1));
fprintf(stdout, " Data = \"%s\"\n", reinterpret_cast<char const*>(&value1[0]));
}
break;
case RegValueType::UNICODE:
{
std::vector< sal_uInt8 > value1(size1);
key1.getValue(tmpName, &value1[0]);
OUString uStrValue(reinterpret_cast<sal_Unicode const*>(&value1[0]));
fprintf(stdout, " Registry 1: Value: Type = RegValueType::UNICODE\n");
fprintf(
stdout, " Size = %lu\n",
sal::static_int_cast< unsigned long >(size1));
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Data = \"%s\"\n", U2S(uStrValue));
2001-02-15 15:01:07 +00:00
}
break;
case RegValueType::BINARY:
fprintf(stdout, " Registry 1: Value: Type = RegValueType::BINARY\n");
2001-02-15 15:01:07 +00:00
break;
case RegValueType::LONGLIST:
2001-02-15 15:01:07 +00:00
{
RegistryValueList<sal_Int32> valueList;
key1.getLongListValue(tmpName, valueList);
fprintf(stdout, " Registry 1: Value: Type = RegValueType::LONGLIST\n");
fprintf(
stdout, " Size = %lu\n",
sal::static_int_cast< unsigned long >(size1));
sal_uInt32 length = valueList.getLength();
for (sal_uInt32 i=0; i<length; i++)
{
fprintf(
stdout, " Data[%lu] = %ld\n",
sal::static_int_cast< unsigned long >(i),
sal::static_int_cast< long >(valueList.getElement(i)));
}
2001-02-15 15:01:07 +00:00
}
break;
case RegValueType::STRINGLIST:
2001-02-15 15:01:07 +00:00
{
RegistryValueList<sal_Char*> valueList;
key1.getStringListValue(tmpName, valueList);
fprintf(stdout, " Registry 1: Value: Type = RegValueType::STRINGLIST\n");
fprintf(
stdout, " Size = %lu\n",
sal::static_int_cast< unsigned long >(size1));
sal_uInt32 length = valueList.getLength();
for (sal_uInt32 i=0; i<length; i++)
{
fprintf(
stdout, " Data[%lu] = \"%s\"\n",
sal::static_int_cast< unsigned long >(i),
valueList.getElement(i));
}
2001-02-15 15:01:07 +00:00
}
break;
case RegValueType::UNICODELIST:
2001-02-15 15:01:07 +00:00
{
RegistryValueList<sal_Unicode*> valueList;
key1.getUnicodeListValue(tmpName, valueList);
fprintf(stdout, " Registry 1: Value: Type = RegValueType::UNICODELIST\n");
fprintf(
stdout, " Size = %lu\n",
sal::static_int_cast< unsigned long >(size1));
sal_uInt32 length = valueList.getLength();
OUString uStrValue;
for (sal_uInt32 i=0; i<length; i++)
{
uStrValue = OUString(valueList.getElement(i));
fprintf(
stdout, " Data[%lu] = \"%s\"\n",
sal::static_int_cast< unsigned long >(i), U2S(uStrValue));
}
2001-02-15 15:01:07 +00:00
}
break;
}
switch (valueType2)
{
case RegValueType::NOT_DEFINED:
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Registry 2: key has no value\n");
2001-02-15 15:01:07 +00:00
break;
case RegValueType::LONG:
2001-02-15 15:01:07 +00:00
{
std::vector< sal_uInt8 > value2(size2);
key2.getValue(tmpName, &value2[0]);
fprintf(stdout, " Registry 2: Value: Type = RegValueType::LONG\n");
fprintf(
stdout, " Size = %lu\n",
sal::static_int_cast< unsigned long >(size2));
fprintf(stdout, " Data = %p\n", &value2[0]);
}
break;
case RegValueType::STRING:
{
std::vector< sal_uInt8 > value2(size2);
key2.getValue(tmpName, &value2[0]);
fprintf(stdout, " Registry 2: Value: Type = RegValueType::STRING\n");
fprintf(
stdout, " Size = %lu\n",
sal::static_int_cast< unsigned long >(size2));
fprintf(stdout, " Data = \"%s\"\n", reinterpret_cast<char const*>(&value2[0]));
}
break;
case RegValueType::UNICODE:
{
std::vector< sal_uInt8 > value2(size2);
key2.getValue(tmpName, &value2[0]);
OUString uStrValue(reinterpret_cast<sal_Unicode const*>(&value2[0]));
fprintf(stdout, " Registry 2: Value: Type = RegValueType::UNICODE\n");
fprintf(
stdout, " Size = %lu\n",
sal::static_int_cast< unsigned long >(size2));
2002-11-27 13:19:37 +00:00
fprintf(stdout, " Data = \"%s\"\n", U2S(uStrValue));
2001-02-15 15:01:07 +00:00
}
break;
case RegValueType::BINARY:
fprintf(stdout, " Registry 2: Value: Type = RegValueType::BINARY\n");
2001-02-15 15:01:07 +00:00
break;
case RegValueType::LONGLIST:
2001-02-15 15:01:07 +00:00
{
RegistryValueList<sal_Int32> valueList;
key2.getLongListValue(tmpName, valueList);
fprintf(stdout, " Registry 2: Value: Type = RegValueType::LONGLIST\n");
fprintf(
stdout, " Size = %lu\n",
sal::static_int_cast< unsigned long >(size2));
sal_uInt32 length = valueList.getLength();
for (sal_uInt32 i=0; i<length; i++)
{
fprintf(
stdout, " Data[%lu] = %ld\n",
sal::static_int_cast< unsigned long >(i),
sal::static_int_cast< long >(valueList.getElement(i)));
}
2001-02-15 15:01:07 +00:00
}
break;
case RegValueType::STRINGLIST:
2001-02-15 15:01:07 +00:00
{
RegistryValueList<sal_Char*> valueList;
key2.getStringListValue(tmpName, valueList);
fprintf(stdout, " Registry 2: Value: Type = RegValueType::STRINGLIST\n");
fprintf(
stdout, " Size = %lu\n",
sal::static_int_cast< unsigned long >(size2));
sal_uInt32 length = valueList.getLength();
for (sal_uInt32 i=0; i<length; i++)
{
fprintf(
stdout, " Data[%lu] = \"%s\"\n",
sal::static_int_cast< unsigned long >(i),
valueList.getElement(i));
}
2001-02-15 15:01:07 +00:00
}
break;
case RegValueType::UNICODELIST:
2001-02-15 15:01:07 +00:00
{
RegistryValueList<sal_Unicode*> valueList;
key2.getUnicodeListValue(tmpName, valueList);
fprintf(stdout, " Registry 2: Value: Type = RegValueType::UNICODELIST\n");
fprintf(
stdout, " Size = %lu\n",
sal::static_int_cast< unsigned long >(size2));
sal_uInt32 length = valueList.getLength();
OUString uStrValue;
for (sal_uInt32 i=0; i<length; i++)
{
uStrValue = OUString(valueList.getElement(i));
fprintf(
stdout, " Data[%lu] = \"%s\"\n",
sal::static_int_cast< unsigned long >(i), U2S(uStrValue));
}
2001-02-15 15:01:07 +00:00
}
break;
}
}
return nError;
}
static bool hasPublishedChildren(Options_Impl const & options, RegistryKey & key)
{
RegistryKeyNames subKeyNames;
key.getKeyNames(OUString(), subKeyNames);
for (sal_uInt32 i = 0; i < subKeyNames.getLength(); ++i)
{
OUString keyName(subKeyNames.getElement(i));
if (!options.matchedWithExcludeKey(keyName))
{
keyName = keyName.copy(keyName.lastIndexOf('/') + 1);
RegistryKey subKey;
if (key.openKey(keyName, subKey) == RegError::NO_ERROR)
{
if (options.forceOutput())
{
fprintf(
stdout,
("WARNING: could not open key \"%s\" in registry"
" \"%s\"\n"),
U2S(subKeyNames.getElement(i)),
options.getRegName1().c_str());
}
}
if (subKey.isValid())
{
RegValueType type;
sal_uInt32 size;
if (subKey.getValueInfo(OUString(), &type, &size) != RegError::NO_ERROR)
{
if (options.forceOutput())
{
fprintf(
stdout,
("WARNING: could not read key \"%s\" in registry"
" \"%s\"\n"),
U2S(subKeyNames.getElement(i)),
options.getRegName1().c_str());
}
}
else if (type == RegValueType::BINARY)
{
bool published = false;
std::vector< sal_uInt8 > value(size);
if (subKey.getValue(OUString(), &value[0]) != RegError::NO_ERROR)
{
if (options.forceOutput())
{
fprintf(
stdout,
("WARNING: could not read key \"%s\" in"
" registry \"%s\"\n"),
U2S(subKeyNames.getElement(i)),
options.getRegName1().c_str());
}
}
else
{
published = typereg::Reader(&value[0], value.size(), false, TYPEREG_VERSION_1).isPublished();
}
if (published)
{
return true;
}
}
}
}
}
return false;
}
static sal_uInt32 checkDifferences(
Options_Impl const & options,
RegistryKey& key, StringSet& keys,
RegistryKeyNames& subKeyNames1,
RegistryKeyNames& subKeyNames2)
2001-02-15 15:01:07 +00:00
{
sal_uInt32 nError = 0;
sal_uInt32 length1 = subKeyNames1.getLength();
sal_uInt32 length2 = subKeyNames2.getLength();
sal_uInt32 i,j;
for (i=0; i<length1; i++)
{
bool bFound = false;
2001-02-15 15:01:07 +00:00
for (j=0; j<length2; j++)
{
if ( subKeyNames1.getElement(i) == subKeyNames2.getElement(j) )
{
bFound = true;
2001-02-15 15:01:07 +00:00
keys.insert(subKeyNames1.getElement(i));
break;
}
}
if ( !bFound )
2001-02-15 15:01:07 +00:00
{
if ( options.fullCheck() )
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() )
{
fprintf(stdout, "EXISTENCE: key \"%s\" exists only in registry \"%s\"\n",
U2S(subKeyNames1.getElement(i)), options.getRegName1().c_str());
}
nError++;
2001-02-15 15:01:07 +00:00
}
else
{
OUString keyName(subKeyNames1.getElement(i));
if (!options.matchedWithExcludeKey(keyName))
{
keyName = keyName.copy(keyName.lastIndexOf('/') + 1);
RegistryKey subKey;
if (key.openKey(keyName, subKey) != RegError::NO_ERROR)
{
if (options.forceOutput())
{
fprintf(
stdout,
("ERROR: could not open key \"%s\" in registry"
" \"%s\"\n"),
U2S(subKeyNames1.getElement(i)),
options.getRegName1().c_str());
}
++nError;
}
if (subKey.isValid())
{
RegValueType type;
sal_uInt32 size;
if (subKey.getValueInfo(OUString(), &type, &size) != RegError::NO_ERROR)
{
if (options.forceOutput())
{
fprintf(
stdout,
("ERROR: could not read key \"%s\" in"
" registry \"%s\"\n"),
U2S(subKeyNames1.getElement(i)),
options.getRegName1().c_str());
}
++nError;
}
else if (type == RegValueType::BINARY)
{
std::vector< sal_uInt8 > value(size);
if (subKey.getValue(OUString(), &value[0]) != RegError::NO_ERROR)
{
if (options.forceOutput())
{
fprintf(
stdout,
("ERROR: could not read key \"%s\" in"
" registry \"%s\"\n"),
U2S(subKeyNames1.getElement(i)),
options.getRegName1().c_str());
}
++nError;
}
else
{
typereg::Reader reader(&value[0], value.size(), false, TYPEREG_VERSION_1);
if (reader.getTypeClass() == RT_TYPE_MODULE)
{
if (options.checkUnpublished() || hasPublishedChildren(options, subKey))
{
if (options.forceOutput())
{
fprintf(
stdout,
("EXISTENCE: module \"%s\""
" %sexists only in registry"
" 1\n"),
U2S(subKeyNames1.getElement(i)),
(options.checkUnpublished()
? ""
: "with published children "));
}
++nError;
}
}
else if (options.checkUnpublished() || reader.isPublished())
{
if (options.forceOutput())
{
fprintf(
stdout,
("EXISTENCE: %spublished key \"%s\""
" exists only in registry 1\n"),
reader.isPublished() ? "" : "un",
U2S(subKeyNames1.getElement(i)));
}
++nError;
}
}
}
}
}
}
}
2001-02-15 15:01:07 +00:00
}
for (i=0; i<length2; i++)
{
bool bFound = false;
2001-02-15 15:01:07 +00:00
for (j=0; j<length1; j++)
{
if ( subKeyNames2.getElement(i) == subKeyNames1.getElement(j) )
{
bFound = true;
2001-02-15 15:01:07 +00:00
keys.insert(subKeyNames2.getElement(i));
break;
}
}
if ( !bFound && options.fullCheck() )
{
if ( options.forceOutput() )
{
2002-11-27 13:19:37 +00:00
fprintf(stdout, "EXISTENCE: key \"%s\" exists only in registry \"%s\"\n",
U2S(subKeyNames2.getElement(i)), options.getRegName2().c_str());
2001-02-15 15:01:07 +00:00
}
nError++;
}
2001-02-15 15:01:07 +00:00
}
return nError;
}
static sal_uInt32 compareKeys(
Options_Impl const & options,
RegistryKey& key1,
RegistryKey& key2)
2001-02-15 15:01:07 +00:00
{
sal_uInt32 nError = 0;
RegValueType valueType1 = RegValueType::NOT_DEFINED;
RegValueType valueType2 = RegValueType::NOT_DEFINED;
2001-02-15 15:01:07 +00:00
sal_uInt32 size1 = 0;
sal_uInt32 size2 = 0;
2001-02-15 15:01:07 +00:00
OUString tmpName;
RegError e1 = key1.getValueInfo(tmpName, &valueType1, &size1);
RegError e2 = key2.getValueInfo(tmpName, &valueType2, &size2);
if ( (e1 == e2) && (e1 != RegError::VALUE_NOT_EXISTS) && (e1 != RegError::INVALID_VALUE) )
2001-02-15 15:01:07 +00:00
{
nError += checkValueDifference(options, key1, valueType1, size1, key2, valueType2, size2);
}
else
2001-02-15 15:01:07 +00:00
{
if ( (e1 != RegError::INVALID_VALUE) || (e2 != RegError::INVALID_VALUE) )
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() )
{
2002-11-27 13:19:37 +00:00
fprintf(stdout, "VALUES: key values of key \"%s\" are different\n", U2S(key1.getName()));
2001-02-15 15:01:07 +00:00
}
nError++;
}
}
RegistryKeyNames subKeyNames1;
RegistryKeyNames subKeyNames2;
key1.getKeyNames(tmpName, subKeyNames1);
key2.getKeyNames(tmpName, subKeyNames2);
StringSet keys;
nError += checkDifferences(options, key1, keys, subKeyNames1, subKeyNames2);
2001-02-15 15:01:07 +00:00
StringSet::iterator iter = keys.begin();
StringSet::iterator end = keys.end();
while ( iter != end )
{
OUString keyName(*iter);
if ( options.matchedWithExcludeKey(keyName) )
2001-02-15 15:01:07 +00:00
{
++iter;
2001-02-15 15:01:07 +00:00
continue;
}
2001-05-10 09:49:31 +00:00
sal_Int32 nPos = keyName.lastIndexOf( '/' );
keyName = keyName.copy( nPos != -1 ? nPos+1 : 0 );
RegistryKey subKey1;
if ( key1.openKey(keyName, subKey1) != RegError::NO_ERROR )
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() )
{
2002-11-27 13:19:37 +00:00
fprintf(stdout, "ERROR: could not open key \"%s\" in registry \"%s\"\n",
U2S(*iter), options.getRegName1().c_str());
2001-02-15 15:01:07 +00:00
}
nError++;
}
RegistryKey subKey2;
if ( key2.openKey(keyName, subKey2) != RegError::NO_ERROR )
2001-02-15 15:01:07 +00:00
{
if ( options.forceOutput() )
{
2002-11-27 13:19:37 +00:00
fprintf(stdout, "ERROR: could not open key \"%s\" in registry \"%s\"\n",
U2S(*iter), options.getRegName2().c_str());
2001-02-15 15:01:07 +00:00
}
nError++;
}
2001-02-15 15:01:07 +00:00
if ( subKey1.isValid() && subKey2.isValid() )
{
nError += compareKeys(options, subKey1, subKey2);
2001-02-15 15:01:07 +00:00
}
++iter;
2001-02-15 15:01:07 +00:00
}
return nError;
}
2011-04-16 09:08:29 +02:00
#if (defined UNX) || defined __MINGW32__
2001-09-26 13:03:24 +00:00
int main( int argc, char * argv[] )
2001-02-15 15:01:07 +00:00
#else
int _cdecl main( int argc, char * argv[] )
2001-02-15 15:01:07 +00:00
#endif
{
std::vector< std::string > args;
Options_Impl options(argv[0]);
for (int i = 1; i < argc; i++)
2001-02-15 15:01:07 +00:00
{
if (!Options::checkArgument(args, argv[i], strlen(argv[i])))
{
// failure.
options.printUsage();
return 1;
}
}
if (!options.initOptions(args))
{
return 1;
2001-02-15 15:01:07 +00:00
}
OUString regName1( convertToFileUrl(options.getRegName1().c_str(), options.getRegName1().size()) );
OUString regName2( convertToFileUrl(options.getRegName2().c_str(), options.getRegName2().size()) );
2001-02-15 15:01:07 +00:00
Registry reg1, reg2;
if ( reg1.open(regName1, RegAccessMode::READONLY) != RegError::NO_ERROR )
2001-02-15 15:01:07 +00:00
{
2002-11-27 13:19:37 +00:00
fprintf(stdout, "%s: open registry \"%s\" failed\n",
options.getProgramName().c_str(), options.getRegName1().c_str());
return 2;
2001-02-15 15:01:07 +00:00
}
if ( reg2.open(regName2, RegAccessMode::READONLY) != RegError::NO_ERROR )
2001-02-15 15:01:07 +00:00
{
2002-11-27 13:19:37 +00:00
fprintf(stdout, "%s: open registry \"%s\" failed\n",
options.getProgramName().c_str(), options.getRegName2().c_str());
return 3;
2001-02-15 15:01:07 +00:00
}
RegistryKey key1, key2;
if ( reg1.openRootKey(key1) != RegError::NO_ERROR )
2001-02-15 15:01:07 +00:00
{
2002-11-27 13:19:37 +00:00
fprintf(stdout, "%s: open root key of registry \"%s\" failed\n",
options.getProgramName().c_str(), options.getRegName1().c_str());
return 4;
2001-02-15 15:01:07 +00:00
}
if ( reg2.openRootKey(key2) != RegError::NO_ERROR )
2001-02-15 15:01:07 +00:00
{
2002-11-27 13:19:37 +00:00
fprintf(stdout, "%s: open root key of registry \"%s\" failed\n",
options.getProgramName().c_str(), options.getRegName2().c_str());
return 5;
2001-02-15 15:01:07 +00:00
}
2001-02-15 15:01:07 +00:00
if ( options.isStartKeyValid() )
{
if ( options.matchedWithExcludeKey( options.getStartKey() ) )
2001-02-15 15:01:07 +00:00
{
2002-11-27 13:19:37 +00:00
fprintf(stdout, "%s: start key is equal to one of the exclude keys\n",
options.getProgramName().c_str());
return 6;
2001-02-15 15:01:07 +00:00
}
RegistryKey sk1, sk2;
if ( key1.openKey(options.getStartKey(), sk1) != RegError::NO_ERROR )
2001-02-15 15:01:07 +00:00
{
2002-11-27 13:19:37 +00:00
fprintf(stdout, "%s: open start key of registry \"%s\" failed\n",
options.getProgramName().c_str(), options.getRegName1().c_str());
return 7;
2001-02-15 15:01:07 +00:00
}
if ( key2.openKey(options.getStartKey(), sk2) != RegError::NO_ERROR )
2001-02-15 15:01:07 +00:00
{
2002-11-27 13:19:37 +00:00
fprintf(stdout, "%s: open start key of registry \"%s\" failed\n",
options.getProgramName().c_str(), options.getRegName2().c_str());
return 8;
2001-02-15 15:01:07 +00:00
}
key1 = sk1;
key2 = sk2;
}
sal_uInt32 nError = compareKeys(options, key1, key2);
if ( nError )
2001-02-15 15:01:07 +00:00
{
if ( options.unoTypeCheck() )
{
fprintf(stdout, "%s: registries are incompatible: %lu differences!\n",
options.getProgramName().c_str(),
sal::static_int_cast< unsigned long >(nError));
}
else
{
fprintf(stdout, "%s: registries contain %lu differences!\n",
options.getProgramName().c_str(),
sal::static_int_cast< unsigned long >(nError));
}
}
2001-02-15 15:01:07 +00:00
key1.releaseKey();
key2.releaseKey();
if ( reg1.close() != RegError::NO_ERROR )
2001-02-15 15:01:07 +00:00
{
2002-11-27 13:19:37 +00:00
fprintf(stdout, "%s: closing registry \"%s\" failed\n",
options.getProgramName().c_str(), options.getRegName1().c_str());
return 9;
2001-02-15 15:01:07 +00:00
}
if ( reg2.close() != RegError::NO_ERROR )
2001-02-15 15:01:07 +00:00
{
2002-11-27 13:19:37 +00:00
fprintf(stdout, "%s: closing registry \"%s\" failed\n",
options.getProgramName().c_str(), options.getRegName2().c_str());
return 10;
2001-02-15 15:01:07 +00:00
}
return ((nError > 0) ? 11 : 0);
2001-02-15 15:01:07 +00:00
}
2011-04-16 09:08:29 +02:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */