8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 15:23:02 +01:00

Migrate ib_udf to platform-neutral integral types.

This commit is contained in:
robocop 2006-06-03 04:53:06 +00:00
parent 12c2d1edc4
commit c4870f6d2b

View File

@ -36,6 +36,7 @@
# include <time.h>
# endif
#endif
#include "fb_types.h"
#include "ib_util.h"
#include "ib_udf.h"
@ -65,7 +66,7 @@ double EXPORT IB_UDF_acos( double *a)
return (acos(*a));
}
char *EXPORT IB_UDF_ascii_char( int *a)
char *EXPORT IB_UDF_ascii_char( ISC_LONG *a)
{
if (!a)
return 0;
@ -77,10 +78,10 @@ char *EXPORT IB_UDF_ascii_char( int *a)
return (b);
}
int EXPORT IB_UDF_ascii_val( const char *a)
ISC_LONG EXPORT IB_UDF_ascii_val( const char *a)
{
// NULL is treated as ASCII(0).
return ((int) (*a));
return ((ISC_LONG) (*a));
}
double EXPORT IB_UDF_asin( double *a)
@ -98,17 +99,17 @@ double EXPORT IB_UDF_atan2( double *a, double *b)
return (atan2(*a, *b));
}
long EXPORT IB_UDF_bin_and( long *a, long *b)
ISC_LONG EXPORT IB_UDF_bin_and( ISC_LONG *a, ISC_LONG *b)
{
return (*a & *b);
}
long EXPORT IB_UDF_bin_or( long *a, long *b)
ISC_LONG EXPORT IB_UDF_bin_or( ISC_LONG *a, ISC_LONG *b)
{
return (*a | *b);
}
long EXPORT IB_UDF_bin_xor( long *a, long *b)
ISC_LONG EXPORT IB_UDF_bin_xor( ISC_LONG *a, ISC_LONG *b)
{
return (*a ^ *b);
}
@ -133,13 +134,13 @@ double EXPORT IB_UDF_cot( double *a)
return (1.0 / tan(*a));
}
double EXPORT IB_UDF_div( long *a, long *b)
double EXPORT IB_UDF_div( ISC_LONG *a, ISC_LONG *b)
{
if (*b != 0)
{
// VS8.0 has two implementations of div().
// Let's explicitly use the int-aware one.
div_t div_result = div((int) *a, (int) *b);
div_t div_result = div((ISC_LONG) *a, (ISC_LONG) *b);
return (div_result.quot);
}
else
@ -200,7 +201,7 @@ char *EXPORT IB_UDF_lower(const char *s)
return buf;
}
char *EXPORT IB_UDF_lpad( const char *s, long *a, const char *c)
char *EXPORT IB_UDF_lpad( const char *s, ISC_LONG *a, const char *c)
{
if (!s || !c)
return 0;
@ -249,13 +250,13 @@ char *EXPORT IB_UDF_ltrim( const char *s)
return buf;
}
double EXPORT IB_UDF_mod( long *a, long *b)
double EXPORT IB_UDF_mod( ISC_LONG *a, ISC_LONG *b)
{
if (*b != 0)
{
// VS8.0 has two implementations of div().
// Let's explicitly use the int-aware one.
div_t div_result = div((int) *a, (int) *b);
div_t div_result = div((ISC_LONG) *a, (ISC_LONG) *b);
return (div_result.rem);
}
else
@ -283,7 +284,7 @@ double EXPORT IB_UDF_rand()
return ((float) rand() / (float) RAND_MAX);
}
char *EXPORT IB_UDF_rpad( const char *s, long *a, const char *c)
char *EXPORT IB_UDF_rpad( const char *s, ISC_LONG *a, const char *c)
{
if (!s || !c)
return 0;
@ -331,7 +332,7 @@ char *EXPORT IB_UDF_rtrim( const char *s)
return buf;
}
int EXPORT IB_UDF_sign( double *a)
ISC_LONG EXPORT IB_UDF_sign( double *a)
{
if (*a > 0)
return 1;
@ -356,7 +357,7 @@ double EXPORT IB_UDF_sqrt( double *a)
return (sqrt(*a));
}
char* EXPORT IB_UDF_substr(const char* s, short* m, short* n)
char* EXPORT IB_UDF_substr(const char* s, ISC_SHORT* m, ISC_SHORT* n)
{
if (!s) {
return 0;
@ -392,7 +393,7 @@ char* EXPORT IB_UDF_substr(const char* s, short* m, short* n)
return buf;
}
char* EXPORT IB_UDF_substrlen(const char* s, short* m, short* n)
char* EXPORT IB_UDF_substrlen(const char* s, ISC_SHORT* m, ISC_SHORT* n)
{
/* Created by Claudio Valderrama for the Firebird project,
2001.04.17 We don't want to return NULL when params are wrong
@ -431,7 +432,7 @@ char* EXPORT IB_UDF_substrlen(const char* s, short* m, short* n)
return buf;
}
int EXPORT IB_UDF_strlen( const char *a)
ISC_LONG EXPORT IB_UDF_strlen( const char *a)
{
return (strlen(a));
}