get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/65646/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 65646,
    "url": "http://patches.dpdk.org/api/patches/65646/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200207031437.9124-3-pallavi.kadam@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20200207031437.9124-3-pallavi.kadam@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200207031437.9124-3-pallavi.kadam@intel.com",
    "date": "2020-02-07T03:14:30",
    "name": "[v8,2/9] eal: dirent.h implementation for windows",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "7a07421439bf4ddec036772817e29484d28ccd49",
    "submitter": {
        "id": 1177,
        "url": "http://patches.dpdk.org/api/people/1177/?format=api",
        "name": "Kadam, Pallavi",
        "email": "pallavi.kadam@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200207031437.9124-3-pallavi.kadam@intel.com/mbox/",
    "series": [
        {
            "id": 8457,
            "url": "http://patches.dpdk.org/api/series/8457/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8457",
            "date": "2020-02-07T03:14:28",
            "name": "Windows patchset with additional EAL functionalities",
            "version": 8,
            "mbox": "http://patches.dpdk.org/series/8457/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/65646/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/65646/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id D4ADFA0541;\n\tFri,  7 Feb 2020 04:16:19 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id C20F11C0C2;\n\tFri,  7 Feb 2020 04:16:03 +0100 (CET)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by dpdk.org (Postfix) with ESMTP id F3AD41C07B\n for <dev@dpdk.org>; Fri,  7 Feb 2020 04:15:55 +0100 (CET)",
            "from orsmga005.jf.intel.com ([10.7.209.41])\n by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n 06 Feb 2020 19:15:53 -0800",
            "from win-dpdk-pallavi.jf.intel.com (HELO localhost.localdomain)\n ([10.166.188.75])\n by orsmga005.jf.intel.com with ESMTP; 06 Feb 2020 19:15:52 -0800"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.70,411,1574150400\"; d=\"scan'208\";a=\"404692992\"",
        "From": "Pallavi Kadam <pallavi.kadam@intel.com>",
        "To": "dev@dpdk.org,\n\tthomas@monjalon.net",
        "Cc": "Harini.Ramakrishnan@microsoft.com, keith.wiles@intel.com,\n bruce.richardson@intel.com, david.marchand@redhat.com,\n jerinjacobk@gmail.com, ranjit.menon@intel.com,\n antara.ganesh.kolar@intel.com, pallavi.kadam@intel.com",
        "Date": "Thu,  6 Feb 2020 19:14:30 -0800",
        "Message-Id": "<20200207031437.9124-3-pallavi.kadam@intel.com>",
        "X-Mailer": "git-send-email 2.18.0.windows.1",
        "In-Reply-To": "<20200207031437.9124-1-pallavi.kadam@intel.com>",
        "References": "<20200201000406.11060-1-pallavi.kadam@intel.com>\n <20200207031437.9124-1-pallavi.kadam@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v8 2/9] eal: dirent.h implementation for windows",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Adding dirent.h on Windows to support common code.\neal_common_options.c includes this file.\n\nThe original contribution is under MIT license.\nhttps://github.com/tronkko/dirent\n\nSigned-off-by: Antara Ganesh Kolar <antara.ganesh.kolar@intel.com>\nSigned-off-by: Pallavi Kadam <pallavi.kadam@intel.com>\nReviewed-by: Ranjit Menon <ranjit.menon@intel.com>\nReviewed-by: Keith Wiles <keith.wiles@intel.com>\n---\n lib/librte_eal/windows/eal/include/dirent.h | 664 ++++++++++++++++++++\n 1 file changed, 664 insertions(+)\n create mode 100644 lib/librte_eal/windows/eal/include/dirent.h",
    "diff": "diff --git a/lib/librte_eal/windows/eal/include/dirent.h b/lib/librte_eal/windows/eal/include/dirent.h\nnew file mode 100644\nindex 000000000..3a5750788\n--- /dev/null\n+++ b/lib/librte_eal/windows/eal/include/dirent.h\n@@ -0,0 +1,664 @@\n+/* SPDX-License-Identifier: MIT\n+ * Dirent interface for Microsoft Visual Studio\n+ * Version 1.21\n+ * Copyright (C) 2006-2012 Toni Ronkko\n+ * https://github.com/tronkko/dirent\n+ */\n+\n+#ifndef DIRENT_H\n+#define DIRENT_H\n+\n+/*\n+ * Include windows.h without Windows Sockets 1.1 to prevent conflicts with\n+ * Windows Sockets 2.0.\n+ */\n+#ifndef WIN32_LEAN_AND_MEAN\n+#   define WIN32_LEAN_AND_MEAN\n+#endif\n+\n+#include <windows.h>\n+\n+#include <stdio.h>\n+#include <stdarg.h>\n+#include <wchar.h>\n+#include <string.h>\n+#include <stdlib.h>\n+#include <malloc.h>\n+#include <sys/types.h>\n+#include <sys/stat.h>\n+#include <errno.h>\n+\n+/* Maximum length of file name */\n+#if !defined(PATH_MAX)\n+#   define PATH_MAX MAX_PATH\n+#endif\n+\n+/* File type flags for d_type */\n+#define DT_UNKNOWN 0\n+#define DT_REG S_IFREG\n+#define DT_DIR S_IFDIR\n+#define DT_CHR S_IFCHR\n+\n+/*\n+ * File type macros.  Note that block devices, sockets and links cannot be\n+ * distinguished on Windows and the macros S_ISBLK, S_ISSOCK and S_ISLNK are\n+ * only defined for compatibility.  These macros should always return false\n+ * on Windows.\n+ */\n+#if !defined(S_ISDIR)\n+#   define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)\n+#endif\n+#if !defined(S_ISREG)\n+#   define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)\n+#endif\n+\n+/* Wide-character version */\n+struct _wdirent {\n+\t/* Always zero */\n+\tlong d_ino;\n+\n+\t/* Structure size */\n+\tunsigned short d_reclen;\n+\n+\t/* Length of name without \\0 */\n+\tsize_t d_namlen;\n+\n+\t/* File type */\n+\tint d_type;\n+\n+\t/* File name */\n+\twchar_t d_name[PATH_MAX];\n+};\n+typedef struct _wdirent _wdirent;\n+\n+struct _WDIR {\n+\t/* Current directory entry */\n+\tstruct _wdirent ent;\n+\n+\t/* Private file data */\n+\tWIN32_FIND_DATAW data;\n+\n+\t/* True if data is valid */\n+\tint cached;\n+\n+\t/* Win32 search handle */\n+\tHANDLE handle;\n+\n+\t/* Initial directory name */\n+\twchar_t *patt;\n+};\n+typedef struct _WDIR _WDIR;\n+\n+static _WDIR *_wopendir(const wchar_t *dirname);\n+static int _wclosedir(_WDIR *dirp);\n+\n+/* For compatibility with Symbian */\n+#define wdirent _wdirent\n+#define WDIR _WDIR\n+#define wopendir _wopendir\n+#define wclosedir _wclosedir\n+\n+/* Multi-byte character versions */\n+struct dirent {\n+\t/* Always zero */\n+\tlong d_ino;\n+\n+\t/* Structure size */\n+\tunsigned short d_reclen;\n+\n+\t/* Length of name without \\0 */\n+\tsize_t d_namlen;\n+\n+\t/* File type */\n+\tint d_type;\n+\n+\t/* File name */\n+\tchar d_name[PATH_MAX];\n+};\n+typedef struct dirent dirent;\n+\n+struct DIR {\n+\tstruct dirent ent;\n+\tstruct _WDIR *wdirp;\n+};\n+typedef struct DIR DIR;\n+\n+static DIR *opendir(const char *dirname);\n+static struct dirent *readdir(DIR *dirp);\n+static int closedir(DIR *dirp);\n+\n+/* Internal utility functions */\n+static WIN32_FIND_DATAW *dirent_first(_WDIR *dirp);\n+static WIN32_FIND_DATAW *dirent_next(_WDIR *dirp);\n+\n+static int dirent_mbstowcs_s(\n+\tsize_t *pReturnValue,\n+\twchar_t *wcstr,\n+\tsize_t sizeInWords,\n+\tconst char *mbstr,\n+\tsize_t count);\n+\n+static int dirent_wcstombs_s(\n+\tsize_t *pReturnValue,\n+\tchar *mbstr,\n+\tsize_t sizeInBytes,\n+\tconst wchar_t *wcstr,\n+\tsize_t count);\n+\n+static void dirent_set_errno(int error);\n+\n+/*\n+ * Open directory stream DIRNAME for read and return a pointer to the\n+ * internal working area that is used to retrieve individual directory\n+ * entries.\n+ */\n+static _WDIR*\n+_wopendir(const wchar_t *dirname)\n+{\n+\t_WDIR *dirp = NULL;\n+\tint error;\n+\n+\t/* Must have directory name */\n+\tif (dirname == NULL || dirname[0] == '\\0') {\n+\t\tdirent_set_errno(ENOENT);\n+\t\treturn NULL;\n+\t}\n+\n+\t/* Allocate new _WDIR structure */\n+\tdirp = (_WDIR *)malloc(sizeof(struct _WDIR));\n+\tif (dirp != NULL) {\n+\t\tDWORD n;\n+\n+\t\t/* Reset _WDIR structure */\n+\t\tdirp->handle = INVALID_HANDLE_VALUE;\n+\t\tdirp->patt = NULL;\n+\t\tdirp->cached = 0;\n+\n+\t\t/* Compute the length of full path plus zero terminator\n+\t\t *\n+\t\t * Note that on WinRT there's no way to convert relative paths\n+\t\t * into absolute paths, so just assume its an absolute path.\n+\t\t */\n+\t#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)\n+\t\tn = wcslen(dirname);\n+\t#else\n+\t\tn = GetFullPathNameW(dirname, 0, NULL, NULL);\n+\t#endif\n+\n+\t\t/* Allocate room for absolute directory name and search\n+\t\t * pattern\n+\t\t */\n+\t\tdirp->patt = (wchar_t *)malloc(sizeof(wchar_t) * n + 16);\n+\t\tif (dirp->patt) {\n+\t\t\t/* Convert relative directory name to an\n+\t\t\t * absolute one. This allows rewinddir() to\n+\t\t\t * function correctly even when  current working\n+\t\t\t * directory is changed between opendir()\n+\t\t\t * and rewinddir().\n+\t\t\t *\n+\t\t\t * Note that on WinRT there's no way to convert\n+\t\t\t * relative paths into absolute paths, so just\n+\t\t\t * assume its an absolute path.\n+\t\t\t */\n+\t\t\t#if defined(WINAPI_FAMILY) &&                   \\\n+\t\t\t\t(WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)\n+\t\t\twcsncpy_s(dirp->patt, n + 1, dirname, n);\n+\t\t\t#else\n+\t\t\tn = GetFullPathNameW(dirname, n, dirp->patt, NULL);\n+\t\t\t#endif\n+\t\t\tif (n > 0) {\n+\t\t\t\twchar_t *p;\n+\n+\t\t\t\t/* Append search pattern \\* to the directory\n+\t\t\t\t * name\n+\t\t\t\t */\n+\t\t\t\tp = dirp->patt + n;\n+\t\t\t\tif (dirp->patt < p) {\n+\t\t\t\t\tswitch (p[-1]) {\n+\t\t\t\t\tcase '\\\\':\n+\t\t\t\t\tcase '/':\n+\t\t\t\t\tcase ':':\n+\t\t\t\t\t/* Directory ends in path separator,\n+\t\t\t\t\t * e.g.c:\\temp\\\n+\t\t\t\t\t */\n+\t\t\t\t\t\t/*NOP*/;\n+\t\t\t\t\t\tbreak;\n+\n+\t\t\t\t\tdefault:\n+\t\t\t\t\t/* Directory name doesn't end in path\n+\t\t\t\t\t * separator\n+\t\t\t\t\t */\n+\t\t\t\t\t\t*p++ = '\\\\';\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t\t*p++ = '*';\n+\t\t\t\t*p = '\\0';\n+\n+\t\t\t\t/* Open directory stream and retrieve the first\n+\t\t\t\t * entry\n+\t\t\t\t */\n+\t\t\t\tif (dirent_first(dirp)) {\n+\t\t\t\t/* Directory stream opened successfully */\n+\t\t\t\t\terror = 0;\n+\t\t\t\t} else {\n+\t\t\t\t\t/* Cannot retrieve first entry */\n+\t\t\t\t\terror = 1;\n+\t\t\t\t\tdirent_set_errno(ENOENT);\n+\t\t\t\t}\n+\n+\t\t\t} else {\n+\t\t\t\t/* Cannot retrieve full path name */\n+\t\t\t\tdirent_set_errno(ENOENT);\n+\t\t\t\terror = 1;\n+\t\t\t}\n+\n+\t\t} else {\n+\t\t\t/* Cannot allocate memory for search pattern */\n+\t\t\terror = 1;\n+\t\t}\n+\n+\t} else {\n+\t\t/* Cannot allocate _WDIR structure */\n+\t\terror = 1;\n+\t}\n+\n+\t/* Clean up in case of error */\n+\tif (error  &&  dirp) {\n+\t\t_wclosedir(dirp);\n+\t\tdirp = NULL;\n+\t}\n+\n+\treturn dirp;\n+}\n+\n+/*\n+ * Close directory stream opened by opendir() function.\n+ * This invalidates the DIR structure as well as any directory\n+ * entry read previously by _wreaddir().\n+ */\n+static int\n+_wclosedir(_WDIR *dirp)\n+{\n+\tint ok;\n+\tif (dirp) {\n+\n+\t\t/* Release search handle */\n+\t\tif (dirp->handle != INVALID_HANDLE_VALUE) {\n+\t\t\tFindClose(dirp->handle);\n+\t\t\tdirp->handle = INVALID_HANDLE_VALUE;\n+\t\t}\n+\n+\t\t/* Release search pattern */\n+\t\tif (dirp->patt) {\n+\t\t\tfree(dirp->patt);\n+\t\t\tdirp->patt = NULL;\n+\t\t}\n+\n+\t\t/* Release directory structure */\n+\t\tfree(dirp);\n+\t\tok = /*success*/0;\n+\n+\t} else {\n+\t\t/* Invalid directory stream */\n+\t\tdirent_set_errno(EBADF);\n+\t\tok = /*failure*/-1;\n+\t}\n+\treturn ok;\n+}\n+\n+/* Get first directory entry (internal) */\n+static WIN32_FIND_DATAW*\n+dirent_first(_WDIR *dirp)\n+{\n+\tWIN32_FIND_DATAW *datap;\n+\n+\t/* Open directory and retrieve the first entry */\n+\tdirp->handle = FindFirstFileExW(\n+\t\tdirp->patt, FindExInfoStandard, &dirp->data,\n+\t\tFindExSearchNameMatch, NULL, 0);\n+\tif (dirp->handle != INVALID_HANDLE_VALUE) {\n+\n+\t\t/* a directory entry is now waiting in memory */\n+\t\tdatap = &dirp->data;\n+\t\tdirp->cached = 1;\n+\n+\t} else {\n+\n+\t\t/* Failed to re-open directory: no directory entry in memory */\n+\t\tdirp->cached = 0;\n+\t\tdatap = NULL;\n+\n+\t}\n+\treturn datap;\n+}\n+\n+/* Get next directory entry (internal) */\n+static WIN32_FIND_DATAW*\n+dirent_next(_WDIR *dirp)\n+{\n+\tWIN32_FIND_DATAW *p;\n+\n+\t/* Get next directory entry */\n+\tif (dirp->cached != 0) {\n+\n+\t\t/* A valid directory entry already in memory */\n+\t\tp = &dirp->data;\n+\t\tdirp->cached = 0;\n+\n+\t} else if (dirp->handle != INVALID_HANDLE_VALUE) {\n+\n+\t\t/* Get the next directory entry from stream */\n+\t\tif (FindNextFileW(dirp->handle, &dirp->data) != FALSE) {\n+\t\t\t/* Got a file */\n+\t\t\tp = &dirp->data;\n+\t\t} else {\n+\t\t\t/* The very last entry has been processed\n+\t\t\t *or an error occurred\n+\t\t\t */\n+\t\t\tFindClose(dirp->handle);\n+\t\t\tdirp->handle = INVALID_HANDLE_VALUE;\n+\t\t\tp = NULL;\n+\t\t}\n+\n+\t} else {\n+\n+\t\t/* End of directory stream reached */\n+\t\tp = NULL;\n+\n+\t}\n+\n+\treturn p;\n+}\n+\n+/*\n+ * Open directory stream using plain old C-string.\n+ */\n+static DIR*\n+opendir(const char *dirname)\n+{\n+\tstruct DIR *dirp;\n+\tint error;\n+\n+\t/* Must have directory name */\n+\tif (dirname == NULL || dirname[0] == '\\0') {\n+\t\tdirent_set_errno(ENOENT);\n+\t\treturn NULL;\n+\t}\n+\n+\t/* Allocate memory for DIR structure */\n+\tdirp = (DIR *)malloc(sizeof(struct DIR));\n+\tif (dirp) {\n+\t\twchar_t wname[PATH_MAX];\n+\t\tsize_t n;\n+\n+\t\t/* Convert directory name to wide-character string */\n+\t\terror = dirent_mbstowcs_s(&n, wname, PATH_MAX,\n+\t\t\tdirname, PATH_MAX);\n+\t\tif (!error) {\n+\n+\t\t\t/* Open directory stream using wide-character name */\n+\t\t\tdirp->wdirp = _wopendir(wname);\n+\t\t\tif (dirp->wdirp) {\n+\t\t\t\t/* Directory stream opened */\n+\t\t\t\terror = 0;\n+\t\t\t} else {\n+\t\t\t\t/* Failed to open directory stream */\n+\t\t\t\terror = 1;\n+\t\t\t}\n+\n+\t\t} else {\n+\t\t\t/*\n+\t\t\t * Cannot convert file name to wide-character string.\n+\t\t\t * This occurs if the string contains invalid multi-byte\n+\t\t\t * sequences or the output buffer is too small to\n+\t\t\t * contain the resulting string.\n+\t\t\t */\n+\t\t\terror = 1;\n+\t\t}\n+\n+\t} else {\n+\t\t/* Cannot allocate DIR structure */\n+\t\terror = 1;\n+\t}\n+\n+\t/* Clean up in case of error */\n+\tif (error  &&  dirp) {\n+\t\tfree(dirp);\n+\t\tdirp = NULL;\n+\t}\n+\n+\treturn dirp;\n+}\n+\n+/*\n+ * Read next directory entry.\n+ *\n+ * When working with text consoles, please note that file names\n+ * returned by readdir() are represented in the default ANSI code\n+ * page while any output toconsole is typically formatted on another\n+ * code page. Thus, non-ASCII characters in file names will not usually\n+ * display correctly on console. The problem can be fixed in two ways:\n+ * (1) change the character set of console to 1252 using chcp utility\n+ * and use Lucida Console font, or (2) use _cprintf function when\n+ * writing to console. The _cprinf() will re-encode ANSI strings to the\n+ * console code page so many non-ASCII characters will display correcly.\n+ */\n+static struct dirent*\n+readdir(DIR *dirp)\n+{\n+\tWIN32_FIND_DATAW *datap;\n+\tstruct dirent *entp;\n+\n+\t/* Read next directory entry */\n+\tdatap = dirent_next(dirp->wdirp);\n+\tif (datap) {\n+\t\tsize_t n;\n+\t\tint error;\n+\n+\t\t/* Attempt to convert file name to multi-byte string */\n+\t\terror = dirent_wcstombs_s(&n, dirp->ent.d_name,\n+\t\t\tPATH_MAX, datap->cFileName, PATH_MAX);\n+\n+\t\t/*\n+\t\t * If the file name cannot be represented by a multi-byte\n+\t\t * string, then attempt to use old 8+3 file name.\n+\t\t * This allows traditional Unix-code to access some file\n+\t\t * names despite of unicode characters, although file names\n+\t\t * may seem unfamiliar to the user.\n+\t\t *\n+\t\t * Be ware that the code below cannot come up with a short\n+\t\t * file name unless the file system provides one.  At least\n+\t\t * VirtualBox shared folders fail to do this.\n+\t\t */\n+\t\tif (error  &&  datap->cAlternateFileName[0] != '\\0') {\n+\t\t\terror = dirent_wcstombs_s(\n+\t\t\t\t&n, dirp->ent.d_name, PATH_MAX,\n+\t\t\t\tdatap->cAlternateFileName, PATH_MAX);\n+\t\t}\n+\n+\t\tif (!error) {\n+\t\t\tDWORD attr;\n+\n+\t\t\t/* Initialize directory entry for return */\n+\t\t\tentp = &dirp->ent;\n+\n+\t\t\t/* Length of file name excluding zero terminator */\n+\t\t\tentp->d_namlen = n - 1;\n+\n+\t\t\t/* File attributes */\n+\t\t\tattr = datap->dwFileAttributes;\n+\t\t\tif ((attr & FILE_ATTRIBUTE_DEVICE) != 0)\n+\t\t\t\tentp->d_type = DT_CHR;\n+\t\t\telse if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0)\n+\t\t\t\tentp->d_type = DT_DIR;\n+\t\t\telse\n+\t\t\t\tentp->d_type = DT_REG;\n+\n+\t\t\t/* Reset dummy fields */\n+\t\t\tentp->d_ino = 0;\n+\t\t\tentp->d_reclen = sizeof(struct dirent);\n+\n+\t\t} else {\n+\t\t\t/*\n+\t\t\t * Cannot convert file name to multi-byte string so\n+\t\t\t * construct an errornous directory entry and return\n+\t\t\t * that. Note that we cannot return NULL as that would\n+\t\t\t * stop the processing of directory entries completely.\n+\t\t\t */\n+\t\t\tentp = &dirp->ent;\n+\t\t\tentp->d_name[0] = '?';\n+\t\t\tentp->d_name[1] = '\\0';\n+\t\t\tentp->d_namlen = 1;\n+\t\t\tentp->d_type = DT_UNKNOWN;\n+\t\t\tentp->d_ino = 0;\n+\t\t\tentp->d_reclen = 0;\n+\t\t}\n+\n+\t} else {\n+\t\t/* No more directory entries */\n+\t\tentp = NULL;\n+\t}\n+\n+\treturn entp;\n+}\n+\n+/*\n+ * Close directory stream.\n+ */\n+static int\n+closedir(DIR *dirp)\n+{\n+\tint ok;\n+\tif (dirp) {\n+\n+\t\t/* Close wide-character directory stream */\n+\t\tok = _wclosedir(dirp->wdirp);\n+\t\tdirp->wdirp = NULL;\n+\n+\t\t/* Release multi-byte character version */\n+\t\tfree(dirp);\n+\n+\t} else {\n+\n+\t\t/* Invalid directory stream */\n+\t\tdirent_set_errno(EBADF);\n+\t\tok = /*failure*/-1;\n+\n+\t}\n+\treturn ok;\n+}\n+\n+/* Convert multi-byte string to wide character string */\n+static int\n+dirent_mbstowcs_s(\n+\tsize_t *pReturnValue,\n+\twchar_t *wcstr,\n+\tsize_t sizeInWords,\n+\tconst char *mbstr,\n+\tsize_t count)\n+{\n+\tint error;\n+\n+\t#if defined(_MSC_VER)  &&  _MSC_VER >= 1400\n+\t/* Microsoft Visual Studio 2005 or later */\n+\terror = mbstowcs_s(pReturnValue, wcstr,\n+\tsizeInWords, mbstr, count);\n+\t#else\n+\n+\t/* Older Visual Studio or non-Microsoft compiler */\n+\tsize_t n;\n+\n+\t/* Convert to wide-character string (or count characters) */\n+\tn = mbstowcs(wcstr, mbstr, sizeInWords);\n+\tif (!wcstr || n < count) {\n+\n+\t\t/* Zero-terminate output buffer */\n+\t\tif (wcstr  &&  sizeInWords) {\n+\t\t\tif (n >= sizeInWords)\n+\t\t\t\tn = sizeInWords - 1;\n+\t\t\twcstr[n] = 0;\n+\t\t}\n+\n+\t\t/* Length of resuting multi-byte string WITH zero\n+\t\t *terminator\n+\t\t */\n+\t\tif (pReturnValue)\n+\t\t\t*pReturnValue = n + 1;\n+\n+\t\t/* Success */\n+\t\terror = 0;\n+\n+\t} else {\n+\n+\t\t/* Could not convert string */\n+\t\terror = 1;\n+\n+\t}\n+\t#endif\n+\n+\treturn error;\n+}\n+\n+/* Convert wide-character string to multi-byte string */\n+static int\n+dirent_wcstombs_s(\n+\tsize_t *pReturnValue,\n+\tchar *mbstr,\n+\tsize_t sizeInBytes, /* max size of mbstr */\n+\tconst wchar_t *wcstr,\n+\tsize_t count)\n+{\n+\tint error;\n+\n+\t#if defined(_MSC_VER)  &&  _MSC_VER >= 1400\n+\t/* Microsoft Visual Studio 2005 or later */\n+\terror = wcstombs_s(pReturnValue, mbstr, sizeInBytes, wcstr, count);\n+\t#else\n+\t/* Older Visual Studio or non-Microsoft compiler */\n+\tsize_t n;\n+\n+\t/* Convert to multi-byte string\n+\t * (or count the number of bytes needed)\n+\t */\n+\tn = wcstombs(mbstr, wcstr, sizeInBytes);\n+\tif (!mbstr || n < count) {\n+\t\t/* Zero-terminate output buffer */\n+\t\tif (mbstr  &&  sizeInBytes) {\n+\t\t\tif (n >= sizeInBytes)\n+\t\t\t\tn = sizeInBytes - 1;\n+\t\t\tmbstr[n] = '\\0';\n+\t\t}\n+\t\t/* Length of resulting multi-bytes string WITH\n+\t\t *zero-terminator\n+\t\t */\n+\t\tif (pReturnValue)\n+\t\t\t*pReturnValue = n + 1;\n+\t\t/* Success */\n+\t\terror = 0;\n+\t} else {\n+\t\t/* Cannot convert string */\n+\t\terror = 1;\n+\t}\n+\t#endif\n+\n+\treturn error;\n+}\n+\n+/* Set errno variable */\n+static void\n+dirent_set_errno(int error)\n+{\n+#if defined(_MSC_VER)  &&  _MSC_VER >= 1400\n+\t/* Microsoft Visual Studio 2005 and later */\n+\t_set_errno(error);\n+#else\n+\n+\t/* Non-Microsoft compiler or older Microsoft compiler */\n+\terrno = error;\n+#endif\n+}\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+#endif /*DIRENT_H*/\n",
    "prefixes": [
        "v8",
        "2/9"
    ]
}