OSDN Git Service

* dcrt0.cc (codepage_type): Remove definition.
authorcgf <cgf>
Thu, 2 Aug 2007 14:21:53 +0000 (14:21 +0000)
committercgf <cgf>
Thu, 2 Aug 2007 14:21:53 +0000 (14:21 +0000)
* strfuncs.cc: Move it here.  New file with bits of miscfuncs.cc.
* miscfuncs.cc: Remove wide character stuff.

winsup/cygwin/ChangeLog
winsup/cygwin/dcrt0.cc
winsup/cygwin/miscfuncs.cc
winsup/cygwin/strfuncs.cc [new file with mode: 0644]

index 713e528..9a7c639 100644 (file)
@@ -1,3 +1,9 @@
+2007-08-02  Christopher Faylor  <me+cygwin@cgf.cx>
+
+       * dcrt0.cc (codepage_type): Remove definition.
+       * strfuncs.cc: Move it here.  New file with bits of miscfuncs.cc.
+       * miscfuncs.cc: Remove wide character stuff.
+
 2007-08-02  Corinna Vinschen  <corinna@vinschen.de>
 
        * syscalls.cc (rename): Move and add text to comment about testing
index 9e02a6f..801b7fb 100644 (file)
@@ -55,7 +55,6 @@ bool display_title;
 bool strip_title_path;
 bool allow_glob = true;
 bool NO_COPY in_forkee;
-codepage_type current_codepage = ansi_cp;
 
 int __argc_safe;
 int _declspec(dllexport) __argc;
index 9bab138..bbbcd59 100644 (file)
@@ -15,8 +15,6 @@ details. */
 #include <sys/uio.h>
 #include <assert.h>
 #include <limits.h>
-#include <winbase.h>
-#include <winnls.h>
 #include "cygthread.h"
 #include "cygtls.h"
 
@@ -163,6 +161,7 @@ dummytest (volatile char *p)
 {
   return *p;
 }
+
 ssize_t
 check_iovec (const struct iovec *iov, int iovcnt, bool forwrite)
 {
@@ -203,35 +202,6 @@ check_iovec (const struct iovec *iov, int iovcnt, bool forwrite)
   return (ssize_t) tot;
 }
 
-UINT
-get_cp ()
-{
-  return current_codepage == ansi_cp ? GetACP() : GetOEMCP();
-}
-
-/* tlen is always treated as the maximum buffer size, including the '\0'
-   character.  sys_wcstombs will always return a 0-terminated result, no
-   matter what. */
-int __stdcall
-sys_wcstombs (char *tgt, int tlen, const WCHAR *src, int slen)
-{
-  int ret;
-
-  ret = WideCharToMultiByte (get_cp (), 0, src, slen, tgt, tlen, NULL, NULL);
-  if (ret)
-    tgt[ret < tlen ? ret : tlen - 1] = '\0';
-  return ret;
-}
-
-int __stdcall
-sys_mbstowcs (WCHAR *tgt, const char *src, int len)
-{
-  int res = MultiByteToWideChar (get_cp (), 0, src, -1, tgt, len);
-  if (!res)
-    debug_printf ("MultiByteToWideChar %E");
-  return res;
-}
-
 extern "C" int
 low_priority_sleep (DWORD secs)
 {
diff --git a/winsup/cygwin/strfuncs.cc b/winsup/cygwin/strfuncs.cc
new file mode 100644 (file)
index 0000000..c0029fb
--- /dev/null
@@ -0,0 +1,43 @@
+/* strfuncs.cc: misc funcs that don't belong anywhere else
+
+   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+   2005, 2006, 2007 Red Hat, Inc.
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#include "winsup.h"
+#include <winbase.h>
+#include <winnls.h>
+
+codepage_type current_codepage = ansi_cp;
+
+UINT
+get_cp ()
+{
+  return current_codepage == ansi_cp ? GetACP() : GetOEMCP();
+}
+
+/* tlen is always treated as the maximum buffer size, including the '\0'
+   character.  sys_wcstombs will always return a 0-terminated result, no
+   matter what. */
+int __stdcall
+sys_wcstombs (char *tgt, int tlen, const WCHAR *src, int slen)
+{
+  int ret;
+
+  ret = WideCharToMultiByte (get_cp (), 0, src, slen, tgt, tlen, NULL, NULL);
+  if (ret)
+    tgt[ret < tlen ? ret : tlen - 1] = '\0';
+  return ret;
+}
+
+int __stdcall
+sys_mbstowcs (WCHAR *tgt, const char *src, int len)
+{
+  int res = MultiByteToWideChar (get_cp (), 0, src, -1, tgt, len);
+  return res;
+}