janitorial: Remove remaining NULL checks before free() (found by Smatch).
[wine] / dlls / gdi / opengl.c
1 /*
2  * OpenGL function forwarding to the display driver
3  *
4  * Copyright (c) 1999 Lionel Ulmer
5  * Copyright (c) 2005 Raphael Junqueira
6  * Copyright (c) 2006 Roderick Colenbrander
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21  */
22
23 #include "config.h"
24 #include "wine/port.h"
25
26 #include <stdarg.h>
27 #include <string.h>
28 #include <stdlib.h>
29
30 #include "windef.h"
31 #include "winbase.h"
32 #include "wingdi.h"
33 #include "winerror.h"
34 #include "gdi.h"
35 #include "gdi_private.h"
36 #include "wine/debug.h"
37
38 WINE_DEFAULT_DEBUG_CHANNEL(wgl);
39
40 /***********************************************************************
41  *              wglCreateContext (OPENGL32.@)
42  */
43 HGLRC WINAPI wglCreateContext(HDC hdc)
44 {
45     HGLRC ret = 0;
46     DC * dc = DC_GetDCPtr( hdc );
47
48     TRACE("(%p)\n",hdc);
49
50     if (!dc) return 0;
51
52     if (!dc->funcs->pwglCreateContext) FIXME(" :stub\n");
53     else ret = dc->funcs->pwglCreateContext(dc->physDev);
54
55     GDI_ReleaseObj( hdc );
56     return ret;
57 }
58
59 /***********************************************************************
60  *              wglMakeCurrent (OPENGL32.@)
61  */
62 BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
63 {
64     BOOL ret = FALSE;
65     DC * dc = DC_GetDCPtr( hdc );
66
67     TRACE("hdc: (%p), hglrc: (%p)\n", hdc, hglrc);
68
69     if (!dc) return FALSE;
70
71     if (!dc->funcs->pwglMakeCurrent) FIXME(" :stub\n");
72     else ret = dc->funcs->pwglMakeCurrent(dc->physDev,hglrc);
73
74     GDI_ReleaseObj( hdc);
75     return ret;
76 }
77
78 /***********************************************************************
79  *              wglUseFontBitmapsA (OPENGL32.@)
80  */
81 BOOL WINAPI wglUseFontBitmapsA(HDC hdc, DWORD first, DWORD count, DWORD listBase)
82 {
83     BOOL ret = FALSE;
84     DC * dc = DC_GetDCPtr( hdc );
85
86     TRACE("(%p, %ld, %ld, %ld)\n", hdc, first, count, listBase);
87
88     if (!dc) return FALSE;
89
90     if (!dc->funcs->pwglUseFontBitmapsA) FIXME(" :stub\n");
91     else ret = dc->funcs->pwglUseFontBitmapsA(dc->physDev, first, count, listBase);
92
93     GDI_ReleaseObj( hdc);
94     return ret;
95 }
96
97 /***********************************************************************
98  *              wglUseFontBitmapsW (OPENGL32.@)
99  */
100 BOOL WINAPI wglUseFontBitmapsW(HDC hdc, DWORD first, DWORD count, DWORD listBase)
101 {
102     BOOL ret = FALSE;
103     DC * dc = DC_GetDCPtr( hdc );
104
105     TRACE("(%p, %ld, %ld, %ld)\n", hdc, first, count, listBase);
106
107     if (!dc) return FALSE;
108
109     if (!dc->funcs->pwglUseFontBitmapsW) FIXME(" :stub\n");
110     else ret = dc->funcs->pwglUseFontBitmapsW(dc->physDev, first, count, listBase);
111
112     GDI_ReleaseObj( hdc);
113     return ret;
114 }