Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| SHA1 Hash: | 84bc7a7536f2b08f037bb80c5542db773b246c74 |
|---|---|
| Date: | 2009-01-07 11:07:47 |
| User: | stephan |
| Comment: | added a define for _ISOC99_SOURCE so snprintf() gets picked up |
Tags And Properties
- branch=trunk inherited from [f1bea87b3b]
- sym-trunk inherited from [f1bea87b3b]
Changes
Changes to whprintf.c
| Old (37c3a0fbd15eb4ee) | New (49b7a7dc214b209b) | |||
|---|---|---|---|---|
| 1 | /************************************************************************ | 1 | /************************************************************************ | |
| 2 | The printf-like implementation in this file is based on the one found | 2 | The printf-like implementation in this file is based on the one found | |
| 3 | in the sqlite3 distribution is in the Public Domain. | 3 | in the sqlite3 distribution is in the Public Domain. | |
| 4 | 4 | |||
| 5 | This copy was forked for use with the clob API in Feb 2008 by Stephan | 5 | This copy was forked for use with the clob API in Feb 2008 by Stephan | |
| 12 hidden lines | ||||
| 18 | 18 | |||
| 19 | See below for several WHPRINTF_OMIT_xxx macros which can be set to | 19 | See below for several WHPRINTF_OMIT_xxx macros which can be set to | |
| 20 | remove certain features/extensions. | 20 | remove certain features/extensions. | |
| 21 | ************************************************************************/ | 21 | ************************************************************************/ | |
| 22 | 22 | |||
| > | 23 | #if !defined(_ISOC99_SOURCE) | ||
| > | 24 | #define _ISOC99_SOURCE 1 /* needed for snprintf() */ | ||
| > | 25 | #endif | ||
| > | 26 | |||
| 23 | #include <stdio.h> /* FILE */ | 27 | #include <stdio.h> /* FILE */ | |
| 24 | #include <string.h> /* strlen() */ | 28 | #include <string.h> /* strlen() */ | |
| 25 | #include <stdlib.h> /* free/malloc() */ | 29 | #include <stdlib.h> /* free/malloc() */ | |
| 26 | #include <ctype.h> | 30 | #include <ctype.h> | |
| 27 | 31 | |||
| 607 hidden lines | ||||
| 635 | for(i=n=0; (ch=escarg[i])!=0; i++){ | 639 | for(i=n=0; (ch=escarg[i])!=0; i++){ | |
| 636 | if( ch==q ) n++; | 640 | if( ch==q ) n++; | |
| 637 | } | 641 | } | |
| 638 | needQuote = !isnull && xtype==etSQLESCAPE2; | 642 | needQuote = !isnull && xtype==etSQLESCAPE2; | |
| 639 | n += i + 1 + needQuote*2; | 643 | n += i + 1 + needQuote*2; | |
| > | 644 | // FIXME: use a static buffer here instead of malloc()! Shame on you! | ||
| 640 | bufpt = (char *)malloc( n ); | 645 | bufpt = (char *)malloc( n ); | |
| 641 | if( ! bufpt ) return -1; | 646 | if( ! bufpt ) return -1; | |
| 642 | j = 0; | 647 | j = 0; | |
| 643 | if( needQuote ) bufpt[j++] = q; | 648 | if( needQuote ) bufpt[j++] = q; | |
| 644 | for(i=0; (ch=escarg[i])!=0; i++){ | 649 | for(i=0; (ch=escarg[i])!=0; i++){ | |
| 715 hidden lines | ||||
| 1360 | va_start( vargs, fmt ); | 1365 | va_start( vargs, fmt ); | |
| 1361 | char * ret = whprintfv_str( fmt, vargs ); | 1366 | char * ret = whprintfv_str( fmt, vargs ); | |
| 1362 | va_end( vargs ); | 1367 | va_end( vargs ); | |
| 1363 | return ret; | 1368 | return ret; | |
| 1364 | } | 1369 | } | |