@@ -13,8 +13,7 @@ void put_scanline_someplace(JSAMPROW buffer : count(row_stride), int row_stride)
1313
1414struct my_error_mgr {
1515 struct jpeg_error_mgr pub ; /* "public" fields */
16-
17- jmp_buf setjmp_buffer ; /* for return to caller */
16+ jmp_buf setjmp_buffer : itype (struct __jmp_buf_tag _Checked [1 ]); /* for return to caller */
1817};
1918
2019typedef _Ptr < struct my_error_mgr > my_error_ptr ;
@@ -34,7 +33,7 @@ my_error_exit (j_common_ptr cinfo)
3433 (* cinfo -> err -> output_message ) (cinfo );
3534
3635 /* Return control to the setjmp point */
37- longjmp (myerr -> setjmp_buffer , 1 );
36+ _Unchecked { longjmp (myerr -> setjmp_buffer , 1 ); }
3837}
3938
4039
@@ -79,7 +78,9 @@ read_JPEG_file (_Nt_array_ptr<char> filename)
7978 cinfo .err = jpeg_std_error (& jerr .pub );
8079 jerr .pub .error_exit = my_error_exit ;
8180 /* Establish the setjmp return context for my_error_exit to use. */
82- if (setjmp (jerr .setjmp_buffer )) {
81+ int jmp = 0 ;
82+ _Unchecked { jmp = setjmp (jerr .setjmp_buffer ); }
83+ if (jmp ) {
8384 /* If we get here, the JPEG code has signaled an error.
8485 * We need to clean up the JPEG object, close the input file, and return.
8586 */
@@ -133,7 +134,7 @@ read_JPEG_file (_Nt_array_ptr<char> filename)
133134 } else if (cinfo .output_components == 3 ) {
134135 printf ("P3\n" );
135136 } else {
136- longjmp (jerr .setjmp_buffer , 1 );
137+ _Unchecked { longjmp (jerr .setjmp_buffer , 1 ); }
137138 }
138139 printf ("%d %d\n255\n" , cinfo .output_width , cinfo .output_height );
139140
@@ -151,7 +152,12 @@ read_JPEG_file (_Nt_array_ptr<char> filename)
151152 */
152153 (void ) jpeg_read_scanlines (& cinfo , buffer , 1 );
153154 /* Assume put_scanline_someplace wants a pointer and sample count. */
154- put_scanline_someplace (_Assume_bounds_cast < JSAMPROW > (buffer [0 ], count (row_stride )), row_stride );
155+ JSAMPROW row_unkb : bounds (unknown ) = buffer [0 ];
156+ JSAMPROW row : count (row_stride ) = 0 ;
157+ _Unchecked {
158+ row = _Assume_bounds_cast < JSAMPROW > (row_unkb , count (row_stride ));
159+ }
160+ put_scanline_someplace (row , row_stride );
155161 }
156162
157163 /* Step 7: Finish decompression */
0 commit comments