summaryrefslogtreecommitdiff
path: root/svtools/source/misc/imap3.cxx
blob: 31246d3caf28e209f3897d9e5ff3f62ac3898868 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* -*- 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 <svtools/imap.hxx>

#include <tools/debug.hxx>


/******************************************************************************
|*
|* Ctor
|*
\******************************************************************************/

IMapCompat::IMapCompat( SvStream& rStm, const StreamMode nStreamMode )
    : pRWStm(&rStm)
    , nCompatPos(0)
    , nTotalSize(0)
    , nStmMode(nStreamMode)
{
    DBG_ASSERT( nStreamMode == StreamMode::READ || nStreamMode == StreamMode::WRITE, "Wrong Mode!" );

    if ( !pRWStm->GetError() )
    {
        if ( nStmMode == StreamMode::WRITE )
        {
            nCompatPos = pRWStm->Tell();
            pRWStm->SeekRel( 4 );
            nTotalSize = nCompatPos + 4;
        }
        else
        {
            sal_uInt32 nTotalSizeTmp;
            pRWStm->ReadUInt32( nTotalSizeTmp );
            nTotalSize = nTotalSizeTmp;
            nCompatPos = pRWStm->Tell();
        }
    }
}


/******************************************************************************
|*
|* Dtor
|*
\******************************************************************************/

IMapCompat::~IMapCompat()
{
    if ( !pRWStm->GetError() )
    {
        if ( nStmMode == StreamMode::WRITE )
        {
            const sal_uLong nEndPos = pRWStm->Tell();

            pRWStm->Seek( nCompatPos );
            pRWStm->WriteUInt32( nEndPos - nTotalSize );
            pRWStm->Seek( nEndPos );
        }
        else
        {
            const sal_uLong nReadSize = pRWStm->Tell() - nCompatPos;

            if ( nTotalSize > nReadSize )
                pRWStm->SeekRel( nTotalSize - nReadSize );
        }
    }
}



/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
n='3' class='logmsg'> Change-Id: I161cd52606c11b6008f5d8b1d8ee391692f91861 Reviewed-on: https://gerrit.libreoffice.org/19231 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com> 2015-02-12Remove uses of osl/diagnose.h from jvmaccessStephan Bergmann Change-Id: Ic9cda5259db81dd921dd3fa891b1289b8283bf27 2015-02-12jvmaccess doesn't have a stable interface anywayStephan Bergmann Change-Id: I681443981a2da8bd3ca0c40965cfee300845c0e9 2014-12-16jvmaccess: Use appropriate OUString functions on string constantsStephan Bergmann Change-Id: I57b6de337eae1dcd8bc08f51ba9be36b61d5c470 2014-07-07DBG_ASSERT->assert when followed by dereferenceCaolán McNamara Change-Id: Ic1c999ffdc391ea01be5711721e7c9e63179473e 2014-06-17improve the inlinesimplememberfunctions clang pluginNoel Grandin Change-Id: I6d5a952901648e01904ef5c37f953c517304d31e 2014-06-09loplugin: inlinesimplememberfunctionsNoel Grandin Change-Id: I42119f656ca528286fb25d2d36c0af54b7d04a6b 2014-05-23remove boilerplate in UNO Exception constructor callsNoel Grandin Now that we have default values for Exception constructor params, remove lots of boilerplate code. Change-Id: I620bd641eecfed38e6123873b3b94aaf47922e74 2014-03-10jvmaccess: simplify deprecated XTypeProvider.getImplementationIdStephan Bergmann Change-Id: I2198f013ce94dc65a7c540a599ee7160ba8d9295 2014-02-23Remove unneccessary commentsAlexander Wilms Change-Id: I939160ae72fecbe3d4a60ce755730bd4c38497fb Reviewed-on: https://gerrit.libreoffice.org/8182 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> 2013-08-19Rename SOLAR_JAVA to ENABLE_JAVA and HAVE_FEATURE_JAVATor Lillqvist Change-Id: Ib451bdb3c1c2ca42347abfde44651d5cf5eef4f3 2013-04-24gbuild: drop empty use_packages callsDavid Tardon Change-Id: I8e9f70eb5d929c98b4379416c2259a74e31d587f Reviewed-on: https://gerrit.libreoffice.org/3503 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com> 2013-04-24gbuild: drop uses of removed packagesDavid Tardon Change-Id: I400fad08c0ae7b6b34bad63693f54856867e4dac Reviewed-on: https://gerrit.libreoffice.org/3502 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com> 2013-04-23execute move of global headersBjoern Michaelsen see https://gerrit.libreoffice.org/#/c/3367/ and Change-Id: I00c96fa77d04b33a6f8c8cd3490dfcd9bdc9e84a for details Change-Id: I199a75bc4042af20817265d5ef85b1134a96ff5a 2013-04-22Move to MPLv2 license headers, with ESC decision and author's permission.Michael Meeks 2013-04-12do not set soversion for private ure librariesMatúš Kukan Change-Id: I2b2099d8fc00062f67c42e73c4b8a17a689db89d Signed-off-by: Stephan Bergmann <sbergman@redhat.com> 2013-04-07remove needless forward rtl::OUString declarationsLuboš Luňák Change-Id: I97d91a758dd82d64768d75c1d2ddd279de5f6034 2013-04-07mass removal of rtl:: prefixes for O(U)String*Luboš Luňák Modules sal, salhelper, cppu, cppuhelper, codemaker (selectively) and odk have kept them, in order not to break external API (the automatic using declaration is LO-internal). Change-Id: I588fc9e0c45b914f824f91c0376980621d730f09 2013-04-05Drop jvmaccess and jvmfwk when no SOLAR_JAVATor Lillqvist Just sprinkle #ifdef SOLAR_JAVA into the code instead. In the source for jvmaccess and jvmfwk such ifdefs can be removed as it isn't compiled unless SOLAR_JAVA. Change-Id: Ia8614f8bd6d833582d3b79b5fb75f9153fa79606 2013-03-19automated removal of RTL_CONSTASCII_USTRINGPARAM for quoted OUStringsThomas Arnhold Done with a perl regex: s/OUString\s*\(\s*RTL_CONSTASCII_USTRINGPARAM\s*\((\s*"[^")]*?"\s*)\)\s*\)/OUString\($1\)/gms Change-Id: Idf28320817cdcbea6d0f7ec06a9bf51bd2c3b3ec Reviewed-on: https://gerrit.libreoffice.org/2832 Reviewed-by: Thomas Arnhold <thomas@arnhold.org> Tested-by: Thomas Arnhold <thomas@arnhold.org> 2013-03-14remove legacy build.pl prj/build.lst files.Michael Meeks 2013-02-28remove all d.lstMichael Stahl Change-Id: Icba4218c5f9fe89d183d25ea82a8eae52881f885 2013-02-11fdo#46808, Use singleton util::theMacroExpander new-style constructorNoel Grandin And deprecate the old-style service util::MacroExpander Change-Id: Ifcefe31a8f8c68c6d44d6ec19616727eb607e1cd 2013-01-30Removed several useless macros: A2OU, A2S, C2U, C2S, OUSTR, OUSTRINGJean-Noël Rouvignac Change-Id: Ie859cb2dfdc7103c379fce56be88eef8fe390afd Reviewed-on: https://gerrit.libreoffice.org/1924 Tested-by: Luboš Luňák <l.lunak@suse.cz> Reviewed-by: Luboš Luňák <l.lunak@suse.cz> 2013-01-26gbuild: fix silly "expandtabs" in makefile VIM modelinesMichael Stahl Change-Id: I54d8923ad315e8041fd3904da3a29f1a7a8c8b16 2012-11-30c++ API: use css alias in generated headers, adds global css declThorsten Behrens This changes all generated API headers (.hpp and .hdl) to use a namespace alias 'css' instead of the pointlessly long com::sun::star Makes the change in cppumaker & associated tools, adds a global namespace alias definition in sal/types.h, and removes a kiloton of local, now pointless-to-harmful versions of that alias from all over the code. Change-Id: Ice5a644a6b971a981f01dc0589d48f5add31cc0f 2012-09-28gbuild: invert handling of standard system libraries:Michael Stahl Always link in gb_STDLIBS, except when the library explicitly opts out with gb_LinkTarget_disable_standard_system_libs. Change-Id: I489a99114fbfa46d0421a27cf6c7b899dc268a4a 2012-09-28gbuild: replace direct gb_STDLIBS use with ...Michael Stahl ... new gb_LinkTarget_add_standard_system_libs Change-Id: Ib2bc843098db3d8c6822b45a3d21724e67f57d69 2012-09-28gbuild: split uwinapi out of gb_STDLIBSMichael Stahl Change-Id: I53316e0b9369d806197bccb42cf22d3497af43e7