mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 03:32:45 +00:00 
			
		
		
		
	ImageDecoder: Actually set is_animated and loop_count variables
				
					
				
			Before 649f78d0a4, the is_animated and
loop_count objects were set directly when making a return object.
That commit moved the decode logic to a separate function but forgot to
assign `is_animated` and `loop_count`. The compiler didn't throw an
error about unused variables because we were also VERIFY()ing that these
variables were zero-initialized at the beginning of the function.
			
			
This commit is contained in:
		
							parent
							
								
									3a9225608a
								
							
						
					
					
						commit
						f23eba1ba8
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		|  | @ -41,8 +41,6 @@ static void decode_image_to_details(Core::AnonymousBuffer const& encoded_buffer, | ||||||
| { | { | ||||||
|     VERIFY(bitmaps.size() == 0); |     VERIFY(bitmaps.size() == 0); | ||||||
|     VERIFY(durations.size() == 0); |     VERIFY(durations.size() == 0); | ||||||
|     VERIFY(!is_animated); |  | ||||||
|     VERIFY(loop_count == 0); |  | ||||||
| 
 | 
 | ||||||
|     auto decoder = Gfx::ImageDecoder::try_create_for_raw_bytes(ReadonlyBytes { encoded_buffer.data<u8>(), encoded_buffer.size() }, known_mime_type); |     auto decoder = Gfx::ImageDecoder::try_create_for_raw_bytes(ReadonlyBytes { encoded_buffer.data<u8>(), encoded_buffer.size() }, known_mime_type); | ||||||
|     if (!decoder) { |     if (!decoder) { | ||||||
|  | @ -54,6 +52,8 @@ static void decode_image_to_details(Core::AnonymousBuffer const& encoded_buffer, | ||||||
|         dbgln_if(IMAGE_DECODER_DEBUG, "Could not decode image from encoded data"); |         dbgln_if(IMAGE_DECODER_DEBUG, "Could not decode image from encoded data"); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|  |     is_animated = decoder->is_animated(); | ||||||
|  |     loop_count = decoder->loop_count(); | ||||||
|     decode_image_to_bitmaps_and_durations_with_decoder(*decoder, bitmaps, durations); |     decode_image_to_bitmaps_and_durations_with_decoder(*decoder, bitmaps, durations); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Karol Kosek
						Karol Kosek