mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	datatrak.c: don't use POSIX %m format for sscanf() in dtrak_prepare_data()
The format option "%m" doesn't work for MINGW/Windows and is reported as an unknown conversation type and this sscanf() call would not work. The alternative is to malloc() enough space manually - e.g. strlen(input) + 1. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									74bf8d5260
								
							
						
					
					
						commit
						fb3ce8554c
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
					@ -115,7 +115,8 @@ static int dtrak_prepare_data(int model, device_data_t *dev_data)
 | 
				
			||||||
	while (model != g_models[i].model_num && g_models[i].model_num != 0xEE)
 | 
						while (model != g_models[i].model_num && g_models[i].model_num != 0xEE)
 | 
				
			||||||
		i++;
 | 
							i++;
 | 
				
			||||||
	dev_data->model = copy_string(g_models[i].name);
 | 
						dev_data->model = copy_string(g_models[i].name);
 | 
				
			||||||
	sscanf(g_models[i].name,"%m[A-Za-z] ", &dev_data->vendor);
 | 
						dev_data->vendor = (const char *)malloc(strlen(g_models[i].name) + 1);
 | 
				
			||||||
 | 
						sscanf(g_models[i].name, "%[A-Za-z] ", (char *)dev_data->vendor);
 | 
				
			||||||
	dev_data->product = copy_string(strchr(g_models[i].name, ' ') + 1);
 | 
						dev_data->product = copy_string(strchr(g_models[i].name, ' ') + 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	d = get_descriptor(g_models[i].type, g_models[i].libdc_num);
 | 
						d = get_descriptor(g_models[i].type, g_models[i].libdc_num);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue