mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:12:45 +00:00 
			
		
		
		
	AK+Everywhere: Add and use static APIs for LexicalPath
The LexicalPath instance methods dirname(), basename(), title() and extension() will be changed to return StringView const& in a further commit. Due to this, users creating temporary LexicalPath objects just to call one of those getters will recieve a StringView const& pointing to a possible freed buffer. To avoid this, static methods for those APIs have been added, which will return a String by value to avoid those problems. All cases where temporary LexicalPath objects have been used as described above haven been changed to use the static APIs.
This commit is contained in:
		
							parent
							
								
									9b8f35259c
								
							
						
					
					
						commit
						fc6d051dfd
					
				
					 43 changed files with 80 additions and 56 deletions
				
			
		|  | @ -300,7 +300,7 @@ void SoundPlayerWidgetAdvancedView::try_fill_missing_info(Vector<M3UEntry>& entr | |||
|         } | ||||
| 
 | ||||
|         if (!entry.extended_info->track_display_title.has_value()) | ||||
|             entry.extended_info->track_display_title = LexicalPath(entry.path).title(); | ||||
|             entry.extended_info->track_display_title = LexicalPath::title(entry.path); | ||||
|         if (!entry.extended_info->track_length_in_seconds.has_value()) { | ||||
|             if (auto reader = Audio::Loader::create(entry.path); !reader->has_error()) | ||||
|                 entry.extended_info->track_length_in_seconds = reader->total_samples() / reader->sample_rate(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Max Wipfli
						Max Wipfli