mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	smtk-import portability: avoid using %m[] in sscanf
As Lubomir pointed out in his patch for datatrak.c, the format option %m for sscanf doesn't work in mingw/windows. Fortunately it's unnecessary as dates are dropped and we just get times. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
This commit is contained in:
		
							parent
							
								
									95ee579150
								
							
						
					
					
						commit
						bde73f05d4
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
					@ -116,10 +116,10 @@ static void smtk_date_to_tm(char *d_buffer, struct tm *tm_date)
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static void smtk_time_to_tm(char *t_buffer, struct tm *tm_date)
 | 
					static void smtk_time_to_tm(char *t_buffer, struct tm *tm_date)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	unsigned int n, hr, min, sec;
 | 
						int n, hr, min, sec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((t_buffer) && (!same_string(t_buffer, ""))) {
 | 
						if ((t_buffer) && (!same_string(t_buffer, ""))) {
 | 
				
			||||||
		n = sscanf(t_buffer, "%*m[/0-9] %d:%d:%d ", &hr, &min, &sec);
 | 
							n = sscanf(t_buffer, "%*[0-9/] %d:%d:%d ", &hr, &min, &sec);
 | 
				
			||||||
		if (n == 3) {
 | 
							if (n == 3) {
 | 
				
			||||||
			tm_date->tm_hour = hr;
 | 
								tm_date->tm_hour = hr;
 | 
				
			||||||
			tm_date->tm_min = min;
 | 
								tm_date->tm_min = min;
 | 
				
			||||||
| 
						 | 
					@ -141,10 +141,10 @@ static void smtk_time_to_tm(char *t_buffer, struct tm *tm_date)
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static unsigned int smtk_time_to_secs(char *t_buffer)
 | 
					static unsigned int smtk_time_to_secs(char *t_buffer)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	unsigned int n, hr, min, sec;
 | 
						int n, hr, min, sec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!same_string(t_buffer, "")) {
 | 
						if (!same_string(t_buffer, "")) {
 | 
				
			||||||
		n = sscanf(t_buffer, "%*m[/0-9] %d:%d:%d ", &hr, &min, &sec);
 | 
							n = sscanf(t_buffer, "%*[0-9/] %d:%d:%d ", &hr, &min, &sec);
 | 
				
			||||||
		return((n == 3) ? (((hr*60)+min)*60)+sec : 0);
 | 
							return((n == 3) ? (((hr*60)+min)*60)+sec : 0);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue