mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	topology: Quit and show error message on big-endian machines
This tool can only support little-endian machines atm. Many codes directly refer to __le32/__le64 variables of ABI objects, so will be broken on big-endian machines. Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
		
							parent
							
								
									cde9a37c06
								
							
						
					
					
						commit
						b917a0c0a8
					
				
					 2 changed files with 17 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -371,10 +371,25 @@ void snd_tplg_verbose(snd_tplg_t *tplg, int verbose)
 | 
			
		|||
	tplg->verbose = verbose;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool is_little_endian(void)
 | 
			
		||||
{
 | 
			
		||||
#ifdef __BYTE_ORDER
 | 
			
		||||
	#if __BYTE_ORDER == __LITTLE_ENDIAN
 | 
			
		||||
		return true;
 | 
			
		||||
	#endif
 | 
			
		||||
#endif
 | 
			
		||||
	return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
snd_tplg_t *snd_tplg_new(void)
 | 
			
		||||
{
 | 
			
		||||
	snd_tplg_t *tplg;
 | 
			
		||||
 | 
			
		||||
	if (!is_little_endian()) {
 | 
			
		||||
		SNDERR("error: cannot support big-endian machines\n");
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	tplg = calloc(1, sizeof(snd_tplg_t));
 | 
			
		||||
	if (!tplg)
 | 
			
		||||
		return NULL;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue