From f542ab8e8ef5919fd9c2d4bbbf05ae0d7dc7e9d1 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Fri, 6 Nov 2015 11:19:45 -0800 Subject: file_util.h includes io.h, we don't need to do so ourselves. While we're at it, get rid of a commented-out include, and update a comment to give more information. Change-Id: I910a26a3d7f4a50f0559abe5f2ab97a93c80357f Reviewed-on: https://code.wireshark.org/review/11610 Petri-Dish: Guy Harris Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris --- wsutil/file_util.c | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) (limited to 'wsutil') diff --git a/wsutil/file_util.c b/wsutil/file_util.c index 50f4fff411..48570027b6 100644 --- a/wsutil/file_util.c +++ b/wsutil/file_util.c @@ -20,13 +20,40 @@ * */ -/* file wrapper functions to prevent the file functions from GLib like g_open(), - * as code compiled with MSVC 7 and above will collide with libs linked with msvcrt.dll (MSVC 6), lib GLib is +/* + * File wrapper functions to replace the file functions from GLib like + * g_open(). + * + * With MSVC, code using the C support library from one version of MSVC + * cannot use file descriptors or FILE *'s returned from code using + * the C support library from another version of MSVC. + * + * We therefore provide our own versions of the routines to open files, + * so that they're built to use the same C support library as our code + * that reads them. + * + * (If both were built to use the Universal CRT: + * + * http://blogs.msdn.com/b/vcblog/archive/2015/03/03/introducing-the-universal-crt.aspx * - * DO NOT USE THESE FUNCTIONS DIRECTLY, USE ws_open() AND ALIKE FUNCTIONS FROM file_util.h INSTEAD!!! + * this would not be a problem.) * - * the following code is stripped down code copied from the GLib file glib/gstdio.h - * stripped down, because this is used on _WIN32 only and we use only wide char functions */ + * DO NOT USE THESE FUNCTIONS DIRECTLY, USE ws_open() AND ALIKE FUNCTIONS + * FROM file_util.h INSTEAD!!! + * + * The following code is stripped down code copied from the GLib file + * glib/gstdio.h - stripped down because this is used only on Windows + * and we use only wide char functions. + * + * In addition, we have our own ws_stdio_stat64(), which uses + * _wstati64(), so that we can get file sizes for files > 4 GB in size. + * + * XXX - is there any reason why we supply our own versions of routines + * that *don't* return file descriptors, other than ws_stdio_stat64()? + * Is there an issue with UTF-16 support in _wmkdir() with some versions + * of the C runtime, so that if GLib is built to use that version, it + * won't handle UTF-16 paths? + */ #ifndef _WIN32 #error "This is only for Windows" @@ -40,8 +67,6 @@ #include #include #include -/*#include */ -#include #include #include "file_util.h" -- cgit v1.2.3