diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2013-09-05 19:47:57 +0200 |
---|---|---|
committer | Thomas Arnhold <thomas@arnhold.org> | 2013-09-08 03:19:20 +0000 |
commit | a92be728a5affb7d74eeeec8c6831968c05aeff4 (patch) | |
tree | 9406d886fbc197cb8f546d524abd92e4997b40b9 /fpicker | |
parent | 5ab959017665e3f74ec4be8245827f3de92dd512 (diff) |
fdo#42155: Replace the only use of CAutoUnicodeBuffer end part
Change-Id: Id1c00a24cdc1914693d8cadeeee64923af3db786
Reviewed-on: https://gerrit.libreoffice.org/5829
Reviewed-by: Thomas Arnhold <thomas@arnhold.org>
Tested-by: Thomas Arnhold <thomas@arnhold.org>
Diffstat (limited to 'fpicker')
-rw-r--r-- | fpicker/Library_fps.mk | 1 | ||||
-rw-r--r-- | fpicker/source/win32/misc/AutoBuffer.cxx | 156 | ||||
-rw-r--r-- | fpicker/source/win32/misc/AutoBuffer.hxx | 72 |
3 files changed, 0 insertions, 229 deletions
diff --git a/fpicker/Library_fps.mk b/fpicker/Library_fps.mk index 4a1056a1c739..6595f6c8a43e 100644 --- a/fpicker/Library_fps.mk +++ b/fpicker/Library_fps.mk @@ -86,7 +86,6 @@ $(eval $(call gb_Library_add_exception_objects,fps,\ fpicker/source/win32/folderpicker/FolderPicker \ fpicker/source/win32/folderpicker/MtaFop \ fpicker/source/win32/folderpicker/WinFOPImpl \ - fpicker/source/win32/misc/AutoBuffer \ fpicker/source/win32/misc/resourceprovider \ fpicker/source/win32/misc/WinImplHelper \ )) diff --git a/fpicker/source/win32/misc/AutoBuffer.cxx b/fpicker/source/win32/misc/AutoBuffer.cxx deleted file mode 100644 index 17162e3c479b..000000000000 --- a/fpicker/source/win32/misc/AutoBuffer.cxx +++ /dev/null @@ -1,156 +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 "AutoBuffer.hxx" -#include <osl/diagnose.h> - -#if defined _MSC_VER -#pragma warning(push, 1) -#endif -#include <windows.h> -#if defined _MSC_VER -#pragma warning(pop) -#endif - -//------------------------------------------------------------------------ -// namespace directives -//------------------------------------------------------------------------ - - -//------------------------------------------------------------------------ -// -//------------------------------------------------------------------------ - -CAutoUnicodeBuffer::CAutoUnicodeBuffer( size_t nSize, sal_Bool bLazyCreation ) : - m_buffSize( nSize ), - m_pBuff( NULL ) -{ - if ( !bLazyCreation ) - init( ); -} - -//------------------------------------------------------------------------ -// -//------------------------------------------------------------------------ - -CAutoUnicodeBuffer::~CAutoUnicodeBuffer( ) -{ - delete [] m_pBuff; -} - -//------------------------------------------------------------------------ -// -//------------------------------------------------------------------------ - -sal_Bool SAL_CALL CAutoUnicodeBuffer::resize( size_t new_size ) -{ - if ( new_size != m_buffSize ) - { - if ( new_size > m_buffSize ) - { - delete [] m_pBuff; - m_pBuff = NULL; - } - - m_buffSize = new_size; - } - - return sal_True; -} - -//------------------------------------------------------------------------ -// -//------------------------------------------------------------------------ - -void SAL_CALL CAutoUnicodeBuffer::empty( ) -{ - if ( m_pBuff ) - ZeroMemory( m_pBuff, m_buffSize * sizeof( sal_Unicode ) ); -} - -//------------------------------------------------------------------------ -// -//------------------------------------------------------------------------ - -sal_Bool SAL_CALL CAutoUnicodeBuffer::fill( const sal_Unicode* pContent, size_t nLen ) -{ - OSL_ASSERT( pContent && m_buffSize && (m_buffSize >= nLen) ); - - init( ); - - sal_Bool bRet = sal_False; - - if ( m_pBuff && pContent && nLen ) - { - CopyMemory( m_pBuff, pContent, nLen * sizeof( sal_Unicode ) ); - bRet = sal_True; - } - - return bRet; -} - -//------------------------------------------------------------------------ -// -//------------------------------------------------------------------------ - -size_t SAL_CALL CAutoUnicodeBuffer::size( ) const -{ - return m_buffSize; -} - -//------------------------------------------------------------------------ -// -//------------------------------------------------------------------------ - -CAutoUnicodeBuffer::operator sal_Unicode*( ) -{ - return m_pBuff; -} - -//------------------------------------------------------------------------ -// -//------------------------------------------------------------------------ - -sal_Unicode* CAutoUnicodeBuffer::operator&( ) -{ - return m_pBuff; -} - -//------------------------------------------------------------------------ -// -//------------------------------------------------------------------------ - -const sal_Unicode* CAutoUnicodeBuffer::operator&( ) const -{ - return m_pBuff; -} - -//------------------------------------------------------------------------ -// -//------------------------------------------------------------------------ - -void SAL_CALL CAutoUnicodeBuffer::init( ) -{ - if ( !m_pBuff && (m_buffSize > 0) ) - m_pBuff = new sal_Unicode[ m_buffSize ]; - - empty( ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/misc/AutoBuffer.hxx b/fpicker/source/win32/misc/AutoBuffer.hxx deleted file mode 100644 index e11357db05ef..000000000000 --- a/fpicker/source/win32/misc/AutoBuffer.hxx +++ /dev/null @@ -1,72 +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 . - */ - -#ifndef _AUTO_BUFFER_HXX_ -#define _AUTO_BUFFER_HXX_ - -#include <sal/types.h> -#include <rtl/ustring.hxx> - -//------------------------------------------------------------- -// A simple unicode buffer management class, the class itself -// is responsible for the allocated unicode buffer, any -// modification of the buffer size outside the class may lead -// to undefined behaviour -//------------------------------------------------------------- - -class CAutoUnicodeBuffer -{ -public: - - // if bLazyCreation is true the buffer will be created - // when someone wants to fill the buffer - CAutoUnicodeBuffer( size_t nSize, sal_Bool bLazyCreation = sal_False ); - ~CAutoUnicodeBuffer( ); - - // resizes the buffer - sal_Bool SAL_CALL resize( size_t new_size ); - - // zeros the buffer - void SAL_CALL empty( ); - - // fills the buffer with a given content - sal_Bool SAL_CALL fill( const sal_Unicode* pContent, size_t nLen ); - - // returns the size of the buffer - size_t SAL_CALL size( ) const; - - // conversion operator - operator sal_Unicode*( ); - - // address operator - sal_Unicode* operator&( ); - - const sal_Unicode* operator&( ) const; - -private: - void SAL_CALL init( ); - -private: - size_t m_buffSize; // the number of unicode chars - sal_Unicode* m_pBuff; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |