Move log implementation for Windows in dedicated directory
This commit is contained in:
parent
cb3452db7b
commit
2be00e7615
4 changed files with 5 additions and 8 deletions
|
|
@ -48,15 +48,15 @@ IF(LIBUSB_FOUND)
|
|||
ENDIF(LIBUSB_FOUND)
|
||||
|
||||
# Library
|
||||
SET(LIBRARY_SOURCES nfc nfc-device nfc-emulation nfc-internal conf iso14443-subr mirror-subr target-subr log ${DRIVERS_SOURCES} ${BUSES_SOURCES} ${CHIPS_SOURCES} ${WINDOWS_SOURCES})
|
||||
SET(LIBRARY_SOURCES nfc nfc-device nfc-emulation nfc-internal conf iso14443-subr mirror-subr target-subr ${DRIVERS_SOURCES} ${BUSES_SOURCES} ${CHIPS_SOURCES} ${WINDOWS_SOURCES})
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
IF(LIBNFC_LOG)
|
||||
IF(WIN32)
|
||||
SET(CMAKE_C_FLAGS "-fgnu89-inline ${CMAKE_C_FLAGS}")
|
||||
LIST(APPEND LIBRARY_SOURCES log_win32)
|
||||
LIST(APPEND LIBRARY_SOURCES log ../contrib/win32/libnfc/log-internal)
|
||||
ELSE(WIN32)
|
||||
LIST(APPEND LIBRARY_SOURCES log_posix)
|
||||
LIST(APPEND LIBRARY_SOURCES log log-internal)
|
||||
ENDIF(WIN32)
|
||||
ENDIF(LIBNFC_LOG)
|
||||
ADD_LIBRARY(nfc SHARED ${LIBRARY_SOURCES})
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ lib_LTLIBRARIES = libnfc.la
|
|||
libnfc_la_SOURCES = \
|
||||
conf.c \
|
||||
iso14443-subr.c \
|
||||
log.c \
|
||||
mirror-subr.c \
|
||||
nfc.c \
|
||||
nfc-device.c \
|
||||
|
|
@ -41,10 +40,8 @@ if LIBUSB_ENABLED
|
|||
endif
|
||||
|
||||
if WITH_LOG
|
||||
libnfc_la_SOURCES += log_posix.c
|
||||
libnfc_la_SOURCES += log.c log-internal.c
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
CMakeLists.txt \
|
||||
log_posix.c \
|
||||
log_win32.c
|
||||
CMakeLists.txt
|
||||
|
|
|
|||
|
|
@ -1,60 +0,0 @@
|
|||
/*-
|
||||
* Free/Libre Near Field Communication (NFC) library
|
||||
*
|
||||
* Libnfc historical contributors:
|
||||
* Copyright (C) 2009 Roel Verdult
|
||||
* Copyright (C) 2009-2013 Romuald Conty
|
||||
* Copyright (C) 2010-2012 Romain Tartière
|
||||
* Copyright (C) 2010-2013 Philippe Teuwen
|
||||
* Copyright (C) 2012-2013 Ludovic Rousseau
|
||||
* Additional contributors of this file:
|
||||
* Copyright (C) 2013 Alex Lian
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 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 Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include "log-internal.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <strsafe.h>
|
||||
|
||||
static void
|
||||
log_output_debug(const char *format, va_list args)
|
||||
{
|
||||
char buffer[1024];
|
||||
HRESULT hr = StringCbVPrintf(buffer, sizeof(buffer), format, args);
|
||||
// Spew what we got, even if the buffer is not sized large enough
|
||||
if ((STRSAFE_E_INSUFFICIENT_BUFFER == hr) || (S_OK == hr))
|
||||
OutputDebugString(buffer);
|
||||
}
|
||||
|
||||
void
|
||||
log_vput_internal(const char *format, va_list args)
|
||||
{
|
||||
vfprintf(stderr, format, args);
|
||||
// Additional windows output to the debug window for debugging purposes
|
||||
log_output_debug(format, args);
|
||||
}
|
||||
|
||||
void
|
||||
log_put_internal(const char *format, ...)
|
||||
{
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
vfprintf(stderr, format, va);
|
||||
// Additional windows output to the debug window for debugging purposes
|
||||
log_output_debug(format, va);
|
||||
va_end(va);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue