Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Mueller <nexyon@gmail.com>2011-06-24 10:39:03 +0400
committerJoerg Mueller <nexyon@gmail.com>2011-06-24 10:39:03 +0400
commitfdb932370bf72de737a9438bd47e94cd54a7b90a (patch)
tree492d3bd471c3f88621764ca0380910cc89a2e60d /intern/audaspace
parenta165ad251e30268e099e8872be4a0874a782cd87 (diff)
3D Audio GSoC:
Fixes for crashes reported by Moguri.
Diffstat (limited to 'intern/audaspace')
-rw-r--r--intern/audaspace/intern/AUD_ConverterFunctions.cpp36
-rw-r--r--intern/audaspace/intern/AUD_Reference.h6
2 files changed, 24 insertions, 18 deletions
diff --git a/intern/audaspace/intern/AUD_ConverterFunctions.cpp b/intern/audaspace/intern/AUD_ConverterFunctions.cpp
index 8f2ac21acd6..c45fde72b1b 100644
--- a/intern/audaspace/intern/AUD_ConverterFunctions.cpp
+++ b/intern/audaspace/intern/AUD_ConverterFunctions.cpp
@@ -45,13 +45,13 @@
void AUD_convert_u8_s16(data_t* target, data_t* source, int length)
{
int16_t* t = (int16_t*) target;
- for(int i = length - 1; i >= 0; i++)
+ for(int i = length - 1; i >= 0; i--)
t[i] = (((int16_t)source[i]) - AUD_U8_0) << 8;
}
void AUD_convert_u8_s24_be(data_t* target, data_t* source, int length)
{
- for(int i = length - 1; i >= 0; i++)
+ for(int i = length - 1; i >= 0; i--)
{
target[i*3] = source[i] - AUD_U8_0;
target[i*3+1] = 0;
@@ -61,7 +61,7 @@ void AUD_convert_u8_s24_be(data_t* target, data_t* source, int length)
void AUD_convert_u8_s24_le(data_t* target, data_t* source, int length)
{
- for(int i = length - 1; i >= 0; i++)
+ for(int i = length - 1; i >= 0; i--)
{
target[i*3+2] = source[i] - AUD_U8_0;
target[i*3+1] = 0;
@@ -72,21 +72,21 @@ void AUD_convert_u8_s24_le(data_t* target, data_t* source, int length)
void AUD_convert_u8_s32(data_t* target, data_t* source, int length)
{
int32_t* t = (int32_t*) target;
- for(int i = length - 1; i >= 0; i++)
+ for(int i = length - 1; i >= 0; i--)
t[i] = (((int32_t)source[i]) - AUD_U8_0) << 24;
}
void AUD_convert_u8_float(data_t* target, data_t* source, int length)
{
float* t = (float*) target;
- for(int i = length - 1; i >= 0; i++)
+ for(int i = length - 1; i >= 0; i--)
t[i] = (((int32_t)source[i]) - AUD_U8_0) / ((float)AUD_U8_0);
}
void AUD_convert_u8_double(data_t* target, data_t* source, int length)
{
double* t = (double*) target;
- for(int i = length - 1; i >= 0; i++)
+ for(int i = length - 1; i >= 0; i--)
t[i] = (((int32_t)source[i]) - AUD_U8_0) / ((double)AUD_U8_0);
}
@@ -101,7 +101,7 @@ void AUD_convert_s16_s24_be(data_t* target, data_t* source, int length)
{
int16_t* s = (int16_t*) source;
int16_t t;
- for(int i = length - 1; i >= 0; i++)
+ for(int i = length - 1; i >= 0; i--)
{
t = s[i];
target[i*3] = t >> 8 & 0xFF;
@@ -114,7 +114,7 @@ void AUD_convert_s16_s24_le(data_t* target, data_t* source, int length)
{
int16_t* s = (int16_t*) source;
int16_t t;
- for(int i = length - 1; i >= 0; i++)
+ for(int i = length - 1; i >= 0; i--)
{
t = s[i];
target[i*3+2] = t >> 8 & 0xFF;
@@ -127,7 +127,7 @@ void AUD_convert_s16_s32(data_t* target, data_t* source, int length)
{
int16_t* s = (int16_t*) source;
int32_t* t = (int32_t*) target;
- for(int i = length - 1; i >= 0; i++)
+ for(int i = length - 1; i >= 0; i--)
t[i] = ((int32_t)s[i]) << 16;
}
@@ -135,7 +135,7 @@ void AUD_convert_s16_float(data_t* target, data_t* source, int length)
{
int16_t* s = (int16_t*) source;
float* t = (float*) target;
- for(int i = length - 1; i >= 0; i++)
+ for(int i = length - 1; i >= 0; i--)
t[i] = s[i] / AUD_S16_FLT;
}
@@ -143,7 +143,7 @@ void AUD_convert_s16_double(data_t* target, data_t* source, int length)
{
int16_t* s = (int16_t*) source;
double* t = (double*) target;
- for(int i = length - 1; i >= 0; i++)
+ for(int i = length - 1; i >= 0; i--)
t[i] = s[i] / AUD_S16_FLT;
}
@@ -181,14 +181,14 @@ void AUD_convert_s24_s24(data_t* target, data_t* source, int length)
void AUD_convert_s24_s32_be(data_t* target, data_t* source, int length)
{
int32_t* t = (int32_t*) target;
- for(int i = length - 1; i >= 0; i++)
+ for(int i = length - 1; i >= 0; i--)
t[i] = source[i*3] << 24 | source[i*3+1] << 16 | source[i*3+2] << 8;
}
void AUD_convert_s24_s32_le(data_t* target, data_t* source, int length)
{
int32_t* t = (int32_t*) target;
- for(int i = length - 1; i >= 0; i++)
+ for(int i = length - 1; i >= 0; i--)
t[i] = source[i*3+2] << 24 | source[i*3+1] << 16 | source[i*3] << 8;
}
@@ -196,7 +196,7 @@ void AUD_convert_s24_float_be(data_t* target, data_t* source, int length)
{
float* t = (float*) target;
int32_t s;
- for(int i = length - 1; i >= 0; i++)
+ for(int i = length - 1; i >= 0; i--)
{
s = source[i*3] << 24 | source[i*3+1] << 16 | source[i*3+2] << 8;
t[i] = s / AUD_S32_FLT;
@@ -207,7 +207,7 @@ void AUD_convert_s24_float_le(data_t* target, data_t* source, int length)
{
float* t = (float*) target;
int32_t s;
- for(int i = length - 1; i >= 0; i++)
+ for(int i = length - 1; i >= 0; i--)
{
s = source[i*3+2] << 24 | source[i*3+1] << 16 | source[i*3] << 8;
t[i] = s / AUD_S32_FLT;
@@ -218,7 +218,7 @@ void AUD_convert_s24_double_be(data_t* target, data_t* source, int length)
{
double* t = (double*) target;
int32_t s;
- for(int i = length - 1; i >= 0; i++)
+ for(int i = length - 1; i >= 0; i--)
{
s = source[i*3] << 24 | source[i*3+1] << 16 | source[i*3+2] << 8;
t[i] = s / AUD_S32_FLT;
@@ -229,7 +229,7 @@ void AUD_convert_s24_double_le(data_t* target, data_t* source, int length)
{
double* t = (double*) target;
int32_t s;
- for(int i = length - 1; i >= 0; i++)
+ for(int i = length - 1; i >= 0; i--)
{
s = source[i*3+2] << 24 | source[i*3+1] << 16 | source[i*3] << 8;
t[i] = s / AUD_S32_FLT;
@@ -289,7 +289,7 @@ void AUD_convert_s32_double(data_t* target, data_t* source, int length)
{
int32_t* s = (int32_t*) source;
double* t = (double*) target;
- for(int i = length - 1; i >= 0; i++)
+ for(int i = length - 1; i >= 0; i--)
t[i] = s[i] / AUD_S32_FLT;
}
diff --git a/intern/audaspace/intern/AUD_Reference.h b/intern/audaspace/intern/AUD_Reference.h
index 4cc5c51d24d..f9716b76fe2 100644
--- a/intern/audaspace/intern/AUD_Reference.h
+++ b/intern/audaspace/intern/AUD_Reference.h
@@ -41,6 +41,9 @@ private:
public:
static inline void incref(void* reference)
{
+ if(!reference)
+ return;
+
std::map<void*, int>::iterator result = m_references.find(reference);
if(result != m_references.end())
{
@@ -54,6 +57,9 @@ public:
static inline bool decref(void* reference)
{
+ if(!reference)
+ return false;
+
if(!--m_references[reference])
{
m_references.erase(reference);