components/pcsc-lite/patches/05-comp_warning_dynfunctions.patch
changeset 6133 73641150a4de
equal deleted inserted replaced
6132:7fb35b7d3c4d 6133:73641150a4de
       
     1 Upstream fix that will be included in another release of pcsclite.
       
     2 
       
     3 From 4d7abdeff7808b1ab545a98733282d421e751a0e Mon Sep 17 00:00:00 2001
       
     4 From: Ludovic Rousseau <[email protected]>
       
     5 Date: Sun, 20 Mar 2016 16:47:05 +0100
       
     6 Subject: [PATCH] dyn_*: Fix compiler warnings
       
     7 
       
     8 DYN_* functions now return a LONG instead of an int
       
     9 
       
    10 dyn_unix.c:59:10: warning: implicit conversion from 'LONG' (aka 'long') to 'int'
       
    11       changes value from 2148532244 to -2146435052 [-Wconstant-conversion]
       
    12                 return SCARD_F_UNKNOWN_ERROR;
       
    13                 ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~
       
    14 ../src/PCSC/pcsclite.h:147:33: note: expanded from macro 'SCARD_F_UNKNOWN_ERROR'
       
    15                                          ^~~~~~~~~~~~~~~~
       
    16 dyn_unix.c:77:10: warning: implicit conversion from 'LONG' (aka 'long') to 'int'
       
    17       changes value from 2148532244 to -2146435052 [-Wconstant-conversion]
       
    18                 return SCARD_F_UNKNOWN_ERROR;
       
    19                 ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~
       
    20 ../src/PCSC/pcsclite.h:147:33: note: expanded from macro 'SCARD_F_UNKNOWN_ERROR'
       
    21                                          ^~~~~~~~~~~~~~~~
       
    22 dyn_unix.c:105:8: warning: implicit conversion from 'LONG' (aka 'long') to 'int'
       
    23       changes value from 2148532244 to -2146435052 [-Wconstant-conversion]
       
    24                 rv = SCARD_F_UNKNOWN_ERROR;
       
    25                    ~ ^~~~~~~~~~~~~~~~~~~~~
       
    26 ../src/PCSC/pcsclite.h:147:33: note: expanded from macro 'SCARD_F_UNKNOWN_ERROR'
       
    27                                          ^~~~~~~~~~~~~~~~
       
    28 ---
       
    29  src/dyn_generic.h | 6 +++---
       
    30  src/dyn_hpux.c    | 6 +++---
       
    31  src/dyn_unix.c    | 8 ++++----
       
    32  3 files changed, 10 insertions(+), 10 deletions(-)
       
    33 
       
    34 diff --git a/src/dyn_generic.h b/src/dyn_generic.h
       
    35 index 30d8225..8989908 100644
       
    36 --- a/src/dyn_generic.h
       
    37 +++ b/src/dyn_generic.h
       
    38 @@ -38,8 +38,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
       
    39  #ifndef __dyn_generic_h__
       
    40  #define __dyn_generic_h__
       
    41  
       
    42 -	int DYN_LoadLibrary(void **, char *);
       
    43 -	int DYN_CloseLibrary(void **);
       
    44 -	int DYN_GetAddress(void *, /*@out@*/ void **, const char *, int);
       
    45 +	LONG DYN_LoadLibrary(void **, char *);
       
    46 +	LONG DYN_CloseLibrary(void **);
       
    47 +	LONG DYN_GetAddress(void *, /*@out@*/ void **, const char *, int);
       
    48  
       
    49  #endif
       
    50 diff --git a/src/dyn_hpux.c b/src/dyn_hpux.c
       
    51 index 03c0392..151ce2a 100644
       
    52 --- a/src/dyn_hpux.c
       
    53 +++ b/src/dyn_hpux.c
       
    54 @@ -45,7 +45,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
       
    55  #include "debuglog.h"
       
    56  #include "dyn_generic.h"
       
    57  
       
    58 -int DYN_LoadLibrary(void **pvLHandle, char *pcLibrary)
       
    59 +LONG DYN_LoadLibrary(void **pvLHandle, char *pcLibrary)
       
    60  {
       
    61  
       
    62  	shl_t myHandle;
       
    63 @@ -65,7 +65,7 @@ int DYN_LoadLibrary(void **pvLHandle, char *pcLibrary)
       
    64  	return SCARD_S_SUCCESS;
       
    65  }
       
    66  
       
    67 -int DYN_CloseLibrary(void **pvLHandle)
       
    68 +LONG DYN_CloseLibrary(void **pvLHandle)
       
    69  {
       
    70  
       
    71  	int rv;
       
    72 @@ -82,7 +82,7 @@ int DYN_CloseLibrary(void **pvLHandle)
       
    73  	return SCARD_S_SUCCESS;
       
    74  }
       
    75  
       
    76 -int DYN_GetAddress(void *pvLHandle, void **pvFHandle, const char *pcFunction,
       
    77 +LONG DYN_GetAddress(void *pvLHandle, void **pvFHandle, const char *pcFunction,
       
    78  	int mayfail)
       
    79  {
       
    80  
       
    81 diff --git a/src/dyn_unix.c b/src/dyn_unix.c
       
    82 index 52353dd..edf8397 100644
       
    83 --- a/src/dyn_unix.c
       
    84 +++ b/src/dyn_unix.c
       
    85 @@ -47,7 +47,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
       
    86  #include "debuglog.h"
       
    87  #include "dyn_generic.h"
       
    88  
       
    89 -INTERNAL int DYN_LoadLibrary(void **pvLHandle, char *pcLibrary)
       
    90 +INTERNAL LONG DYN_LoadLibrary(void **pvLHandle, char *pcLibrary)
       
    91  {
       
    92  	*pvLHandle = NULL;
       
    93  #ifndef PCSCLITE_STATIC_DRIVER
       
    94 @@ -63,7 +63,7 @@ INTERNAL int DYN_LoadLibrary(void **pvLHandle, char *pcLibrary)
       
    95  	return SCARD_S_SUCCESS;
       
    96  }
       
    97  
       
    98 -INTERNAL int DYN_CloseLibrary(void **pvLHandle)
       
    99 +INTERNAL LONG DYN_CloseLibrary(void **pvLHandle)
       
   100  {
       
   101  #ifndef PCSCLITE_STATIC_DRIVER
       
   102  	int ret;
       
   103 @@ -81,11 +81,11 @@ INTERNAL int DYN_CloseLibrary(void **pvLHandle)
       
   104  	return SCARD_S_SUCCESS;
       
   105  }
       
   106  
       
   107 -INTERNAL int DYN_GetAddress(void *pvLHandle, void **pvFHandle,
       
   108 +INTERNAL LONG DYN_GetAddress(void *pvLHandle, void **pvFHandle,
       
   109  	const char *pcFunction, int mayfail)
       
   110  {
       
   111  	char pcFunctionName[256];
       
   112 -	int rv = SCARD_S_SUCCESS;
       
   113 +	LONG rv = SCARD_S_SUCCESS;
       
   114  
       
   115  	/* Some platforms might need a leading underscore for the symbol */
       
   116  	(void)snprintf(pcFunctionName, sizeof(pcFunctionName), "_%s", pcFunction);
       
   117 -- 
       
   118 1.9.1
       
   119