equal
deleted
inserted
replaced
176 joffs = (*env)->GetObjectField(env, rasterP->jsampleModel, |
176 joffs = (*env)->GetObjectField(env, rasterP->jsampleModel, |
177 g_SPPSMmaskOffID); |
177 g_SPPSMmaskOffID); |
178 jnbits = (*env)->GetObjectField(env, rasterP->jsampleModel, |
178 jnbits = (*env)->GetObjectField(env, rasterP->jsampleModel, |
179 g_SPPSMnBitsID); |
179 g_SPPSMnBitsID); |
180 if (jmask == NULL || joffs == NULL || jnbits == NULL || |
180 if (jmask == NULL || joffs == NULL || jnbits == NULL || |
181 rasterP->sppsm.maxBitSize < 0 || rasterP->sppsm.maxBitSize > 8) |
181 rasterP->sppsm.maxBitSize < 0) |
182 { |
182 { |
183 JNU_ThrowInternalError(env, "Can't grab SPPSM fields"); |
183 JNU_ThrowInternalError(env, "Can't grab SPPSM fields"); |
184 return -1; |
184 return -1; |
185 } |
185 } |
186 (*env)->GetIntArrayRegion(env, jmask, 0, |
186 (*env)->GetIntArrayRegion(env, jmask, 0, |
276 JNU_ThrowOutOfMemoryError(env, "Out of memory"); |
276 JNU_ThrowOutOfMemoryError(env, "Out of memory"); |
277 return -1; |
277 return -1; |
278 } |
278 } |
279 (*env)->GetIntArrayRegion(env, joffs, 0, rasterP->numDataElements, |
279 (*env)->GetIntArrayRegion(env, joffs, 0, rasterP->numDataElements, |
280 rasterP->chanOffsets); |
280 rasterP->chanOffsets); |
|
281 } |
|
282 |
|
283 /* additioanl check for sppsm fields validity: make sure that |
|
284 * size of raster samples doesn't exceed the data type cpacity. |
|
285 */ |
|
286 if (rasterP->dataType > UNKNOWN_DATA_TYPE && /* data type has been recognized */ |
|
287 rasterP->sppsm.maxBitSize > 0 && /* raster has SPP sample model */ |
|
288 rasterP->sppsm.maxBitSize > (rasterP->dataSize * 8)) |
|
289 { |
|
290 JNU_ThrowInternalError(env, "Raster samples are too big"); |
|
291 return -1; |
281 } |
292 } |
282 |
293 |
283 #if 0 |
294 #if 0 |
284 fprintf(stderr,"---------------------\n"); |
295 fprintf(stderr,"---------------------\n"); |
285 fprintf(stderr,"Width : %d\n",rasterP->width); |
296 fprintf(stderr,"Width : %d\n",rasterP->width); |