Przeglądaj źródła

LibC: Implement wctob

Tim Schumacher 3 lat temu
rodzic
commit
3336c382fb
1 zmienionych plików z 5 dodań i 3 usunięć
  1. 5 3
      Userland/Libraries/LibC/wchar.cpp

+ 5 - 3
Userland/Libraries/LibC/wchar.cpp

@@ -319,10 +319,12 @@ int wcscoll(const wchar_t* ws1, const wchar_t* ws2)
     return wcscmp(ws1, ws2);
 }
 
-int wctob(wint_t)
+int wctob(wint_t c)
 {
-    dbgln("FIXME: Implement wctob()");
-    TODO();
+    if (c > 0x7f)
+        return EOF;
+
+    return static_cast<unsigned char>(c);
 }
 
 int mbsinit(const mbstate_t* state)