Message250030
| Author |
eryksun |
| Recipients |
BreamoreBoy, JohnLeitch, belopolsky, brycedarling, eryksun, georg.brandl, larry, lemburg, paul.moore, python-dev, steve.dower, tim.golden, vstinner, zach.ware |
| Date |
2015年09月06日.22:45:38 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1441579538.48.0.455263715426.issue24917@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
With MSVC, if errno is cleared before calling strftime, then when buflen == 0 you know whether it's an invalid format string (EINVAL) or maxsize is too small (ERANGE). There's no need to guess. Oddly, only EINVAL is documented, even though setting ERANGE has been in the implementation for years.
VC 10 (strftime.c):
/* error - return an empty string */
*(strstart)='0円';
/* now return our error/insufficient buffer indication */
if ( !failed && left <= 0 )
{
/* do not report this as an error to allow the caller to resize */
errno=ERANGE;
}
else
{
_VALIDATE_RETURN( FALSE, EINVAL, 0);
}
VC 14 (time/wcsftime.cpp):
// Error: return an empty string:
*string = L'0円';
// Now return our error/insufficient buffer indication:
if (!failed && remaining <= 0)
{
// Do not report this as an error to allow the caller to resize:
errno = ERANGE;
}
else
{
_VALIDATE_RETURN(false, EINVAL, 0);
} |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2015年09月06日 22:45:38 | eryksun | set | recipients:
+ eryksun, lemburg, georg.brandl, paul.moore, belopolsky, vstinner, larry, tim.golden, BreamoreBoy, python-dev, zach.ware, steve.dower, JohnLeitch, brycedarling |
| 2015年09月06日 22:45:38 | eryksun | set | messageid: <1441579538.48.0.455263715426.issue24917@psf.upfronthosting.co.za> |
| 2015年09月06日 22:45:38 | eryksun | link | issue24917 messages |
| 2015年09月06日 22:45:38 | eryksun | create |
|