From 7a8a03c20d71ede3896a6e3ed9820baae5b0ccf9 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Wed, 21 Dec 2016 15:08:44 +0100 Subject: [PATCH] util.h: restore BSD license for Facebook Open-Source --- programs/bench.c | 1 + programs/dibio.c | 1 + programs/fileio.c | 3 ++- programs/platform.h | 41 +++++++++++++++++++++++------------------ programs/util.h | 39 ++++++++++----------------------------- programs/zstdcli.c | 3 ++- 6 files changed, 39 insertions(+), 49 deletions(-) diff --git a/programs/bench.c b/programs/bench.c index 5d142529f..4089d6ba7 100644 --- a/programs/bench.c +++ b/programs/bench.c @@ -20,6 +20,7 @@ /* ************************************* * Includes ***************************************/ +#include "platform.h" /* Large Files support */ #include "util.h" /* UTIL_getFileSize, UTIL_sleep */ #include /* malloc, free */ #include /* memset */ diff --git a/programs/dibio.c b/programs/dibio.c index 743d3ef93..b95bab34e 100644 --- a/programs/dibio.c +++ b/programs/dibio.c @@ -20,6 +20,7 @@ /*-************************************* * Includes ***************************************/ +#include "platform.h" /* Large Files support */ #include "util.h" /* UTIL_getFileSize, UTIL_getTotalFileSize */ #include /* malloc, free */ #include /* memset */ diff --git a/programs/fileio.c b/programs/fileio.c index 8305fbd76..a112cc049 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -22,7 +22,8 @@ /*-************************************* * Includes ***************************************/ -#include "util.h" /* SET_BINARY_MODE, UTIL_getFileSize */ +#include "platform.h" /* Large Files support, SET_BINARY_MODE */ +#include "util.h" /* UTIL_getFileSize */ #include /* fprintf, fopen, fread, _fileno, stdin, stdout */ #include /* malloc, free */ #include /* strcmp, strlen */ diff --git a/programs/platform.h b/programs/platform.h index 0b82e46bf..f30528aa9 100644 --- a/programs/platform.h +++ b/programs/platform.h @@ -1,21 +1,13 @@ -/* - platform.h - compiler and OS detection - Copyright (C) 2016-present, Przemyslaw Skibinski, Yann Collet - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ +/** + * platform.h - compiler and OS detection + * + * Copyright (c) 2016-present, Przemyslaw Skibinski, Yann Collet, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ #ifndef PLATFORM_H_MODULE #define PLATFORM_H_MODULE @@ -25,6 +17,19 @@ extern "C" { #endif + +/* ************************************** +* Compiler Options +****************************************/ +#if defined(_MSC_VER) +# define _CRT_SECURE_NO_WARNINGS /* Disable Visual Studio warning messages for fopen, strncpy, strerror */ +# define _CRT_SECURE_NO_DEPRECATE /* VS2005 - must be declared before and */ +# if (_MSC_VER <= 1800) /* (1800 = Visual Studio 2013) */ +# define snprintf sprintf_s /* snprintf unsupported by Visual <= 2013 */ +# endif +#endif + + /* ************************************** * Detect 64-bit OS * http://nadeausoftware.com/articles/2012/02/c_c_tip_how_detect_processor_type_using_compiler_predefined_macros diff --git a/programs/util.h b/programs/util.h index 5779fa772..aaa4b7c1e 100644 --- a/programs/util.h +++ b/programs/util.h @@ -1,21 +1,13 @@ -/* - util.h - utility functions - Copyright (C) 2016-present, Przemyslaw Skibinski, Yann Collet - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ +/** + * util.h - utility functions + * + * Copyright (c) 2016-present, Przemyslaw Skibinski, Yann Collet, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ #ifndef UTIL_H_MODULE #define UTIL_H_MODULE @@ -25,17 +17,6 @@ extern "C" { #endif -/* ************************************** -* Compiler Options -****************************************/ -#if defined(_MSC_VER) -# define _CRT_SECURE_NO_WARNINGS /* Disable Visual Studio warning messages for fopen, strncpy, strerror */ -# define _CRT_SECURE_NO_DEPRECATE /* VS2005 */ -# if (_MSC_VER <= 1800) /* (1800 = Visual Studio 2013) */ -# define snprintf sprintf_s /* snprintf unsupported by Visual <= 2013 */ -# endif -#endif - /*-**************************************** * Dependencies diff --git a/programs/zstdcli.c b/programs/zstdcli.c index 0b6f9241c..978ffcfe0 100644 --- a/programs/zstdcli.c +++ b/programs/zstdcli.c @@ -23,7 +23,8 @@ /*-************************************ * Dependencies **************************************/ -#include "util.h" /* IS_CONSOLE, UTIL_HAS_CREATEFILELIST, UTIL_createFileList */ +#include "platform.h" /* IS_CONSOLE, PLATFORM_POSIX_VERSION */ +#include "util.h" /* UTIL_HAS_CREATEFILELIST, UTIL_createFileList */ #include /* strcmp, strlen */ #include /* errno */ #include "fileio.h"