@@ -2369,17 +2369,18 @@ static void datetime_to_text(const dsc* from, dsc* to, Callbacks* cb)
23692369
23702370 if (!from->isTime ())
23712371 {
2372- // yyyy-mm-dd OR dd-MMM-yyyy + nul-termination
2373- char dateStr[11 + 1 ];
2372+ string dateStr;
2373+ // yyyy-mm-dd OR dd-MMM-yyyy
2374+ dateStr.reserve (11 );
23742375 if (from->dsc_dtype == dtype_sql_date || !version4)
23752376 {
2376- snprintf ( dateStr, sizeof (dateStr), " %4.4d-%2.2d-%2.2d" ,
2377+ dateStr. printf ( " %4.4d-%2.2d-%2.2d" ,
23772378 times.tm_year + 1900 , times.tm_mon + 1 , times.tm_mday );
23782379 }
23792380 else
23802381 {
23812382 // Prior to BLR version 5 timestamps were converted to text in the dd-MMM-yyyy format
2382- snprintf ( dateStr, sizeof (dateStr), " %2.2d-%.3s-%4.4d" ,
2383+ dateStr. printf ( " %2.2d-%.3s-%4.4d" ,
23832384 times.tm_mday ,
23842385 FB_LONG_MONTHS_UPPER[times.tm_mon ], times.tm_year + 1900 );
23852386 }
@@ -2395,17 +2396,18 @@ static void datetime_to_text(const dsc* from, dsc* to, Callbacks* cb)
23952396
23962397 if (from->dsc_dtype != dtype_sql_date)
23972398 {
2398- // hh:mm:ss.tttt + nul-termination
2399- char timeStr[13 + 1 ];
2399+ string timeStr;
2400+ // hh:mm:ss.tttt
2401+ timeStr.reserve (13 );
24002402 if (from->isTime () || !version4)
24012403 {
2402- snprintf ( timeStr, sizeof (timeStr), " %2.2d:%2.2d:%2.2d.%4.4d" ,
2404+ timeStr. printf ( " %2.2d:%2.2d:%2.2d.%4.4d" ,
24032405 times.tm_hour , times.tm_min , times.tm_sec , fractions);
24042406 }
24052407 else if (times.tm_hour || times.tm_min || times.tm_sec || fractions)
24062408 {
24072409 // Timestamp formating prior to BLR Version 5 is slightly different
2408- snprintf ( timeStr, sizeof (timeStr), " %d:%.2d:%.2d.%.4d" ,
2410+ timeStr. printf ( " %d:%.2d:%.2d.%.4d" ,
24092411 times.tm_hour , times.tm_min , times.tm_sec , fractions);
24102412 }
24112413 temp.append (timeStr);
0 commit comments