Browse Source

fixed warnings with msvc

Nicolas Cannasse 3 years ago
parent
commit
17e48497ed
4 changed files with 14 additions and 9 deletions
  1. 2 2
      src/hl.h
  2. 1 1
      src/profile.c
  3. 5 4
      src/std/bytes.c
  4. 6 2
      src/std/ucs2.c

+ 2 - 2
src/hl.h

@@ -251,8 +251,8 @@ typedef char16_t uchar;
 
 C_FUNCTION_BEGIN
 #ifndef HL_NATIVE_UCHAR_FUN
-HL_API double utod( const uchar *str, const uchar **end );
-HL_API int utoi( const uchar *str, const uchar **end );
+HL_API double utod( const uchar *str, uchar **end );
+HL_API int utoi( const uchar *str, uchar **end );
 HL_API int ustrlen( const uchar *str );
 HL_API uchar *ustrdup( const uchar *str );
 HL_API int ucmp( const uchar *a, const uchar *b );

+ 1 - 1
src/profile.c

@@ -433,7 +433,7 @@ static void profile_event( int code, vbyte *ptr, int dataLen ) {
 		break;
 	case -7:
 		{
-			const uchar *end = NULL;
+			uchar *end = NULL;
 			hl_profile_setup( ptr ? utoi((uchar*)ptr,&end) : 1000);
 		}
 		break;

+ 5 - 4
src/std/bytes.c

@@ -181,7 +181,8 @@ static inline bool is_space_char(uchar c) {
 }
 
 HL_PRIM double hl_parse_float( vbyte *bytes, int pos, int len ) {
-	const uchar *str = (uchar*)(bytes+pos), *end = NULL;
+	const uchar *str = (uchar*)(bytes+pos);
+	uchar *end = NULL;
 	while( is_space_char(*str) ) str++;
 	double d = utod(str,&end);
 	if( end == str )
@@ -197,12 +198,12 @@ static inline bool has_hex_prefix( const uchar *c, int len, bool is_signed ) {
 
 HL_PRIM vdynamic *hl_parse_int( vbyte *bytes, int pos, int len ) {
 	const uchar *c = (uchar*)(bytes + pos);
-	const uchar *const start = c;
+	const uchar *start = c;
 	int h;
 	while( is_space_char(*c) ) c++;
 	uchar sign = c[0];
 	bool is_signed = sign == '-' || sign == '+';
-	if( has_hex_prefix(c,len+start-c,is_signed) ) {
+	if( has_hex_prefix(c,(int)(len+start-c),is_signed) ) {
 		h = 0;
 		c += is_signed ? 3 : 2;
 		while( *c ) {
@@ -218,7 +219,7 @@ HL_PRIM vdynamic *hl_parse_int( vbyte *bytes, int pos, int len ) {
 		}
 		if( sign == '-' ) h = -h;
 	} else {
-		const uchar *end = NULL;
+		uchar *end = NULL;
 		h = utoi(c,&end);
 		if( c == end )
 			return NULL;

+ 6 - 2
src/std/ucs2.c

@@ -67,7 +67,7 @@ uchar *ustrdup( const uchar *str ) {
 	return d;
 }
 
-double utod( const uchar *str, const uchar **end ) {
+double utod( const uchar *str, uchar **end ) {
 	char buf[31];
 	char *bend;
 	double result;
@@ -84,7 +84,7 @@ double utod( const uchar *str, const uchar **end ) {
 	return result;
 }
 
-int utoi( const uchar *str, const uchar **end ) {
+int utoi( const uchar *str, uchar **end ) {
 	char buf[17];
 	char *bend;
 	int result;
@@ -180,6 +180,10 @@ void uprintf( const uchar *fmt, const uchar *str ) {
 
 #if !defined(HL_NATIVE_UCHAR_FUN) || defined(HL_WIN)
 
+#ifdef HL_VCC
+#pragma warning(disable:4774)
+#endif
+
 HL_PRIM int uvszprintf( uchar *out, int out_size, const uchar *fmt, va_list arglist ) {
 	uchar *start = out;
 	uchar *end = out + out_size - 1;