[bug #52011] Remove incorrect init from NSDateFormatter, and fix call to udat_open

David Lobron <[email protected]>
Newsgroups gmane.comp.lib.gnustep.bugs
Message-ID <[email protected]>
URL:
  <http://savannah.gnu.org/bugs/?52011>

                 Summary: Remove incorrect init from NSDateFormatter, and fix
call to udat_open
                 Project: GNUstep
            Submitted by: dlobron
            Submitted on: Wed 13 Sep 2017 04:54:48 PM UTC
                Category: Base/Foundation
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

In NSDateFormatter.m, the [NSDateFormatter init] method has code that is
called when GS_USE_ICU is enabled.  When run on GNU/Linux (Ubuntu
3.13.0-113-generic), I found that it causes NSDateFormatter to have an invalid
initial dateFormat.  On an Apple system, the initial dateFormat is nil, and
that seems correct for Linux also.  I propose removing this code, which is at
NSDateFormatter.m:113-148 in my source.

Also, the call to udat_open should pass UDAT_PATTERN for the first two
arguments, if the pattern argument is unused.  That is the usage described in
the doc, and I verified that this change fixes another bug I observed.  The
doc is here:

http://www.icu-project.org/apiref/icu4c/udat_8h.html#a4261e9fd5382197c3d86a00211c48079

I've attached a diff with both changes.  



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Wed 13 Sep 2017 04:54:48 PM UTC  Name: NSDateFormatter.m.patch  Size:
2KiB   By: dlobron
Suggested patch file, based on 1.24.9
<http://savannah.gnu.org/bugs/download.php?file_id=41796>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?52011>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.