mirror of
				https://github.com/luanti-org/luanti.git
				synced 2025-10-30 23:15:32 +01:00 
			
		
		
		
	Fix Android build of narrow_to_wide
This commit is contained in:
		
				
					committed by
					
						 Craig Robbins
						Craig Robbins
					
				
			
			
				
	
			
			
			
						parent
						
							93e5ab367a
						
					
				
				
					commit
					9e9688fc61
				
			| @@ -62,20 +62,21 @@ int wctomb(char *s, wchar_t wc) | |||||||
| 
 | 
 | ||||||
| int mbtowc(wchar_t *pwc, const char *s, size_t n) | int mbtowc(wchar_t *pwc, const char *s, size_t n) | ||||||
| { | { | ||||||
| 	wchar_t *intermediate = narrow_to_wide(s); | 	const wchar_t *tmp = narrow_to_wide_c(s); | ||||||
| 
 | 
 | ||||||
| 	if (intermediate.length() > 0) { | 	if (tmp[0] != '\0') { | ||||||
| 		*pwc = intermediate[0]; | 		*pwc = tmp[0]; | ||||||
| 		return 1; | 		return 1; | ||||||
| 	} else { | 	} else { | ||||||
| 		return -1; | 		return -1; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | 
 | ||||||
| // You must free the returned string!
 | // You must free the returned string!
 | ||||||
| const wchar_t *narrow_to_wide_c(const char *mbs) | const wchar_t *narrow_to_wide_c(const char *mbs) | ||||||
| { | { | ||||||
| 	size_t mbl = strlen(mbs); | 	size_t mbl = strlen(mbs); | ||||||
| 	wchar_t wcs = new wchar_t[mbl + 1]; | 	wchar_t *wcs = new wchar_t[mbl + 1]; | ||||||
| 
 | 
 | ||||||
| 	for (size_t i = 0; i < mbl; i++) { | 	for (size_t i = 0; i < mbl; i++) { | ||||||
| 		if (((unsigned char) mbs[i] > 31) && | 		if (((unsigned char) mbs[i] > 31) && | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user