got rid of snprintf.... Replaced with MEM_mallocN and friends...

Kent
This commit is contained in:
2005-11-22 20:24:28 +00:00
parent 9664b7924f
commit d234f611f5
2 changed files with 28 additions and 6 deletions

View File

@@ -48,11 +48,16 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include "BLI_blenlib.h"
#include "imbuf.h"
#include "imbuf_patch.h"
#include "IMB_imbuf.h"
#include "BKE_global.h"
#include "PIL_dynlib.h"
/*********************
* LOCAL DEFINITIONS *
*********************/
@@ -68,8 +73,9 @@ int libtiff_load_symbols();
void libtiff_loadlibtiff()
{
char filename[1024];
char *filename;
libtiff = NULL;
int size;
/* Try to find libtiff in a couple of standard places */
libtiff = PIL_dynlib_open("libtiff.so");
@@ -86,8 +92,13 @@ void libtiff_loadlibtiff()
/* For solaris */
libtiff = PIL_dynlib_open("/usr/openwin/lib/libtiff.so");
if (libtiff != NULL) return;
snprintf(filename, 1023, "%s", getenv("BF_TIFF_LIB"));
size = sizeof(getenv("BF_TIFF_LIB"));
filename = MEM_mallocN(size * sizeof(unsigned char),"ENVVAR");
memcpy(filename,getenv("BF_TIFF_LIB"),size);
libtiff = PIL_dynlib_open(filename);
MEM_freeN(filename);
if (libtiff != NULL) return;
}

View File

@@ -90,11 +90,16 @@ C_EXTRA = \
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include "BLI_blenlib.h"
#include "imbuf.h"
#include "imbuf_patch.h"
#include "IMB_imbuf.h"
#include "BKE_global.h"
#include "PIL_dynlib.h"
/*********************
* LOCAL DEFINITIONS *
*********************/
@@ -110,8 +115,9 @@ int libtiff_load_symbols();
void libtiff_loadlibtiff()
{
char filename[1024];
char *filename;
libtiff = NULL;
int size;
/* Try to find libtiff in a couple of standard places */
libtiff = PIL_dynlib_open("libtiff.so");
@@ -128,8 +134,13 @@ void libtiff_loadlibtiff()
/* For solaris */
libtiff = PIL_dynlib_open("/usr/openwin/lib/libtiff.so");
if (libtiff != NULL) return;
snprintf(filename, 1023, "%s", getenv("BF_TIFF_LIB"));
size = sizeof(getenv("BF_TIFF_LIB"));
filename = MEM_mallocN(size * sizeof(unsigned char),"ENVVAR");
memcpy(filename,getenv("BF_TIFF_LIB"),size);
libtiff = PIL_dynlib_open(filename);
MEM_freeN(filename);
if (libtiff != NULL) return;
}