X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fstdlib%2Fstrtoll.c;h=0eb8423f609c5246294f53e865a38df4e8f2af46;hp=768da391ef3f75f08bc71d946f236325ec7e2875;hb=f93d55176e4db9edfb1840054169003bcca4d1fb;hpb=48ec56a384a70f2d7b1293db192e37f6dfaabe1e diff --git a/functions/stdlib/strtoll.c b/functions/stdlib/strtoll.c index 768da39..0eb8423 100644 --- a/functions/stdlib/strtoll.c +++ b/functions/stdlib/strtoll.c @@ -21,13 +21,13 @@ long long int strtoll( const char * s, char ** endptr, int base ) if ( base < 2 || base > 36 ) return 0; if ( sign == '+' ) { - rc = _PDCLIB_strtox_main( &p, (unsigned)base, (uintmax_t)LLONG_MAX, (uintmax_t)( LLONG_MAX / base ), (uintmax_t)( LLONG_MAX % base ), &sign ); + rc = _PDCLIB_strtox_main( &p, (unsigned)base, (uintmax_t)LLONG_MAX, (uintmax_t)( LLONG_MAX / base ), (int)( LLONG_MAX % base ), &sign ); } else { /* FIXME: This breaks on some machines that round negatives wrongly */ /* FIXME: Sign error not caught by testdriver */ - rc = _PDCLIB_strtox_main( &p, (unsigned)base, (uintmax_t)LLONG_MIN, (uintmax_t)( LLONG_MIN / -base ), (uintmax_t)( -( LLONG_MIN % base ) ), &sign ); + rc = _PDCLIB_strtox_main( &p, (unsigned)base, (uintmax_t)LLONG_MIN, (uintmax_t)( LLONG_MIN / -base ), (int)( -( LLONG_MIN % base ) ), &sign ); } if ( endptr != NULL ) *endptr = ( p != NULL ) ? (char *) p : (char *) s; return ( sign == '+' ) ? rc : -rc; @@ -93,7 +93,7 @@ int main( void ) TESTCASE( strtoll( "0x8000000000000000", NULL, 0 ) == LLONG_MAX ); TESTCASE( errno == ERANGE ); errno = 0; - TESTCASE( strtoll( "-0x7FFFFFFFFFFFFFFF", NULL, 0 ) == 0x8000000000000001 ); + TESTCASE( strtoll( "-0x7FFFFFFFFFFFFFFF", NULL, 0 ) == (long long)0x8000000000000001 ); TESTCASE( errno == 0 ); TESTCASE( strtoll( "-0x8000000000000000", NULL, 0 ) == LLONG_MIN ); TESTCASE( errno == 0 );