jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c
changeset 23892 9959956918be
parent 23644 0cdb97daeef5
child 23917 d247e52b5262
equal deleted inserted replaced
23891:5b4c7da22eab 23892:9959956918be
   287     }
   287     }
   288     RELEASE_ARRAYS(env, src);
   288     RELEASE_ARRAYS(env, src);
   289     buflen = (*env)->GetArrayLength(env, src->hInputBuffer);
   289     buflen = (*env)->GetArrayLength(env, src->hInputBuffer);
   290     ret = (*env)->CallIntMethod(env, src->hInputStream, InputStream_readID,
   290     ret = (*env)->CallIntMethod(env, src->hInputStream, InputStream_readID,
   291                                 src->hInputBuffer, 0, buflen);
   291                                 src->hInputBuffer, 0, buflen);
       
   292     if (ret > buflen) ret = buflen;
   292     if ((*env)->ExceptionOccurred(env) || !GET_ARRAYS(env, src)) {
   293     if ((*env)->ExceptionOccurred(env) || !GET_ARRAYS(env, src)) {
   293         cinfo->err->error_exit((struct jpeg_common_struct *) cinfo);
   294         cinfo->err->error_exit((struct jpeg_common_struct *) cinfo);
   294     }
   295     }
   295     if (ret <= 0) {
   296     if (ret <= 0) {
   296         /* Silently accept truncated JPEG files */
   297         /* Silently accept truncated JPEG files */
   347         }
   348         }
   348         return;
   349         return;
   349     }
   350     }
   350     ret = (*env)->CallIntMethod(env, src->hInputStream, InputStream_readID,
   351     ret = (*env)->CallIntMethod(env, src->hInputStream, InputStream_readID,
   351                                 src->hInputBuffer, offset, buflen);
   352                                 src->hInputBuffer, offset, buflen);
       
   353     if (ret > buflen) ret = buflen;
   352     if ((*env)->ExceptionOccurred(env) || !GET_ARRAYS(env, src)) {
   354     if ((*env)->ExceptionOccurred(env) || !GET_ARRAYS(env, src)) {
   353         cinfo->err->error_exit((struct jpeg_common_struct *) cinfo);
   355         cinfo->err->error_exit((struct jpeg_common_struct *) cinfo);
   354     }
   356     }
   355     if (ret <= 0) {
   357     if (ret <= 0) {
   356         /* Silently accept truncated JPEG files */
   358         /* Silently accept truncated JPEG files */
   422     buflen =  (*env)->GetArrayLength(env, src->hInputBuffer);
   424     buflen =  (*env)->GetArrayLength(env, src->hInputBuffer);
   423     while (num_bytes > 0) {
   425     while (num_bytes > 0) {
   424         ret = (*env)->CallIntMethod(env, src->hInputStream,
   426         ret = (*env)->CallIntMethod(env, src->hInputStream,
   425                                     InputStream_readID,
   427                                     InputStream_readID,
   426                                     src->hInputBuffer, 0, buflen);
   428                                     src->hInputBuffer, 0, buflen);
       
   429         if (ret > buflen) ret = buflen;
   427         if ((*env)->ExceptionOccurred(env)) {
   430         if ((*env)->ExceptionOccurred(env)) {
   428             cinfo->err->error_exit((struct jpeg_common_struct *) cinfo);
   431             cinfo->err->error_exit((struct jpeg_common_struct *) cinfo);
   429         }
   432         }
   430         if (ret < 0) {
   433         if (ret < 0) {
   431             break;
   434             break;