../3rdparty/harfbuzz/src/harfbuzz-stream.c

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/* -
2 * Copyright (C) 2005 David Turner -
3 * Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies) -
4 * Copyright (C) 2007 Red Hat, Inc. -
5 * -
6 * This is part of HarfBuzz, an OpenType Layout engine library. -
7 * -
8 * Permission is hereby granted, without written agreement and without -
9 * license or royalty fees, to use, copy, modify, and distribute this -
10 * software and its documentation for any purpose, provided that the -
11 * above copyright notice and the following two paragraphs appear in -
12 * all copies of this software. -
13 * -
14 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR -
15 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES -
16 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN -
17 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -
18 * DAMAGE. -
19 * -
20 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, -
21 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -
22 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS -
23 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO -
24 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -
25 * -
26 * Red Hat Author(s): Behdad Esfahbod -
27 */ -
28 -
29#include "harfbuzz-impl.h" -
30#include "harfbuzz-stream-private.h" -
31#include <stdlib.h> -
32 -
33#if 0 -
34#include <stdio.h> -
35#define LOG(x) _hb_log x -
36 -
37static void -
38_hb_log( const char* format, ... ) -
39{ -
40 va_list ap; -
41 -
42 va_start( ap, format ); -
43 vfprintf( stderr, format, ap ); -
44 va_end( ap ); -
45} -
46 -
47#else -
48#define LOG(x) do {} while (0) -
49#endif -
50 -
51HB_INTERNAL void -
52_hb_close_stream( HB_Stream stream ) -
53{ -
54 if (!stream)
evaluated: !stream
TRUEFALSE
yes
Evaluation Count:240
yes
Evaluation Count:414
240-414
55 return;
executed: return;
Execution Count:240
240
56 free(stream->base);
executed (the execution status of this line is deduced): free(stream->base);
-
57 free(stream);
executed (the execution status of this line is deduced): free(stream);
-
58}
executed: }
Execution Count:414
414
59 -
60 -
61HB_INTERNAL HB_Int -
62_hb_stream_pos( HB_Stream stream ) -
63{ -
64 LOG(( "_hb_stream_pos() -> %ld\n", stream->pos ));
executed: }
Execution Count:877145
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:877145
0-877145
65 return stream->pos;
executed: return stream->pos;
Execution Count:877145
877145
66} -
67 -
68 -
69HB_INTERNAL HB_Error -
70_hb_stream_seek( HB_Stream stream, -
71 HB_UInt pos ) -
72{ -
73 HB_Error error = (HB_Error)0;
executed (the execution status of this line is deduced): HB_Error error = (HB_Error)0;
-
74 -
75 stream->pos = pos;
executed (the execution status of this line is deduced): stream->pos = pos;
-
76 if (pos > stream->size)
partially evaluated: pos > stream->size
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:925905
0-925905
77 error = ERR(HB_Err_Read_Error);
never executed: error = _hb_err (HB_Err_Read_Error);
0
78 -
79 LOG(( "_hb_stream_seek(%ld) -> 0x%04X\n", pos, error ));
executed: }
Execution Count:925905
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:925905
0-925905
80 return error;
executed: return error;
Execution Count:925905
925905
81} -
82 -
83 -
84HB_INTERNAL HB_Error -
85_hb_stream_frame_enter( HB_Stream stream, -
86 HB_UInt count ) -
87{ -
88 HB_Error error = HB_Err_Ok;
executed (the execution status of this line is deduced): HB_Error error = HB_Err_Ok;
-
89 -
90 /* check new position, watch for overflow */ -
91 if (HB_UNLIKELY (stream->pos + count > stream->size ||
partially evaluated: stream->pos + count > stream->size
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1398725
partially evaluated: stream->pos + count < stream->pos
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1398725
0-1398725
92 stream->pos + count < stream->pos)) -
93 { -
94 error = ERR(HB_Err_Read_Error);
never executed (the execution status of this line is deduced): error = _hb_err (HB_Err_Read_Error);
-
95 goto Exit;
never executed: goto Exit;
0
96 } -
97 -
98 /* set cursor */ -
99 stream->cursor = stream->base + stream->pos;
executed (the execution status of this line is deduced): stream->cursor = stream->base + stream->pos;
-
100 stream->pos += count;
executed (the execution status of this line is deduced): stream->pos += count;
-
101 -
102Exit:
code before this statement executed: Exit:
Execution Count:1398725
1398725
103 LOG(( "_hb_stream_frame_enter(%ld) -> 0x%04X\n", count, error ));
executed: }
Execution Count:1398725
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1398725
0-1398725
104 return error;
executed: return error;
Execution Count:1398725
1398725
105} -
106 -
107 -
108HB_INTERNAL void -
109_hb_stream_frame_exit( HB_Stream stream ) -
110{ -
111 stream->cursor = NULL;
executed (the execution status of this line is deduced): stream->cursor = ((void *)0);
-
112 -
113 LOG(( "_hb_stream_frame_exit()\n" ));
executed: }
Execution Count:1398623
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1398623
0-1398623
114}
executed: }
Execution Count:1398623
1398623
115 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial