Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 219438 | Differences between
and this patch

Collapse All | Expand All

(-)rezound-0.12.3beta~/src/backend/ALFO.h (-2 / +12 lines)
Lines 21-26 Link Here
21
#ifndef __ALFO_H__
21
#ifndef __ALFO_H__
22
#define __ALFO_H__
22
#define __ALFO_H__
23
23
24
#ifndef GCC_VERSION
25
#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
26
#endif
27
28
#if GCC_VERSION >= 403
29
# define STATIC
30
#else
31
# define STATIC static
32
#endif
33
24
#include "../../config/common.h"
34
#include "../../config/common.h"
25
35
26
#include "CSound_defs.h"
36
#include "CSound_defs.h"
Lines 94-100 Link Here
94
};
104
};
95
105
96
#include <CNestedDataFile/anytype.h>
106
#include <CNestedDataFile/anytype.h>
97
template<> static const CLFODescription string_to_anytype<CLFODescription>(const string &str,CLFODescription &ret) 
107
template<> STATIC const CLFODescription string_to_anytype<CLFODescription>(const string &str,CLFODescription &ret) 
98
{
108
{
99
	 CNestedDataFile f;
109
	 CNestedDataFile f;
100
	 f.parseString(s2at::remove_surrounding_quotes(str));
110
	 f.parseString(s2at::remove_surrounding_quotes(str));
Lines 102-108 Link Here
102
	 return ret;
112
	 return ret;
103
}
113
}
104
114
105
template<> static const string anytype_to_string<CLFODescription>(const CLFODescription &any) 
115
template<> STATIC const string anytype_to_string<CLFODescription>(const CLFODescription &any) 
106
{
116
{
107
	CNestedDataFile f; any.writeToFile(&f,"");
117
	CNestedDataFile f; any.writeToFile(&f,"");
108
	return "\""+s2at::escape_chars(istring(f.asString()).searchAndReplace("\n"," ",true))+"\"";
118
	return "\""+s2at::escape_chars(istring(f.asString()).searchAndReplace("\n"," ",true))+"\"";
(-)rezound-0.12.3beta~/src/backend/CGraphParamValueNode.h (-2 / +11 lines)
Lines 21-26 Link Here
21
#ifndef __CGraphParamValueNode_H__
21
#ifndef __CGraphParamValueNode_H__
22
#define __CGraphParamValueNode_H__
22
#define __CGraphParamValueNode_H__
23
23
24
#ifndef GCC_VERSION
25
#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
26
#endif
27
28
#if GCC_VERSION >= 403
29
# define STATIC
30
#else
31
# define STATIC static
32
#endif
24
33
25
#include "../../config/common.h"
34
#include "../../config/common.h"
26
35
Lines 45-51 Link Here
45
typedef vector<CGraphParamValueNode> CGraphParamValueNodeList;
54
typedef vector<CGraphParamValueNode> CGraphParamValueNodeList;
46
55
47
#include <CNestedDataFile/anytype.h>
56
#include <CNestedDataFile/anytype.h>
48
template<> static const CGraphParamValueNode string_to_anytype<CGraphParamValueNode>(const string &_str,CGraphParamValueNode &ret) 
57
template<> STATIC const CGraphParamValueNode string_to_anytype<CGraphParamValueNode>(const string &_str,CGraphParamValueNode &ret) 
49
{
58
{
50
	const string str=s2at::remove_surrounding_quotes(_str); 
59
	const string str=s2at::remove_surrounding_quotes(_str); 
51
	const size_t pos=str.find("|"); 
60
	const size_t pos=str.find("|"); 
Lines 56-62 Link Here
56
	return ret; 
65
	return ret; 
57
}
66
}
58
67
59
template<> static const string anytype_to_string<CGraphParamValueNode>(const CGraphParamValueNode &any) 
68
template<> STATIC const string anytype_to_string<CGraphParamValueNode>(const CGraphParamValueNode &any) 
60
{
69
{
61
	return "\""+anytype_to_string<double>(any.x)+"|"+anytype_to_string<double>(any.y)+"\""; 
70
	return "\""+anytype_to_string<double>(any.x)+"|"+anytype_to_string<double>(any.y)+"\""; 
62
}
71
}
(-)rezound-0.12.3beta~/src/backend/CPluginMapping.h (-2 / +12 lines)
Lines 21-26 Link Here
21
#ifndef __CPluginMapping_H__
21
#ifndef __CPluginMapping_H__
22
#define __CPluginMapping_H__
22
#define __CPluginMapping_H__
23
23
24
#ifndef GCC_VERSION
25
#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
26
#endif
27
28
#if GCC_VERSION >= 403
29
# define STATIC
30
#else
31
# define STATIC static
32
#endif
33
24
#include "../../config/common.h"
34
#include "../../config/common.h"
25
35
26
#include <string>
36
#include <string>
Lines 215-221 Link Here
215
};
225
};
216
226
217
#include <CNestedDataFile/anytype.h>
227
#include <CNestedDataFile/anytype.h>
218
template<> static const CPluginMapping string_to_anytype<CPluginMapping>(const string &str,CPluginMapping &ret)
228
template<> STATIC const CPluginMapping string_to_anytype<CPluginMapping>(const string &str,CPluginMapping &ret)
219
{
229
{
220
	CNestedDataFile f;
230
	CNestedDataFile f;
221
	f.parseString(s2at::remove_surrounding_quotes(str));
231
	f.parseString(s2at::remove_surrounding_quotes(str));
Lines 223-229 Link Here
223
	return ret;
233
	return ret;
224
}
234
}
225
235
226
template<> static const string anytype_to_string<CPluginMapping>(const CPluginMapping &any)
236
template<> STATIC const string anytype_to_string<CPluginMapping>(const CPluginMapping &any)
227
{
237
{
228
	CNestedDataFile f;
238
	CNestedDataFile f;
229
	any.writeToFile(&f,"");
239
	any.writeToFile(&f,"");
(-)rezound-0.12.3beta~/src/backend/CSound_defs.h (-24 / +34 lines)
Lines 21-26 Link Here
21
#ifndef __CSound_defs_H__
21
#ifndef __CSound_defs_H__
22
#define __CSound_defs_H__
22
#define __CSound_defs_H__
23
23
24
#ifndef GCC_VERSION
25
#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
26
#endif
27
28
#if GCC_VERSION >= 403
29
# define STATIC
30
#else
31
# define STATIC static
32
#endif
33
24
#include "../../config/common.h"
34
#include "../../config/common.h"
25
35
26
class CSound;
36
class CSound;
Lines 161-170 Link Here
161
171
162
// int8_t -> ...
172
// int8_t -> ...
163
	// int8_t -> int8_t
173
	// int8_t -> int8_t
164
	template<> static inline const int8_t convert_sample<int8_t,int8_t>(const register int8_t sample) { return sample; }
174
	template<> STATIC inline const int8_t convert_sample<int8_t,int8_t>(const register int8_t sample) { return sample; }
165
175
166
	// int8_t -> int16_t
176
	// int8_t -> int16_t
167
	template<> static inline const int16_t convert_sample<int8_t,int16_t>(const register int8_t sample) { return sample*256; }
177
	template<> STATIC inline const int16_t convert_sample<int8_t,int16_t>(const register int8_t sample) { return sample*256; }
168
178
169
	// int8_t -> int24_t
179
	// int8_t -> int24_t
170
	//template<> static inline const int24_t convert_sample<int8_t,int24_t>(const register int8_t sample) { }
180
	//template<> static inline const int24_t convert_sample<int8_t,int24_t>(const register int8_t sample) { }
Lines 173-179 Link Here
173
	//template<> static inline const int32_t convert_sample<int8_t,int32_t>(const register int8_t sample) { }
183
	//template<> static inline const int32_t convert_sample<int8_t,int32_t>(const register int8_t sample) { }
174
184
175
	// int8_t -> float
185
	// int8_t -> float
176
	template<> static inline const float convert_sample<int8_t,float>(const register int8_t sample) { return ((float)sample)/127.0f; }
186
	template<> STATIC inline const float convert_sample<int8_t,float>(const register int8_t sample) { return ((float)sample)/127.0f; }
177
187
178
	// int8_t -> double
188
	// int8_t -> double
179
	//template<> static inline const double convert_sample<int8_t,double>(const register int8_t sample) { }
189
	//template<> static inline const double convert_sample<int8_t,double>(const register int8_t sample) { }
Lines 181-202 Link Here
181
191
182
// int16_t -> ...
192
// int16_t -> ...
183
	// int16_t -> int8_t
193
	// int16_t -> int8_t
184
	template<> static inline const int8_t convert_sample<int16_t,int8_t>(const register int16_t sample) { return sample/256; }
194
	template<> STATIC inline const int8_t convert_sample<int16_t,int8_t>(const register int16_t sample) { return sample/256; }
185
195
186
	// int16_t -> int16_t
196
	// int16_t -> int16_t
187
	template<> static inline const int16_t convert_sample<int16_t,int16_t>(const register int16_t sample) { return sample; }
197
	template<> STATIC inline const int16_t convert_sample<int16_t,int16_t>(const register int16_t sample) { return sample; }
188
198
189
	// int16_t -> int24_t
199
	// int16_t -> int24_t
190
	template<> static inline const int24_t convert_sample<int16_t,int24_t>(const register int16_t sample) { int24_t r; r.set(sample*256); return r; }
200
	template<> STATIC inline const int24_t convert_sample<int16_t,int24_t>(const register int16_t sample) { int24_t r; r.set(sample*256); return r; }
191
201
192
	// int16_t -> int32_t
202
	// int16_t -> int32_t
193
	template<> static inline const int32_t convert_sample<int16_t,int32_t>(const register int16_t sample) { return sample*65536; }
203
	template<> STATIC inline const int32_t convert_sample<int16_t,int32_t>(const register int16_t sample) { return sample*65536; }
194
204
195
	// int16_t -> float
205
	// int16_t -> float
196
	template<> static inline const float convert_sample<int16_t,float>(const register int16_t sample) { return (float)sample/32767.0f; }
206
	template<> STATIC inline const float convert_sample<int16_t,float>(const register int16_t sample) { return (float)sample/32767.0f; }
197
207
198
	// int16_t -> double
208
	// int16_t -> double
199
	template<> static inline const double convert_sample<int16_t,double>(const register int16_t sample) { return (double)sample/32767.0; }
209
	template<> STATIC inline const double convert_sample<int16_t,double>(const register int16_t sample) { return (double)sample/32767.0; }
200
210
201
211
202
// int24_t -> ...
212
// int24_t -> ...
Lines 204-219 Link Here
204
	//template<> static inline const int8_t convert_sample<int24_t,int8_t>(const int24_t sample) { }
214
	//template<> static inline const int8_t convert_sample<int24_t,int8_t>(const int24_t sample) { }
205
215
206
	// int24_t -> int16_t
216
	// int24_t -> int16_t
207
	template<> static inline const int16_t convert_sample<int24_t,int16_t>(const int24_t sample) { return sample.get()>>8; }
217
	template<> STATIC inline const int16_t convert_sample<int24_t,int16_t>(const int24_t sample) { return sample.get()>>8; }
208
218
209
	// int24_t -> int24_t
219
	// int24_t -> int24_t
210
	template<> static inline const int24_t convert_sample<int24_t,int24_t>(const int24_t sample) { return sample; }
220
	template<> STATIC inline const int24_t convert_sample<int24_t,int24_t>(const int24_t sample) { return sample; }
211
221
212
	// int24_t -> int32_t
222
	// int24_t -> int32_t
213
	//template<> static inline const int32_t convert_sample<int24_t,int32_t>(const int24_t sample) { }
223
	//template<> static inline const int32_t convert_sample<int24_t,int32_t>(const int24_t sample) { }
214
224
215
	// int24_t -> float
225
	// int24_t -> float
216
	template<> static inline const float convert_sample<int24_t,float>(const int24_t sample) { return sample.get()/8388607.0f; }
226
	template<> STATIC inline const float convert_sample<int24_t,float>(const int24_t sample) { return sample.get()/8388607.0f; }
217
227
218
	// int24_t -> double
228
	// int24_t -> double
219
	//template<> static inline const double convert_sample<int24_t,double>(const int24_t sample) { }
229
	//template<> static inline const double convert_sample<int24_t,double>(const int24_t sample) { }
Lines 224-239 Link Here
224
	//template<> static inline const int8_t convert_sample<int32_t,int8_t>(const register int32_t sample) { }
234
	//template<> static inline const int8_t convert_sample<int32_t,int8_t>(const register int32_t sample) { }
225
235
226
	// int32_t -> int16_t
236
	// int32_t -> int16_t
227
	template<> static inline const int16_t convert_sample<int32_t,int16_t>(const register int32_t sample) { return sample/65536; }
237
	template<> STATIC inline const int16_t convert_sample<int32_t,int16_t>(const register int32_t sample) { return sample/65536; }
228
238
229
	// int32_t -> int24_t
239
	// int32_t -> int24_t
230
	//template<> static inline const int24_t convert_sample<int32_t,int24_t>(const register int32_t sample) { }
240
	//template<> static inline const int24_t convert_sample<int32_t,int24_t>(const register int32_t sample) { }
231
241
232
	// int32_t -> int32_t
242
	// int32_t -> int32_t
233
	template<> static inline const int32_t convert_sample<int32_t,int32_t>(const register int32_t sample) { return sample; }
243
	template<> STATIC inline const int32_t convert_sample<int32_t,int32_t>(const register int32_t sample) { return sample; }
234
244
235
	// int32_t -> float
245
	// int32_t -> float
236
	template<> static inline const float convert_sample<int32_t,float>(const register int32_t sample) { return ((double)sample)/2147483647.0; }
246
	template<> STATIC inline const float convert_sample<int32_t,float>(const register int32_t sample) { return ((double)sample)/2147483647.0; }
237
247
238
	// int32_t -> double
248
	// int32_t -> double
239
	//template<> static inline const double  convert_sample<int32_t,double >(const register int32_t sample) { }
249
	//template<> static inline const double  convert_sample<int32_t,double >(const register int32_t sample) { }
Lines 241-262 Link Here
241
251
242
// float -> ...
252
// float -> ...
243
	// float -> int8_t
253
	// float -> int8_t
244
	template<> static inline const int8_t convert_sample<float,int8_t>(const register float sample) { return (int8_t)floorf((sample>1.0f ? 1.0f : (sample<-1.0f ? -1.0f : sample))*127.0f); }
254
	template<> STATIC inline const int8_t convert_sample<float,int8_t>(const register float sample) { return (int8_t)floorf((sample>1.0f ? 1.0f : (sample<-1.0f ? -1.0f : sample))*127.0f); }
245
255
246
	// float -> int16_t
256
	// float -> int16_t
247
	template<> static inline const int16_t convert_sample<float,int16_t>(const register float sample) { return (int16_t)floorf((sample>1.0f ? 1.0f : (sample<-1.0f ? -1.0f : sample))*32767.0f); }
257
	template<> STATIC inline const int16_t convert_sample<float,int16_t>(const register float sample) { return (int16_t)floorf((sample>1.0f ? 1.0f : (sample<-1.0f ? -1.0f : sample))*32767.0f); }
248
258
249
	// float -> int24_t
259
	// float -> int24_t
250
	template<> static inline const int24_t convert_sample<float,int24_t>(const register float sample) { int24_t r; r.set((int_fast32_t)floorf((sample>1.0f ? 1.0f : (sample<-1.0f ? -1.0f : sample))*8388607.0f)); return r; }
260
	template<> STATIC inline const int24_t convert_sample<float,int24_t>(const register float sample) { int24_t r; r.set((int_fast32_t)floorf((sample>1.0f ? 1.0f : (sample<-1.0f ? -1.0f : sample))*8388607.0f)); return r; }
251
261
252
	// float -> int32_t
262
	// float -> int32_t
253
	template<> static inline const int32_t convert_sample<float,int32_t>(const register float sample) { return (int32_t) floor((double)(sample>1.0f ? 1.0f : (sample<-1.0f ? -1.0f : sample)) * 2147483647.0); }
263
	template<> STATIC inline const int32_t convert_sample<float,int32_t>(const register float sample) { return (int32_t) floor((double)(sample>1.0f ? 1.0f : (sample<-1.0f ? -1.0f : sample)) * 2147483647.0); }
254
264
255
	// float -> float
265
	// float -> float
256
	template<> static inline const float convert_sample<float,float>(const register float sample) { return sample; }
266
	template<> STATIC inline const float convert_sample<float,float>(const register float sample) { return sample; }
257
267
258
	// float -> double
268
	// float -> double
259
	template<> static inline const double convert_sample<float,double>(const register float sample) { return (double)sample; }
269
	template<> STATIC inline const double convert_sample<float,double>(const register float sample) { return (double)sample; }
260
270
261
271
262
// double -> ...
272
// double -> ...
Lines 264-270 Link Here
264
	//template<> static inline const int8_t convert_sample<double,int8_t>(const register double sample) { }
274
	//template<> static inline const int8_t convert_sample<double,int8_t>(const register double sample) { }
265
275
266
	// double -> int16_t
276
	// double -> int16_t
267
	template<> static inline const int16_t convert_sample<double,int16_t>(const register double sample) { return (int16_t)floor((sample>1.0 ? 1.0 : (sample<-1.0 ? -1.0 : sample))*32767.0); }
277
	template<> STATIC inline const int16_t convert_sample<double,int16_t>(const register double sample) { return (int16_t)floor((sample>1.0 ? 1.0 : (sample<-1.0 ? -1.0 : sample))*32767.0); }
268
278
269
	// double -> int24_t
279
	// double -> int24_t
270
	//template<> static inline const int24_t convert_sample<double,int24_t>(const register double sample) { }
280
	//template<> static inline const int24_t convert_sample<double,int24_t>(const register double sample) { }
Lines 273-282 Link Here
273
	//template<> static inline const int32_t convert_sample<double,int32_t>(const register double sample) { }
283
	//template<> static inline const int32_t convert_sample<double,int32_t>(const register double sample) { }
274
284
275
	// double -> float
285
	// double -> float
276
	template<> static inline const float convert_sample<double,float>(const register double sample) { return (float)sample; }
286
	template<> STATIC inline const float convert_sample<double,float>(const register double sample) { return (float)sample; }
277
287
278
	// double -> double
288
	// double -> double
279
	template<> static inline const double convert_sample<double,double>(const register double sample) { return sample; }
289
	template<> STATIC inline const double convert_sample<double,double>(const register double sample) { return sample; }
280
290
281
291
282
292
(-)rezound-0.12.3beta~/src/backend/Generate/CGenerateNoiseAction.cpp (+1 lines)
Lines 22-27 Link Here
22
#include "CGenerateNoiseAction.h"
22
#include "CGenerateNoiseAction.h"
23
23
24
#include "../CActionParameters.h"
24
#include "../CActionParameters.h"
25
#include <cstdlib>
25
26
26
CGenerateNoiseAction::CGenerateNoiseAction(const AActionFactory *factory,const CActionSound *actionSound,const double _noiseLength,const double _volume,const NoiseTypes _noiseType,const StereoImage _stereoImage,const double _maxParticleVelocity):
27
CGenerateNoiseAction::CGenerateNoiseAction(const AActionFactory *factory,const CActionSound *actionSound,const double _noiseLength,const double _volume,const NoiseTypes _noiseType,const StereoImage _stereoImage,const double _maxParticleVelocity):
27
	AAction(factory,actionSound),
28
	AAction(factory,actionSound),
(-)rezound-0.12.3beta~/src/misc/CNestedDataFile/anytype.h (-30 / +40 lines)
Lines 20-25 Link Here
20
#ifndef __anytype_H__
20
#ifndef __anytype_H__
21
#define __anytype_H__
21
#define __anytype_H__
22
22
23
#ifndef GCC_VERSION
24
#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
25
#endif
26
27
#if GCC_VERSION >= 403
28
# define STATIC
29
#else
30
# define STATIC static
31
#endif
32
23
#include <sstream>
33
#include <sstream>
24
#include <string>
34
#include <string>
25
#include <vector> // for the vector implemenation to/from string
35
#include <vector> // for the vector implemenation to/from string
Lines 67-94 Link Here
67
77
68
// template specializations of string_to_anytype
78
// template specializations of string_to_anytype
69
79
70
template<> static const string string_to_anytype<string>(const string &str,string &ret)                         { return s2at::unescape_chars(s2at::remove_surrounding_quotes(str)); }
80
template<> STATIC const string string_to_anytype<string>(const string &str,string &ret)                         { return s2at::unescape_chars(s2at::remove_surrounding_quotes(str)); }
71
81
72
template<> static const bool string_to_anytype<bool>(const string &str,bool &ret)                             { return s2at::remove_surrounding_quotes(str)=="true" ? ret=true : ret=false; }
82
template<> STATIC const bool string_to_anytype<bool>(const string &str,bool &ret)                             { return s2at::remove_surrounding_quotes(str)=="true" ? ret=true : ret=false; }
73
83
74
template<> static const char string_to_anytype<char>(const string &str,char &ret)                             { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
84
template<> STATIC const char string_to_anytype<char>(const string &str,char &ret)                             { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
75
template<> static const unsigned char string_to_anytype<unsigned char>(const string &str,unsigned char &ret)           { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
85
template<> STATIC const unsigned char string_to_anytype<unsigned char>(const string &str,unsigned char &ret)           { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
76
86
77
template<> static const short string_to_anytype<short>(const string &str,short &ret)                           { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
87
template<> STATIC const short string_to_anytype<short>(const string &str,short &ret)                           { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
78
template<> static const unsigned short string_to_anytype<unsigned short>(const string &str,unsigned short &ret)         { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
88
template<> STATIC const unsigned short string_to_anytype<unsigned short>(const string &str,unsigned short &ret)         { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
79
89
80
template<> static const int string_to_anytype<int>(const string &str,int &ret)                               { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
90
template<> STATIC const int string_to_anytype<int>(const string &str,int &ret)                               { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
81
template<> static const unsigned int string_to_anytype<unsigned int>(const string &str,unsigned int &ret)             { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
91
template<> STATIC const unsigned int string_to_anytype<unsigned int>(const string &str,unsigned int &ret)             { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
82
92
83
template<> static const long string_to_anytype<long>(const string &str,long &ret)                             { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
93
template<> STATIC const long string_to_anytype<long>(const string &str,long &ret)                             { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
84
template<> static const unsigned long string_to_anytype<unsigned long>(const string &str,unsigned long &ret)           { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
94
template<> STATIC const unsigned long string_to_anytype<unsigned long>(const string &str,unsigned long &ret)           { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
85
95
86
template<> static const long long string_to_anytype<long long>(const string &str,long long &ret)                   { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
96
template<> STATIC const long long string_to_anytype<long long>(const string &str,long long &ret)                   { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
87
template<> static const unsigned long long string_to_anytype<unsigned long long>(const string &str,unsigned long long &ret) { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
97
template<> STATIC const unsigned long long string_to_anytype<unsigned long long>(const string &str,unsigned long long &ret) { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
88
98
89
template<> static const float string_to_anytype<float>(const string &str,float &ret)                           { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0.0f; ss >> ret; return ret; }
99
template<> STATIC const float string_to_anytype<float>(const string &str,float &ret)                           { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0.0f; ss >> ret; return ret; }
90
template<> static const double string_to_anytype<double>(const string &str,double &ret)                         { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0.0; ss >> ret; return ret; }
100
template<> STATIC const double string_to_anytype<double>(const string &str,double &ret)                         { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0.0; ss >> ret; return ret; }
91
template<> static const long double string_to_anytype<long double>(const string &str,long double &ret)               { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0.0; ss >> ret; return ret; }
101
template<> STATIC const long double string_to_anytype<long double>(const string &str,long double &ret)               { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0.0; ss >> ret; return ret; }
92
102
93
// I really wished that I didn't have to explicitly use 'vector' in the definition; I'd have like to use any container with an iterator interface
103
// I really wished that I didn't have to explicitly use 'vector' in the definition; I'd have like to use any container with an iterator interface
94
#include <CMutex.h>
104
#include <CMutex.h>
Lines 119-149 Link Here
119
129
120
// template specializations of anytype_to_string
130
// template specializations of anytype_to_string
121
131
122
template<> static const string anytype_to_string<string>(const string &any)             { return "\""+s2at::escape_chars(any)+"\""; }
132
template<> STATIC const string anytype_to_string<string>(const string &any)             { return "\""+s2at::escape_chars(any)+"\""; }
123
133
124
template<> static const string anytype_to_string<bool>(const bool &any)               { return any ? "true" : "false"; }
134
template<> STATIC const string anytype_to_string<bool>(const bool &any)               { return any ? "true" : "false"; }
125
135
126
template<> static const string anytype_to_string<char>(const char &any)               { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
136
template<> STATIC const string anytype_to_string<char>(const char &any)               { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
127
template<> static const string anytype_to_string<unsigned char>(const unsigned char &any)      { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
137
template<> STATIC const string anytype_to_string<unsigned char>(const unsigned char &any)      { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
128
138
129
template<> static const string anytype_to_string<short>(const short &any)              { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
139
template<> STATIC const string anytype_to_string<short>(const short &any)              { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
130
template<> static const string anytype_to_string<unsigned short>(const unsigned short &any)     { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
140
template<> STATIC const string anytype_to_string<unsigned short>(const unsigned short &any)     { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
131
141
132
template<> static const string anytype_to_string<int>(const int &any)                { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
142
template<> STATIC const string anytype_to_string<int>(const int &any)                { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
133
template<> static const string anytype_to_string<unsigned int>(const unsigned int &any)       { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
143
template<> STATIC const string anytype_to_string<unsigned int>(const unsigned int &any)       { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
134
144
135
template<> static const string anytype_to_string<long>(const long &any)               { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
145
template<> STATIC const string anytype_to_string<long>(const long &any)               { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
136
template<> static const string anytype_to_string<unsigned long>(const unsigned long &any)      { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
146
template<> STATIC const string anytype_to_string<unsigned long>(const unsigned long &any)      { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
137
147
138
template<> static const string anytype_to_string<long long>(const long long &any)          { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
148
template<> STATIC const string anytype_to_string<long long>(const long long &any)          { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
139
template<> static const string anytype_to_string<unsigned long long>(const unsigned long long &any) { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
149
template<> STATIC const string anytype_to_string<unsigned long long>(const unsigned long long &any) { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
140
150
141
// I've picked a rather arbitrary way of formatting floats one way or another depending on how big it is.. I wish there were a way to output the ascii in such a way as to preserve all the information in the float (without printing the hex of it or something like that)
151
// I've picked a rather arbitrary way of formatting floats one way or another depending on how big it is.. I wish there were a way to output the ascii in such a way as to preserve all the information in the float (without printing the hex of it or something like that)
142
#include <istring>
152
#include <istring>
143
#include <math.h> // for isnan which I hope is there (maybe fix in common.h if it's not
153
#include <math.h> // for isnan which I hope is there (maybe fix in common.h if it's not
144
template<> static const string anytype_to_string<float>(const float &any)              { if(isnan(any)) return "0"; else { ostringstream ss; NO_LOCALE(ss) if(any>999999.0) {ss.setf(ios::scientific); ss.width(0); ss.precision(12); ss.fill(' '); } else {ss.setf(ios::fixed); ss.precision(6); ss.fill(' '); } ss << any; return istring(ss.str()).trim(); } }
154
template<> STATIC const string anytype_to_string<float>(const float &any)              { if(isnan(any)) return "0"; else { ostringstream ss; NO_LOCALE(ss) if(any>999999.0) {ss.setf(ios::scientific); ss.width(0); ss.precision(12); ss.fill(' '); } else {ss.setf(ios::fixed); ss.precision(6); ss.fill(' '); } ss << any; return istring(ss.str()).trim(); } }
145
template<> static const string anytype_to_string<double>(const double &any)             { if(isnan(any)) return "0"; else { ostringstream ss; NO_LOCALE(ss) if(any>999999.0) {ss.setf(ios::scientific); ss.width(0); ss.precision(12); ss.fill(' '); } else {ss.setf(ios::fixed); ss.precision(6); ss.fill(' '); } ss << any; return istring(ss.str()).trim(); } }
155
template<> STATIC const string anytype_to_string<double>(const double &any)             { if(isnan(any)) return "0"; else { ostringstream ss; NO_LOCALE(ss) if(any>999999.0) {ss.setf(ios::scientific); ss.width(0); ss.precision(12); ss.fill(' '); } else {ss.setf(ios::fixed); ss.precision(6); ss.fill(' '); } ss << any; return istring(ss.str()).trim(); } }
146
template<> static const string anytype_to_string<long double>(const long double &any)        { if(isnan(any)) return "0"; else { ostringstream ss; NO_LOCALE(ss) if(any>999999.0) {ss.setf(ios::scientific); ss.width(0); ss.precision(12); ss.fill(' '); } else {ss.setf(ios::fixed); ss.precision(6); ss.fill(' '); } ss << any; return istring(ss.str()).trim(); } }
156
template<> STATIC const string anytype_to_string<long double>(const long double &any)        { if(isnan(any)) return "0"; else { ostringstream ss; NO_LOCALE(ss) if(any>999999.0) {ss.setf(ios::scientific); ss.width(0); ss.precision(12); ss.fill(' '); } else {ss.setf(ios::fixed); ss.precision(6); ss.fill(' '); } ss << any; return istring(ss.str()).trim(); } }
147
157
148
158
149
// I really wished that I didn't have to explicitly use 'vector' in the definition, I'd have like to use any container with an iterator interface
159
// I really wished that I didn't have to explicitly use 'vector' in the definition, I'd have like to use any container with an iterator interface
(-)rezound-0.12.3beta~/src/misc/endian_util.h (-4 / +14 lines)
Lines 21-26 Link Here
21
#ifndef __endian_util_H__
21
#ifndef __endian_util_H__
22
#define __endian_util_H__
22
#define __endian_util_H__
23
23
24
#ifndef GCC_VERSION
25
#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
26
#endif
27
28
#if GCC_VERSION >= 403
29
# define STATIC
30
#else
31
# define STATIC static
32
#endif
33
24
/*
34
/*
25
 * This header files given functionality to convenient change endian-ness of values
35
 * This header files given functionality to convenient change endian-ness of values
26
 * and through the use of very few function names regardless of the type.
36
 * and through the use of very few function names regardless of the type.
Lines 131-143 Link Here
131
	}
141
	}
132
142
133
	// --- implementation for 1 byte quantities (nothing)
143
	// --- implementation for 1 byte quantities (nothing)
134
	template<> inline static void really_swap_endian_ptr<1>(void *value,const unsigned size)
144
	template<> inline STATIC void really_swap_endian_ptr<1>(void *value,const unsigned size)
135
	{
145
	{
136
		// nothing to do
146
		// nothing to do
137
	}
147
	}
138
148
139
	// --- implementation for 2 byte quantities
149
	// --- implementation for 2 byte quantities
140
	template<> inline static void really_swap_endian_ptr<2>(void *value,const unsigned size)
150
	template<> inline STATIC void really_swap_endian_ptr<2>(void *value,const unsigned size)
141
	{
151
	{
142
		const register uint16_t v=((uint16_t *)value)[0];
152
		const register uint16_t v=((uint16_t *)value)[0];
143
		((uint16_t *)value)[0]=
153
		((uint16_t *)value)[0]=
Lines 147-153 Link Here
147
	}
157
	}
148
158
149
	// --- implementation for 4 byte quantities
159
	// --- implementation for 4 byte quantities
150
	template<> inline static void really_swap_endian_ptr<4>(void *value,const unsigned size)
160
	template<> inline STATIC void really_swap_endian_ptr<4>(void *value,const unsigned size)
151
	{
161
	{
152
		const register uint32_t v=((uint32_t *)value)[0];
162
		const register uint32_t v=((uint32_t *)value)[0];
153
		((uint32_t *)value)[0]=
163
		((uint32_t *)value)[0]=
Lines 157-163 Link Here
157
	}
167
	}
158
168
159
	// --- implementation for 8 byte quantities
169
	// --- implementation for 8 byte quantities
160
	template<> inline static void really_swap_endian_ptr<8>(void *value,const unsigned size)
170
	template<> inline STATIC void really_swap_endian_ptr<8>(void *value,const unsigned size)
161
	{
171
	{
162
		const register uint64_t v=((uint64_t *)value)[0];
172
		const register uint64_t v=((uint64_t *)value)[0];
163
		// of 8, swap upper most and lower most octets then the next two inward, and so on ..
173
		// of 8, swap upper most and lower most octets then the next two inward, and so on ..

Return to bug 219438