comparison mac/dw.m @ 1886:f7d408a47752

Fix a couple of errors reported by the static analyzer on Mac.... Also added similar fixes to the other platforms as well just in case.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 05 Sep 2013 17:58:40 +0000
parents 0768bbcf67e5
children 09860ba329a4
comparison
equal deleted inserted replaced
1885:0768bbcf67e5 1886:f7d408a47752
3692 * Parameters: 3692 * Parameters:
3693 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). 3693 * dialog: Pointer to a dialog struct aquired by dw_dialog_new).
3694 */ 3694 */
3695 void * API dw_dialog_wait(DWDialog *dialog) 3695 void * API dw_dialog_wait(DWDialog *dialog)
3696 { 3696 {
3697 void *tmp; 3697 void *tmp = NULL;
3698 3698
3699 while(!dialog->done) 3699 if(dialog)
3700 { 3700 {
3701 _dw_main_iteration([NSDate dateWithTimeIntervalSinceNow:0.01]); 3701 while(!dialog->done)
3702 } 3702 {
3703 dw_event_close(&dialog->eve); 3703 _dw_main_iteration([NSDate dateWithTimeIntervalSinceNow:0.01]);
3704 tmp = dialog->result; 3704 }
3705 free(dialog); 3705 dw_event_close(&dialog->eve);
3706 tmp = dialog->result;
3707 free(dialog);
3708 }
3706 return tmp; 3709 return tmp;
3707 } 3710 }
3708 3711
3709 /* 3712 /*
3710 * Create a new Box to be packed. 3713 * Create a new Box to be packed.
7834 * Returns: 7837 * Returns:
7835 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure. 7838 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure.
7836 */ 7839 */
7837 int API dw_pixmap_stretch_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc, int srcwidth, int srcheight) 7840 int API dw_pixmap_stretch_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc, int srcwidth, int srcheight)
7838 { 7841 {
7839 DWBitBlt *bltinfo = calloc(1, sizeof(DWBitBlt)); 7842 DWBitBlt *bltinfo;
7840 NSValue* bi; 7843 NSValue* bi;
7841 DW_LOCAL_POOL_IN; 7844 DW_LOCAL_POOL_IN;
7842
7843 bi = [NSValue valueWithPointer:bltinfo];
7844 7845
7845 /* Sanity checks */ 7846 /* Sanity checks */
7846 if((!dest && !destp) || (!src && !srcp) || 7847 if((!dest && !destp) || (!src && !srcp) ||
7847 ((srcwidth == -1 || srcheight == -1) && srcwidth != srcheight)) 7848 ((srcwidth == -1 || srcheight == -1) && srcwidth != srcheight))
7848 { 7849 {
7849 DW_LOCAL_POOL_OUT; 7850 DW_LOCAL_POOL_OUT;
7850 return DW_ERROR_GENERAL; 7851 return DW_ERROR_GENERAL;
7851 } 7852 }
7852 7853
7854 bltinfo = calloc(1, sizeof(DWBitBlt));
7855 bi = [NSValue valueWithPointer:bltinfo];
7856
7853 /* Fill in the information */ 7857 /* Fill in the information */
7854 bltinfo->dest = dest; 7858 bltinfo->dest = dest;
7855 bltinfo->src = src; 7859 bltinfo->src = src;
7856 bltinfo->xdest = xdest; 7860 bltinfo->xdest = xdest;
7857 bltinfo->ydest = ydest; 7861 bltinfo->ydest = ydest;
10581 10585
10582 FD_SET(array[z].fd, &rd); 10586 FD_SET(array[z].fd, &rd);
10583 } 10587 }
10584 10588
10585 if(select(maxfd+1, &rd, NULL, NULL, NULL) == -1) 10589 if(select(maxfd+1, &rd, NULL, NULL, NULL) == -1)
10586 return; 10590 {
10591 free(array);
10592 return;
10593 }
10587 10594
10588 if(FD_ISSET(listenfd, &rd)) 10595 if(FD_ISSET(listenfd, &rd))
10589 { 10596 {
10590 struct _seminfo *newarray; 10597 struct _seminfo *newarray;
10591 int newfd = accept(listenfd, 0, 0); 10598 int newfd = accept(listenfd, 0, 0);