From ba1fa96fae292191f61196814cc8f4fad9113df8 Mon Sep 17 00:00:00 2001 From: BlackLight Date: Wed, 9 Feb 2011 03:09:41 +0100 Subject: [PATCH] Fixing unsigned int bug for 64-bit archs --- regex.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/regex.c b/regex.c index eb6b09d..9f7d591 100644 --- a/regex.c +++ b/regex.c @@ -161,8 +161,8 @@ char* str_replace ( char *str, char *orig, char *rep ) { char *new_s = NULL; - unsigned int new_len = 0; - unsigned int pos = 0; + unsigned long int new_len = 0; + unsigned long int pos = 0; if ( !( pos = (int) strstr ( str, orig ))) return str; @@ -173,17 +173,17 @@ str_replace ( char *str, char *orig, char *rep ) return NULL; memset ( new_s, 0, new_len ); - strncpy ( new_s, str, pos - (unsigned int) str ); - new_s[ pos - (unsigned int) str] = 0; + strncpy ( new_s, str, pos - (unsigned long int) str ); + new_s[ pos - (unsigned long int) str] = 0; if ( rep ) { if ( strlen ( rep ) != 0 ) - sprintf ( new_s + pos - (unsigned int) str, "%s%s", rep, (char*) pos + strlen ( orig )); + sprintf ( new_s + pos - (unsigned long int) str, "%s%s", rep, (char*) pos + strlen ( orig )); else - sprintf ( new_s + pos - (unsigned int) str, "%s", (char*) pos + strlen ( orig )); + sprintf ( new_s + pos - (unsigned long int) str, "%s", (char*) pos + strlen ( orig )); } else { - sprintf ( new_s + pos - (unsigned int) str, "%s", (char*) pos + strlen ( orig )); + sprintf ( new_s + pos - (unsigned long int) str, "%s", (char*) pos + strlen ( orig )); } return new_s;