mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
Fix for snprintf
This commit is contained in:
parent
a803c36b70
commit
9d7c3ceed2
4 changed files with 13 additions and 6 deletions
|
@ -222,8 +222,6 @@ inline double ulonglong2double(ulonglong value)
|
|||
|
||||
#define HAVE_PERROR
|
||||
#define HAVE_VFPRINT
|
||||
#define HAVE_SNPRINTF
|
||||
#define _snprintf snprintf
|
||||
#define HAVE_CHSIZE /* System has chsize() function */
|
||||
#define HAVE_RENAME /* Have rename() as function */
|
||||
#define HAVE_BINARY_STREAMS /* Have "b" flag in streams */
|
||||
|
@ -248,6 +246,11 @@ inline double ulonglong2double(ulonglong value)
|
|||
#define HAVE_ALLOCA
|
||||
#define HAVE_COMPRESS
|
||||
|
||||
#ifdef NOT_USED
|
||||
#define HAVE_SNPRINTF /* Gave link error */
|
||||
#define _snprintf snprintf
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define HAVE_LDIV /* The optimizer breaks in zortech for ldiv */
|
||||
#define HAVE_ANSI_INCLUDE
|
||||
|
|
|
@ -501,7 +501,8 @@ void Field_decimal::store(double nr)
|
|||
|
||||
fyllchar = zerofill ? (char) '0' : (char) ' ';
|
||||
#ifdef HAVE_SNPRINTF_
|
||||
snprintf(buff,sizeof(buff), "%.*f",(int) dec,nr);
|
||||
buff[sizeof(buff)-1]=0; // Safety
|
||||
snprintf(buff,sizeof(buff)-1, "%.*f",(int) dec,nr);
|
||||
#else
|
||||
sprintf(buff,"%.*f",dec,nr);
|
||||
#endif
|
||||
|
@ -2075,7 +2076,8 @@ String *Field_double::val_str(String *val_buffer,
|
|||
*to++= *pos++;
|
||||
#else
|
||||
#ifdef HAVE_SNPRINTF
|
||||
snprintf(to,to_length,"%.*f",dec,nr);
|
||||
buff[to_length-1]=0; // Safety
|
||||
snprintf(to,to_length-1,"%.*f",dec,nr);
|
||||
#else
|
||||
sprintf(to,"%.*f",dec,nr);
|
||||
#endif
|
||||
|
|
|
@ -359,7 +359,8 @@ void field_real::add()
|
|||
else
|
||||
{
|
||||
#ifdef HAVE_SNPRINTF
|
||||
snprintf(buff, sizeof(buff), "%-.*f", (int) decs, num);
|
||||
buff[sizeof(buff)-1]=0; // Safety
|
||||
snprintf(buff, sizeof(buff)-1, "%-.*f", (int) decs, num);
|
||||
#else
|
||||
sprintf(buff, "%-.*f", (int) decs, num);
|
||||
#endif
|
||||
|
|
|
@ -186,7 +186,8 @@ end:
|
|||
return FALSE;
|
||||
#else
|
||||
#ifdef HAVE_SNPRINTF
|
||||
snprintf(buff,sizeof(buff), "%.*f",(int) decimals,num);
|
||||
buff[sizeof(buff)-1]=0; // Safety
|
||||
snprintf(buff,sizeof(buff)-1, "%.*f",(int) decimals,num);
|
||||
#else
|
||||
sprintf(buff,"%.*f",(int) decimals,num);
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue