Repository.mk | 2 registry/Executable_checksingleton.mk | 43 ---- registry/Executable_rdbedit.mk | 24 -- registry/Module_registry.mk | 2 registry/tools/checksingleton.cxx | 336 ---------------------------------- registry/tools/rdbedit.cxx | 307 ------------------------------- 6 files changed, 714 deletions(-)
New commits: commit 32afbf1ae15426defc2c1b58f754d0e6d5c406e5 Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Jan 15 12:29:36 2013 +0100 Remove obsolete rdbedit tool Change-Id: Ibc0885e4c073c09a673f08297bfc5de42f2b3c28 diff --git a/Repository.mk b/Repository.mk index 662f5095..fc1e38b 100644 --- a/Repository.mk +++ b/Repository.mk @@ -55,7 +55,6 @@ $(eval $(call gb_Helper_register_executables,NONE, \ osl_process_child \ pdf2xml \ pdfunzip \ - rdbedit \ propex \ regsvrex \ renewpo \ diff --git a/registry/Executable_rdbedit.mk b/registry/Executable_rdbedit.mk deleted file mode 100644 index 7fea3fd..0000000 --- a/registry/Executable_rdbedit.mk +++ /dev/null @@ -1,24 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# 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/. -# -$(eval $(call gb_Executable_Executable,rdbedit)) - -$(eval $(call gb_Executable_use_libraries,rdbedit,\ - sal \ - reg \ -)) - -$(eval $(call gb_Executable_use_static_libraries,rdbedit,\ - registry_helper \ -)) - -$(eval $(call gb_Executable_add_exception_objects,rdbedit,\ - registry/tools/rdbedit \ -)) - -# vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/registry/Module_registry.mk b/registry/Module_registry.mk index 480306d..147ee8af 100644 --- a/registry/Module_registry.mk +++ b/registry/Module_registry.mk @@ -38,7 +38,6 @@ $(eval $(call gb_Module_add_targets,registry,\ Executable_regmerge \ Executable_regview \ Executable_regcompare \ - Executable_rdbedit \ )) endif diff --git a/registry/tools/rdbedit.cxx b/registry/tools/rdbedit.cxx deleted file mode 100644 index 6e8a99f..0000000 --- a/registry/tools/rdbedit.cxx +++ /dev/null @@ -1,307 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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 . - */ - -#include <stdio.h> -#include <string.h> - -#include "registry/registry.hxx" -#include "registry/reflread.hxx" -#include <rtl/ustring.hxx> -#include <rtl/alloc.h> -#include <osl/process.h> -#include <osl/diagnose.h> -#include <osl/thread.h> -#include <osl/file.hxx> - -#ifdef SAL_UNX -#define SEPARATOR '/' -#else -#define SEPARATOR '\\' -#endif - -using namespace ::rtl; -using namespace ::osl; - -sal_Bool isFileUrl(const OString& fileName) -{ - if (fileName.indexOf("file://") == 0 ) - return sal_True; - return sal_False; -} - -OUString convertToFileUrl(const OString& fileName) -{ - if ( isFileUrl(fileName) ) - { - return OStringToOUString(fileName, osl_getThreadTextEncoding()); - } - - OUString uUrlFileName; - OUString uFileName(fileName.getStr(), fileName.getLength(), osl_getThreadTextEncoding()); - if ( fileName.indexOf('.') == 0 || fileName.indexOf(SEPARATOR) < 0 ) - { - OUString uWorkingDir; - if (osl_getProcessWorkingDir(&uWorkingDir.pData) != osl_Process_E_None) - { - OSL_ASSERT(false); - } - if (FileBase::getAbsoluteFileURL(uWorkingDir, uFileName, uUrlFileName) - != FileBase::E_None) - { - OSL_ASSERT(false); - } - } else - { - if (FileBase::getFileURLFromSystemPath(uFileName, uUrlFileName) - != FileBase::E_None) - { - OSL_ASSERT(false); - } - } - - return uUrlFileName; -} - -#define U2S( s ) \ - OUStringToOString(s, RTL_TEXTENCODING_UTF8).getStr() -#define S2U( s ) \ - OStringToOUString(s, RTL_TEXTENCODING_UTF8) - -struct LessString -{ - sal_Bool operator()(const OUString& str1, const OUString& str2) const - { - return (str1 < str2); - } -}; - -enum Command { - DELETEKEY -}; - -class Options -{ -public: - Options() - : m_bVerbose(false) - {} - ~Options() - {} - - bool initOptions(int ac, char* av[]); - - OString prepareHelp(); - OString prepareVersion(); - - const OString& getProgramName() const - { return m_program; } - const OString& getTypeReg() const - { return m_typeRegName; } - const OString& getKeyName() const - { return m_keyName; } - Command getCommand() const - { return m_command; } - bool verbose() const - { return m_bVerbose; } -protected: - OString m_program; - OString m_typeRegName; - OString m_keyName; - Command m_command; - bool m_bVerbose; -}; - -bool Options::initOptions(int ac, char* av[]) -{ - bool bRet = true; - sal_uInt16 i=1; - - if (ac < 2) - { - fprintf(stderr, "%s", prepareHelp().getStr()); - bRet = sal_False; - } - - m_program = av[0]; - sal_Int32 index = -1; - if ((index=m_program.lastIndexOf(SEPARATOR)) > 0) - m_program = av[0]+index+1; - - char *s=NULL; - for (; i < ac; i++) - { - if (av[i][0] == '-') - { - switch (av[i][1]) - { - case 'r': - case 'R': - if (av[i][2] == '\0') - { - if (i < ac - 1 && av[i+1][0] != '-') - { - i++; - s = av[i]; - } else - { - fprintf(stderr, "%s: invalid option '%s'\n", m_program.getStr(), av[i]); - bRet = sal_False; - break; - } - } else - { - s = av[i] + 2; - } - m_typeRegName = OString(s); - break; - case 'd': - case 'D': - if (av[i][2] == '\0') - { - if (i < ac - 1 && av[i+1][0] != '-') - { - i++; - s = av[i]; - } else - { - fprintf(stderr, "%s: invalid option '%s'\n", m_program.getStr(), av[i]); - bRet = sal_False; - break; - } - } else - { - s = av[i] + 2; - } - m_keyName = OString(s); - break; - case 'v': - case 'V': - if (av[i][2] != '\0') - { - fprintf(stderr, "%s: invalid option '%s'\n", m_program.getStr(), av[i]); - bRet = sal_False; - } - m_bVerbose = true; - break; - case 'h': - case '?': - if (av[i][2] != '\0') - { - fprintf(stderr, "%s: invalid option '%s'\n", m_program.getStr(), av[i]); - bRet = false; - } else - { - fprintf(stdout, "%s", prepareHelp().getStr()); - exit(0); - } - break; - default: - fprintf(stderr, "%s: unknown option '%s'\n", m_program.getStr(), av[i]); - bRet = false; - break; - } - } else - { - fprintf(stderr, "%s: unknown option '%s'\n", m_program.getStr(), av[i]); - bRet = false; - } - } - - return bRet; -} - -OString Options::prepareHelp() -{ - OString help("\nusing: "); - help += m_program + " -r<filename> <command>\n"; - help += " -r<filename> = filename specifies the name of the type registry.\n"; - help += "Commands:\n"; - help += " -d <keyname> = delete the specified key from the registry. Keyname\n"; - help += " specifies the name of the key that get deleted.\n"; - help += " -v = verbose output.\n"; - help += " -h|-? = print this help message and exit.\n"; - help += prepareVersion(); - - return help; -} - -OString Options::prepareVersion() -{ - OString version(m_program); - version += " Version 1.0\n\n"; - return version; -} - -static Options options; - - -#if (defined UNX) || (defined __MINGW32__) -int main( int argc, char * argv[] ) -#else -int _cdecl main( int argc, char * argv[] ) -#endif -{ - if ( !options.initOptions(argc, argv) ) - { - exit(1); - } - - OUString typeRegName( convertToFileUrl(options.getTypeReg()) ); - - Registry typeReg; - - if ( typeReg.open(typeRegName, REG_READWRITE) ) - { - fprintf(stderr, "%s: open registry \"%s\" failed\n", - options.getProgramName().getStr(), options.getTypeReg().getStr()); - exit(2); - } - - RegistryKey typeRoot; - if ( typeReg.openRootKey(typeRoot) ) - { - fprintf(stderr, "%s: open root key of registry \"%s\" failed\n", - options.getProgramName().getStr(), options.getTypeReg().getStr()); - exit(3); - } - - if ( options.getCommand() == DELETEKEY ) - { - if ( typeRoot.deleteKey(S2U(options.getKeyName())) ) - { - fprintf(stderr, "%s: delete key \"%s\" of registry \"%s\" failed\n", - options.getProgramName().getStr(), options.getKeyName().getStr(), options.getTypeReg().getStr()); - exit(4); - } else { - if (options.verbose()) - fprintf(stderr, "%s: delete key \"%s\" of registry \"%s\"\n", - options.getProgramName().getStr(), options.getKeyName().getStr(), options.getTypeReg().getStr()); - } - } - - typeRoot.releaseKey(); - if ( typeReg.close() ) - { - fprintf(stderr, "%s: closing registry \"%s\" failed\n", - options.getProgramName().getStr(), options.getTypeReg().getStr()); - exit(5); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit f74c5f27f04940654320ce5bbfcd41b58a046288 Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Jan 15 12:19:33 2013 +0100 Remove obsolete checksingleton tool Change-Id: Ief63ba65ea90636f9a2803a98bbe43d73c101ef5 diff --git a/Repository.mk b/Repository.mk index 5907c3e..662f5095 100644 --- a/Repository.mk +++ b/Repository.mk @@ -35,7 +35,6 @@ $(eval $(call gb_Helper_register_executables,NONE, \ bmpsum \ cfgex \ checkdll \ - checksingleton \ cpp \ cppunit/cppunittester \ g2g \ diff --git a/registry/Executable_checksingleton.mk b/registry/Executable_checksingleton.mk deleted file mode 100644 index dc191c8..0000000 --- a/registry/Executable_checksingleton.mk +++ /dev/null @@ -1,43 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# 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. -# -# Major Contributor(s): -# Copyright (C) 2012 David Ostrovsky <d.ostrov...@gmx.de> (initial developer) -# -# All Rights Reserved. -# -# 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_Executable_Executable,checksingleton)) - -$(eval $(call gb_Executable_use_libraries,checksingleton,\ - sal \ - salhelper \ - reg \ -)) - -$(eval $(call gb_Executable_use_static_libraries,checksingleton,\ - registry_helper \ -)) - -$(eval $(call gb_Executable_add_exception_objects,checksingleton,\ - registry/tools/checksingleton \ -)) - -# vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/registry/Module_registry.mk b/registry/Module_registry.mk index cec5ff1..480306d 100644 --- a/registry/Module_registry.mk +++ b/registry/Module_registry.mk @@ -38,7 +38,6 @@ $(eval $(call gb_Module_add_targets,registry,\ Executable_regmerge \ Executable_regview \ Executable_regcompare \ - Executable_checksingleton \ Executable_rdbedit \ )) diff --git a/registry/tools/checksingleton.cxx b/registry/tools/checksingleton.cxx deleted file mode 100644 index 18c9613..0000000 --- a/registry/tools/checksingleton.cxx +++ /dev/null @@ -1,336 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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 . - */ - - -#include "registry/registry.hxx" -#include "registry/reflread.hxx" -#include "fileurl.hxx" -#include "options.hxx" - -#include "rtl/ustring.hxx" -#include "osl/diagnose.h" - -#include <stdio.h> -#include <string.h> - -#include <vector> -#include <string> - -using namespace rtl; -using namespace registry::tools; - -#define U2S( s ) \ - OUStringToOString(s, RTL_TEXTENCODING_UTF8).getStr() -#define S2U( s ) \ - OStringToOUString(s, RTL_TEXTENCODING_UTF8) - -class Options_Impl : public Options -{ -public: - explicit Options_Impl(char const * program) - : Options (program), m_bForceOutput(false) - {} - - std::string const & getIndexReg() const - { return m_indexRegName; } - std::string const & getTypeReg() const - { return m_typeRegName; } - bool hasBase() const - { return (!m_base.isEmpty()); } - const OString & getBase() const - { return m_base; } - bool forceOutput() const - { return m_bForceOutput; } - -protected: - virtual void printUsage_Impl() const; - virtual bool initOptions_Impl (std::vector< std::string > & rArgs); - - std::string m_indexRegName; - std::string m_typeRegName; - OString m_base; - bool m_bForceOutput; -}; - -// virtual -void Options_Impl::printUsage_Impl() const -{ - std::string const & rProgName = getProgramName(); - fprintf(stderr, - "Usage: %s -r<filename> -o<filename> [-options] | @<filename>\n", rProgName.c_str() - ); - fprintf(stderr, - " -o<filename> = filename specifies the name of the new singleton index registry.\n" - " -r<filename> = filename specifies the name of the type registry.\n" - " @<filename> = filename specifies a command file.\n" - "Options:\n" - " -b<name> = name specifies the name of a start key. The types will be searched\n" - " under this key in the type registry.\n" - " -f = force the output of all found singletons.\n" - " -h|-? = print this help message and exit.\n" - ); - fprintf(stderr, - "\n%s Version 1.0\n\n", rProgName.c_str() - ); -} - -// 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) - { - std::string option (*first); - if ((*first)[0] != '-') - { - return badOption("invalid", option.c_str()); - } - switch ((*first)[1]) - { - case 'r': - case 'R': - { - if (!((++first != last) && ((*first)[0] != '-'))) - { - return badOption("invalid", option.c_str()); - } - m_typeRegName = *first; - break; - } - case 'o': - case 'O': - { - if (!((++first != last) && ((*first)[0] != '-'))) - { - return badOption("invalid", option.c_str()); - } - m_indexRegName = (*first); - break; - } - case 'b': - case 'B': - { - if (!((++first != last) && ((*first)[0] != '-'))) - { - return badOption("invalid", option.c_str()); - } - m_base = OString((*first).c_str(), (*first).size()); - break; - } - case 'f': - case 'F': - { - if ((*first).size() > 2) - { - return badOption("invalid", option.c_str()); - } - m_bForceOutput = sal_True; - break; - } - case 'h': - case '?': - { - if ((*first).size() > 2) - { - return badOption("invalid", option.c_str()); - } - return printUsage(); - // break; // unreachable - } - default: - return badOption("unknown", option.c_str()); - // break; // unreachable - } - } - return true; -} - -static sal_Bool checkSingletons(Options_Impl const & options, RegistryKey& singletonKey, RegistryKey& typeKey) -{ - RegValueType valueType = RG_VALUETYPE_NOT_DEFINED; - sal_uInt32 size = 0; - OUString tmpName; - sal_Bool bRet = sal_False; - - RegError e = typeKey.getValueInfo(tmpName, &valueType, &size); - if ((e != REG_VALUE_NOT_EXISTS) && (e != REG_INVALID_VALUE) && (valueType == RG_VALUETYPE_BINARY)) - { - std::vector< sal_uInt8 > value(size); - typeKey.getValue(tmpName, &value[0]); // @@@ broken api: write to buffer w/o buffer size. - - RegistryTypeReader reader(&value[0], value.size(), sal_False); - if ( reader.isValid() && reader.getTypeClass() == RT_TYPE_SINGLETON ) - { - RegistryKey entryKey; - OUString singletonName = reader.getTypeName().replace('/', '.'); - if ( singletonKey.createKey(singletonName, entryKey) ) - { - fprintf(stderr, "%s: could not create SINGLETONS entry for \"%s\"\n", - options.getProgramName().c_str(), U2S( singletonName )); - } - else - { - bRet = sal_True; - OUString value2 = reader.getSuperTypeName(); - - if ( entryKey.setValue(tmpName, RG_VALUETYPE_UNICODE, - (RegValue)value2.getStr(), sizeof(sal_Unicode)* (value2.getLength()+1)) ) - { - fprintf(stderr, "%s: could not create data entry for singleton \"%s\"\n", - options.getProgramName().c_str(), U2S( singletonName )); - } - - if ( options.forceOutput() ) - { - fprintf(stderr, "%s: create SINGLETON entry for \"%s\" -> \"%s\"\n", - options.getProgramName().c_str(), U2S( singletonName ), U2S(value2)); - } - } - } - } - - RegistryKeyArray subKeys; - typeKey.openSubKeys(tmpName, subKeys); - - sal_uInt32 length = subKeys.getLength(); - for (sal_uInt32 i = 0; i < length; i++) - { - RegistryKey elementKey = subKeys.getElement(i); - if ( checkSingletons(options, singletonKey, elementKey) ) - { - bRet = sal_True; - } - } - return bRet; -} - -#if (defined UNX) || (defined __MINGW32__) -int main( int argc, char * argv[] ) -#else -int _cdecl main( int argc, char * argv[] ) -#endif -{ - std::vector< std::string > args; - for (int i = 1; i < argc; i++) - { - int result = Options::checkArgument(args, argv[i], strlen(argv[i])); - if (result != 0) - { - // failure. - return (result); - } - } - - Options_Impl options(argv[0]); - if (!options.initOptions(args)) - { - options.printUsage(); - return (1); - } - - OUString indexRegName( convertToFileUrl(options.getIndexReg().c_str(), options.getIndexReg().size()) ); - Registry indexReg; - if ( indexReg.open(indexRegName, REG_READWRITE) ) - { - if ( indexReg.create(indexRegName) ) - { - fprintf(stderr, "%s: open registry \"%s\" failed\n", - options.getProgramName().c_str(), options.getIndexReg().c_str()); - return (2); - } - } - - OUString typeRegName( convertToFileUrl(options.getTypeReg().c_str(), options.getTypeReg().size()) ); - Registry typeReg; - if ( typeReg.open(typeRegName, REG_READONLY) ) - { - fprintf(stderr, "%s: open registry \"%s\" failed\n", - options.getProgramName().c_str(), options.getTypeReg().c_str()); - return (3); - } - - RegistryKey indexRoot; - if ( indexReg.openRootKey(indexRoot) ) - { - fprintf(stderr, "%s: open root key of registry \"%s\" failed\n", - options.getProgramName().c_str(), options.getIndexReg().c_str()); - return (4); - } - - RegistryKey typeRoot; - if ( typeReg.openRootKey(typeRoot) ) - { - fprintf(stderr, "%s: open root key of registry \"%s\" failed\n", - options.getProgramName().c_str(), options.getTypeReg().c_str()); - return (5); - } - - RegistryKey typeKey; - if ( options.hasBase() ) - { - if ( typeRoot.openKey(S2U(options.getBase()), typeKey) ) - { - fprintf(stderr, "%s: open base key of registry \"%s\" failed\n", - options.getProgramName().c_str(), options.getTypeReg().c_str()); - return (6); - } - } - else - { - typeKey = typeRoot; - } - - RegistryKey singletonKey; - if ( indexRoot.createKey(OUString("SINGLETONS"), singletonKey) ) - { - fprintf(stderr, "%s: open/create SINGLETONS key of registry \"%s\" failed\n", - options.getProgramName().c_str(), options.getIndexReg().c_str()); - return (7); - } - - sal_Bool bSingletonsExist = checkSingletons(options, singletonKey, typeKey); - - indexRoot.releaseKey(); - typeRoot.releaseKey(); - typeKey.releaseKey(); - singletonKey.releaseKey(); - if ( indexReg.close() ) - { - fprintf(stderr, "%s: closing registry \"%s\" failed\n", - options.getProgramName().c_str(), options.getIndexReg().c_str()); - return (9); - } - if ( !bSingletonsExist ) - { - if ( indexReg.destroy(OUString()) ) - { - fprintf(stderr, "%s: destroy registry \"%s\" failed\n", - options.getProgramName().c_str(), options.getIndexReg().c_str()); - return (10); - } - } - if ( typeReg.close() ) - { - fprintf(stderr, "%s: closing registry \"%s\" failed\n", - options.getProgramName().c_str(), options.getTypeReg().c_str()); - return (11); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits