[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50607] trunk/blender/intern: style cleanup

Campbell Barton ideasman42 at gmail.com
Sat Sep 15 01:11:49 CEST 2012


Revision: 50607
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50607
Author:   campbellbarton
Date:     2012-09-14 23:11:47 +0000 (Fri, 14 Sep 2012)
Log Message:
-----------
style cleanup

Modified Paths:
--------------
    trunk/blender/intern/audaspace/intern/AUD_C-API.cpp
    trunk/blender/intern/audaspace/intern/AUD_C-API.h
    trunk/blender/intern/cycles/kernel/osl/osl_globals.h
    trunk/blender/intern/cycles/kernel/osl/osl_services.cpp
    trunk/blender/intern/cycles/kernel/osl/osl_services.h

Modified: trunk/blender/intern/audaspace/intern/AUD_C-API.cpp
===================================================================
--- trunk/blender/intern/audaspace/intern/AUD_C-API.cpp	2012-09-14 22:31:26 UTC (rev 50606)
+++ trunk/blender/intern/audaspace/intern/AUD_C-API.cpp	2012-09-14 23:11:47 UTC (rev 50607)
@@ -99,11 +99,11 @@
 #include "AUD_C-API.h"
 
 #ifndef NULL
-#define NULL 0
+#  define NULL (void *)0
 #endif
 
 static AUD_Reference<AUD_IDevice> AUD_device;
-static AUD_I3DDevice* AUD_3ddevice;
+static AUD_I3DDevice *AUD_3ddevice;
 
 void AUD_initOnce()
 {
@@ -116,13 +116,12 @@
 {
 	AUD_Reference<AUD_IDevice> dev;
 
-	if(!AUD_device.isNull())
+	if (!AUD_device.isNull()) {
 		AUD_exit();
+	}
 
-	try
-	{
-		switch(device)
-		{
+	try {
+		switch(device) {
 		case AUD_NULL_DEVICE:
 			dev = new AUD_NULLDevice();
 			break;
@@ -140,8 +139,7 @@
 		case AUD_JACK_DEVICE:
 #ifdef __APPLE__
 			struct stat st;
-			if(stat("/Library/Frameworks/Jackmp.framework", &st) != 0)
-			{
+			if (stat("/Library/Frameworks/Jackmp.framework", &st) != 0) {
 				printf("Warning: Jack Framework not installed\n");
 				// No break, fall through to default, to return false
 			}
@@ -159,7 +157,7 @@
 		}
 
 		AUD_device = dev;
-		AUD_3ddevice = dynamic_cast<AUD_I3DDevice*>(AUD_device.get());
+		AUD_3ddevice = dynamic_cast<AUD_I3DDevice *>(AUD_device.get());
 
 		return true;
 	}
@@ -176,48 +174,44 @@
 }
 
 #ifdef WITH_PYTHON
-static PyObject* AUD_getCDevice(PyObject* self)
+static PyObject *AUD_getCDevice(PyObject *self)
 {
-	if(!AUD_device.isNull())
-	{
-		Device* device = (Device*)Device_empty();
-		if(device != NULL)
-		{
+	if (!AUD_device.isNull()) {
+		Device *device = (Device *)Device_empty();
+		if (device != NULL) {
 			device->device = new AUD_Reference<AUD_IDevice>(AUD_device);
-			return (PyObject*)device;
+			return (PyObject *)device;
 		}
 	}
 
 	Py_RETURN_NONE;
 }
 
-static PyMethodDef meth_getcdevice[] = {{ "device", (PyCFunction)AUD_getCDevice, METH_NOARGS,
-										  "device()\n\n"
-										  "Returns the application's :class:`Device`.\n\n"
-										  ":return: The application's :class:`Device`.\n"
-										  ":rtype: :class:`Device`"}};
+static PyMethodDef meth_getcdevice[] = {
+    {"device", (PyCFunction)AUD_getCDevice, METH_NOARGS,
+     "device()\n\n"
+     "Returns the application's :class:`Device`.\n\n"
+     ":return: The application's :class:`Device`.\n"
+     ":rtype: :class:`Device`"}
+};
 
 extern "C" {
-extern void* sound_get_factory(void* sound);
+extern void *sound_get_factory(void *sound);
 }
 
-static PyObject* AUD_getSoundFromPointer(PyObject* self, PyObject* args)
+static PyObject *AUD_getSoundFromPointer(PyObject *self, PyObject *args)
 {
 	long int lptr;
 
-	if(PyArg_Parse(args, "l:_sound_from_pointer", &lptr))
-	{
-		if(lptr)
-		{
-			AUD_Reference<AUD_IFactory>* factory = (AUD_Reference<AUD_IFactory>*) sound_get_factory((void*) lptr);
+	if (PyArg_Parse(args, "l:_sound_from_pointer", &lptr)) {
+		if (lptr) {
+			AUD_Reference<AUD_IFactory>* factory = (AUD_Reference<AUD_IFactory>*) sound_get_factory((void *) lptr);
 
-			if(factory)
-			{
-				Factory* obj = (Factory*) Factory_empty();
-				if(obj)
-				{
+			if (factory) {
+				Factory *obj = (Factory *)Factory_empty();
+				if (obj) {
 					obj->factory = new AUD_Reference<AUD_IFactory>(*factory);
-					return (PyObject*) obj;
+					return (PyObject *) obj;
 				}
 			}
 		}
@@ -226,44 +220,44 @@
 	Py_RETURN_NONE;
 }
 
-static PyMethodDef meth_sound_from_pointer[] = {{ "_sound_from_pointer", (PyCFunction)AUD_getSoundFromPointer, METH_O,
-										  "_sound_from_pointer(pointer)\n\n"
-										  "Returns the corresponding :class:`Factory` object.\n\n"
-										  ":arg pointer: The pointer to the bSound object as long.\n"
-										  ":type pointer: long\n"
-										  ":return: The corresponding :class:`Factory` object.\n"
-										  ":rtype: :class:`Factory`"}};
+static PyMethodDef meth_sound_from_pointer[] = {
+    {"_sound_from_pointer", (PyCFunction)AUD_getSoundFromPointer, METH_O,
+     "_sound_from_pointer(pointer)\n\n"
+     "Returns the corresponding :class:`Factory` object.\n\n"
+     ":arg pointer: The pointer to the bSound object as long.\n"
+     ":type pointer: long\n"
+     ":return: The corresponding :class:`Factory` object.\n"
+     ":rtype: :class:`Factory`"}
+};
 
-PyObject* AUD_initPython()
+PyObject *AUD_initPython()
 {
-	PyObject* module = PyInit_aud();
-	PyModule_AddObject(module, "device", (PyObject*)PyCFunction_New(meth_getcdevice, NULL));
-	PyModule_AddObject(module, "_sound_from_pointer", (PyObject*)PyCFunction_New(meth_sound_from_pointer, NULL));
+	PyObject *module = PyInit_aud();
+	PyModule_AddObject(module, "device", (PyObject *)PyCFunction_New(meth_getcdevice, NULL));
+	PyModule_AddObject(module, "_sound_from_pointer", (PyObject *)PyCFunction_New(meth_sound_from_pointer, NULL));
 	PyDict_SetItemString(PyImport_GetModuleDict(), "aud", module);
 
 	return module;
 }
 
-void* AUD_getPythonFactory(AUD_Sound* sound)
+void *AUD_getPythonFactory(AUD_Sound *sound)
 {
-	if(sound)
-	{
-		Factory* obj = (Factory*) Factory_empty();
-		if(obj)
-		{
+	if (sound) {
+		Factory *obj = (Factory *) Factory_empty();
+		if (obj) {
 			obj->factory = new AUD_Reference<AUD_IFactory>(*sound);
-			return (PyObject*) obj;
+			return (PyObject *) obj;
 		}
 	}
 
 	return NULL;
 }
 
-AUD_Sound* AUD_getPythonSound(void* sound)
+AUD_Sound *AUD_getPythonSound(void *sound)
 {
-	Factory* factory = checkFactory((PyObject *)sound);
+	Factory *factory = checkFactory((PyObject *)sound);
 
-	if(!factory)
+	if (!factory)
 		return NULL;
 
 	return new AUD_Reference<AUD_IFactory>(*reinterpret_cast<AUD_Reference<AUD_IFactory>*>(factory->factory));
@@ -281,7 +275,7 @@
 	AUD_device->unlock();
 }
 
-AUD_SoundInfo AUD_getInfo(AUD_Sound* sound)
+AUD_SoundInfo AUD_getInfo(AUD_Sound *sound)
 {
 	assert(sound);
 
@@ -290,12 +284,10 @@
 	info.specs.rate = AUD_RATE_INVALID;
 	info.length = 0.0f;
 
-	try
-	{
+	try {
 		AUD_Reference<AUD_IReader> reader = (*sound)->createReader();
 
-		if(!reader.isNull())
-		{
+		if (!reader.isNull()) {
 			info.specs = reader->getSpecs();
 			info.length = reader->getLength() / (float) info.specs.rate;
 		}
@@ -307,24 +299,23 @@
 	return info;
 }
 
-AUD_Sound* AUD_load(const char* filename)
+AUD_Sound *AUD_load(const char *filename)
 {
 	assert(filename);
 	return new AUD_Sound(new AUD_FileFactory(filename));
 }
 
-AUD_Sound* AUD_loadBuffer(unsigned char* buffer, int size)
+AUD_Sound *AUD_loadBuffer(unsigned char *buffer, int size)
 {
 	assert(buffer);
 	return new AUD_Sound(new AUD_FileFactory(buffer, size));
 }
 
-AUD_Sound* AUD_bufferSound(AUD_Sound* sound)
+AUD_Sound *AUD_bufferSound(AUD_Sound *sound)
 {
 	assert(sound);
 
-	try
-	{
+	try {
 		return new AUD_Sound(new AUD_StreamBufferFactory(*sound));
 	}
 	catch(AUD_Exception&)
@@ -333,12 +324,11 @@
 	}
 }
 
-AUD_Sound* AUD_monoSound(AUD_Sound* sound)
+AUD_Sound *AUD_monoSound(AUD_Sound *sound)
 {
 	assert(sound);
 
-	try
-	{
+	try {
 		AUD_DeviceSpecs specs;
 		specs.channels = AUD_CHANNELS_MONO;
 		specs.rate = AUD_RATE_INVALID;
@@ -351,12 +341,11 @@
 	}
 }
 
-AUD_Sound* AUD_delaySound(AUD_Sound* sound, float delay)
+AUD_Sound *AUD_delaySound(AUD_Sound *sound, float delay)
 {
 	assert(sound);
 
-	try
-	{
+	try {
 		return new AUD_Sound(new AUD_DelayFactory(*sound, delay));
 	}
 	catch(AUD_Exception&)
@@ -365,12 +354,11 @@
 	}
 }
 
-AUD_Sound* AUD_limitSound(AUD_Sound* sound, float start, float end)
+AUD_Sound *AUD_limitSound(AUD_Sound *sound, float start, float end)
 {
 	assert(sound);
 
-	try
-	{
+	try {
 		return new AUD_Sound(new AUD_LimiterFactory(*sound, start, end));
 	}
 	catch(AUD_Exception&)
@@ -379,12 +367,11 @@
 	}
 }
 
-AUD_Sound* AUD_pingpongSound(AUD_Sound* sound)
+AUD_Sound *AUD_pingpongSound(AUD_Sound *sound)
 {
 	assert(sound);
 
-	try
-	{
+	try {
 		return new AUD_Sound(new AUD_PingPongFactory(*sound));
 	}
 	catch(AUD_Exception&)
@@ -393,12 +380,11 @@
 	}
 }
 
-AUD_Sound* AUD_loopSound(AUD_Sound* sound)
+AUD_Sound *AUD_loopSound(AUD_Sound *sound)
 {
 	assert(sound);
 
-	try
-	{
+	try {
 		return new AUD_Sound(new AUD_LoopFactory(*sound));
 	}
 	catch(AUD_Exception&)
@@ -407,12 +393,11 @@
 	}
 }
 
-int AUD_setLoop(AUD_Handle* handle, int loops)
+int AUD_setLoop(AUD_Handle *handle, int loops)
 {
 	assert(handle);
 
-	try
-	{
+	try {
 		return (*handle)->setLoopCount(loops);
 	}
 	catch(AUD_Exception&)
@@ -422,12 +407,11 @@
 	return false;
 }
 
-AUD_Sound* AUD_rectifySound(AUD_Sound* sound)
+AUD_Sound *AUD_rectifySound(AUD_Sound *sound)
 {
 	assert(sound);
 
-	try
-	{
+	try {
 		return new AUD_Sound(new AUD_RectifyFactory(*sound));
 	}
 	catch(AUD_Exception&)
@@ -436,20 +420,20 @@
 	}
 }
 
-void AUD_unload(AUD_Sound* sound)
+void AUD_unload(AUD_Sound *sound)
 {
 	assert(sound);
 	delete sound;
 }
 
-AUD_Handle* AUD_play(AUD_Sound* sound, int keep)
+AUD_Handle *AUD_play(AUD_Sound *sound, int keep)
 {
 	assert(sound);
-	try
-	{
+	try {
 		AUD_Handle handle = AUD_device->play(*sound, keep);
-		if(!handle.isNull())
+		if (!handle.isNull()) {
 			return new AUD_Handle(handle);
+		}
 	}
 	catch(AUD_Exception&)
 	{
@@ -457,19 +441,19 @@
 	return NULL;
 }
 
-int AUD_pause(AUD_Handle* handle)
+int AUD_pause(AUD_Handle *handle)
 {
 	assert(handle);
 	return (*handle)->pause();
 }
 
-int AUD_resume(AUD_Handle* handle)
+int AUD_resume(AUD_Handle *handle)
 {
 	assert(handle);
 	return (*handle)->resume();
 }
 
-int AUD_stop(AUD_Handle* handle)
+int AUD_stop(AUD_Handle *handle)
 {
 	assert(handle);
 	int result = (*handle)->stop();
@@ -477,34 +461,33 @@
 	return result;
 }
 
-int AUD_setKeep(AUD_Handle* handle, int keep)
+int AUD_setKeep(AUD_Handle *handle, int keep)
 {
 	assert(handle);
 	return (*handle)->setKeep(keep);
 }
 
-int AUD_seek(AUD_Handle* handle, float seekTo)
+int AUD_seek(AUD_Handle *handle, float seekTo)
 {
 	assert(handle);
 	return (*handle)->seek(seekTo);
 }
 
-float AUD_getPosition(AUD_Handle* handle)
+float AUD_getPosition(AUD_Handle *handle)
 {
 	assert(handle);
 	return (*handle)->getPosition();
 }
 
-AUD_Status AUD_getStatus(AUD_Handle* handle)
+AUD_Status AUD_getStatus(AUD_Handle *handle)
 {
 	assert(handle);
 	return (*handle)->getStatus();
 }
 
-int AUD_setListenerLocation(const float* location)
+int AUD_setListenerLocation(const float location[3])
 {
-	if(AUD_3ddevice)
-	{
+	if (AUD_3ddevice) {
 		AUD_Vector3 v(location[0], location[1], location[2]);
 		AUD_3ddevice->setListenerLocation(v);
 		return true;
@@ -513,10 +496,9 @@
 	return false;
 }
 
-int AUD_setListenerVelocity(const float* velocity)
+int AUD_setListenerVelocity(const float velocity[3])
 {
-	if(AUD_3ddevice)
-	{

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list