From: Jozef M. <mis...@ho...> - 2009-04-03 10:03:01
|
---------------------------------------- > Date: Fri, 3 Apr 2009 10:49:29 +0200 > From: ms...@gm... > To: mis...@ho... > CC: pdf...@li... > Subject: Re: os_wince_patch.patch > > On Thu, Apr 02, 2009 at 04:26:17PM +0000, Jozef Misutka wrote: >> Index: win.h >> =================================================================== >> RCS file: /cvsroot/pdfedit/pdfedit/src/os/win.h,v >> retrieving revision 1.9 >> diff -u -p -r1.9 win.h >> --- win.h 6 Mar 2009 11:16:44 -0000 1.9 >> +++ win.h 2 Apr 2009 15:59:45 -0000 >> @@ -37,18 +37,30 @@ >> // boost won't work otherwise! >> #define _HAS_ITERATOR_DEBUGGING 1 >> >> - >> #include >> -#include >> +#include >> + >> +#ifdef UNDER_CE >> + extern int errno; >> + inline char* strerror (int) { return ""; } > > Shouldn't we return at least the error number? Something like > inline char* strerror(int errno) > { > static char msg[64]; > snprintf(msg, sizeof(msg), "error %d", errno); > return msg; > } does not make sense; currently, errno is defined in .cpp and set to 0. > >> + inline time_t time(time_t*) { return time_t(); } > > This will return 0 all the time, right? How do we get the correct value? check wince msdn > >> +#else >> + #include >> +#endif >> >> // >> -// localtime_r hack >> +// localtime hack >> // >> +#ifdef UNDER_CE >> +inline struct tm* localtime_r (const time_t *clock, struct tm *result) >> + { if (!clock || !result){ return NULL;} return result; } > > Could you at least copy all relevant fields from clock to result? why? it is working now and partial solution is not needed. what is needed is a proper fix. > >> + >> +#else >> + >> inline struct tm* >> localtime_r (const time_t *clock, struct tm *result) { >> if (!clock || !result) >> return NULL; >> - >> // there is no localtime_r() on Windows, so for now >> // we just call localtime() and deep copy the result. >> struct tm* _ptr = localtime(clock); >> @@ -65,6 +77,7 @@ localtime_r (const time_t *clock, struct >> result->tm_isdst = _ptr->tm_isdst; /* daylight saving time */ >> return result; >> } >> +#endif >> >> // >> // S_ISREG hack >> @@ -76,7 +89,11 @@ localtime_r (const time_t *clock, struct >> // >> // ftruncate hack >> // >> -#define ftruncate(a,b) _chsize((a),(b)) >> +#ifdef UNDER_CE >> +#define ftruncate(a,b) false > > This is not correct. You should return -1, because this value is > checked. will be fixed in next step, currently it works also this way. > >> +#else >> +#define ftruncate(a,b) _chsize((a),(b)) >> +#endif >> >> // >> // snprintf > > > -- > Michal Hocko _________________________________________________________________ Rediscover Hotmail®: Get quick friend updates right in your inbox. http://windowslive.com/RediscoverHotmail?ocid=TXT_TAGLM_WL_HM_Rediscover_Updates1_042009 |