This file is indexed.

/usr/include/obs/util/serializer.h is in libobs-dev 21.0.2+dfsg1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/*
 * Copyright (c) 2013 Hugh Bailey <obs.jim@gmail.com>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#pragma once

#include "c99defs.h"

/*
 *   General programmable serialization functions.  (A shared interface to
 * various reading/writing to/from different inputs/outputs)
 */

#ifdef __cplusplus
extern "C" {
#endif

enum serialize_seek_type {
	SERIALIZE_SEEK_START,
	SERIALIZE_SEEK_CURRENT,
	SERIALIZE_SEEK_END
};

struct serializer {
	void     *data;

	size_t   (*read)(void *, void *, size_t);
	size_t   (*write)(void *, const void *, size_t);
	int64_t  (*seek)(void *, int64_t, enum serialize_seek_type);
	int64_t  (*get_pos)(void *);
};

static inline size_t s_read(struct serializer *s, void *data, size_t size)
{
	if (s && s->read && data && size)
		return s->read(s->data, (void*)data, size);
	return 0;
}

static inline size_t s_write(struct serializer *s, const void *data,
		size_t size)
{
	if (s && s->write && data && size)
		return s->write(s->data, (void*)data, size);
	return 0;
}

static inline size_t serialize(struct serializer *s, void *data, size_t len)
{
	if (s) {
		if (s->write)
			return s->write(s->data, data, len);
		else if (s->read)
			return s->read(s->data, data, len);
	}

	return 0;
}

static inline int64_t serializer_seek(struct serializer *s, int64_t offset,
		enum serialize_seek_type seek_type)
{
	if (s && s->seek)
		return s->seek(s->data, offset, seek_type);
	return -1;
}

static inline int64_t serializer_get_pos(struct serializer *s)
{
	if (s && s->get_pos)
		return s->get_pos(s->data);
	return -1;
}

/* formatted this to be similar to the AVIO layout that ffmpeg uses */

static inline void s_w8(struct serializer *s, uint8_t u8)
{
	s_write(s, &u8, sizeof(uint8_t));
}

static inline void s_wl16(struct serializer *s, uint16_t u16)
{
	s_w8(s, (uint8_t)u16);
	s_w8(s, u16 >> 8);
}

static inline void s_wl24(struct serializer *s, uint32_t u24)
{
	s_w8  (s, (uint8_t)u24);
	s_wl16(s, (uint16_t)(u24 >> 8));
}

static inline void s_wl32(struct serializer *s, uint32_t u32)
{
	s_wl16(s, (uint16_t)u32);
	s_wl16(s, (uint16_t)(u32 >> 16));
}

static inline void s_wl64(struct serializer *s, uint64_t u64)
{
	s_wl32(s, (uint32_t)u64);
	s_wl32(s, (uint32_t)(u64 >> 32));
}

static inline void s_wlf(struct serializer *s, float f)
{
	s_wl32(s, *(uint32_t*)&f);
}

static inline void s_wld(struct serializer *s, double d)
{
	s_wl64(s, *(uint64_t*)&d);
}

static inline void s_wb16(struct serializer *s, uint16_t u16)
{
	s_w8(s, u16 >> 8);
	s_w8(s, (uint8_t)u16);
}

static inline void s_wb24(struct serializer *s, uint32_t u24)
{
	s_wb16(s, (uint16_t)(u24 >> 8));
	s_w8  (s, (uint8_t)u24);
}

static inline void s_wb32(struct serializer *s, uint32_t u32)
{
	s_wb16(s, (uint16_t)(u32 >> 16));
	s_wb16(s, (uint16_t)u32);
}

static inline void s_wb64(struct serializer *s, uint64_t u64)
{
	s_wb32(s, (uint32_t)(u64 >> 32));
	s_wb32(s, (uint32_t)u64);
}

static inline void s_wbf(struct serializer *s, float f)
{
	s_wb32(s, *(uint32_t*)&f);
}

static inline void s_wbd(struct serializer *s, double d)
{
	s_wb64(s, *(uint64_t*)&d);
}

#ifdef __cplusplus
}
#endif