Coverage Report

Created: 2026-05-16 09:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sal/rtl/ustrbuf.cxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
5
 * This Source Code Form is subject to the terms of the Mozilla Public
6
 * License, v. 2.0. If a copy of the MPL was not distributed with this
7
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
11
 *   Licensed to the Apache Software Foundation (ASF) under one or more
12
 *   contributor license agreements. See the NOTICE file distributed
13
 *   with this work for additional information regarding copyright
14
 *   ownership. The ASF licenses this file to you under the Apache
15
 *   License, Version 2.0 (the "License"); you may not use this file
16
 *   except in compliance with the License. You may obtain a copy of
17
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
 */
19
20
#include <osl/interlck.h>
21
#include <rtl/character.hxx>
22
#include <rtl/ustrbuf.h>
23
#include "strimp.hxx"
24
25
#if USE_SDT_PROBES
26
#define RTL_LOG_STRING_BITS         16
27
#endif
28
29
#include "strtmpl.hxx"
30
31
void SAL_CALL rtl_uStringbuffer_newFromStr_WithLength( rtl_uString ** newStr,
32
                                                       const sal_Unicode * value,
33
                                                       sal_Int32 count)
34
27.7M
{
35
27.7M
    rtl::str::stringbuffer_newFromStr_WithLength(newStr, value, count);
36
27.7M
}
37
38
rtl_uString * SAL_CALL rtl_uStringBuffer_refReturn( rtl_uString * pThis )
39
0
{
40
0
    RTL_LOG_STRING_NEW( pThis );
41
0
    rtl::str::acquire( pThis );
42
0
    return pThis;
43
0
}
44
45
rtl_uString * SAL_CALL rtl_uStringBuffer_makeStringAndClear( rtl_uString ** ppThis,
46
                                                             sal_Int32 *nCapacity )
47
320M
{
48
320M
    assert(ppThis);
49
320M
    assert(nCapacity);
50
    // avoid an un-necessary atomic ref/unref pair
51
320M
    rtl_uString *pStr = *ppThis;
52
320M
    *ppThis = nullptr;
53
54
320M
    rtl::str::new_(ppThis);
55
320M
    *nCapacity = 0;
56
57
320M
    RTL_LOG_STRING_NEW( pStr );
58
59
320M
    return pStr;
60
320M
}
61
62
sal_Int32 SAL_CALL rtl_uStringbuffer_newFromStringBuffer( rtl_uString ** newStr,
63
                                                          sal_Int32 capacity,
64
                                                          rtl_uString * oldStr )
65
680k
{
66
680k
    return rtl::str::stringbuffer_newFromStringBuffer(newStr, capacity, oldStr);
67
680k
}
68
69
void SAL_CALL rtl_uStringbuffer_ensureCapacity
70
    (rtl_uString ** This, sal_Int32* capacity, sal_Int32 minimumCapacity)
71
598k
{
72
598k
    rtl::str::stringbuffer_ensureCapacity(This, capacity, minimumCapacity);
73
598k
}
74
75
void SAL_CALL rtl_uStringbuffer_insert( rtl_uString ** This,
76
                                        sal_Int32 * capacity,
77
                                        sal_Int32 offset,
78
                                        const sal_Unicode * str,
79
                                        sal_Int32 len)
80
946M
{
81
946M
    rtl::str::stringbuffer_insert(This, capacity, offset, str, len);
82
946M
}
83
84
void rtl_uStringbuffer_insertUtf32(
85
    rtl_uString ** pThis, sal_Int32 * capacity, sal_Int32 offset, sal_uInt32 c) noexcept
86
164M
{
87
164M
    sal_Unicode buf[2];
88
164M
    sal_Int32 len = rtl::splitSurrogates(c, buf);
89
164M
    rtl::str::stringbuffer_insert(pThis, capacity, offset, buf, len);
90
164M
}
91
92
void SAL_CALL rtl_uStringbuffer_insert_ascii(   /*inout*/rtl_uString ** This,
93
                                                /*inout*/sal_Int32 * capacity,
94
                                                sal_Int32 offset,
95
                                                const char * str,
96
                                                sal_Int32 len)
97
11.6M
{
98
11.6M
    rtl::str::stringbuffer_insert(This, capacity, offset, str, len);
99
11.6M
}
100
101
/*************************************************************************
102
 *  rtl_uStringbuffer_remove
103
 */
104
void SAL_CALL rtl_uStringbuffer_remove( rtl_uString ** This,
105
                                       sal_Int32 start,
106
                                       sal_Int32 len )
107
32.9M
{
108
32.9M
    rtl::str::stringbuffer_remove(This, start, len);
109
32.9M
}
110
111
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */