[IWineD3d + d3d9] bogus query implemetation

Juan Lang juan_lang at yahoo.com
Fri Jan 28 13:39:53 CST 2005


Hi Oliver,

+HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface,
D3DQUERYTYPE Type, IWineD3DQuery** ppQuery){
+    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+    
+    if(NULL == ppQuery){ 
+        /*Just a check to see if we support this type of query*/        
+        HRESULT hr = D3DERR_NOTAVAILABLE;
+        /*Lie and say everything is good (we can return ok fake data from
a stub)*/
+        switch(Type){
+        case WINED3DQUERYTYPE_VCACHE:
+            hr = D3D_OK;
+        case WINED3DQUERYTYPE_RESOURCEMANAGER:
+            hr = D3D_OK;

These are missing a break statement.  Better style would be to take
advantage of the fallthrough like so:
+        switch(Type){
+        case WINED3DQUERYTYPE_VCACHE:
+        case WINED3DQUERYTYPE_RESOURCEMANAGER:
(all the other WINED3DQUERYTYPE_ cases)
+            hr = D3D_OK;
+            break;

+struct IWineD3DQueryImpl
+{
+    IWineD3DQueryVtbl        *lpVtbl;
+    DWORD                     ref;     /* Note: Ref counting not required
*/
+    IWineD3DDeviceImpl       *wineD3DDevice;
+    /* IWineD3DQuery fields */
+    D3DQUERYTYPE              type;
+    void                     *data;
+    int                       dataSize;
+    
+  
+};

What's with the couple of blank lines in the struct declaration?  Yeah, so
I'm picky ;)

+DWORD WINAPI IWineD3DQueryImpl_GetDataSize(IWineD3DQuery* iface){
+    IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
+    FIXME("(%p) : stub \n", This);
+    int dataSize = 0;
+    switch(This->type){
+    case WINED3DQUERYTYPE_VCACHE:
+        dataSize = sizeof(D3DDEVINFO_VCACHE);
+    case WINED3DQUERYTYPE_RESOURCEMANAGER:

Aren't these case statements missing a break statement too?

--Juan


		
__________________________________ 
Do you Yahoo!? 
All your favorites on one personal page – Try My Yahoo!
http://my.yahoo.com 



More information about the wine-devel mailing list