Skip to content

Commit ca89b6d

Browse files
author
Ilia Alshanetsky
committed
last set of zts fixes
1 parent c69555b commit ca89b6d

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

ext/pdo_sqlite/sqlite/src/date.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#include <stdlib.h>
5454
#include <assert.h>
5555
#include <time.h>
56+
#include "main/php_reentrancy.h"
5657

5758
#ifndef SQLITE_OMIT_DATETIME_FUNCS
5859

@@ -393,7 +394,7 @@ static void clearYMD_HMS_TZ(DateTime *p){
393394
static double localtimeOffset(DateTime *p){
394395
DateTime x, y;
395396
time_t t;
396-
struct tm *pTm;
397+
struct tm *pTm, tmbuf;
397398
x = *p;
398399
computeYMD_HMS(&x);
399400
if( x.Y<1971 || x.Y>=2038 ){
@@ -412,7 +413,8 @@ static double localtimeOffset(DateTime *p){
412413
computeJD(&x);
413414
t = (x.rJD-2440587.5)*86400.0 + 0.5;
414415
sqlite3OsEnterMutex();
415-
pTm = localtime(&t);
416+
pTm = php_localtime_r
417+
(&t, &tmbuf);
416418
y.Y = pTm->tm_year + 1900;
417419
y.M = pTm->tm_mon + 1;
418420
y.D = pTm->tm_mday;

ext/sqlite/libsqlite/src/date.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#include <stdlib.h>
5454
#include <assert.h>
5555
#include <time.h>
56+
#include "main/php_reentrancy.h"
5657

5758
#ifndef SQLITE_OMIT_DATETIME_FUNCS
5859

@@ -397,7 +398,7 @@ static void clearYMD_HMS_TZ(DateTime *p){
397398
static double localtimeOffset(DateTime *p){
398399
DateTime x, y;
399400
time_t t;
400-
struct tm *pTm;
401+
struct tm *pTm, tmbuf;
401402
x = *p;
402403
computeYMD_HMS(&x);
403404
if( x.Y<1971 || x.Y>=2038 ){
@@ -416,7 +417,7 @@ static double localtimeOffset(DateTime *p){
416417
computeJD(&x);
417418
t = (x.rJD-2440587.5)*86400.0 + 0.5;
418419
sqliteOsEnterMutex();
419-
pTm = localtime(&t);
420+
pTm = php_localtime_r(&t, &tmbuf);
420421
y.Y = pTm->tm_year + 1900;
421422
y.M = pTm->tm_mon + 1;
422423
y.D = pTm->tm_mday;

ext/xmlrpc/libxmlrpc/xmlrpc.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ static const char rcsid[] = "#(@) $Id$";
4343
* 9/1999 - 10/2000
4444
* HISTORY
4545
* $Log$
46+
* Revision 1.8 2005/03/28 00:07:24 edink
47+
* Reshufle includes to make it compile on windows
48+
*
4649
* Revision 1.7 2005/03/26 03:13:58 sniper
4750
* - Made it possible to build ext/xmlrpc with libxml2
4851
*
@@ -123,6 +126,7 @@ static const char rcsid[] = "#(@) $Id$";
123126
*******/
124127

125128
#include "ext/xml/expat_compat.h"
129+
#include "main/php_reentrancy.h"
126130
#ifdef _WIN32
127131
#include "xmlrpc_win32.h"
128132
#endif
@@ -227,8 +231,8 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
227231
}
228232

229233
static int date_to_ISO8601 (time_t value, char *buf, int length) {
230-
struct tm *tm;
231-
tm = localtime(&value);
234+
struct tm *tm, tmbuf;
235+
tm = php_localtime_r(&value, &tmbuf);
232236
#if 0 /* TODO: soap seems to favor this method. xmlrpc the latter. */
233237
return strftime (buf, length, "%Y-%m-%dT%H:%M:%SZ", tm);
234238
#else

ext/zip/lib/zip_dirent.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3434
*/
3535

36-
37-
3836
#include <stdio.h>
3937
#include <stdlib.h>
4038
#include <string.h>
@@ -47,6 +45,7 @@
4745

4846
#include "zip.h"
4947
#include "zipint.h"
48+
#include "main/php_reentrancy.h"
5049

5150
static time_t _zip_d2u_time(int, int);
5251
static char *_zip_readfpstr(FILE *, unsigned int, int, struct zip_error *);
@@ -391,11 +390,11 @@ _zip_dirent_write(struct zip_dirent *zde, FILE *fp, int localp,
391390
static time_t
392391
_zip_d2u_time(int dtime, int ddate)
393392
{
394-
struct tm *tm;
393+
struct tm *tm, tmbuf;
395394
time_t now;
396395

397396
now = time(NULL);
398-
tm = localtime(&now);
397+
tm = php_localtime_r(&now, &tmbuf);
399398

400399
tm->tm_year = ((ddate>>9)&127) + 1980 - 1900;
401400
tm->tm_mon = ((ddate>>5)&15) - 1;
@@ -520,9 +519,9 @@ _zip_write4(unsigned int i, FILE *fp)
520519
static void
521520
_zip_u2d_time(time_t time, unsigned short *dtime, unsigned short *ddate)
522521
{
523-
struct tm *tm;
522+
struct tm *tm, tmbuf;
524523

525-
tm = localtime(&time);
524+
tm = php_localtime_r(&time, &tmbuf);
526525
*ddate = ((tm->tm_year+1900-1980)<<9) + ((tm->tm_mon+1)<<5)
527526
+ tm->tm_mday;
528527
*dtime = ((tm->tm_hour)<<11) + ((tm->tm_min)<<5)

0 commit comments

Comments
 (0)