Revision: 37788
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37788
Author:   nexyon
Date:     2011-06-24 06:39:03 +0000 (Fri, 24 Jun 2011)
Log Message:
-----------
3D Audio GSoC:
Fixes for crashes reported by Moguri.

Modified Paths:
--------------
    branches/soc-2011-pepper/intern/audaspace/intern/AUD_ConverterFunctions.cpp
    branches/soc-2011-pepper/intern/audaspace/intern/AUD_Reference.h

Modified: 
branches/soc-2011-pepper/intern/audaspace/intern/AUD_ConverterFunctions.cpp
===================================================================
--- branches/soc-2011-pepper/intern/audaspace/intern/AUD_ConverterFunctions.cpp 
2011-06-24 05:34:03 UTC (rev 37787)
+++ branches/soc-2011-pepper/intern/audaspace/intern/AUD_ConverterFunctions.cpp 
2011-06-24 06:39:03 UTC (rev 37788)
@@ -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_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_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 @@
 {
        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 @@
 {
        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 @@
 {
        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 @@
 {
        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 @@
 {
        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_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 @@
 {
        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 @@
 {
        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 @@
 {
        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 @@
 {
        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 @@
 {
        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;
 }
 

Modified: branches/soc-2011-pepper/intern/audaspace/intern/AUD_Reference.h
===================================================================
--- branches/soc-2011-pepper/intern/audaspace/intern/AUD_Reference.h    
2011-06-24 05:34:03 UTC (rev 37787)
+++ branches/soc-2011-pepper/intern/audaspace/intern/AUD_Reference.h    
2011-06-24 06:39:03 UTC (rev 37788)
@@ -41,6 +41,9 @@
 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 @@
 
        static inline bool decref(void* reference)
        {
+               if(!reference)
+                       return false;
+
                if(!--m_references[reference])
                {
                        m_references.erase(reference);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to