瀏覽代碼

LibC: Implement wctob

Tim Schumacher 3 年之前
父節點
當前提交
3336c382fb
共有 1 個文件被更改,包括 5 次插入3 次删除
  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);
     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)
 int mbsinit(const mbstate_t* state)