Skip to content

Commit

Permalink
winpr: fixes and cleanup
Browse files Browse the repository at this point in the history
Integrated notes and issues for the pending pull request
* wf_info:
 * cleanup: remove unnecessary breaks
 * fix typo
 * change usage of calloc
* print.c: fix incorrect check
* makecert.c: cleanup includes
  • Loading branch information
bmiklautz committed Apr 8, 2015
1 parent 850de59 commit 12e1d94
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
10 changes: 2 additions & 8 deletions server/Windows/wf_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,13 @@ int wf_info_lock(wfInfo* wfi)
case WAIT_ABANDONED:
case WAIT_OBJECT_0:
return TRUE;
break;

case WAIT_TIMEOUT:
return FALSE;
break;

case WAIT_FAILED:
WLog_ERR(TAG, "wf_info_lock failed with 0x%08X", GetLastError());
return -1;
break;
}

return -1;
Expand All @@ -74,16 +71,13 @@ int wf_info_try_lock(wfInfo* wfi, DWORD dwMilliseconds)
case WAIT_ABANDONED:
case WAIT_OBJECT_0:
return TRUE;
break;

case WAIT_TIMEOUT:
return FALSE;
break;

case WAIT_FAILED:
WLog_ERR(TAG, "wf_info_try_lock failed with 0x%08X", GetLastError());
return -1;
break;
}

return -1;
Expand Down Expand Up @@ -143,7 +137,7 @@ wfInfo* wf_info_init()
return NULL;
}

wfi->peers = (freerdp_peer**) calloc(1, sizeof(freerdp_peer*) * WF_INFO_MAXPEERS);
wfi->peers = (freerdp_peer**) calloc(WF_INFO_MAXPEERS, sizeof(freerdp_peer*));
if (!wfi->peers)
{
WLog_ERR(TAG, "Failed to allocate memory for peer");
Expand Down Expand Up @@ -222,7 +216,7 @@ void wf_info_peer_register(wfInfo* wfi, wfPeerContext* context)
return;
}
#endif
//look trhough the array of peers until an empty slot
//look through the array of peers until an empty slot
for(i=0; i<WF_INFO_MAXPEERS; ++i)
{
//empty index will be our peer id
Expand Down
2 changes: 1 addition & 1 deletion winpr/libwinpr/utils/print.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ char* winpr_BinToHexString(const BYTE* data, int length, BOOL space)
char bin2hex[] = "0123456789ABCDEF";
n = space ? 3 : 2;
p = (char*) malloc((length + 1) * n);
if (p)
if (!p)
return NULL;

for (i = 0; i < length; i++)
Expand Down
2 changes: 0 additions & 2 deletions winpr/tools/makecert/makecert.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@
#include <stdlib.h>

#include <winpr/crt.h>
#include <winpr/file.h>
#include <winpr/path.h>
#include <winpr/cmdline.h>
#include <winpr/sysinfo.h>

#include <openssl/conf.h>
#include <openssl/pem.h>
#include <openssl/err.h>
#include <openssl/pkcs12.h>
#include <openssl/x509v3.h>

Expand Down

0 comments on commit 12e1d94

Please sign in to comment.