comparison src/strftime.c @ 5016:2ade80e8c640

enable more warnings and fix them -------------------- ChangeLog entries follow: -------------------- ChangeLog addition: 2010-02-08 Ben Wing <ben@xemacs.org> * configure: * configure.ac (TAB): Various warnings that used to be present had mistakenly gotten turned off. Turn them back on. lwlib/ChangeLog addition: 2010-02-08 Ben Wing <ben@xemacs.org> * xt-wrappers.h: * xt-wrappers.h (Xt_SET_VALUE): * xt-wrappers.h (Xt_GET_VALUE): Rename var to avoid shadowing problems. src/ChangeLog addition: 2010-02-08 Ben Wing <ben@xemacs.org> * alloc.c: Add prototypes for debugging functions. * alloc.c (compact_string_chars): Make static. * console-x.c (x_initially_selected_for_input): * console-x.h: * console-x.h (X_ERROR_OCCURRED): Delete x_has_keysym() prototype from console-x.c, move to console-x.h. * eval.c (multiple_value_call): Real bug: Fix shadowing local vars. * event-unixoid.c (read_event_from_tty_or_stream_desc): * event-unixoid.c (signal_fake_event): * lread.c (check_if_suppressed): * strftime.c (strftime): Fix stupid global shadowing warnings. * event-unixoid.c (signal_fake_event): * event-unixoid.c (drain_signal_event_pipe): Use Rawbyte, not char. * frame.h: Remove old prototype. * gc.c: * gc.c (show_gc_cursor_and_message): * gc.c (remove_gc_cursor_and_message): * gc.c (gc_prepare): * gc.c (gc_finish_mark): * gc.c (gc_finalize): * gc.c (gc_sweep): * gc.c (gc_finish): * gc.c (gc_suspend_mark_phase): * gc.c (gc_resume_mark_phase): * gc.c (gc_mark): * gc.c (gc_resume_mark): Make fns static. * glyphs-eimage.c (gif_decode_error_string): Fix non-prototype. * lisp.h: Hack around global shadowing warnings involving `index'. * intl-win32.c (wcsncpy): * number-gmp.c (bigfloat_to_string): * objects-msw.c (mswindows_font_spec_matches_charset_stage_2): * specifier.c (call_charset_predicate): * specifier.c (DEFINE_SPECIFIER_TAG_FROB): Declarations cannot follow statements in standard C. * search.c (search_buffer): Fix local shadowing warnings.
author Ben Wing <ben@xemacs.org>
date Mon, 08 Feb 2010 21:28:57 -0600
parents 0a63e5de7bdc
children 1537701f08a1
comparison
equal deleted inserted replaced
5015:d95c102a96d3 5016:2ade80e8c640
394 case 'V': 394 case 'V':
395 case 'g': 395 case 'g':
396 case 'G': 396 case 'G':
397 { 397 {
398 int year = tm->tm_year + 1900; 398 int year = tm->tm_year + 1900;
399 int days = iso_week_days (tm->tm_yday, tm->tm_wday); 399 int ndays = iso_week_days (tm->tm_yday, tm->tm_wday);
400 400
401 if (days < 0) 401 if (ndays < 0)
402 { 402 {
403 /* This ISO week belongs to the previous year. */ 403 /* This ISO week belongs to the previous year. */
404 year--; 404 year--;
405 days = 405 ndays =
406 iso_week_days (tm->tm_yday + (365 + __isleap (year)), 406 iso_week_days (tm->tm_yday + (365 + __isleap (year)),
407 tm->tm_wday); 407 tm->tm_wday);
408 } 408 }
409 else 409 else
410 { 410 {
413 tm->tm_wday); 413 tm->tm_wday);
414 if (0 <= d) 414 if (0 <= d)
415 { 415 {
416 /* This ISO week belongs to the next year. */ 416 /* This ISO week belongs to the next year. */
417 year++; 417 year++;
418 days = d; 418 ndays = d;
419 } 419 }
420 } 420 }
421 421
422 switch (*format) 422 switch (*format)
423 { 423 {
440 max - length, zero); 440 max - length, zero);
441 break; 441 break;
442 442
443 default: 443 default:
444 length += 444 length +=
445 add_num2 (&string[length], days / 7 + 1, 445 add_num2 (&string[length], ndays / 7 + 1,
446 max - length, pad); 446 max - length, pad);
447 break; 447 break;
448 } 448 }
449 } 449 }
450 break; 450 break;
472 assert( utc != (time_t) -1 && ut != NULL ); 472 assert( utc != (time_t) -1 && ut != NULL );
473 473
474 /* tm diff code below is based on mktime.c, glibc 2.3.2 */ 474 /* tm diff code below is based on mktime.c, glibc 2.3.2 */
475 { 475 {
476 int lt4, ut4, lt100, ut100, lt400, ut400; 476 int lt4, ut4, lt100, ut100, lt400, ut400;
477 int intervening_leap_days, years, days; 477 int intervening_leap_days, years, ndays;
478 478
479 lt4 = (lt.tm_year >> 2) + (1900 >> 2) - 479 lt4 = (lt.tm_year >> 2) + (1900 >> 2) -
480 ! (lt.tm_year & 3); 480 ! (lt.tm_year & 3);
481 ut4 = (ut->tm_year >> 2) + (1900 >> 2) - 481 ut4 = (ut->tm_year >> 2) + (1900 >> 2) -
482 ! (ut->tm_year & 3); 482 ! (ut->tm_year & 3);
485 lt400 = lt100 >> 2; 485 lt400 = lt100 >> 2;
486 ut400 = ut100 >> 2; 486 ut400 = ut100 >> 2;
487 intervening_leap_days = 487 intervening_leap_days =
488 (lt4 - ut4) - (lt100 - ut100) + (lt400 - ut400); 488 (lt4 - ut4) - (lt100 - ut100) + (lt400 - ut400);
489 years = lt.tm_year - ut->tm_year; 489 years = lt.tm_year - ut->tm_year;
490 days = (365 * years + intervening_leap_days 490 ndays = (365 * years + intervening_leap_days
491 + (lt.tm_yday - ut->tm_yday)); 491 + (lt.tm_yday - ut->tm_yday));
492 offset = (60 * (60 * (24 * days + (lt.tm_hour - ut->tm_hour)) 492 offset = (60 * (60 * (24 * ndays
493 + (lt.tm_hour - ut->tm_hour))
493 + (lt.tm_min - ut->tm_min)) 494 + (lt.tm_min - ut->tm_min))
494 + (lt.tm_sec - ut->tm_sec)); 495 + (lt.tm_sec - ut->tm_sec));
495 } 496 }
496 497
497 minutes = offset / ( offset < 0 ? -60 : 60 ); 498 minutes = offset / ( offset < 0 ? -60 : 60 );