mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 11:56:39 +00:00 
			
		
		
		
	Merge remote branch 'corristo/master'
This commit is contained in:
		
						commit
						8da0925e70
					
				
					 1 changed files with 23 additions and 3 deletions
				
			
		| 
						 | 
					@ -2,13 +2,33 @@
 | 
				
			||||||
#ifndef _STRING_WRAPPER_H
 | 
					#ifndef _STRING_WRAPPER_H
 | 
				
			||||||
#define _STRING_WRAPPER_H
 | 
					#define _STRING_WRAPPER_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef __APPLE__
 | 
				
			||||||
 | 
					#include <Availability.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
#if (defined(__APPLE__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) || defined(__MINGW32__)
 | 
					#if (defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED < 1070) || defined(__MINGW32__)
 | 
				
			||||||
// need our own implementation of strnlen
 | 
					// need our own implementation of strnlen
 | 
				
			||||||
 | 
					#ifdef __MINGW32__
 | 
				
			||||||
static size_t strnlen(const char *s, size_t n)
 | 
					static size_t strnlen(const char *s, size_t n)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    const char *p = (const char *)memchr(s, 0, n);
 | 
					    const char *p = (const char *)memchr(s, 0, n);
 | 
				
			||||||
    return(p ? p-s : n);
 | 
					    return(p ? p-s : n);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					#elif (defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
 | 
				
			||||||
 | 
					static size_t mw_strnlen(const char *s, size_t n)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (strnlen != NULL) {
 | 
				
			||||||
 | 
					        return strnlen(s, n);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
						else {
 | 
				
			||||||
 | 
					  		const char *p = (const char *)memchr(s, 0, n);
 | 
				
			||||||
 | 
					  		return(p ? p-s : n);
 | 
				
			||||||
 | 
					  	}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#define strnlen mw_strnlen
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue