2145 /* 2146 * We are done, but we might not have read all the lines, or all 2147 * the passes, so use jpeg_abort instead of jpeg_finish_decompress. 2148 */ 2149 if (cinfo->output_scanline == cinfo->output_height) { 2150 // if ((cinfo->output_scanline == cinfo->output_height) && 2151 //(jpeg_input_complete(cinfo))) { // We read the whole file 2152 jpeg_finish_decompress(cinfo); 2153 } else { 2154 jpeg_abort_decompress(cinfo); 2155 } 2156 2157 free(scanLinePtr); 2158 2159 RELEASE_ARRAYS(env, data, src->next_input_byte); 2160 2161 return data->abortFlag; 2162 } 2163 2164 JNIEXPORT void JNICALL 2165 Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_abortRead 2166 (JNIEnv *env, 2167 jobject this, 2168 jlong ptr) { 2169 2170 imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr); 2171 2172 if (data == NULL) { 2173 JNU_ThrowByName(env, 2174 "java/lang/IllegalStateException", 2175 "Attempting to use reader after dispose()"); 2176 return; 2177 } 2178 2179 imageio_abort(env, this, data); 2180 2181 } 2182 2183 JNIEXPORT void JNICALL 2184 Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_resetLibraryState | 2145 /* 2146 * We are done, but we might not have read all the lines, or all 2147 * the passes, so use jpeg_abort instead of jpeg_finish_decompress. 2148 */ 2149 if (cinfo->output_scanline == cinfo->output_height) { 2150 // if ((cinfo->output_scanline == cinfo->output_height) && 2151 //(jpeg_input_complete(cinfo))) { // We read the whole file 2152 jpeg_finish_decompress(cinfo); 2153 } else { 2154 jpeg_abort_decompress(cinfo); 2155 } 2156 2157 free(scanLinePtr); 2158 2159 RELEASE_ARRAYS(env, data, src->next_input_byte); 2160 2161 return data->abortFlag; 2162 } 2163 2164 JNIEXPORT void JNICALL 2165 Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_clearNativeReadAbortFlag 2166 (JNIEnv *env, 2167 jobject this, 2168 jlong ptr) { 2169 2170 imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr); 2171 2172 if (data == NULL) { 2173 JNU_ThrowByName(env, 2174 "java/lang/IllegalStateException", 2175 "Attempting to use reader after dispose()"); 2176 return; 2177 } 2178 2179 data->abortFlag = JNI_FALSE; 2180 2181 } 2182 2183 JNIEXPORT void JNICALL 2184 Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_abortRead 2185 (JNIEnv *env, 2186 jobject this, 2187 jlong ptr) { 2188 2189 imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr); 2190 2191 if (data == NULL) { 2192 JNU_ThrowByName(env, 2193 "java/lang/IllegalStateException", 2194 "Attempting to use reader after dispose()"); 2195 return; 2196 } 2197 2198 imageio_abort(env, this, data); 2199 2200 } 2201 2202 JNIEXPORT void JNICALL 2203 Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_resetLibraryState |