Coverage Report

Created: 2026-05-16 09:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/o3tl/safeint.hxx
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
10
#pragma once
11
12
#include <sal/config.h>
13
14
#include <o3tl/intcmp.hxx>
15
16
#include <algorithm>
17
#include <cassert>
18
#include <concepts>
19
#include <limits>
20
#include <type_traits>
21
22
#if defined(_MSC_VER)
23
#include <safeint.h>
24
#else
25
#ifndef __has_builtin
26
#   define __has_builtin(x) 0
27
#endif
28
#endif
29
30
namespace o3tl
31
{
32
33
template <typename T> inline constexpr T saturating_add(T a, T b)
34
1.57M
{
35
1.57M
    if (b >= 0) {
36
1.52M
        if (a <= std::numeric_limits<T>::max() - b) {
37
1.51M
            return a + b;
38
1.51M
        } else {
39
1.72k
            return std::numeric_limits<T>::max();
40
1.72k
        }
41
1.52M
    } else {
42
        // coverity[dead_error_line] - suppress warning for template
43
51.0k
        if (a >= std::numeric_limits<T>::min() - b) {
44
48.7k
            return a + b;
45
48.7k
        } else {
46
2.30k
            return std::numeric_limits<T>::min();
47
2.30k
        }
48
51.0k
    }
49
1.57M
}
Unexecuted instantiation: unsigned long o3tl::saturating_add<unsigned long>(unsigned long, unsigned long)
long o3tl::saturating_add<long>(long, long)
Line
Count
Source
34
275k
{
35
275k
    if (b >= 0) {
36
250k
        if (a <= std::numeric_limits<T>::max() - b) {
37
249k
            return a + b;
38
249k
        } else {
39
793
            return std::numeric_limits<T>::max();
40
793
        }
41
250k
    } else {
42
        // coverity[dead_error_line] - suppress warning for template
43
24.7k
        if (a >= std::numeric_limits<T>::min() - b) {
44
24.2k
            return a + b;
45
24.2k
        } else {
46
485
            return std::numeric_limits<T>::min();
47
485
        }
48
24.7k
    }
49
275k
}
int o3tl::saturating_add<int>(int, int)
Line
Count
Source
34
741k
{
35
741k
    if (b >= 0) {
36
714k
        if (a <= std::numeric_limits<T>::max() - b) {
37
714k
            return a + b;
38
714k
        } else {
39
434
            return std::numeric_limits<T>::max();
40
434
        }
41
714k
    } else {
42
        // coverity[dead_error_line] - suppress warning for template
43
26.2k
        if (a >= std::numeric_limits<T>::min() - b) {
44
24.5k
            return a + b;
45
24.5k
        } else {
46
1.74k
            return std::numeric_limits<T>::min();
47
1.74k
        }
48
26.2k
    }
49
741k
}
short o3tl::saturating_add<short>(short, short)
Line
Count
Source
34
555k
{
35
555k
    if (b >= 0) {
36
555k
        if (a <= std::numeric_limits<T>::max() - b) {
37
554k
            return a + b;
38
554k
        } else {
39
497
            return std::numeric_limits<T>::max();
40
497
        }
41
555k
    } else {
42
        // coverity[dead_error_line] - suppress warning for template
43
84
        if (a >= std::numeric_limits<T>::min() - b) {
44
0
            return a + b;
45
84
        } else {
46
84
            return std::numeric_limits<T>::min();
47
84
        }
48
84
    }
49
555k
}
50
51
template <typename T> inline constexpr T saturating_sub(T a, T b)
52
1.36M
{
53
1.36M
    if (b >= 0) {
54
1.21M
        if (a >= std::numeric_limits<T>::min() + b) {
55
1.21M
            return a - b;
56
1.21M
        } else {
57
126
            return std::numeric_limits<T>::min();
58
126
        }
59
1.21M
    } else {
60
158k
        if (a <= std::numeric_limits<T>::max() + b) {
61
158k
            return a - b;
62
158k
        } else {
63
80
            return std::numeric_limits<T>::max();
64
80
        }
65
158k
    }
66
1.36M
}
long o3tl::saturating_sub<long>(long, long)
Line
Count
Source
52
213k
{
53
213k
    if (b >= 0) {
54
57.1k
        if (a >= std::numeric_limits<T>::min() + b) {
55
57.1k
            return a - b;
56
57.1k
        } else {
57
9
            return std::numeric_limits<T>::min();
58
9
        }
59
156k
    } else {
60
156k
        if (a <= std::numeric_limits<T>::max() + b) {
61
156k
            return a - b;
62
156k
        } else {
63
78
            return std::numeric_limits<T>::max();
64
78
        }
65
156k
    }
66
213k
}
short o3tl::saturating_sub<short>(short, short)
Line
Count
Source
52
555k
{
53
555k
    if (b >= 0) {
54
555k
        if (a >= std::numeric_limits<T>::min() + b) {
55
555k
            return a - b;
56
555k
        } else {
57
84
            return std::numeric_limits<T>::min();
58
84
        }
59
555k
    } else {
60
0
        if (a <= std::numeric_limits<T>::max() + b) {
61
0
            return a - b;
62
0
        } else {
63
0
            return std::numeric_limits<T>::max();
64
0
        }
65
0
    }
66
555k
}
int o3tl::saturating_sub<int>(int, int)
Line
Count
Source
52
600k
{
53
600k
    if (b >= 0) {
54
598k
        if (a >= std::numeric_limits<T>::min() + b) {
55
598k
            return a - b;
56
598k
        } else {
57
33
            return std::numeric_limits<T>::min();
58
33
        }
59
598k
    } else {
60
2.03k
        if (a <= std::numeric_limits<T>::max() + b) {
61
2.03k
            return a - b;
62
2.03k
        } else {
63
2
            return std::numeric_limits<T>::max();
64
2
        }
65
2.03k
    }
66
600k
}
67
68
template <std::signed_integral T> inline constexpr T saturating_toggle_sign(T a)
69
17.7k
{
70
17.7k
    if (a == std::numeric_limits<T>::min())
71
3.46k
        return std::numeric_limits<T>::max();
72
14.2k
    return -a;
73
17.7k
}
_ZN4o3tl22saturating_toggle_signITkNSt3__115signed_integralEiEET_S2_
Line
Count
Source
69
16.1k
{
70
16.1k
    if (a == std::numeric_limits<T>::min())
71
3.12k
        return std::numeric_limits<T>::max();
72
12.9k
    return -a;
73
16.1k
}
_ZN4o3tl22saturating_toggle_signITkNSt3__115signed_integralElEET_S2_
Line
Count
Source
69
1.62k
{
70
1.62k
    if (a == std::numeric_limits<T>::min())
71
337
        return std::numeric_limits<T>::max();
72
1.28k
    return -a;
73
1.62k
}
74
75
// TODO: reimplement using ckd_add/ckd_sub/ckd_mul from <stdckdint.h>, when C23 is part of C++
76
77
#if defined(_MSC_VER)
78
79
template<typename T> inline bool checked_multiply(T a, T b, T& result)
80
{
81
    return !msl::utilities::SafeMultiply(a, b, result);
82
}
83
84
template<typename T> inline bool checked_add(T a, T b, T& result)
85
{
86
    return !msl::utilities::SafeAdd(a, b, result);
87
}
88
89
template<typename T> inline bool checked_sub(T a, T b, T& result)
90
{
91
    return !msl::utilities::SafeSubtract(a, b, result);
92
}
93
94
#elif (defined __GNUC__ && !defined __clang__) || (__has_builtin(__builtin_mul_overflow) && !(defined(__clang__) && (defined(ANDROID) || defined(__arm__) || defined(__i386__))))
95
// 32-bit clang fails with undefined reference to `__mulodi4'
96
97
template<typename T> inline bool checked_multiply(T a, T b, T& result)
98
78.2M
{
99
78.2M
    return __builtin_mul_overflow(a, b, &result);
100
78.2M
}
bool o3tl::checked_multiply<long>(long, long, long&)
Line
Count
Source
98
2.01M
{
99
2.01M
    return __builtin_mul_overflow(a, b, &result);
100
2.01M
}
bool o3tl::checked_multiply<int>(int, int, int&)
Line
Count
Source
98
74.6M
{
99
74.6M
    return __builtin_mul_overflow(a, b, &result);
100
74.6M
}
bool o3tl::checked_multiply<unsigned int>(unsigned int, unsigned int, unsigned int&)
Line
Count
Source
98
621k
{
99
621k
    return __builtin_mul_overflow(a, b, &result);
100
621k
}
bool o3tl::checked_multiply<unsigned long>(unsigned long, unsigned long, unsigned long&)
Line
Count
Source
98
933k
{
99
933k
    return __builtin_mul_overflow(a, b, &result);
100
933k
}
bool o3tl::checked_multiply<unsigned short>(unsigned short, unsigned short, unsigned short&)
Line
Count
Source
98
11.4k
{
99
11.4k
    return __builtin_mul_overflow(a, b, &result);
100
11.4k
}
101
102
template<typename T> inline bool checked_add(T a, T b, T& result)
103
320M
{
104
320M
    return __builtin_add_overflow(a, b, &result);
105
320M
}
bool o3tl::checked_add<long>(long, long, long&)
Line
Count
Source
103
679k
{
104
679k
    return __builtin_add_overflow(a, b, &result);
105
679k
}
bool o3tl::checked_add<int>(int, int, int&)
Line
Count
Source
103
317M
{
104
317M
    return __builtin_add_overflow(a, b, &result);
105
317M
}
bool o3tl::checked_add<unsigned long>(unsigned long, unsigned long, unsigned long&)
Line
Count
Source
103
29.5k
{
104
29.5k
    return __builtin_add_overflow(a, b, &result);
105
29.5k
}
bool o3tl::checked_add<short>(short, short, short&)
Line
Count
Source
103
1.90M
{
104
1.90M
    return __builtin_add_overflow(a, b, &result);
105
1.90M
}
bool o3tl::checked_add<unsigned short>(unsigned short, unsigned short, unsigned short&)
Line
Count
Source
103
1.40k
{
104
1.40k
    return __builtin_add_overflow(a, b, &result);
105
1.40k
}
106
107
template<typename T> inline bool checked_sub(T a, T b, T& result)
108
78.1M
{
109
78.1M
    return __builtin_sub_overflow(a, b, &result);
110
78.1M
}
bool o3tl::checked_sub<long>(long, long, long&)
Line
Count
Source
108
4.37k
{
109
4.37k
    return __builtin_sub_overflow(a, b, &result);
110
4.37k
}
bool o3tl::checked_sub<int>(int, int, int&)
Line
Count
Source
108
78.1M
{
109
78.1M
    return __builtin_sub_overflow(a, b, &result);
110
78.1M
}
bool o3tl::checked_sub<unsigned short>(unsigned short, unsigned short, unsigned short&)
Line
Count
Source
108
187
{
109
187
    return __builtin_sub_overflow(a, b, &result);
110
187
}
111
112
#else
113
114
//https://www.securecoding.cert.org/confluence/display/c/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow
115
template<std::signed_integral T> inline bool checked_multiply(T a, T b, T& result)
116
{
117
  if (a > 0) {  /* a is positive */
118
    if (b > 0) {  /* a and b are positive */
119
      if (a > (std::numeric_limits<T>::max() / b)) {
120
        return true; /* Handle error */
121
      }
122
    } else { /* a positive, b nonpositive */
123
      if (b < (std::numeric_limits<T>::min() / a)) {
124
        return true; /* Handle error */
125
      }
126
    } /* a positive, b nonpositive */
127
  } else { /* a is nonpositive */
128
    if (b > 0) { /* a is nonpositive, b is positive */
129
      if (a < (std::numeric_limits<T>::min() / b)) {
130
        return true; /* Handle error */
131
      }
132
    } else { /* a and b are nonpositive */
133
      if ( (a != 0) && (b < (std::numeric_limits<T>::max() / a))) {
134
        return true; /* Handle error */
135
      }
136
    } /* End if a and b are nonpositive */
137
  } /* End if a is nonpositive */
138
139
  result = a * b;
140
141
  return false;
142
}
143
144
//https://www.securecoding.cert.org/confluence/display/c/INT30-C.+Ensure+that+unsigned+integer+operations+do+not+wrap
145
template<std::unsigned_integral T> inline bool checked_multiply(T a, T b, T& result)
146
{
147
    if (b && a > std::numeric_limits<T>::max() / b) {
148
        return true;/* Handle error */
149
    }
150
151
    result = a * b;
152
153
    return false;
154
}
155
156
//https://www.securecoding.cert.org/confluence/display/c/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow
157
template<std::signed_integral T> inline bool checked_add(T a, T b, T& result)
158
{
159
    if (((b > 0) && (a > (std::numeric_limits<T>::max() - b))) ||
160
        ((b < 0) && (a < (std::numeric_limits<T>::min() - b)))) {
161
        return true;
162
    }
163
164
    result = a + b;
165
166
    return false;
167
}
168
169
//https://www.securecoding.cert.org/confluence/display/c/INT30-C.+Ensure+that+unsigned+integer+operations+do+not+wrap
170
template<std::unsigned_integral T> inline bool checked_add(T a, T b, T& result)
171
{
172
    if (std::numeric_limits<T>::max() - a < b) {
173
        return true;/* Handle error */
174
    }
175
176
    result = a + b;
177
178
    return false;
179
}
180
181
//https://www.securecoding.cert.org/confluence/display/c/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow
182
template<std::signed_integral T> inline bool checked_sub(T a, T b, T& result)
183
{
184
    if ((b > 0 && a < std::numeric_limits<T>::min() + b) ||
185
        (b < 0 && a > std::numeric_limits<T>::max() + b)) {
186
        return true;
187
    }
188
189
    result = a - b;
190
191
    return false;
192
}
193
194
//https://www.securecoding.cert.org/confluence/display/c/INT30-C.+Ensure+that+unsigned+integer+operations+do+not+wrap
195
template<std::unsigned_integral T> inline bool checked_sub(T a, T b, T& result)
196
{
197
    if (a < b) {
198
        return true;
199
    }
200
201
    result = a - b;
202
203
    return false;
204
}
205
206
#endif
207
208
template <std::signed_integral T> constexpr std::make_unsigned_t<T> make_unsigned(T value)
209
4.14G
{
210
4.14G
    assert(value >= 0);
211
4.14G
    return value;
212
4.14G
}
_ZN4o3tl13make_unsignedITkNSt3__115signed_integralEiEEu15__make_unsignedIT_ES2_
Line
Count
Source
209
3.64G
{
210
    assert(value >= 0);
211
3.64G
    return value;
212
3.64G
}
_ZN4o3tl13make_unsignedITkNSt3__115signed_integralElEEu15__make_unsignedIT_ES2_
Line
Count
Source
209
72.0M
{
210
    assert(value >= 0);
211
72.0M
    return value;
212
72.0M
}
_ZN4o3tl13make_unsignedITkNSt3__115signed_integralEsEEu15__make_unsignedIT_ES2_
Line
Count
Source
209
428M
{
210
    assert(value >= 0);
211
428M
    return value;
212
428M
}
213
214
template <std::unsigned_integral T1, std::integral T2> constexpr T1 clamp_to_unsigned(T2 value)
215
22
{
216
22
    if (IntCmp(value) < IntCmp(std::numeric_limits<T1>::min()))
217
0
        return std::numeric_limits<T1>::min();
218
22
    if (IntCmp(value) > IntCmp(std::numeric_limits<T1>::max()))
219
0
        return std::numeric_limits<T1>::max();
220
22
    return value;
221
22
}
_ZN4o3tl17clamp_to_unsignedITkNSt3__117unsigned_integralEmTkNS1_8integralEjEET_T0_
Line
Count
Source
215
22
{
216
22
    if (IntCmp(value) < IntCmp(std::numeric_limits<T1>::min()))
217
0
        return std::numeric_limits<T1>::min();
218
22
    if (IntCmp(value) > IntCmp(std::numeric_limits<T1>::max()))
219
0
        return std::numeric_limits<T1>::max();
220
22
    return value;
221
22
}
Unexecuted instantiation: _ZN4o3tl17clamp_to_unsignedITkNSt3__117unsigned_integralEmTkNS1_8integralEiEET_T0_
222
223
// An implicit conversion from T2 to T1, useful in places where an explicit conversion from T2 to
224
// T1 is needed (e.g., in list initialization, if the implicit conversion would be narrowing) but
225
// tools like -fsanitize=implicit-conversion should still be able to detect truncation:
226
4.08M
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
Unexecuted instantiation: int o3tl::narrowing<int, unsigned long>(unsigned long)
short o3tl::narrowing<short, int>(int)
Line
Count
Source
226
2.13k
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
Unexecuted instantiation: unsigned char o3tl::narrowing<unsigned char, int>(int)
Unexecuted instantiation: unsigned char o3tl::narrowing<unsigned char, unsigned int>(unsigned int)
Unexecuted instantiation: int o3tl::narrowing<int, float>(float)
int o3tl::narrowing<int, long>(long)
Line
Count
Source
226
26.6k
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
unsigned short o3tl::narrowing<unsigned short, unsigned long>(unsigned long)
Line
Count
Source
226
137k
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
Unexecuted instantiation: int o3tl::narrowing<int, int>(int)
unsigned short o3tl::narrowing<unsigned short, int>(int)
Line
Count
Source
226
2.98M
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
unsigned short o3tl::narrowing<unsigned short, long>(long)
Line
Count
Source
226
714k
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
unsigned short o3tl::narrowing<unsigned short, unsigned char>(unsigned char)
Line
Count
Source
226
22.1k
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
unsigned short o3tl::narrowing<unsigned short, short>(short)
Line
Count
Source
226
110k
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
Unexecuted instantiation: unsigned short o3tl::narrowing<unsigned short, TOXSortType>(TOXSortType)
unsigned short o3tl::narrowing<unsigned short, TypedWhichId<SwFormatEndAtTextEnd> >(TypedWhichId<SwFormatEndAtTextEnd>)
Line
Count
Source
226
248
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
unsigned short o3tl::narrowing<unsigned short, TypedWhichId<SwFormatFootnoteAtTextEnd> >(TypedWhichId<SwFormatFootnoteAtTextEnd>)
Line
Count
Source
226
248
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
Unexecuted instantiation: short o3tl::narrowing<short, unsigned short>(unsigned short)
unsigned short o3tl::narrowing<unsigned short, TypedWhichId<SvxFrameDirectionItem> >(TypedWhichId<SvxFrameDirectionItem>)
Line
Count
Source
226
30
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
unsigned short o3tl::narrowing<unsigned short, unsigned int>(unsigned int)
Line
Count
Source
226
79.3k
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
Unexecuted instantiation: unsigned short o3tl::narrowing<unsigned short, SwCursorShell::CursorFlag>(SwCursorShell::CursorFlag)
unsigned short o3tl::narrowing<unsigned short, double>(double)
Line
Count
Source
226
7.96k
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
Unexecuted instantiation: unsigned short o3tl::narrowing<unsigned short, ToxAuthorityField>(ToxAuthorityField)
unsigned short o3tl::narrowing<unsigned short, unsigned short>(unsigned short)
Line
Count
Source
226
6.53k
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
Unexecuted instantiation: unsigned short o3tl::narrowing<unsigned short, bool>(bool)
Unexecuted instantiation: unsigned short o3tl::narrowing<unsigned short, SvxLinkInsertMode>(SvxLinkInsertMode)
unsigned short o3tl::narrowing<unsigned short, TypedWhichId<SwFormatFrameSize> >(TypedWhichId<SwFormatFrameSize>)
Line
Count
Source
226
60
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
unsigned short o3tl::narrowing<unsigned short, TypedWhichId<SvxLRSpaceItem> >(TypedWhichId<SvxLRSpaceItem>)
Line
Count
Source
226
20
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
unsigned short o3tl::narrowing<unsigned short, TypedWhichId<SvxULSpaceItem> >(TypedWhichId<SvxULSpaceItem>)
Line
Count
Source
226
20
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
unsigned short o3tl::narrowing<unsigned short, TypedWhichId<SwFormatPageDesc> >(TypedWhichId<SwFormatPageDesc>)
Line
Count
Source
226
10
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
unsigned short o3tl::narrowing<unsigned short, TypedWhichId<SvxFormatBreakItem> >(TypedWhichId<SvxFormatBreakItem>)
Line
Count
Source
226
20
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
unsigned short o3tl::narrowing<unsigned short, TypedWhichId<SwFormatHoriOrient> >(TypedWhichId<SwFormatHoriOrient>)
Line
Count
Source
226
10
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
unsigned short o3tl::narrowing<unsigned short, TypedWhichId<SvxBrushItem> >(TypedWhichId<SvxBrushItem>)
Line
Count
Source
226
60
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
unsigned short o3tl::narrowing<unsigned short, TypedWhichId<SvxShadowItem> >(TypedWhichId<SvxShadowItem>)
Line
Count
Source
226
10
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
unsigned short o3tl::narrowing<unsigned short, TypedWhichId<SvxFormatKeepItem> >(TypedWhichId<SvxFormatKeepItem>)
Line
Count
Source
226
10
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
unsigned short o3tl::narrowing<unsigned short, TypedWhichId<SwFormatLayoutSplit> >(TypedWhichId<SwFormatLayoutSplit>)
Line
Count
Source
226
10
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
unsigned short o3tl::narrowing<unsigned short, TypedWhichId<SvXMLAttrContainerItem> >(TypedWhichId<SvXMLAttrContainerItem>)
Line
Count
Source
226
30
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
unsigned short o3tl::narrowing<unsigned short, TypedWhichId<SfxBoolItem> >(TypedWhichId<SfxBoolItem>)
Line
Count
Source
226
10
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
unsigned short o3tl::narrowing<unsigned short, TypedWhichId<SvxPrintItem> >(TypedWhichId<SvxPrintItem>)
Line
Count
Source
226
20
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
unsigned short o3tl::narrowing<unsigned short, TypedWhichId<SwFormatRowSplit> >(TypedWhichId<SwFormatRowSplit>)
Line
Count
Source
226
20
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
unsigned short o3tl::narrowing<unsigned short, TypedWhichId<SwFormatVertOrient> >(TypedWhichId<SwFormatVertOrient>)
Line
Count
Source
226
10
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
unsigned short o3tl::narrowing<unsigned short, TypedWhichId<SvxBoxItem> >(TypedWhichId<SvxBoxItem>)
Line
Count
Source
226
150
template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; }
227
228
// A helper for taking care of signed/unsigned comparisons in constant bounds case
229
// Should avoid Coverity warnings like "cid#1618764 Operands don't affect result"
230
template <std::integral I, I Min = std::template numeric_limits<I>::min(),
231
                           I Max = std::template numeric_limits<I>::max()>
232
    requires(Min <= 0 && Max > 0)
233
struct ValidRange
234
{
235
    template <std::integral I2> static constexpr bool isAbove(I2 n)
236
54.7k
    {
237
54.7k
        return IntCmp(n) > IntCmp(Max);
238
54.7k
    }
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln922337203685477ELl922337203685477EE7isAboveITkNSt3__18integralEhEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln922337203685477ELl922337203685477EE7isAboveITkNSt3__18integralEDsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln922337203685477ELl922337203685477EE7isAboveITkNSt3__18integralEsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln922337203685477ELl922337203685477EE7isAboveITkNSt3__18integralEtEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln922337203685477ELl922337203685477EE7isAboveITkNSt3__18integralEiEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln922337203685477ELl922337203685477EE7isAboveITkNSt3__18integralEjEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln922337203685477ELl922337203685477EE7isAboveITkNSt3__18integralElEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln922337203685477ELl922337203685477EE7isAboveITkNSt3__18integralEmEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeImLm0ELm18446744073709551615EE7isAboveITkNSt3__18integralElEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIDsLDs0ELDs65535EE7isAboveITkNSt3__18integralElEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIhLh0ELh255EE7isAboveITkNSt3__18integralElEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIsLsn32768ELs32767EE7isAboveITkNSt3__18integralElEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeItLt0ELt65535EE7isAboveITkNSt3__18integralElEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIiLin2147483648ELi2147483647EE7isAboveITkNSt3__18integralElEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIjLj0ELj4294967295EE7isAboveITkNSt3__18integralElEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln9223372036854775808ELl9223372036854775807EE7isAboveITkNSt3__18integralElEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIDsLDs0ELDs65535EE7isAboveITkNSt3__18integralEDsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIDsLDs0ELDs65535EE7isAboveITkNSt3__18integralEhEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIDsLDs0ELDs65535EE7isAboveITkNSt3__18integralEsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIDsLDs0ELDs65535EE7isAboveITkNSt3__18integralEtEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIDsLDs0ELDs65535EE7isAboveITkNSt3__18integralEiEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIDsLDs0ELDs65535EE7isAboveITkNSt3__18integralEjEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIDsLDs0ELDs65535EE7isAboveITkNSt3__18integralEmEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIhLh0ELh255EE7isAboveITkNSt3__18integralEDsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIhLh0ELh255EE7isAboveITkNSt3__18integralEhEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIhLh0ELh255EE7isAboveITkNSt3__18integralEsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIhLh0ELh255EE7isAboveITkNSt3__18integralEtEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIhLh0ELh255EE7isAboveITkNSt3__18integralEiEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIhLh0ELh255EE7isAboveITkNSt3__18integralEjEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIhLh0ELh255EE7isAboveITkNSt3__18integralEmEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIsLsn32768ELs32767EE7isAboveITkNSt3__18integralEDsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIsLsn32768ELs32767EE7isAboveITkNSt3__18integralEhEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIsLsn32768ELs32767EE7isAboveITkNSt3__18integralEsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIsLsn32768ELs32767EE7isAboveITkNSt3__18integralEtEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIsLsn32768ELs32767EE7isAboveITkNSt3__18integralEiEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIsLsn32768ELs32767EE7isAboveITkNSt3__18integralEjEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIsLsn32768ELs32767EE7isAboveITkNSt3__18integralEmEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeItLt0ELt65535EE7isAboveITkNSt3__18integralEDsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeItLt0ELt65535EE7isAboveITkNSt3__18integralEhEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeItLt0ELt65535EE7isAboveITkNSt3__18integralEsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeItLt0ELt65535EE7isAboveITkNSt3__18integralEtEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeItLt0ELt65535EE7isAboveITkNSt3__18integralEiEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeItLt0ELt65535EE7isAboveITkNSt3__18integralEjEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeItLt0ELt65535EE7isAboveITkNSt3__18integralEmEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIiLin2147483648ELi2147483647EE7isAboveITkNSt3__18integralEDsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIiLin2147483648ELi2147483647EE7isAboveITkNSt3__18integralEhEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIiLin2147483648ELi2147483647EE7isAboveITkNSt3__18integralEsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIiLin2147483648ELi2147483647EE7isAboveITkNSt3__18integralEtEEbT_
_ZN4o3tl10ValidRangeIiLin2147483648ELi2147483647EE7isAboveITkNSt3__18integralEiEEbT_
Line
Count
Source
236
54.7k
    {
237
54.7k
        return IntCmp(n) > IntCmp(Max);
238
54.7k
    }
Unexecuted instantiation: _ZN4o3tl10ValidRangeIiLin2147483648ELi2147483647EE7isAboveITkNSt3__18integralEjEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIiLin2147483648ELi2147483647EE7isAboveITkNSt3__18integralEmEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIjLj0ELj4294967295EE7isAboveITkNSt3__18integralEDsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIjLj0ELj4294967295EE7isAboveITkNSt3__18integralEhEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIjLj0ELj4294967295EE7isAboveITkNSt3__18integralEsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIjLj0ELj4294967295EE7isAboveITkNSt3__18integralEtEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIjLj0ELj4294967295EE7isAboveITkNSt3__18integralEiEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIjLj0ELj4294967295EE7isAboveITkNSt3__18integralEjEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIjLj0ELj4294967295EE7isAboveITkNSt3__18integralEmEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln9223372036854775808ELl9223372036854775807EE7isAboveITkNSt3__18integralEDsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln9223372036854775808ELl9223372036854775807EE7isAboveITkNSt3__18integralEhEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln9223372036854775808ELl9223372036854775807EE7isAboveITkNSt3__18integralEsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln9223372036854775808ELl9223372036854775807EE7isAboveITkNSt3__18integralEtEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln9223372036854775808ELl9223372036854775807EE7isAboveITkNSt3__18integralEiEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln9223372036854775808ELl9223372036854775807EE7isAboveITkNSt3__18integralEjEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln9223372036854775808ELl9223372036854775807EE7isAboveITkNSt3__18integralEmEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeImLm0ELm18446744073709551615EE7isAboveITkNSt3__18integralEDsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeImLm0ELm18446744073709551615EE7isAboveITkNSt3__18integralEhEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeImLm0ELm18446744073709551615EE7isAboveITkNSt3__18integralEsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeImLm0ELm18446744073709551615EE7isAboveITkNSt3__18integralEtEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeImLm0ELm18446744073709551615EE7isAboveITkNSt3__18integralEiEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeImLm0ELm18446744073709551615EE7isAboveITkNSt3__18integralEjEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeImLm0ELm18446744073709551615EE7isAboveITkNSt3__18integralEmEEbT_
239
240
    template <std::integral I2> static constexpr bool isBelow(I2 n)
241
54.7k
    {
242
54.7k
        return IntCmp(n) < IntCmp(Min);
243
54.7k
    }
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln922337203685477ELl922337203685477EE7isBelowITkNSt3__18integralEhEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln922337203685477ELl922337203685477EE7isBelowITkNSt3__18integralEDsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln922337203685477ELl922337203685477EE7isBelowITkNSt3__18integralEsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln922337203685477ELl922337203685477EE7isBelowITkNSt3__18integralEtEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln922337203685477ELl922337203685477EE7isBelowITkNSt3__18integralEiEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln922337203685477ELl922337203685477EE7isBelowITkNSt3__18integralEjEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln922337203685477ELl922337203685477EE7isBelowITkNSt3__18integralElEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln922337203685477ELl922337203685477EE7isBelowITkNSt3__18integralEmEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeImLm0ELm18446744073709551615EE7isBelowITkNSt3__18integralElEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIDsLDs0ELDs65535EE7isBelowITkNSt3__18integralElEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIhLh0ELh255EE7isBelowITkNSt3__18integralElEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIsLsn32768ELs32767EE7isBelowITkNSt3__18integralElEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeItLt0ELt65535EE7isBelowITkNSt3__18integralElEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIiLin2147483648ELi2147483647EE7isBelowITkNSt3__18integralElEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIjLj0ELj4294967295EE7isBelowITkNSt3__18integralElEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln9223372036854775808ELl9223372036854775807EE7isBelowITkNSt3__18integralElEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIDsLDs0ELDs65535EE7isBelowITkNSt3__18integralEDsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIDsLDs0ELDs65535EE7isBelowITkNSt3__18integralEhEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIDsLDs0ELDs65535EE7isBelowITkNSt3__18integralEsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIDsLDs0ELDs65535EE7isBelowITkNSt3__18integralEtEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIDsLDs0ELDs65535EE7isBelowITkNSt3__18integralEiEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIDsLDs0ELDs65535EE7isBelowITkNSt3__18integralEjEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIDsLDs0ELDs65535EE7isBelowITkNSt3__18integralEmEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIhLh0ELh255EE7isBelowITkNSt3__18integralEDsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIhLh0ELh255EE7isBelowITkNSt3__18integralEhEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIhLh0ELh255EE7isBelowITkNSt3__18integralEsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIhLh0ELh255EE7isBelowITkNSt3__18integralEtEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIhLh0ELh255EE7isBelowITkNSt3__18integralEiEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIhLh0ELh255EE7isBelowITkNSt3__18integralEjEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIhLh0ELh255EE7isBelowITkNSt3__18integralEmEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIsLsn32768ELs32767EE7isBelowITkNSt3__18integralEDsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIsLsn32768ELs32767EE7isBelowITkNSt3__18integralEhEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIsLsn32768ELs32767EE7isBelowITkNSt3__18integralEsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIsLsn32768ELs32767EE7isBelowITkNSt3__18integralEtEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIsLsn32768ELs32767EE7isBelowITkNSt3__18integralEiEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIsLsn32768ELs32767EE7isBelowITkNSt3__18integralEjEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIsLsn32768ELs32767EE7isBelowITkNSt3__18integralEmEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeItLt0ELt65535EE7isBelowITkNSt3__18integralEDsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeItLt0ELt65535EE7isBelowITkNSt3__18integralEhEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeItLt0ELt65535EE7isBelowITkNSt3__18integralEsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeItLt0ELt65535EE7isBelowITkNSt3__18integralEtEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeItLt0ELt65535EE7isBelowITkNSt3__18integralEiEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeItLt0ELt65535EE7isBelowITkNSt3__18integralEjEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeItLt0ELt65535EE7isBelowITkNSt3__18integralEmEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIiLin2147483648ELi2147483647EE7isBelowITkNSt3__18integralEDsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIiLin2147483648ELi2147483647EE7isBelowITkNSt3__18integralEhEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIiLin2147483648ELi2147483647EE7isBelowITkNSt3__18integralEsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIiLin2147483648ELi2147483647EE7isBelowITkNSt3__18integralEtEEbT_
_ZN4o3tl10ValidRangeIiLin2147483648ELi2147483647EE7isBelowITkNSt3__18integralEiEEbT_
Line
Count
Source
241
54.7k
    {
242
54.7k
        return IntCmp(n) < IntCmp(Min);
243
54.7k
    }
Unexecuted instantiation: _ZN4o3tl10ValidRangeIiLin2147483648ELi2147483647EE7isBelowITkNSt3__18integralEjEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIiLin2147483648ELi2147483647EE7isBelowITkNSt3__18integralEmEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIjLj0ELj4294967295EE7isBelowITkNSt3__18integralEDsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIjLj0ELj4294967295EE7isBelowITkNSt3__18integralEhEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIjLj0ELj4294967295EE7isBelowITkNSt3__18integralEsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIjLj0ELj4294967295EE7isBelowITkNSt3__18integralEtEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIjLj0ELj4294967295EE7isBelowITkNSt3__18integralEiEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIjLj0ELj4294967295EE7isBelowITkNSt3__18integralEjEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIjLj0ELj4294967295EE7isBelowITkNSt3__18integralEmEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln9223372036854775808ELl9223372036854775807EE7isBelowITkNSt3__18integralEDsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln9223372036854775808ELl9223372036854775807EE7isBelowITkNSt3__18integralEhEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln9223372036854775808ELl9223372036854775807EE7isBelowITkNSt3__18integralEsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln9223372036854775808ELl9223372036854775807EE7isBelowITkNSt3__18integralEtEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln9223372036854775808ELl9223372036854775807EE7isBelowITkNSt3__18integralEiEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln9223372036854775808ELl9223372036854775807EE7isBelowITkNSt3__18integralEjEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeIlLln9223372036854775808ELl9223372036854775807EE7isBelowITkNSt3__18integralEmEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeImLm0ELm18446744073709551615EE7isBelowITkNSt3__18integralEDsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeImLm0ELm18446744073709551615EE7isBelowITkNSt3__18integralEhEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeImLm0ELm18446744073709551615EE7isBelowITkNSt3__18integralEsEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeImLm0ELm18446744073709551615EE7isBelowITkNSt3__18integralEtEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeImLm0ELm18446744073709551615EE7isBelowITkNSt3__18integralEiEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeImLm0ELm18446744073709551615EE7isBelowITkNSt3__18integralEjEEbT_
Unexecuted instantiation: _ZN4o3tl10ValidRangeImLm0ELm18446744073709551615EE7isBelowITkNSt3__18integralEmEEbT_
244
245
    template <std::integral I2> static constexpr bool isOutside(I2 n)
246
    {
247
        return isAbove(n) || isBelow(n);
248
    }
249
250
    template <std::integral I2> static constexpr bool isInside(I2 n) { return !isOutside(n); }
251
};
252
253
}
254
255
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */