Skip to content
Snippets Groups Projects
  1. May 22, 2014
    • Nadav Har'El's avatar
      locale: fix shifted ctype array · e1b3b6b4
      Nadav Har'El authored
      
      Fixes #314.
      
      In two's complement, the lowest signed 8-bit number is -128, not -127.
      By wrongly starting to generate the ctype array starting with -127 instead
      of -128, we got all the locale ctype questions shifted by one character;
      For example character 32 (' ') was not considered a space, but 31 was!
      
      We didn't see this bug because our C library isspace() and friends are
      currently implemented without using the locale framework (which is fine,
      as we only support the "C" locale anyway). However, this bug is
      apparent in C++, as explained in issue #314: std::isspace() returns the
      wrong answer, and C++ facilities which use this under the hood - such
      as reading from an istream which is supposed to stop at a space - also
      got broken.
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      e1b3b6b4
    • Nadav Har'El's avatar
      Don't abort() on unknown locale · 669f657f
      Nadav Har'El authored
      
      When an application attempts to use an unknown locale, don't abort but
      rather fail normally, as Linux does on an unknown locale.
      
      Theoretically, Posix specifies newlocale() can also fail with EINVAL if
      the category_mask is malformed. However, the only reasonable usage of this
      function we support is when base=NULL (or "C" locale) and locale is again
      "C", and then we just ignore the category_mask. If that is not the case,
      we can just complain with ENOENT (meaning we couldn't find the named
      locale).
      
      In any case, callers like std::locale() don't actually care why newlocale()
      failed, and anyway assume a failure means the localename wasn't recognized.
      
      Reviewed-by: default avatarRaphael S. Carvalho <raphaelsc@cloudius-systems.com>
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      669f657f
    • Nadav Har'El's avatar
      Reindent __newlocale() · 35a40cee
      Nadav Har'El authored
      
      The __newlocale() function in runtime.cc used a mixture of spaces and
      tabs. Reindent it, with no changes to actual content (that would come
      later).
      
      Reviewed-by: default avatarRaphael S. Carvalho <raphaelsc@cloudius-systems.com>
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      35a40cee
  2. May 21, 2014
  3. May 20, 2014
  4. May 19, 2014
  5. May 18, 2014
  6. May 16, 2014
Loading