Check-in [c634e02a7f]
Overview
Comment:Corrected casting to for %p formatting
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:c634e02a7f007217822c4b503266817132193e89
User & Date: rkeene on 2012-07-20 01:04:45
Other Links: manifest | tags
Context
2012-07-20
01:05
Corrected arithmetic on a void pointer check-in: 07d8b72d7d user: rkeene tags: trunk
01:04
Corrected casting to for %p formatting check-in: c634e02a7f user: rkeene tags: trunk
00:55
Updated to define _WIN32_WINNT before including windows.h anywhere check-in: 6b0275529a user: rkeene tags: trunk
Changes

Modified cackey.c from [0c7ae7a3d1] to [1be2f8a22e].

   178    178   #  else
   179    179   #    define CACKEY_DEBUG_PRINTTIME /**/
   180    180   #  endif
   181    181   
   182    182   #  define CACKEY_DEBUG_PRINTF(x...) { CACKEY_DEBUG_PRINTTIME; fprintf(cackey_debug_fd(), "%s():%i: ", __func__, __LINE__); fprintf(cackey_debug_fd(), x); fprintf(cackey_debug_fd(), "\n"); fflush(cackey_debug_fd()); }
   183    183   #  define CACKEY_DEBUG_PRINTBUF(f, x, y) { unsigned char *TMPBUF; unsigned long idx; TMPBUF = (unsigned char *) (x); CACKEY_DEBUG_PRINTTIME; fprintf(cackey_debug_fd(), "%s():%i: %s  (%s/%lu = {%02x", __func__, __LINE__, f, #x, (unsigned long) (y), TMPBUF[0]); for (idx = 1; idx < (y); idx++) { fprintf(cackey_debug_fd(), ", %02x", TMPBUF[idx]); }; fprintf(cackey_debug_fd(), "})\n"); fflush(cackey_debug_fd()); }
   184    184   #  define CACKEY_DEBUG_PERROR(x) { fprintf(cackey_debug_fd(), "%s():%i: ", __func__, __LINE__); CACKEY_DEBUG_PRINTTIME; perror(x); fflush(cackey_debug_fd()); }
   185         -#  define free(x) { CACKEY_DEBUG_PRINTF("FREE(%p) (%s)", x, #x); free(x); }
          185  +#  define free(x) { CACKEY_DEBUG_PRINTF("FREE(%p) (%s)", (void *) x, #x); free(x); }
   186    186   
   187    187   static FILE *cackey_debug_fd(void) {
   188    188   	static FILE *fd = NULL;
   189    189   	char *logfile;
   190    190   
   191    191   	if (fd != NULL) {
   192    192   		return(fd);
................................................................................
   219    219   	if (fd == NULL) {
   220    220   		fd = stderr;
   221    221   	}
   222    222   
   223    223   	if (fd == stderr) {
   224    224   		CACKEY_DEBUG_PRINTF("Returning stderr");
   225    225   	} else {
   226         -		CACKEY_DEBUG_PRINTF("Returning %p", fd);
          226  +		CACKEY_DEBUG_PRINTF("Returning %p", (void *) fd);
   227    227   	}
   228    228   
   229    229   	return(fd);
   230    230   }
   231    231   
   232    232   static void *CACKEY_DEBUG_FUNC_MALLOC(size_t size, const char *func, int line) {
   233    233   	void *retval;
................................................................................
  3363   3363   		free(retval);
  3364   3364   
  3365   3365   		retval = NULL;
  3366   3366   	}
  3367   3367   
  3368   3368   	*pulCount = numattrs;
  3369   3369   
  3370         -	CACKEY_DEBUG_PRINTF("Returning %lu objects (%p).", numattrs, retval);
         3370  +	CACKEY_DEBUG_PRINTF("Returning %lu objects (%p).", numattrs, (void *) retval);
  3371   3371   
  3372   3372   	return(retval);
  3373   3373   }
  3374   3374   
  3375   3375   static void cackey_free_identities(struct cackey_identity *identities, unsigned long identities_count) {
  3376   3376   	CK_ATTRIBUTE *curr_attr;
  3377   3377   	unsigned long id_idx, attr_idx;
................................................................................
  5746   5746   
  5747   5747   	cackey_sessions[hSession].sign_mechanism = pMechanism->mechanism;
  5748   5748   
  5749   5749   	cackey_sessions[hSession].sign_buflen = 128;
  5750   5750   	cackey_sessions[hSession].sign_bufused = 0;
  5751   5751   	cackey_sessions[hSession].sign_buf = malloc(sizeof(*cackey_sessions[hSession].sign_buf) * cackey_sessions[hSession].sign_buflen);
  5752   5752   
  5753         -	CACKEY_DEBUG_PRINTF("Session %lu sign_identity is %p (identity #%lu)", (unsigned long) hSession, &cackey_sessions[hSession].identities[hKey], (unsigned long) hKey);
         5753  +	CACKEY_DEBUG_PRINTF("Session %lu sign_identity is %p (identity #%lu)", (unsigned long) hSession, (void *) &cackey_sessions[hSession].identities[hKey], (unsigned long) hKey);
  5754   5754   	cackey_sessions[hSession].sign_identity = &cackey_sessions[hSession].identities[hKey];
  5755   5755   
  5756   5756   	mutex_retval = cackey_mutex_unlock(cackey_biglock);
  5757   5757   	if (mutex_retval != 0) {
  5758   5758   		CACKEY_DEBUG_PRINTF("Error.  Unlocking failed.");
  5759   5759   
  5760   5760   		return(CKR_GENERAL_ERROR);
................................................................................
  6008   6008   
  6009   6009   		return(CKR_GENERAL_ERROR);
  6010   6010   	}
  6011   6011   
  6012   6012   	switch (cackey_sessions[hSession].sign_mechanism) {
  6013   6013   		case CKM_RSA_PKCS:
  6014   6014   			/* Ask card to sign */
  6015         -			CACKEY_DEBUG_PRINTF("Asking to sign from identity %p in session %lu", cackey_sessions[hSession].sign_identity, (unsigned long) hSession);
         6015  +			CACKEY_DEBUG_PRINTF("Asking to sign from identity %p in session %lu", (void *) cackey_sessions[hSession].sign_identity, (unsigned long) hSession);
  6016   6016   			sigbuflen = cackey_signdecrypt(&cackey_slots[slotID], cackey_sessions[hSession].sign_identity, cackey_sessions[hSession].sign_buf, cackey_sessions[hSession].sign_bufused, sigbuf, sizeof(sigbuf), 1, 0);
  6017   6017   
  6018   6018   			if (sigbuflen < 0) {
  6019   6019   				/* Signing failed. */
  6020   6020   				if (sigbuflen == CACKEY_PCSC_E_NEEDLOGIN) {
  6021   6021   					retval = CKR_USER_NOT_LOGGED_IN;
  6022   6022   				} else if (sigbuflen == CACKEY_PCSC_E_TOKENABSENT) {