Revision 3539 trunk/libraries/libjni-mrsid/src/mrsidimagereader.cpp
mrsidimagereader.cpp | ||
---|---|---|
46 | 46 |
* |
47 | 47 |
* +34 963163400 |
48 | 48 |
* dac@iver.es |
49 |
* |
|
50 |
* [01] 01-Oct-2005 nbt MrSIDImageReaderArrayNat function to support name parameter in char array |
|
49 | 51 |
*/ |
50 | 52 |
|
51 | 53 |
|
52 | 54 |
#include <jni.h> |
55 |
#include <stdlib.h> |
|
53 | 56 |
#include "es_gva_cit_jmrsid_MrSIDImageReader.h" |
54 | 57 |
#include "es_gva_cit_jmrsid_JNIBase.h" |
55 | 58 |
|
... | ... | |
70 | 73 |
#include "lti_scene.h" |
71 | 74 |
//#include "cpl_conv.h" |
72 | 75 |
#include "TIFFImageWriter.h" |
73 |
#include <string.h> |
|
76 |
|
|
74 | 77 |
LT_USE_NAMESPACE(LizardTech); |
75 | 78 |
|
76 | 79 |
/******************************************************************************/ |
... | ... | |
86 | 89 |
jlong jresult = 0 ; |
87 | 90 |
FILE *fich; |
88 | 91 |
|
92 |
|
|
89 | 93 |
pszFilename = env->GetStringUTFChars(pszF, 0); |
94 |
|
|
90 | 95 |
fich=fopen( pszFilename, "r" ); |
91 | 96 |
if( fich ) |
92 | 97 |
fclose(fich); |
... | ... | |
108 | 113 |
} |
109 | 114 |
|
110 | 115 |
/******************************************************************************/ |
111 |
// Constructor MrSIDImageReader |
|
116 |
// Constructor MrSIDImageArrayReader
|
|
112 | 117 |
/******************************************************************************/ |
113 | 118 |
|
114 | 119 |
|
... | ... | |
123 | 128 |
|
124 | 129 |
longitud = env->GetArrayLength(pszF); |
125 | 130 |
pszFilename = (char *)env->GetByteArrayElements(pszF, 0); |
126 |
|
|
127 |
fich=fopen( pszFilename, "r" ); |
|
131 |
pszFilename = (char *)realloc(pszFilename, longitud + 1); |
|
132 |
pszFilename[longitud] = '\0'; |
|
133 |
|
|
134 |
fich=fopen( (char *)pszFilename, "r" ); |
|
128 | 135 |
if( fich ) |
129 | 136 |
fclose(fich); |
130 | 137 |
else |
131 |
{ |
|
132 |
fclose(fich); |
|
133 | 138 |
return -1; |
134 |
} |
|
135 |
|
|
139 |
|
|
136 | 140 |
const LTFileSpec fileSpec(pszFilename); |
137 | 141 |
poImageReader = new MrSIDImageReader( fileSpec ); |
138 | 142 |
*(LTIImageReader **)&jresult = poImageReader; |
139 |
|
|
140 |
if(poImageReader==NULL)return -1; |
|
141 |
else return jresult; |
|
143 |
|
|
144 |
env->ReleaseByteArrayElements(pszF, (jbyte *)pszFilename, 0); |
|
145 |
|
|
146 |
if(poImageReader==NULL) |
|
147 |
return -1; |
|
148 |
else |
|
149 |
return jresult; |
|
142 | 150 |
|
143 | 151 |
} |
144 | 152 |
|
Also available in: Unified diff