summaryrefslogtreecommitdiff
path: root/wsutil/file_util.h
AgeCommit message (Collapse)AuthorFilesLines
2016-12-20Qt+Win32: Make software updates more friendly.Gerald Combs1-0/+4
Add WinSparkle can_shutdown and shutdown_request callbacks which are called prior to running the installer. Reject updates when we have unsaved information. Add notes about possible improvements. Ping-Bug: 9687 Ping-Bug: 12989 Change-Id: Ia126244b311417aa3105ea8136f186adc2745445 Reviewed-on: https://code.wireshark.org/review/19244 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-13Use getc_unlocked in a few places.Gerald Combs1-0/+2
Use getc_unlocked or _fgetc_nolock instead of getc in a few places. This reduces startup time by about 100ms here. Change-Id: I59ceb09678457c871cce79fcc3ce71998fe4f5af Reviewed-on: https://code.wireshark.org/review/14518 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-04-13Windows: Remove the need for _CRT_NONSTDC_NO_DEPRECATE.Gerald Combs1-0/+15
Replace some function calls with their non-deprecated equivalents so that we can remove _CRT_NONSTDC_NO_DEPRECATE from CMakeLists.txt and config.nmake. Leave _CRT_SECURE_NO_DEPRECATE in place. Removing it failed with 145 warnings and 72 errors. Note that we could probably improve startup performance by using wmem in diam_dict.*. Change-Id: I6e130003de838aebedbdd1aa78c50de8a339ddcb Reviewed-on: https://code.wireshark.org/review/14883 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-04-03wsutil: Remove getenv_utf8(), replaced with g_getenv()João Valverde1-5/+0
Replace getenv() calls in filesystem.c too for consistency. Change-Id: I31425179290e556e6696953531989d93777adf92 Reviewed-on: https://code.wireshark.org/review/14752 Petri-Dish: João Valverde <j@v6e.pt> Reviewed-by: João Valverde <j@v6e.pt> Tested-by: João Valverde <j@v6e.pt> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-03-30ws_load_library() is called with constant char reflect that.MSVC15 build.AndersBroman1-1/+1
Change-Id: I7d103c7316ee372b5cdb3aa9033a62eb75cd38b2 Reviewed-on: https://code.wireshark.org/review/14702 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-11-08Use ws_{read,write,fdopen,close}.Guy Harris1-0/+7
Be more consistent about using the ws_ routines, as we suggest in README.developer. In C++ on UN*X, define ws_close as ::close rather than close, so that it works even in classes with methods or members named "close". Change-Id: Ide2652229e6b6b4624cbddae0e909a4ea1efa591 Reviewed-on: https://code.wireshark.org/review/11637 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-07Clean up includes of unistd.h, fcntl.h, and sys/stat.h.Guy Harris1-7/+13
Have wsutil/file_util.h include them on UN*X, just as it includes io.h on Windows, so we can have a rule of "if you do file operations, include <wsutil/file_util.h> and use the routines in it". Remove includes of unistd.h, fcntl.h, and sys/stat.h that aren't necessary (whether because of the addition of them to wsutil/file_util.h or because they weren't needed in the first place). Change-Id: Ie241dd74deff284e39a5f690a297dbb6e1dc485f Reviewed-on: https://code.wireshark.org/review/11619 Petri-Dish: Guy Harris <guy@alum.mit.edu> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-06-30Use ws_fstat64() to determine the size of an open file.Guy Harris1-0/+18
fseek() to the end, followed by ftell(), is a bit of an odd way to get the file size. Use ws_fstat64() instead. Check that the file is a regular file, while we're at it. This means we don't have to check before opening. Bug: 11268 Change-Id: I31ee20dd5568d10541375cf97b286abfc1384d1c Reviewed-on: https://code.wireshark.org/review/9230 Petri-Dish: Guy Harris <guy@alum.mit.edu> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(Using sed : sed -i '/^ \* \$Id\$/,+1 d') Fix manually some typo (in export_object_dicom.c and crc16-plain.c) Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8 Reviewed-on: https://code.wireshark.org/review/497 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2013-03-01Export libwireshark symbols using WS_DLL_PUBLIC defineBalint Reczey1-20/+10
Also remove old WS_VAR_IMPORT define and related Makefile magic everywhere in the project. svn path=/trunk/; revision=47992
2013-02-28Export libwsutil symbols using WS_DLL_PUBLIC defineBalint Reczey1-0/+15
This change replaces *.def and *.sym file usage following the guideline at http://gcc.gnu.org/wiki/Visibility svn path=/trunk/; revision=47938
2013-02-20When any of our executables start on Windows create or open a "WiresharkGerald Combs1-0/+7
is running" mutex. Have the NSIS installer check for this mutex and ask the user to close Wireshark if it's found. While not perfect this makes the WinSparkle update process much less annoying. svn path=/trunk/; revision=47758
2012-12-20fclose() and fflush() are standard C routines, so there's no need forGuy Harris1-4/+0
our own wrappers. (pcapio.c isn't using wrappers around, for example, fwrite().) svn path=/trunk/; revision=46640
2012-12-20Add ws_fclose(), ws_fflush(), and ws_fdopen() to the fileutils.Michael Tüxen1-0/+6
Retire libpcap_fdopen(), libpcap_dump_flush(), and libpcap_dump_close(). svn path=/trunk/; revision=46636
2012-06-28Update Free Software Foundation address.Jakub Zawadzki1-1/+1
(COPYING will be updated in next commit) svn path=/trunk/; revision=43536
2012-05-22Update comments to reflect that the GLib version is no longer relevantGuy Harris1-6/+16
(we require GLib 2.14 or later, and always use UTF-8 for pathnames on Windows), to note that ws_stdio_rename() should have UN*X-style rename semantics in that it removes the target if necessary, and to give more details in other ways. Clean up indetation a bit. svn path=/trunk/; revision=42775
2011-07-11More GLIB_CHECK_VERSION cleanups. Update the minimum GLib/GTK+ versionsGerald Combs1-16/+0
in README.devloper. Remove g_gnuc.h since it's no longer needed. Remove tvbuff_init(), tvbuff_cleanup(), reassemble_init(), and reassemble_cleanup() since they were only used for older GLib versions which didn't support GSlices. Assume we always support the "matches" operator. svn path=/trunk/; revision=37978
2011-04-10We have to define ws_statb64 before declaring routines that use it.Guy Harris1-33/+40
svn path=/trunk/; revision=36550
2011-04-10To fill in a ws_statb64, you must use ws_fstat64.Guy Harris1-1/+1
Declare ws_stdio_stat64, as that's its new name. svn path=/trunk/; revision=36549
2011-04-10Rename ws_stat to ws_stat64, and make it take a pointer to a ws_statb64Guy Harris1-8/+10
as an argument, along the lines of ws_fstat64, and, on Windows, make it use _wstati64, to handle 64-bit file sizes. svn path=/trunk/; revision=36547
2011-04-10Define ws_statb64 as struct stat *within* the "not Windows" block.Guy Harris1-1/+1
svn path=/trunk/; revision=36546
2011-04-10Define ws_statb64 to be the appropriate "struct XXX" for aGuy Harris1-0/+10
64-bit-file-size-capable stat call, and use it for ws_fstat64(). svn path=/trunk/; revision=36545
2011-04-10Add ws_fstat64(), defined to be fstat on UN*X and _fstati64 on Windows.Guy Harris1-1/+3
Use it in some places where we're getting the file size. svn path=/trunk/; revision=36544
2011-04-10Use AC_SYS_LARGEFILE to turn on large file support on platforms thatGuy Harris1-10/+10
support it. Rename ws_lseek to ws_lseek64, as it should be given a 64-bit offset, and have it use _lseeki64 on Windows, to try to get 64-bit offset support; AC_SYS_LARGEFILE should cause lseek() to support 64-bit offsets on UN*X if possible. svn path=/trunk/; revision=36542
2010-12-07Move getenv_utf8() to wsutil.Jeff Morriss1-0/+6
svn path=/trunk/; revision=35148
2010-08-27Forward-port r33953.Gerald Combs1-0/+7
Move the SetDllDirectory calls to ws_init_dll_search_path. If SetDllDirectory fails, pass the Wireshark program path to SetCurrentDirectory. svn path=/trunk/; revision=33958
2010-08-25Move Windows-specific material inside an appropriate #ifdef.Gerald Combs1-17/+17
svn path=/trunk/; revision=33925
2010-08-25Add ws_load_library and ws_module_open, which respectively callGerald Combs1-0/+20
LoadLibrary and g_module_open only for the program directory and system directory on Windows. Use them to replace a bunch of LoadLibrary and g_module_open calls. Use the extension ".dll" for all the DLLs that we load. Add comments about DLL loading in Python. svn path=/trunk/; revision=33924
2009-03-06Update a commentBill Meier1-3/+3
svn path=/trunk/; revision=27626
2008-10-27ETH -> WS updates.Gerald Combs1-2/+2
svn path=/trunk/; revision=26570
2008-05-22Move the file utility functions from wiretap to libwsutil so thatJeff Morriss1-0/+126
libwireshark (and the plugins using those functions) do not depend on wiretap on Windows. While doing that, rename the eth_* functions to ws_*. svn path=/trunk/; revision=25354