This file is indexed.

/usr/include/qtruby/marshall_complex.h is in libqtruby4shared-dev 4:4.13.0-0ubuntu1.

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
165
166
167
168
169
170
171
172
173
174
175
/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Lesser General Public License as        *
 *   published by the Free Software Foundation; either version 2 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 ***************************************************************************/

#ifndef MARSHALL_COMPLEX_H
#define MARSHALL_COMPLEX_H

#include <QtCore/qlist.h>
#include <QtCore/qlinkedlist.h>
#include <QtCore/qvector.h>

template <>
void marshall_from_ruby<long long>(Marshall *m) 
{
	VALUE obj = *(m->var());
	m->item().s_voidp = new long long;
	*(long long *)m->item().s_voidp = ruby_to_primitive<long long>(obj);
	
	m->next();
	
	if(m->cleanup() && m->type().isConst()) {
		delete (long long int *) m->item().s_voidp;
	}	
}

template <>
void marshall_from_ruby<unsigned long long>(Marshall *m) 
{
	VALUE obj = *(m->var());
	m->item().s_voidp = new unsigned long long;
	*(long long *)m->item().s_voidp = ruby_to_primitive<unsigned long long>(obj);

	m->next();
	
	if(m->cleanup() && m->type().isConst()) {
		delete (long long int *) m->item().s_voidp;
	}	
}

template <>
void marshall_from_ruby<int *>(Marshall *m) 
{
	VALUE rv = *(m->var());
	int *i = new int;
	
	if (rv == Qnil) {
		m->item().s_voidp = 0;
		return;
	} else if (TYPE(rv) == T_OBJECT) {
		// A Qt::Integer has been passed as an integer value
		VALUE temp = rb_funcall(qt_internal_module, rb_intern("get_qinteger"), 1, rv);
		*i = NUM2INT(temp);
		m->item().s_voidp = i;
		m->next();
		rb_funcall(qt_internal_module, rb_intern("set_qinteger"), 2, rv, INT2NUM(*i));
		rv = temp;
	} else {
		*i = NUM2INT(rv);
		m->item().s_voidp = i;
		m->next();
	}

	if(m->cleanup() && m->type().isConst()) {
		delete i;
	} else {
		m->item().s_voidp = new int((int)NUM2INT(rv));
	}
}

template <>
void marshall_to_ruby<int *>(Marshall *m)
{
	int *ip = (int*)m->item().s_voidp;
	VALUE rv = *(m->var());
	if(!ip) {
		rv = Qnil;
		return;
	}
	
	*(m->var()) = INT2NUM(*ip);
	m->next();
	if(!m->type().isConst())
		*ip = NUM2INT(*(m->var()));
}

template <>
void marshall_from_ruby<unsigned int *>(Marshall *m) 
{
	VALUE rv = *(m->var());
	unsigned int *i = new unsigned int;
	
	if (rv == Qnil) {
		m->item().s_voidp = 0;
		return;
	} else if (TYPE(rv) == T_OBJECT) {
		// A Qt::Integer has been passed as an integer value
		VALUE temp = rb_funcall(qt_internal_module, rb_intern("get_qinteger"), 1, rv);
		*i = NUM2INT(temp);
		m->item().s_voidp = i;
		m->next();
		rb_funcall(qt_internal_module, rb_intern("set_qinteger"), 2, rv, INT2NUM(*i));
		rv = temp;
	} else {
		*i = NUM2UINT(rv);
		m->item().s_voidp = i;
		m->next();
	}

	if(m->cleanup() && m->type().isConst()) {
		delete i;
	} else {
		m->item().s_voidp = new int((int)NUM2UINT(rv));
	}
}

template <>
void marshall_to_ruby<unsigned int *>(Marshall *m)
{
	unsigned int *ip = (unsigned int*) m->item().s_voidp;
	VALUE rv = *(m->var());
	if (ip == 0) {
		rv = Qnil;
		return;
	}
	
	*(m->var()) = UINT2NUM(*ip);
	m->next();
	if(!m->type().isConst())
		*ip = NUM2UINT(*(m->var()));
}

template <>
void marshall_from_ruby<bool *>(Marshall *m) 
{
   VALUE rv = *(m->var());
	bool * b = new bool;

	if (TYPE(rv) == T_OBJECT) {
		// A Qt::Boolean has been passed as a value
		VALUE temp = rb_funcall(qt_internal_module, rb_intern("get_qboolean"), 1, rv);
		*b = (temp == Qtrue ? true : false);
		m->item().s_voidp = b;
		m->next();
		rb_funcall(qt_internal_module, rb_intern("set_qboolean"), 2, rv, (*b ? Qtrue : Qfalse));
	} else {
		*b = (rv == Qtrue ? true : false);
		m->item().s_voidp = b;
		m->next();
	}

	if(m->cleanup() && m->type().isConst()) {
		delete b;
	}
}

template <>
void marshall_to_ruby<bool *>(Marshall *m)
{
	bool *ip = (bool*)m->item().s_voidp;
	if(!ip) {
		*(m->var()) = Qnil;
		return;
	}
	*(m->var()) = (*ip?Qtrue:Qfalse);
	m->next();
	if(!m->type().isConst())
	*ip = *(m->var()) == Qtrue ? true : false;
}

#endif