use BLI_findstring in more places & remove some warnings, no functional changes.

This commit is contained in:
Campbell Barton
2010-02-22 09:22:36 +00:00
parent 756dace6f5
commit b65a983d39
5 changed files with 13 additions and 41 deletions

View File

@@ -32,6 +32,7 @@
#include <limits.h>
#include <stdio.h> // for printf fopen fwrite fclose sprintf FILE
#include <stdlib.h> // for getenv atoi
#include <stddef.h> // for offsetof
#include <fcntl.h> // for open
#include <string.h> // for strrchr strncmp strstr
#include <math.h> // for fabs
@@ -10882,20 +10883,9 @@ char *bhead_id_name(FileData *fd, BHead *bhead)
static ID *is_yet_read(FileData *fd, Main *mainvar, BHead *bhead)
{
ListBase *lb;
char *idname= bhead_id_name(fd, bhead);
lb= wich_libbase(mainvar, GS(idname));
if(lb) {
ID *id= lb->first;
while(id) {
if( strcmp(id->name, idname)==0 )
return id;
id= id->next;
}
}
return NULL;
const char *idname= bhead_id_name(fd, bhead);
/* wich_libbase can be NULL, intentionally not using idname+2 */
return BLI_findstring(wich_libbase(mainvar, GS(idname)), idname, offsetof(ID, name));
}
static void expand_doit(FileData *fd, Main *mainvar, void *old)

View File

@@ -316,22 +316,8 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
exitrequested = KX_EXIT_REQUEST_QUIT_GAME;
}
}
Scene *blscene = NULL;
if (!bfd)
{
blscene = (Scene*) blenderdata->scene.first;
for (Scene *sce= (Scene*) blenderdata->scene.first; sce; sce= (Scene*) sce->id.next)
{
if (startscenename == (sce->id.name+2))
{
blscene = sce;
break;
}
}
} else {
blscene = bfd->curscene;
}
Scene *blscene= bfd ? bfd->curscene : (Scene *)BLI_findstring(&blenderdata->scene, startscenename, offsetof(ID, name) + 2);
if (blscene)
{
@@ -457,7 +443,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
* should this really be?
*/
if (event->type==MOUSEMOVE) {
/* Note nice! XXX 2.5 event hack */
/* Note, not nice! XXX 2.5 event hack */
val = event->x - ar->winrct.xmin;
mousedevice->ConvertBlenderEvent(MOUSEX, val);

View File

@@ -208,17 +208,14 @@ Scene *KX_BlenderSceneConverter::GetBlenderSceneForName(const STR_String& name)
* Find the specified scene by name, or the first
* scene if nothing matches (shouldn't happen).
*/
for (sce= (Scene*) m_maggie->scene.first; sce; sce= (Scene*) sce->id.next)
if (name == (sce->id.name+2))
return sce;
if((sce= (Scene *)BLI_findstring(&m_maggie->scene, name.ReadPtr(), offsetof(ID, name) + 2)))
return sce;
for (vector<Main*>::iterator it=m_DynamicMaggie.begin(); !(it==m_DynamicMaggie.end()); it++) {
Main *main= *it;
for (sce= (Scene*) main->scene.first; sce; sce= (Scene*) sce->id.next)
if (name == (sce->id.name+2))
return sce;
if((sce= (Scene *)BLI_findstring(&main->scene, name.ReadPtr(), offsetof(ID, name) + 2)))
return sce;
}
return (Scene*)m_maggie->scene.first;

View File

@@ -504,7 +504,6 @@ static PyObject* gPyAddScene(PyObject*, PyObject* args)
{
char* name;
int overlay = 1;
KX_Scene* scene = NULL;
if (!PyArg_ParseTuple(args, "s|i:addScene", &name , &overlay))
return NULL;

View File

@@ -51,12 +51,12 @@ struct RAS_CameraData
m_clipstart(clipstart),
m_clipend(clipend),
m_perspective(perspective),
m_focallength(focallength),
m_viewport(viewport),
m_viewportleft(viewportleft),
m_viewportbottom(viewportbottom),
m_viewportright(viewportright),
m_viewporttop(viewporttop)
m_viewporttop(viewporttop),
m_focallength(focallength)
{
}
};