Coverage Report

Created: 2026-03-15 06:47

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openexr/src/lib/OpenEXR/ImfLineOrderAttribute.cpp
Line
Count
Source
1
//
2
// SPDX-License-Identifier: BSD-3-Clause
3
// Copyright (c) Contributors to the OpenEXR Project.
4
//
5
6
//-----------------------------------------------------------------------------
7
//
8
//  class LineOrderAttribute
9
//
10
//-----------------------------------------------------------------------------
11
#define COMPILING_IMF_LINE_ORDER_ATTRIBUTE
12
13
#include "ImfLineOrderAttribute.h"
14
15
#if defined(_MSC_VER)
16
// suppress warning about non-exported base classes
17
#    pragma warning(disable : 4251)
18
#    pragma warning(disable : 4275)
19
#endif
20
21
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
22
23
using namespace OPENEXR_IMF_INTERNAL_NAMESPACE;
24
25
template <>
26
IMF_EXPORT const char*
27
LineOrderAttribute::staticTypeName ()
28
446k
{
29
446k
    return "lineOrder";
30
446k
}
31
32
template <>
33
IMF_EXPORT void
34
LineOrderAttribute::writeValueTo (
35
    OPENEXR_IMF_INTERNAL_NAMESPACE::OStream& os, int version) const
36
0
{
37
0
    unsigned char tmp = _value;
38
0
    Xdr::write<StreamIO> (os, tmp);
39
0
}
40
41
template <>
42
IMF_EXPORT void
43
LineOrderAttribute::readValueFrom (
44
    OPENEXR_IMF_INTERNAL_NAMESPACE::IStream& is, int size, int version)
45
0
{
46
0
    unsigned char tmp;
47
0
    Xdr::read<StreamIO> (is, tmp);
48
49
    //
50
    // prevent invalid values being written to LineOrder enum
51
    // by forcing all unknown types to NUM_LINEORDERS which is also an invalid
52
    // value but is a legal enum. Note that Header::sanityCheck will
53
    // throw an exception when files with invalid lineOrders
54
    //
55
56
0
    if (tmp != INCREASING_Y && tmp != DECREASING_Y && tmp != RANDOM_Y)
57
0
        tmp = NUM_LINEORDERS;
58
59
0
    _value = LineOrder (tmp);
60
0
}
61
62
template class IMF_EXPORT_TEMPLATE_INSTANCE
63
    TypedAttribute<OPENEXR_IMF_INTERNAL_NAMESPACE::LineOrder>;
64
65
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT