Wine-devel
Threads by month
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
May 2021
- 86 participants
- 705 discussions
12 May '21
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/winepulse.drv/Makefile.in | 3 +-
dlls/winepulse.drv/mmdevdrv.c | 199 ++++++++++++++++-----------------
dlls/winepulse.drv/pulse.c | 83 ++++++++++++++
dlls/winepulse.drv/unixlib.h | 25 +++++
4 files changed, 207 insertions(+), 103 deletions(-)
create mode 100644 dlls/winepulse.drv/pulse.c
create mode 100644 dlls/winepulse.drv/unixlib.h
2
1
12 May '21
Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com>
---
dlls/windowscodecs/ddsformat.c | 77 +++++++++++++++++++++-------
dlls/windowscodecs/tests/ddsformat.c | 2 -
2 files changed, 58 insertions(+), 21 deletions(-)
2
1
12 May '21
Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com>
---
dlls/windowscodecs/ddsformat.c | 50 ++++++++++++++++++++++++++--
dlls/windowscodecs/tests/ddsformat.c | 2 --
2 files changed, 48 insertions(+), 4 deletions(-)
2
1
12 May '21
Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com>
---
dlls/windowscodecs/tests/ddsformat.c | 81 ++++++++++++++++++++++++++++
1 file changed, 81 insertions(+)
2
1
12 May '21
---
Right now this patch allows us to remove/shrink some our manual thunks, but as more wrappable handles are added, this should become more useful.
---
dlls/winevulkan/make_vulkan | 541 +++++++++++++++++++++++++++++-------
dlls/winevulkan/vulkan.c | 32 +--
2 files changed, 440 insertions(+), 133 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan
index d5cc62d2097..fe62cb0fb35 100755
--- a/dlls/winevulkan/make_vulkan
+++ b/dlls/winevulkan/make_vulkan
@@ -204,14 +204,14 @@ FUNCTION_OVERRIDES = {
# VK_KHR_get_surface_capabilities2
"vkGetPhysicalDeviceSurfaceCapabilities2KHR" : {"dispatch" : True, "driver" : True, "thunk" : ThunkType.PRIVATE},
- "vkGetPhysicalDeviceSurfaceFormats2KHR" : {"dispatch" : True, "driver" : True, "thunk" : ThunkType.PRIVATE},
+ "vkGetPhysicalDeviceSurfaceFormats2KHR" : {"dispatch" : True, "driver" : True, "thunk" : ThunkType.PUBLIC},
# VK_KHR_win32_surface
"vkCreateWin32SurfaceKHR" : {"dispatch" : True, "driver" : True, "thunk" : ThunkType.NONE},
"vkGetPhysicalDeviceWin32PresentationSupportKHR" : {"dispatch" : True, "driver" : True, "thunk" : ThunkType.PUBLIC},
# VK_KHR_swapchain
- "vkCreateSwapchainKHR" : {"dispatch" : True, "driver" : True, "thunk" : ThunkType.PRIVATE},
+ "vkCreateSwapchainKHR" : {"dispatch" : True, "driver" : True, "thunk" : ThunkType.PUBLIC},
"vkDestroySwapchainKHR" : {"dispatch" : True, "driver" : True, "thunk" : ThunkType.PUBLIC},
"vkGetSwapchainImagesKHR": {"dispatch" : True, "driver" : True, "thunk" : ThunkType.PUBLIC},
"vkQueuePresentKHR": {"dispatch" : True, "driver" : True, "thunk" : ThunkType.PUBLIC},
@@ -645,6 +645,18 @@ class VkFunction(object):
return False
+ def needs_unwrapping(self):
+ """ Check if the function needs any input/output type unwrapping.
+ Functions need input/output unwrapping if struct parameters have
+ wrapped dispatchable handles.
+ """
+
+ for p in self.params:
+ if p.needs_unwrapping():
+ return True
+
+ return False
+
def needs_dispatch(self):
return self.dispatch
@@ -748,13 +760,16 @@ class VkFunction(object):
# Declare any tmp parameters for conversion.
for p in self.params:
- if not p.needs_conversion():
- continue
-
- if p.is_dynamic_array():
- body += " {0}_host *{1}_host;\n".format(p.type, p.name)
- else:
- body += " {0}_host {1}_host;\n".format(p.type, p.name)
+ if p.needs_conversion():
+ if p.is_dynamic_array():
+ body += " {0}_host *{1}_host;\n".format(p.type, p.name)
+ else:
+ body += " {0}_host {1}_host;\n".format(p.type, p.name)
+ elif p.needs_unwrapping():
+ if p.is_dynamic_array():
+ body += " {0} *{1}_host;\n".format(p.type, p.name)
+ else:
+ body += " {0} {1}_host;\n".format(p.type, p.name)
if not self.needs_private_thunk():
body += " {0}\n".format(self.trace())
@@ -798,6 +813,51 @@ class VkFunction(object):
return body
+ def body_unwrapping(self):
+ body = ""
+
+ # Declare a variable to hold the result for non-void functions.
+ if self.type != "void":
+ body += " {0} result;\n".format(self.type)
+
+ for p in self.params:
+ if p.needs_unwrapping():
+ if p.is_dynamic_array():
+ body += " {0} *{1}_host;\n".format(p.type, p.name)
+ else:
+ body += " {0} {1}_host;\n".format(p.type, p.name)
+
+ if not self.needs_private_thunk():
+ body += " {0}".format(self.trace())
+
+ # Call unwrapping win_to_host conversion calls.
+ for p in self.params:
+ if p.needs_unwrapping() and p.needs_input_conversion():
+ body += p.copy(Direction.INPUT)
+
+ params = ", ".join([p.variable(conv=False) for p in self.params])
+
+ # Call the native Vulkan function.
+ if self.type == "void":
+ body += " {0}.p_{1}({2});\n".format(self.params[0].dispatch_table(), self.name, params)
+ else:
+ body += " result = {0}.p_{1}({2});\n".format(self.params[0].dispatch_table(), self.name, params)
+
+ body += "\n"
+
+ # Perform any required cleanups. Most of these are for array functions.
+ for p in self.params:
+ if not p.needs_free() or not p.needs_unwrapping():
+ continue
+
+ body += p.free()
+
+ # Finally return the result.
+ if self.type != "void":
+ body += " return result;\n"
+
+ return body
+
def spec(self, prefix=None, symbol=None):
""" Generate spec file entry for this function.
@@ -842,8 +902,13 @@ class VkFunction(object):
thunk += "#if defined(USE_STRUCT_CONVERSION)\n"
thunk += self.body_conversion()
thunk += "#else\n"
- thunk += self.body()
+ if self.needs_unwrapping():
+ thunk += self.body_unwrapping()
+ else:
+ thunk += self.body()
thunk += "#endif\n"
+ elif self.needs_unwrapping():
+ thunk += self.body_unwrapping()
else:
thunk += self.body()
@@ -1063,6 +1128,12 @@ class VkHandle(object):
def is_wrapped(self):
return self.native_handle("test") is not None
+ def needs_conversion(self):
+ return False
+
+ def needs_unwrapping(self):
+ return self.is_wrapped()
+
class VkMember(object):
def __init__(self, const=False, struct_fwd_decl=False,_type=None, pointer=None, name=None, array_len=None,
dyn_array_len=None, optional=False, values=None):
@@ -1148,10 +1219,11 @@ class VkMember(object):
return VkMember(const=const, struct_fwd_decl=struct_fwd_decl, _type=member_type, pointer=pointer, name=name_elem.text,
array_len=array_len, dyn_array_len=dyn_array_len, optional=optional, values=values)
- def copy(self, input, output, direction):
- """ Helper method for use by conversion logic to generate a C-code statement to copy this member. """
+ def copy(self, input, output, direction, conv):
+ """ Helper method for use by conversion logic to generate a C-code statement to copy this member.
+ - `conv` indicates whether the statement is in a struct alignment conversion path. """
- if self.needs_conversion():
+ if (conv and self.needs_conversion()) or self.needs_unwrapping():
if self.is_dynamic_array():
if direction == Direction.OUTPUT:
LOGGER.warn("TODO: implement copying of returnedonly dynamic array for {0}.{1}".format(self.type, self.name))
@@ -1167,6 +1239,12 @@ class VkMember(object):
else:
# Nothing needed this yet.
LOGGER.warn("TODO: implement copying of static array for {0}.{1}".format(self.type, self.name))
+ elif self.is_handle() and self.needs_unwrapping():
+ if direction == Direction.OUTPUT:
+ LOGGER.err("Only INPUT parameters can be unwrapped")
+ else:
+ handle = self.type_info["data"]
+ return "{0}{1} = {2};\n".format(output, self.name, handle.driver_handle("{0}{1}".format(input, self.name)))
else:
if direction == Direction.OUTPUT:
return "convert_{0}_host_to_win(&{2}{1}, &{3}{1});\n".format(self.type, self.name, input, output)
@@ -1178,6 +1256,27 @@ class VkMember(object):
else:
return "{0}{1} = {2}{1};\n".format(output, self.name, input)
+ def free(self, location, conv):
+ """ Helper method for use by conversion logic to generate a C-code statement to free this member. """
+
+ if not self.needs_unwrapping() and not conv:
+ return ""
+
+ cast = ("(" + self.type + ("_host" if conv and self.needs_conversion() else "") + " *)") if self.is_const() else ""
+ if self.is_dynamic_array():
+ count = self.dyn_array_len if isinstance(self.dyn_array_len, int) else "{0}{1}".format(location, self.dyn_array_len)
+ if self.is_struct() and self.type_info["data"].returnedonly:
+ # For returnedonly, counts is stored in a pointer.
+ return "free_{0}_array({1}{2}{3}, *{4});\n".format(self.type, cast, location, self.name, count)
+ else:
+ return "free_{0}_array({1}{2}{3}, {4});\n".format(self.type, cast, location, self.name, count)
+ else:
+ # We are operating on a single structure. Some structs (very rare) contain dynamic members,
+ # which would need freeing.
+ if self.needs_free():
+ return "free_{0}({1}&{2}{3});\n".format(self.type, cast, location, self.name)
+ return ""
+
def definition(self, align=False, conv=False):
""" Generate prototype for given function.
@@ -1216,31 +1315,35 @@ class VkMember(object):
# Check if we need conversion either for this member itself or for any child members
# in case member represents a struct.
- if not self.needs_conversion():
+ if not self.needs_conversion() and not self.needs_unwrapping():
return None
conversions = []
# Collect any conversion for any member structs.
- struct = self.type_info["data"]
- for m in struct:
- m.needs_struct_extensions_conversion()
- if m.needs_conversion():
- conversions.extend(m.get_conversions())
+ direction = None
+ if self.is_struct():
+ struct = self.type_info["data"]
+ for m in struct:
+ m.needs_struct_extensions_conversion()
+ if m.needs_conversion() or m.needs_unwrapping():
+ conversions.extend(m.get_conversions())
- struct.needs_struct_extensions_conversion()
+ struct.needs_struct_extensions_conversion()
+ direction = Direction.OUTPUT if struct.returnedonly else Direction.INPUT
+ elif self.is_handle():
+ direction = Direction.INPUT
- struct = self.type_info["data"]
- direction = Direction.OUTPUT if struct.returnedonly else Direction.INPUT
+ operand = self.type_info["data"]
if self.is_dynamic_array():
- conversions.append(ConversionFunction(False, True, direction, struct))
+ conversions.append(ConversionFunction(False, True, direction, operand))
elif self.is_static_array():
- conversions.append(ConversionFunction(True, False, direction, struct))
+ conversions.append(ConversionFunction(True, False, direction, operand))
else:
- conversions.append(ConversionFunction(False, False, direction, struct))
+ conversions.append(ConversionFunction(False, False, direction, operand))
if self.needs_free():
- conversions.append(FreeFunction(self.is_dynamic_array(), struct))
+ conversions.append(FreeFunction(self.is_dynamic_array(), operand))
return conversions
@@ -1307,8 +1410,21 @@ class VkMember(object):
struct = self.type_info["data"]
return struct.needs_conversion()
+ def needs_unwrapping(self):
+ """ Structures with wrapped dispatchable handles, need unwrapping. """
+
+ if self.is_struct():
+ struct = self.type_info["data"]
+ return struct.needs_unwrapping()
+
+ if self.is_handle():
+ handle = self.type_info["data"]
+ return handle.is_wrapped()
+
+ return False
+
def needs_free(self):
- if not self.needs_conversion():
+ if not self.needs_conversion() and not self.needs_unwrapping():
return False
if self.is_dynamic_array():
@@ -1392,7 +1508,7 @@ class VkParam(object):
self.free_func = None
self.input_conv = None
self.output_conv = None
- if not self.needs_conversion():
+ if not self.needs_conversion() and not self.needs_unwrapping():
return
# Input functions require win to host conversion.
@@ -1570,7 +1686,7 @@ class VkParam(object):
for m in self.struct:
m.needs_struct_extensions_conversion()
- if not self.needs_conversion():
+ if not self.needs_conversion() and not self.needs_unwrapping():
return None
conversions = []
@@ -1582,7 +1698,7 @@ class VkParam(object):
if not m.is_struct():
continue
- if not m.needs_conversion():
+ if not m.needs_conversion() and not m.needs_unwrapping():
continue
conversions.extend(m.get_conversions())
@@ -1641,6 +1757,15 @@ class VkParam(object):
return False
+ def needs_unwrapping(self):
+ """ Returns if parameter needs unwrapping of dispatchable handle. """
+
+ # Wrapped handle parameters are handled seperately, only look for wrapped handles in structs
+ if self.is_struct():
+ return self.struct.needs_unwrapping()
+
+ return False
+
def needs_free(self):
return self.free_func is not None
@@ -1880,6 +2005,14 @@ class VkStruct(Sequence):
return True
return False
+ def needs_unwrapping(self):
+ """ Returns if struct members need unwrapping of a dispatchable handle. """
+
+ for m in self.members:
+ if m.needs_unwrapping():
+ return True
+ return False
+
def needs_free(self):
""" Check if any struct member needs some memory freeing."""
@@ -1897,7 +2030,10 @@ class VkStruct(Sequence):
for e in self.struct_extensions:
if e.required and e.needs_conversion():
- LOGGER.error("Unhandled pNext chain conversion for {0}".format(e.name))
+ LOGGER.error("Unhandled pNext chain alignment conversion for {0}".format(e.name))
+ ret = True
+ if e.required and e.needs_unwrapping():
+ LOGGER.error("Unhandled pNext chain unwrapping conversion for {0}".format(e.name))
ret = True
return ret
@@ -1913,12 +2049,12 @@ class VkStruct(Sequence):
class ConversionFunction(object):
- def __init__(self, array, dyn_array, direction, struct):
+ def __init__(self, array, dyn_array, direction, operand):
self.array = array
self.direction = direction
self.dyn_array = dyn_array
- self.struct = struct
- self.type = struct.name
+ self.operand = operand
+ self.type = operand.name
self._set_name()
@@ -1926,21 +2062,44 @@ class ConversionFunction(object):
return self.name == other.name
def _generate_array_conversion_func(self):
- """ Helper function for generating a conversion function for array structs. """
+ """ Helper function for generating a conversion function for array operands. """
+
+ body = ""
+
+ if self.operand.needs_conversion():
+ if self.direction == Direction.OUTPUT:
+ params = ["const {0}_host *in".format(self.type), "uint32_t count"]
+ return_type = self.type
+ else:
+ params = ["const {0} *in".format(self.type), "uint32_t count"]
+ return_type = "{0}_host".format(self.type)
+
+ # Generate function prototype.
+ body += "static inline {0} *{1}(".format(return_type, self.name)
+ body += ", ".join(p for p in params)
+ body += ")\n{\n"
+
+ body += " {0} *out;\n".format(return_type)
+
+ if self.operand.needs_unwrapping():
+ if self.operand.needs_conversion():
+ body += "#else\n"
+ else:
+ body += "#endif /* USE_STRUCT_CONVERSION */\n\n"
- if self.direction == Direction.OUTPUT:
- params = ["const {0}_host *in".format(self.type), "uint32_t count"]
- return_type = self.type
- else:
params = ["const {0} *in".format(self.type), "uint32_t count"]
- return_type = "{0}_host".format(self.type)
+ return_type = "{0}".format(self.type)
- # Generate function prototype.
- body = "static inline {0} *{1}(".format(return_type, self.name)
- body += ", ".join(p for p in params)
- body += ")\n{\n"
+ # Generate function prototype.
+ body += "static inline {0} *{1}(".format(return_type, self.name)
+ body += ", ".join(p for p in params)
+ body += ")\n{\n"
+
+ body += " {0} *out;\n".format(return_type)
+
+ if self.operand.needs_conversion():
+ body += "#endif /* USE_STRUCT_CONVERSION */\n"
- body += " {0} *out;\n".format(return_type)
body += " unsigned int i;\n\n"
body += " if (!in) return NULL;\n\n"
@@ -1949,10 +2108,25 @@ class ConversionFunction(object):
body += " for (i = 0; i < count; i++)\n"
body += " {\n"
- for m in self.struct:
- # TODO: support copying of pNext extension structures!
- # Luckily though no extension struct at this point needs conversion.
- body += " " + m.copy("in[i].", "out[i].", self.direction)
+ if isinstance(self.operand, VkStruct):
+ for m in self.operand:
+ # TODO: support copying of pNext extension structures!
+ # Luckily though no extension struct at this point needs conversion.
+ convert = m.copy("in[i].", "out[i].", self.direction, True)
+ if self.operand.needs_conversion() and not self.operand.needs_unwrapping():
+ body += " " + convert
+ else:
+ unwrap = m.copy("in[i].", "out[i].", self.direction, False)
+ if unwrap == convert:
+ body += " " + unwrap
+ else:
+ body += "#if defined(USE_STRUCT_CONVERSION)\n {0}#else\n {1}#endif /* USE_STRUCT_CONVERSION */\n".format(convert, unwrap)
+
+ elif isinstance(self.operand, VkHandle) and self.direction == Direction.INPUT:
+ body += " out[i] = " + self.operand.driver_handle("in[i]") + ";\n"
+ else:
+ LOGGER.warn("Unhandled conversion operand type")
+ body += " out[i] = in[i];\n"
body += " }\n\n"
body += " return out;\n"
@@ -1960,22 +2134,47 @@ class ConversionFunction(object):
return body
def _generate_conversion_func(self):
- """ Helper function for generating a conversion function for non-array structs. """
+ """ Helper function for generating a conversion function for non-array operands. """
- if self.direction == Direction.OUTPUT:
- params = ["const {0}_host *in".format(self.type), "{0} *out".format(self.type)]
- else:
- params = ["const {0} *in".format(self.type), "{0}_host *out".format(self.type)]
+ # It doesn't make sense to generate conversion functions for non-struct variables
+ # which aren't in arrays, as this should be handled by the copy() function
+ if not isinstance(self.operand, VkStruct):
+ return ""
+
+ body = ""
- body = "static inline void {0}(".format(self.name)
+ if self.operand.needs_conversion():
+ body += "static inline void {0}(".format(self.name)
- # Generate parameter list
- body += ", ".join(p for p in params)
- body += ")\n{\n"
+ if self.direction == Direction.OUTPUT:
+ params = ["const {0}_host *in".format(self.type), "{0} *out".format(self.type)]
+ else:
+ params = ["const {0} *in".format(self.type), "{0}_host *out".format(self.type)]
- body += " if (!in) return;\n\n"
+ # Generate parameter list
+ body += ", ".join(p for p in params)
+ body += ")\n"
- if self.direction == Direction.INPUT and "pNext" in self.struct and self.struct.returnedonly:
+ if self.operand.needs_unwrapping():
+ if self.operand.needs_conversion():
+ body += "#else\n"
+ else:
+ body += "#endif /* USE_STRUCT_CONVERSION */\n\n"
+
+ body += "static inline void {0}(".format(self.name)
+
+ params = ["const {0} *in".format(self.type), "{0} *out".format(self.type)]
+
+ # Generate parameter list
+ body += ", ".join(p for p in params)
+ body += ")\n"
+
+ if self.operand.needs_conversion():
+ body += "#endif /* USE_STRUCT_CONVERSION */\n"
+
+ body += "{\n if (!in) return;\n\n"
+
+ if self.direction == Direction.INPUT and "pNext" in self.operand and self.operand.returnedonly:
# We are dealing with an input_output parameter. For these we only need to copy
# pNext and sType as the other fields are filled in by the host. We do potentially
# have to iterate over pNext and perform conversions based on switch(sType)!
@@ -1984,36 +2183,84 @@ class ConversionFunction(object):
body += " out->pNext = in->pNext;\n"
body += " out->sType = in->sType;\n"
else:
- for m in self.struct:
+ for m in self.operand:
# TODO: support copying of pNext extension structures!
- body += " " + m.copy("in->", "out->", self.direction)
+ convert = m.copy("in->", "out->", self.direction, True)
+ if self.operand.needs_conversion() and not self.operand.needs_unwrapping():
+ body += " " + convert
+ else:
+ unwrap = m.copy("in->", "out->", self.direction, False)
+ if unwrap == convert:
+ body += " " + unwrap
+ else:
+ body += "#if defined(USE_STRUCT_CONVERSION)\n {0}#else\n {1}#endif /* USE_STRUCT_CONVERSION */\n".format(convert, unwrap)
body += "}\n\n"
+
+ if self.operand.needs_unwrapping() and not self.operand.needs_free():
+ body += "#if defined(USE_STRUCT_CONVERSION)\n"
+
return body
def _generate_static_array_conversion_func(self):
- """ Helper function for generating a conversion function for array structs. """
+ """ Helper function for generating a conversion function for array operands. """
- if self.direction == Direction.OUTPUT:
- params = ["const {0}_host *in".format(self.type), "{0} *out".format(self.type), "uint32_t count"]
- else:
- params = ["const {0} *in".format(self.type), "{0} *out_host".format(self.type), "uint32_t count"]
+ body = ""
- # Generate function prototype.
- body = "static inline void {0}(".format(self.name)
- body += ", ".join(p for p in params)
- body += ")\n{\n"
+ if self.operand.needs_conversion():
+ if self.direction == Direction.OUTPUT:
+ params = ["const {0}_host *in".format(self.type), "{0} *out".format(self.type), "uint32_t count"]
+ else:
+ params = ["const {0} *in".format(self.type), "{0} *out_host".format(self.type), "uint32_t count"]
+
+ # Generate function prototype.
+ body += "static inline void {0}(".format(self.name)
+ body += ", ".join(p for p in params)
+ body += ")\n"
+
+ if self.operand.needs_unwrapping():
+ if self.operand.needs_conversion():
+ body += "#else\n"
+ else:
+ body += "#endif /* USE_STRUCT_CONVERSION */\n\n"
+
+ params = ["const {0} *in".format(self.type), "{0} *out".format(self.type), "uint32_t count"]
+
+ # Generate function prototype.
+ body += "static inline void {0}(".format(self.name)
+ body += ", ".join(p for p in params)
+ body += ")\n"
+
+ body += "{\n"
body += " unsigned int i;\n\n"
body += " if (!in) return;\n\n"
body += " for (i = 0; i < count; i++)\n"
body += " {\n"
- for m in self.struct:
- # TODO: support copying of pNext extension structures!
- body += " " + m.copy("in[i].", "out[i].", self.direction)
+ if isinstance(self.operand, VkStruct):
+ for m in self.operand:
+ # TODO: support copying of pNext extension structures!
+ convert = m.copy("in[i].", "out[i].", self.direction, True)
+ if self.operand.needs_conversion() and not self.operand.needs_unwrapping():
+ body += " " + convert
+ else:
+ unwrap = m.copy("in[i].", "out[i].", self.direction, False)
+ if unwrap == convert:
+ body += " " + unwrap
+ else:
+ body += "#if defined(USE_STRUCT_CONVERSION)\n {0}#else\n {1}#endif /* USE_STRUCT_CONVERSION */\n".format(convert, unwrap)
+ elif isinstance(self.operand, VkHandle) and self.direction == Direction.INPUT:
+ body += " out[i] = " + self.operand.driver_handle("in[i]") + ";\n"
+ else:
+ LOGGER.warn("Unhandled conversion operand type")
+ body += " out[i] = in[i];\n"
body += " }\n"
body += "}\n\n"
+
+ if self.operand.needs_unwrapping():
+ body += "#if defined(USE_STRUCT_CONVERSION)\n\n"
+
return body
def _set_name(self):
@@ -2044,10 +2291,10 @@ class ConversionFunction(object):
class FreeFunction(object):
- def __init__(self, dyn_array, struct):
+ def __init__(self, dyn_array, operand):
self.dyn_array = dyn_array
- self.struct = struct
- self.type = struct.name
+ self.operand = operand
+ self.type = operand.name
if dyn_array:
self.name = "free_{0}_array".format(self.type)
@@ -2060,25 +2307,47 @@ class FreeFunction(object):
def _generate_array_free_func(self):
""" Helper function for cleaning up temporary buffers required for array conversions. """
- # Generate function prototype.
- body = "static inline void {0}({1}_host *in, uint32_t count)\n{{\n".format(self.name, self.type)
+ body = ""
+
+ if self.operand.needs_conversion():
+ if self.operand.needs_unwrapping():
+ body += "#if defined(USE_STRUCT_CONVERSION)\n"
+
+ # Generate function prototype.
+ body += "static inline void {0}({1}_host *in, uint32_t count)\n".format(self.name, self.type)
+
+ if self.operand.needs_unwrapping():
+ if self.operand.needs_conversion():
+ body += "#else\n"
+
+ # Generate function prototype.
+ body += "static inline void {0}({1} *in, uint32_t count)\n".format(self.name, self.type)
+
+ if self.operand.needs_conversion():
+ body += "#endif /* USE_STRUCT_CONVERSION */\n"
+
+ body += "{\n"
# E.g. VkGraphicsPipelineCreateInfo_host needs freeing for pStages.
- if self.struct.needs_free():
+ if isinstance(self.operand, VkStruct) and self.operand.needs_free():
body += " unsigned int i;\n\n"
body += " if (!in) return;\n\n"
body += " for (i = 0; i < count; i++)\n"
body += " {\n"
- for m in self.struct:
- if m.needs_conversion() and m.is_dynamic_array():
- if m.is_const():
- # Add a cast to ignore const on conversion structs we allocated ourselves.
- body += " free_{0}_array(({0}_host *)in[i].{1}, in[i].{2});\n".format(m.type, m.name, m.dyn_array_len)
+ for m in self.operand:
+ if m.needs_free():
+ convert = m.free("in[i].", True)
+ if self.operand.needs_conversion() and not self.operand.needs_unwrapping():
+ body += " " + convert
else:
- body += " free_{0}_array(in[i].{1}, in[i].{2});\n".format(m.type, m.name, m.dyn_array_len)
- elif m.needs_conversion():
- LOGGER.error("Unhandled conversion for {0}".format(m.name))
+ unwrap = m.free("in[i].", False)
+ if convert == unwrap:
+ body += " " + unwrap
+ elif unwrap == "":
+ body += "#if defined(USE_STRUCT_CONVERSION)\n {0}#endif /* USE_STRUCT_CONVERSION */\n".format(convert)
+ else:
+ body += "#if defined(USE_STRUCT_CONVERSION)\n {0}#else\n {1}#endif /* USE_STRUCT_CONVERSION */\n".format(convert, unwrap)
body += " }\n"
else:
body += " if (!in) return;\n\n"
@@ -2086,26 +2355,44 @@ class FreeFunction(object):
body += " free(in);\n"
body += "}\n\n"
+
+ if self.operand.needs_unwrapping():
+ body += "#if defined(USE_STRUCT_CONVERSION)\n"
+
return body
def _generate_free_func(self):
# E.g. VkCommandBufferBeginInfo.pInheritanceInfo needs freeing.
- if not self.struct.needs_free():
+ if not self.operand.needs_free():
return ""
+ if not isinstance(self.operand, VkStruct):
+ return ""
+
+ body = ""
+
# Generate function prototype.
- body = "static inline void {0}({1}_host *in)\n{{\n".format(self.name, self.type)
+ body += "static inline void {0}({1}_host *in)\n{{\n".format(self.name, self.type)
- for m in self.struct:
- if m.needs_conversion() and m.is_dynamic_array():
- count = m.dyn_array_len if isinstance(m.dyn_array_len, int) else "in->{0}".format(m.dyn_array_len)
- if m.is_const():
- # Add a cast to ignore const on conversion structs we allocated ourselves.
- body += " free_{0}_array(({0}_host *)in->{1}, {2});\n".format(m.type, m.name, count)
+ for m in self.operand:
+ if m.needs_free():
+ convert = m.free("in->", True)
+ if self.operand.needs_conversion() and not self.operand.needs_unwrapping():
+ body += " " + convert
else:
- body += " free_{0}_array(in->{1}, {2});\n".format(m.type, m.name, count)
+ unwrap = m.free("in->", False)
+ if convert == unwrap:
+ body += " " + unwrap
+ elif unwrap == "":
+ body += "#if defined(USE_STRUCT_CONVERSION)\n {0}#endif /* USE_STRUCT_CONVERSION */\n".format(convert)
+ else:
+ body += "#if defined(USE_STRUCT_CONVERSION)\n {0}#else\n {1}#endif /* USE_STRUCT_CONVERSION */\n".format(convert, unwrap)
body += "}\n\n"
+
+ if self.operand.needs_unwrapping():
+ body += "#if defined(USE_STRUCT_CONVERSION)\n"
+
return body
def definition(self):
@@ -2168,7 +2455,12 @@ class StructChainConversionFunction(object):
if m.name == "pNext":
body += " out->pNext = NULL;\n"
else:
- body += " " + m.copy("in->", "out->", self.direction)
+ convert = m.copy("in->", "out->", self.direction, True)
+ unwrap = m.copy("in->", "out->", self.direction, False)
+ if unwrap == convert:
+ body += " " + unwrap
+ else:
+ body += "#if defined(USE_STRUCT_CONVERSION)\n {0}#else\n {1}#endif /* USE_STRUCT_CONVERSION */\n".format(convert, unwrap)
body += "\n out_header->pNext = (VkBaseOutStructure *)out;\n"
body += " out_header = out_header->pNext;\n"
@@ -2212,7 +2504,41 @@ class FreeStructChainFunction(object):
body += " while (header)\n"
body += " {\n"
- body += " void *prev = header;\n"
+ body += " void *prev = header;\n\n"
+ body += " switch (header->sType)\n"
+ body += " {\n"
+
+ for e in self.struct.struct_extensions:
+ if not e.required:
+ continue
+
+ if not any(m.needs_free() for m in e):
+ continue
+
+ stype = next(x for x in e.members if x.name == "sType")
+
+ body += " case {0}:\n".format(stype.values)
+ body += " {\n"
+ body += " {0} *structure = ({0} *) header;\n".format(e.name)
+
+ for m in e:
+ if m.needs_free():
+ convert = m.free("structure->", True)
+ unwrap = m.free("structure->", False)
+ if convert == unwrap:
+ body += " " + unwrap
+ elif unwrap == "":
+ body += "#if defined(USE_STRUCT_CONVERSION)\n {0}#endif /* USE_STRUCT_CONVERSION */\n".format(convert)
+ else:
+ body += "#if defined(USE_STRUCT_CONVERSION)\n {0}#else\n {1}#endif /* USE_STRUCT_CONVERSION */\n".format(convert, unwrap)
+
+ body += " break;\n"
+ body += " }\n"
+
+ body += " default:\n"
+ body += " break;\n"
+ body += " }\n"
+
body += " header = header->pNext;\n"
body += " free(prev);\n"
body += " }\n\n"
@@ -2235,7 +2561,7 @@ class VkGenerator(object):
if not func.is_required():
continue
- if not func.needs_conversion():
+ if not func.needs_conversion() and not func.needs_unwrapping():
continue
conversions = func.get_conversions()
@@ -2246,15 +2572,26 @@ class VkGenerator(object):
if not any(c == conv for c in self.conversions):
self.conversions.append(conv)
+ if not isinstance(conv.operand, VkStruct):
+ continue
+
# Structs can be used in different ways by different conversions
# e.g. array vs non-array. Just make sure we pull in each struct once.
- if not any(s.name == conv.struct.name for s in self.host_structs):
- self.host_structs.append(conv.struct)
+ if not any(s.name == conv.operand.name for s in self.host_structs):
+ self.host_structs.append(conv.operand)
for struct in self.registry.structs:
if struct.name in STRUCT_CHAIN_CONVERSIONS:
self.struct_chain_conversions.append(StructChainConversionFunction(Direction.INPUT, struct))
self.struct_chain_conversions.append(FreeStructChainFunction(struct))
+ # Once we decide to support pNext chains conversion everywhere, move this under get_conversions
+ for e in struct.struct_extensions:
+ for m in e:
+ if m.needs_conversion() or m.needs_unwrapping():
+ conversions = m.get_conversions()
+ for conv in conversions:
+ if not any(c == conv for c in self.conversions):
+ self.conversions.append(conv)
def _generate_copyright(self, f, spec_file=False):
f.write("# " if spec_file else "/* ")
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c
index 45eda78e997..58a67c6d285 100644
--- a/dlls/winevulkan/vulkan.c
+++ b/dlls/winevulkan/vulkan.c
@@ -1540,19 +1540,6 @@ void WINAPI wine_vkGetPrivateDataEXT(VkDevice device, VkObjectType object_type,
device->funcs.p_vkGetPrivateDataEXT(device->device, object_type, object_handle, private_data_slot, data);
}
-VkResult WINAPI wine_vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *create_info,
- const VkAllocationCallbacks *allocator, VkSwapchainKHR *swapchain)
-{
- VkSwapchainCreateInfoKHR native_info;
-
- TRACE("%p, %p, %p, %p\n", device, create_info, allocator, swapchain);
-
- native_info = *create_info;
- native_info.surface = wine_surface_from_handle(create_info->surface)->driver_surface;
-
- return thunk_vkCreateSwapchainKHR(device, &native_info, allocator, swapchain);
-}
-
VkResult WINAPI wine_vkCreateWin32SurfaceKHR(VkInstance instance,
const VkWin32SurfaceCreateInfoKHR *createInfo, const VkAllocationCallbacks *allocator, VkSurfaceKHR *surface)
{
@@ -1601,19 +1588,6 @@ void WINAPI wine_vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface,
free(object);
}
-VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice phys_dev,
- const VkPhysicalDeviceSurfaceInfo2KHR *surface_info, uint32_t *formats_count, VkSurfaceFormat2KHR *formats)
-{
- VkPhysicalDeviceSurfaceInfo2KHR native_info;
-
- TRACE("%p, %p, %p, %p\n", phys_dev, surface_info, formats_count, formats);
-
- native_info = *surface_info;
- native_info.surface = wine_surface_from_handle(surface_info->surface)->driver_surface;
-
- return thunk_vkGetPhysicalDeviceSurfaceFormats2KHR(phys_dev, &native_info, formats_count, formats);
-}
-
static inline void adjust_max_image_count(VkPhysicalDevice phys_dev, VkSurfaceCapabilitiesKHR* capabilities)
{
/* Many Windows games, for example Strange Brigade, No Man's Sky, Path of Exile
@@ -1647,15 +1621,11 @@ VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice
VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice phys_dev,
const VkPhysicalDeviceSurfaceInfo2KHR *surface_info, VkSurfaceCapabilities2KHR *capabilities)
{
- VkPhysicalDeviceSurfaceInfo2KHR native_info;
VkResult res;
TRACE("%p, %p, %p\n", phys_dev, surface_info, capabilities);
- native_info = *surface_info;
- native_info.surface = wine_surface_from_handle(surface_info->surface)->driver_surface;
-
- res = thunk_vkGetPhysicalDeviceSurfaceCapabilities2KHR(phys_dev, &native_info, capabilities);
+ res = thunk_vkGetPhysicalDeviceSurfaceCapabilities2KHR(phys_dev, surface_info, capabilities);
if (res == VK_SUCCESS)
adjust_max_image_count(phys_dev, &capabilities->surfaceCapabilities);
--
2.31.1
2
3
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/mfplat/buffer.c | 37 +++---
dlls/mfplat/main.c | 210 +++++++++++++++--------------------
dlls/mfplat/mediatype.c | 37 +++---
dlls/mfplat/mfplat_private.h | 3 +-
dlls/mfplat/sample.c | 28 +++--
5 files changed, 136 insertions(+), 179 deletions(-)
diff --git a/dlls/mfplat/buffer.c b/dlls/mfplat/buffer.c
index f428630ea01..e04cc1a9251 100644
--- a/dlls/mfplat/buffer.c
+++ b/dlls/mfplat/buffer.c
@@ -141,9 +141,9 @@ static ULONG WINAPI memory_buffer_Release(IMFMediaBuffer *iface)
clear_attributes_object(&buffer->dxgi_surface.attributes);
}
DeleteCriticalSection(&buffer->cs);
- heap_free(buffer->_2d.linear_buffer);
- heap_free(buffer->data);
- heap_free(buffer);
+ free(buffer->_2d.linear_buffer);
+ free(buffer->data);
+ free(buffer);
}
return refcount;
@@ -278,7 +278,7 @@ static HRESULT WINAPI memory_1d_2d_buffer_Lock(IMFMediaBuffer *iface, BYTE **dat
hr = MF_E_INVALIDREQUEST;
else if (!buffer->_2d.linear_buffer)
{
- if (!(buffer->_2d.linear_buffer = heap_alloc(ALIGN_SIZE(buffer->_2d.plane_size, MF_64_BYTE_ALIGNMENT))))
+ if (!(buffer->_2d.linear_buffer = malloc(ALIGN_SIZE(buffer->_2d.plane_size, MF_64_BYTE_ALIGNMENT))))
hr = E_OUTOFMEMORY;
}
@@ -310,7 +310,7 @@ static HRESULT WINAPI memory_1d_2d_buffer_Unlock(IMFMediaBuffer *iface)
MFCopyImage(buffer->data, buffer->_2d.pitch, buffer->_2d.linear_buffer, buffer->_2d.width,
buffer->_2d.width, buffer->_2d.height);
- heap_free(buffer->_2d.linear_buffer);
+ free(buffer->_2d.linear_buffer);
buffer->_2d.linear_buffer = NULL;
}
@@ -349,7 +349,7 @@ static HRESULT WINAPI d3d9_surface_buffer_Lock(IMFMediaBuffer *iface, BYTE **dat
{
D3DLOCKED_RECT rect;
- if (!(buffer->_2d.linear_buffer = heap_alloc(ALIGN_SIZE(buffer->_2d.plane_size, MF_64_BYTE_ALIGNMENT))))
+ if (!(buffer->_2d.linear_buffer = malloc(ALIGN_SIZE(buffer->_2d.plane_size, MF_64_BYTE_ALIGNMENT))))
hr = E_OUTOFMEMORY;
if (SUCCEEDED(hr))
@@ -401,7 +401,7 @@ static HRESULT WINAPI d3d9_surface_buffer_Unlock(IMFMediaBuffer *iface)
IDirect3DSurface9_UnlockRect(buffer->d3d9_surface.surface);
}
- heap_free(buffer->_2d.linear_buffer);
+ free(buffer->_2d.linear_buffer);
buffer->_2d.linear_buffer = NULL;
}
@@ -928,7 +928,7 @@ static HRESULT WINAPI dxgi_surface_buffer_Lock(IMFMediaBuffer *iface, BYTE **dat
hr = MF_E_INVALIDREQUEST;
else if (!buffer->_2d.linear_buffer)
{
- if (!(buffer->_2d.linear_buffer = heap_alloc(ALIGN_SIZE(buffer->_2d.plane_size, MF_64_BYTE_ALIGNMENT))))
+ if (!(buffer->_2d.linear_buffer = malloc(ALIGN_SIZE(buffer->_2d.plane_size, MF_64_BYTE_ALIGNMENT))))
hr = E_OUTOFMEMORY;
if (SUCCEEDED(hr))
@@ -974,7 +974,7 @@ static HRESULT WINAPI dxgi_surface_buffer_Unlock(IMFMediaBuffer *iface)
buffer->_2d.linear_buffer, buffer->_2d.width, buffer->_2d.width, buffer->_2d.height);
dxgi_surface_buffer_unmap(buffer);
- heap_free(buffer->_2d.linear_buffer);
+ free(buffer->_2d.linear_buffer);
buffer->_2d.linear_buffer = NULL;
}
@@ -1225,8 +1225,7 @@ static const IMFDXGIBufferVtbl dxgi_buffer_vtbl =
static HRESULT memory_buffer_init(struct buffer *buffer, DWORD max_length, DWORD alignment,
const IMFMediaBufferVtbl *vtbl)
{
- buffer->data = heap_alloc_zero(ALIGN_SIZE(max_length, alignment));
- if (!buffer->data)
+ if (!(buffer->data = calloc(1, ALIGN_SIZE(max_length, alignment))))
return E_OUTOFMEMORY;
buffer->IMFMediaBuffer_iface.lpVtbl = vtbl;
@@ -1248,14 +1247,13 @@ static HRESULT create_1d_buffer(DWORD max_length, DWORD alignment, IMFMediaBuffe
*buffer = NULL;
- object = heap_alloc_zero(sizeof(*object));
- if (!object)
+ if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
hr = memory_buffer_init(object, max_length, alignment, &memory_1d_buffer_vtbl);
if (FAILED(hr))
{
- heap_free(object);
+ free(object);
return hr;
}
@@ -1291,8 +1289,7 @@ static HRESULT create_2d_buffer(DWORD width, DWORD height, DWORD fourcc, BOOL bo
if (FAILED(hr = MFGetPlaneSize(fourcc, width, height, &plane_size)))
return hr;
- object = heap_alloc_zero(sizeof(*object));
- if (!object)
+ if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
switch (fourcc)
@@ -1326,7 +1323,7 @@ static HRESULT create_2d_buffer(DWORD width, DWORD height, DWORD fourcc, BOOL bo
if (FAILED(hr = memory_buffer_init(object, max_length, MF_1_BYTE_ALIGNMENT, &memory_1d_2d_buffer_vtbl)))
{
- heap_free(object);
+ free(object);
return hr;
}
@@ -1360,8 +1357,7 @@ static HRESULT create_d3d9_surface_buffer(IUnknown *surface, BOOL bottom_up, IMF
if (!(stride = mf_format_get_stride(&subtype, desc.Width, &is_yuv)))
return MF_E_INVALIDMEDIATYPE;
- object = heap_alloc_zero(sizeof(*object));
- if (!object)
+ if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
object->IMFMediaBuffer_iface.lpVtbl = &d3d9_surface_1d_buffer_vtbl;
@@ -1412,8 +1408,7 @@ static HRESULT create_dxgi_surface_buffer(IUnknown *surface, unsigned int sub_re
return MF_E_INVALIDMEDIATYPE;
}
- object = heap_alloc_zero(sizeof(*object));
- if (!object)
+ if (!(object = calloc(1, sizeof(*object))))
{
ID3D11Texture2D_Release(texture);
return E_OUTOFMEMORY;
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index c8d74b5d42c..1fc65f54ea2 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -47,27 +47,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
-static HRESULT heap_strdupW(const WCHAR *str, WCHAR **dest)
-{
- HRESULT hr = S_OK;
-
- if (str)
- {
- unsigned int size;
-
- size = (lstrlenW(str) + 1) * sizeof(WCHAR);
- *dest = heap_alloc(size);
- if (*dest)
- memcpy(*dest, str, size);
- else
- hr = E_OUTOFMEMORY;
- }
- else
- *dest = NULL;
-
- return hr;
-}
-
struct local_handler
{
struct list entry;
@@ -204,7 +183,7 @@ static ULONG WINAPI transform_activate_Release(IMFActivate *iface)
IClassFactory_Release(activate->factory);
if (activate->transform)
IMFTransform_Release(activate->transform);
- heap_free(activate);
+ free(activate);
}
return refcount;
@@ -598,13 +577,12 @@ static HRESULT create_transform_activate(IClassFactory *factory, IMFActivate **a
struct transform_activate *object;
HRESULT hr;
- object = heap_alloc_zero(sizeof(*object));
- if (!object)
+ if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = init_attributes_object(&object->attributes, 0)))
{
- heap_free(object);
+ free(object);
return hr;
}
@@ -745,14 +723,14 @@ static HRESULT register_transform(const CLSID *clsid, const WCHAR *name, UINT32
{
if (SUCCEEDED(hr = MFGetAttributesAsBlobSize(attributes, &size)))
{
- if ((blob = heap_alloc(size)))
+ if ((blob = malloc(size)))
{
if (SUCCEEDED(hr = MFGetAttributesAsBlob(attributes, blob, size)))
{
if ((ret = RegSetValueExW(hclsid, L"Attributes", 0, REG_BINARY, blob, size)))
hr = HRESULT_FROM_WIN32(ret);
}
- heap_free(blob);
+ free(blob);
}
else
hr = E_OUTOFMEMORY;
@@ -813,10 +791,10 @@ static void release_mft_registration(struct mft_registration *mft)
{
if (mft->factory)
IClassFactory_Release(mft->factory);
- heap_free(mft->name);
- heap_free(mft->input_types);
- heap_free(mft->output_types);
- heap_free(mft);
+ free(mft->name);
+ free(mft->input_types);
+ free(mft->output_types);
+ free(mft);
}
static HRESULT mft_register_local(IClassFactory *factory, REFCLSID clsid, REFGUID category, LPCWSTR name, UINT32 flags,
@@ -824,7 +802,7 @@ static HRESULT mft_register_local(IClassFactory *factory, REFCLSID clsid, REFGUI
const MFT_REGISTER_TYPE_INFO *output_types)
{
struct mft_registration *mft, *cur, *unreg_mft = NULL;
- HRESULT hr;
+ HRESULT hr = S_OK;
if (!factory && !clsid)
{
@@ -832,8 +810,7 @@ static HRESULT mft_register_local(IClassFactory *factory, REFCLSID clsid, REFGUI
return E_FAIL;
}
- mft = heap_alloc_zero(sizeof(*mft));
- if (!mft)
+ if (!(mft = calloc(1, sizeof(*mft))))
return E_OUTOFMEMORY;
mft->factory = factory;
@@ -846,13 +823,16 @@ static HRESULT mft_register_local(IClassFactory *factory, REFCLSID clsid, REFGUI
flags |= MFT_ENUM_FLAG_SYNCMFT;
mft->flags = flags;
mft->local = TRUE;
- if (FAILED(hr = heap_strdupW(name, &mft->name)))
+ if (name && !(mft->name = wcsdup(name)))
+ {
+ hr = E_OUTOFMEMORY;
goto failed;
+ }
if (input_count && input_types)
{
mft->input_types_count = input_count;
- if (!(mft->input_types = heap_calloc(mft->input_types_count, sizeof(*input_types))))
+ if (!(mft->input_types = calloc(mft->input_types_count, sizeof(*input_types))))
{
hr = E_OUTOFMEMORY;
goto failed;
@@ -863,7 +843,7 @@ static HRESULT mft_register_local(IClassFactory *factory, REFCLSID clsid, REFGUI
if (output_count && output_types)
{
mft->output_types_count = output_count;
- if (!(mft->output_types = heap_calloc(mft->output_types_count, sizeof(*output_types))))
+ if (!(mft->output_types = calloc(mft->output_types_count, sizeof(*output_types))))
{
hr = E_OUTOFMEMORY;
goto failed;
@@ -1063,14 +1043,14 @@ static void mft_get_reg_type_info(const WCHAR *clsidW, const WCHAR *typeW, MFT_R
if (!size || size % sizeof(**type))
goto out;
- if (!(*type = heap_alloc(size)))
+ if (!(*type = malloc(size)))
goto out;
*count = size / sizeof(**type);
if (RegQueryValueExW(hfilter, typeW, NULL, ®_type, (BYTE *)*type, &size))
{
- heap_free(*type);
+ free(*type);
*type = NULL;
*count = 0;
}
@@ -1139,12 +1119,12 @@ static HRESULT mft_collect_machine_reg(struct list *mfts, const GUID *category,
if (!mft_is_type_info_match(&mft, category, flags, plugin_control, input_type, output_type))
{
- heap_free(mft.input_types);
- heap_free(mft.output_types);
+ free(mft.input_types);
+ free(mft.output_types);
goto next;
}
- cur = heap_alloc(sizeof(*cur));
+ cur = malloc(sizeof(*cur));
/* Reuse allocated type arrays. */
*cur = mft;
list_add_tail(mfts, &cur->entry);
@@ -1216,7 +1196,7 @@ static HRESULT mft_enum(GUID category, UINT32 flags, const MFT_REGISTER_TYPE_INF
{
if (mft_is_type_info_match(local, &category, flags, plugin_control, input_type, output_type))
{
- mft = heap_alloc_zero(sizeof(*mft));
+ mft = calloc(1, sizeof(*mft));
mft->clsid = local->clsid;
mft->factory = local->factory;
@@ -2185,7 +2165,7 @@ static ULONG WINAPI mfattributes_Release(IMFAttributes *iface)
if (!refcount)
{
clear_attributes_object(attributes);
- heap_free(attributes);
+ free(attributes);
}
return refcount;
@@ -2671,7 +2651,7 @@ HRESULT attributes_DeleteAllItems(struct attributes *attributes)
{
PropVariantClear(&attributes->attributes[--attributes->count].value);
}
- heap_free(attributes->attributes);
+ free(attributes->attributes);
attributes->attributes = NULL;
attributes->capacity = 0;
@@ -3147,7 +3127,7 @@ void clear_attributes_object(struct attributes *object)
for (i = 0; i < object->count; i++)
PropVariantClear(&object->attributes[i].value);
- heap_free(object->attributes);
+ free(object->attributes);
DeleteCriticalSection(&object->cs);
}
@@ -3162,13 +3142,12 @@ HRESULT WINAPI MFCreateAttributes(IMFAttributes **attributes, UINT32 size)
TRACE("%p, %d\n", attributes, size);
- object = heap_alloc_zero(sizeof(*object));
- if (!object)
+ if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = init_attributes_object(object, size)))
{
- heap_free(object);
+ free(object);
return hr;
}
*attributes = &object->IMFAttributes_iface;
@@ -3575,7 +3554,7 @@ static ULONG WINAPI async_stream_op_Release(IUnknown *iface)
{
if (op->caller)
IMFAsyncResult_Release(op->caller);
- heap_free(op);
+ free(op);
}
return refcount;
@@ -3595,7 +3574,7 @@ static HRESULT bytestream_create_io_request(struct bytestream *stream, enum asyn
IRtwqAsyncResult *request;
HRESULT hr;
- op = heap_alloc(sizeof(*op));
+ op = malloc(sizeof(*op));
if (!op)
return E_OUTOFMEMORY;
@@ -3757,7 +3736,7 @@ static ULONG WINAPI bytestream_Release(IMFByteStream *iface)
IStream_Release(stream->stream);
if (stream->hfile)
CloseHandle(stream->hfile);
- heap_free(stream);
+ free(stream);
}
return refcount;
@@ -4320,13 +4299,12 @@ HRESULT WINAPI MFCreateMFByteStreamOnStream(IStream *stream, IMFByteStream **byt
TRACE("%p, %p.\n", stream, bytestream);
- object = heap_alloc_zero(sizeof(*object));
- if (!object)
+ if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = init_attributes_object(&object->attributes, 0)))
{
- heap_free(object);
+ free(object);
return hr;
}
@@ -4485,8 +4463,7 @@ HRESULT WINAPI MFCreateFile(MF_FILE_ACCESSMODE accessmode, MF_FILE_OPENMODE open
if(file == INVALID_HANDLE_VALUE)
return HRESULT_FROM_WIN32(GetLastError());
- object = heap_alloc_zero(sizeof(*object));
- if (!object)
+ if (!(object = calloc(1, sizeof(*object))))
{
CloseHandle(file);
return E_OUTOFMEMORY;
@@ -4495,7 +4472,7 @@ HRESULT WINAPI MFCreateFile(MF_FILE_ACCESSMODE accessmode, MF_FILE_OPENMODE open
if (FAILED(hr = init_attributes_object(&object->attributes, 2)))
{
CloseHandle(file);
- heap_free(object);
+ free(object);
return hr;
}
object->IMFByteStream_iface.lpVtbl = &bytestream_file_vtbl;
@@ -4668,7 +4645,7 @@ static ULONG WINAPI bytestream_wrapper_Release(IMFByteStream *iface)
if (wrapper->attributes)
IMFAttributes_Release(wrapper->attributes);
IMFByteStream_Release(wrapper->stream);
- heap_free(wrapper);
+ free(wrapper);
}
return refcount;
@@ -5545,8 +5522,7 @@ HRESULT WINAPI MFCreateMFByteStreamWrapper(IMFByteStream *stream, IMFByteStream
TRACE("%p, %p.\n", stream, wrapper);
- object = heap_alloc_zero(sizeof(*object));
- if (!object)
+ if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
object->IMFByteStreamCacheControl_iface.lpVtbl = &bytestream_wrapper_cache_control_vtbl;
@@ -5738,7 +5714,7 @@ static HRESULT resolver_handler_end_create(struct source_resolver *resolver, enu
IMFSchemeHandler *scheme_handler;
} handler;
- if (!(queued_result = heap_alloc_zero(sizeof(*queued_result))))
+ if (!(queued_result = calloc(1, sizeof(*queued_result))))
return E_OUTOFMEMORY;
queued_result->origin = origin;
@@ -5823,7 +5799,7 @@ static ULONG WINAPI resolver_cancel_object_Release(IUnknown *iface)
if (object->cancel_cookie)
IUnknown_Release(object->cancel_cookie);
IUnknown_Release(object->u.handler);
- heap_free(object);
+ free(object);
}
return refcount;
@@ -5850,8 +5826,7 @@ static HRESULT resolver_create_cancel_object(IUnknown *handler, enum resolved_ob
{
struct resolver_cancel_object *object;
- object = heap_alloc_zero(sizeof(*object));
- if (!object)
+ if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
object->IUnknown_iface.lpVtbl = &resolver_cancel_object_vtbl;
@@ -6153,7 +6128,7 @@ static HRESULT resolver_get_scheme_handler(const WCHAR *url, DWORD flags, IMFSch
}
len = ptr - url;
- scheme = heap_alloc((len + 1) * sizeof(WCHAR));
+ scheme = malloc((len + 1) * sizeof(WCHAR));
if (!scheme)
return E_OUTOFMEMORY;
@@ -6164,7 +6139,7 @@ static HRESULT resolver_get_scheme_handler(const WCHAR *url, DWORD flags, IMFSch
if (FAILED(hr) && url != fileschemeW)
hr = resolver_create_scheme_handler(fileschemeW, flags, handler);
- heap_free(scheme);
+ free(scheme);
return hr;
}
@@ -6202,7 +6177,7 @@ static HRESULT resolver_end_create_object(struct source_resolver *resolver, enum
hr = queued_result->hr;
if (queued_result->inner_result)
IRtwqAsyncResult_Release(queued_result->inner_result);
- heap_free(queued_result);
+ free(queued_result);
}
else
hr = E_UNEXPECTED;
@@ -6257,10 +6232,10 @@ static ULONG WINAPI source_resolver_Release(IMFSourceResolver *iface)
if (result->object)
IUnknown_Release(result->object);
list_remove(&result->entry);
- heap_free(result);
+ free(result);
}
DeleteCriticalSection(&resolver->cs);
- heap_free(resolver);
+ free(resolver);
}
return refcount;
@@ -6488,8 +6463,7 @@ HRESULT WINAPI MFCreateSourceResolver(IMFSourceResolver **resolver)
if (!resolver)
return E_POINTER;
- object = heap_alloc_zero(sizeof(*object));
- if (!object)
+ if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
object->IMFSourceResolver_iface.lpVtbl = &mfsourceresolvervtbl;
@@ -6564,7 +6538,7 @@ static ULONG WINAPI mfmediaevent_Release(IMFMediaEvent *iface)
{
clear_attributes_object(&event->attributes);
PropVariantClear(&event->value);
- heap_free(event);
+ free(event);
}
return refcount;
@@ -6941,13 +6915,13 @@ HRESULT WINAPI MFCreateMediaEvent(MediaEventType type, REFGUID extended_type, HR
TRACE("%s, %s, %#x, %s, %p.\n", debugstr_eventid(type), debugstr_guid(extended_type), status,
debugstr_propvar(value), event);
- object = heap_alloc(sizeof(*object));
+ object = malloc(sizeof(*object));
if (!object)
return E_OUTOFMEMORY;
if (FAILED(hr = init_attributes_object(&object->attributes, 0)))
{
- heap_free(object);
+ free(object);
return hr;
}
object->IMFMediaEvent_iface.lpVtbl = &mfmediaevent_vtbl;
@@ -7003,7 +6977,7 @@ static IMFMediaEvent *queue_pop_event(struct event_queue *queue)
queued_event = LIST_ENTRY(head, struct queued_event, entry);
event = queued_event->event;
list_remove(&queued_event->entry);
- heap_free(queued_event);
+ free(queued_event);
return event;
}
@@ -7063,7 +7037,7 @@ static ULONG WINAPI eventqueue_Release(IMFMediaEventQueue *iface)
{
event_queue_cleanup(queue);
DeleteCriticalSection(&queue->cs);
- heap_free(queue);
+ free(queue);
}
return refcount;
@@ -7179,7 +7153,7 @@ static HRESULT eventqueue_queue_event(struct event_queue *queue, IMFMediaEvent *
struct queued_event *queued_event;
HRESULT hr = S_OK;
- queued_event = heap_alloc(sizeof(*queued_event));
+ queued_event = malloc(sizeof(*queued_event));
if (!queued_event)
return E_OUTOFMEMORY;
@@ -7199,7 +7173,7 @@ static HRESULT eventqueue_queue_event(struct event_queue *queue, IMFMediaEvent *
LeaveCriticalSection(&queue->cs);
if (FAILED(hr))
- heap_free(queued_event);
+ free(queued_event);
WakeAllConditionVariable(&queue->update_event);
@@ -7298,8 +7272,7 @@ HRESULT WINAPI MFCreateEventQueue(IMFMediaEventQueue **queue)
TRACE("%p\n", queue);
- object = heap_alloc_zero(sizeof(*object));
- if (!object)
+ if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
object->IMFMediaEventQueue_iface.lpVtbl = &eventqueuevtbl;
@@ -7337,7 +7310,7 @@ static void collection_clear(struct collection *collection)
IUnknown_Release(collection->elements[i]);
}
- heap_free(collection->elements);
+ free(collection->elements);
collection->elements = NULL;
collection->count = 0;
collection->capacity = 0;
@@ -7380,8 +7353,8 @@ static ULONG WINAPI collection_Release(IMFCollection *iface)
if (!refcount)
{
collection_clear(collection);
- heap_free(collection->elements);
- heap_free(collection);
+ free(collection->elements);
+ free(collection);
}
return refcount;
@@ -7527,8 +7500,7 @@ HRESULT WINAPI MFCreateCollection(IMFCollection **collection)
if (!collection)
return E_POINTER;
- object = heap_alloc_zero(sizeof(*object));
- if (!object)
+ if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
object->IMFCollection_iface.lpVtbl = &mfcollectionvtbl;
@@ -7602,7 +7574,7 @@ static ULONG WINAPI system_clock_Release(IMFClock *iface)
TRACE("%p, refcount %u.\n", iface, refcount);
if (!refcount)
- heap_free(clock);
+ free(clock);
return refcount;
}
@@ -7676,7 +7648,7 @@ static HRESULT create_system_clock(IMFClock **clock)
{
struct system_clock *object;
- if (!(object = heap_alloc(sizeof(*object))))
+ if (!(object = malloc(sizeof(*object))))
return E_OUTOFMEMORY;
object->IMFClock_iface.lpVtbl = &system_clock_vtbl;
@@ -7735,7 +7707,7 @@ static ULONG WINAPI system_time_source_Release(IMFPresentationTimeSource *iface)
if (source->clock)
IMFClock_Release(source->clock);
DeleteCriticalSection(&source->cs);
- heap_free(source);
+ free(source);
}
return refcount;
@@ -8025,7 +7997,7 @@ HRESULT WINAPI MFCreateSystemTimeSource(IMFPresentationTimeSource **time_source)
TRACE("%p.\n", time_source);
- object = heap_alloc_zero(sizeof(*object));
+ object = calloc(1, sizeof(*object));
if (!object)
return E_OUTOFMEMORY;
@@ -8105,8 +8077,8 @@ static ULONG WINAPI async_create_file_callback_Release(IRtwqAsyncCallback *iface
if (!refcount)
{
- heap_free(async->path);
- heap_free(async);
+ free(async->path);
+ free(async);
}
return refcount;
@@ -8131,7 +8103,7 @@ static HRESULT WINAPI async_create_file_callback_Invoke(IRtwqAsyncCallback *ifac
{
struct async_create_file_result *result_item;
- result_item = heap_alloc(sizeof(*result_item));
+ result_item = malloc(sizeof(*result_item));
if (result_item)
{
result_item->result = caller;
@@ -8182,8 +8154,7 @@ HRESULT WINAPI MFBeginCreateFile(MF_FILE_ACCESSMODE access_mode, MF_FILE_OPENMOD
if (FAILED(hr = RtwqCreateAsyncResult(NULL, (IRtwqAsyncCallback *)callback, state, &caller)))
return hr;
- async = heap_alloc(sizeof(*async));
- if (!async)
+ if (!(async = malloc(sizeof(*async))))
{
hr = E_OUTOFMEMORY;
goto failed;
@@ -8194,8 +8165,11 @@ HRESULT WINAPI MFBeginCreateFile(MF_FILE_ACCESSMODE access_mode, MF_FILE_OPENMOD
async->access_mode = access_mode;
async->open_mode = open_mode;
async->flags = flags;
- if (FAILED(hr = heap_strdupW(path, &async->path)))
+ if (!(async->path = wcsdup(path)))
+ {
+ hr = E_OUTOFMEMORY;
goto failed;
+ }
hr = RtwqCreateAsyncResult(NULL, &async->IRtwqAsyncCallback_iface, (IUnknown *)caller, &item);
if (FAILED(hr))
@@ -8240,7 +8214,7 @@ static HRESULT async_create_file_pull_result(IUnknown *unk, IMFByteStream **stre
*stream = item->stream;
IRtwqAsyncResult_Release(item->result);
list_remove(&item->entry);
- heap_free(item);
+ free(item);
break;
}
}
@@ -8289,20 +8263,19 @@ HRESULT WINAPI MFCancelCreateFile(IUnknown *cancel_cookie)
HRESULT WINAPI MFRegisterLocalSchemeHandler(const WCHAR *scheme, IMFActivate *activate)
{
struct local_handler *handler;
- HRESULT hr;
TRACE("%s, %p.\n", debugstr_w(scheme), activate);
if (!scheme || !activate)
return E_INVALIDARG;
- if (!(handler = heap_alloc(sizeof(*handler))))
+ if (!(handler = malloc(sizeof(*handler))))
return E_OUTOFMEMORY;
- if (FAILED(hr = heap_strdupW(scheme, &handler->u.scheme)))
+ if (!(handler->u.scheme = wcsdup(scheme)))
{
- heap_free(handler);
- return hr;
+ free(handler);
+ return E_OUTOFMEMORY;
}
handler->activate = activate;
IMFActivate_AddRef(handler->activate);
@@ -8320,35 +8293,32 @@ HRESULT WINAPI MFRegisterLocalSchemeHandler(const WCHAR *scheme, IMFActivate *ac
HRESULT WINAPI MFRegisterLocalByteStreamHandler(const WCHAR *extension, const WCHAR *mime, IMFActivate *activate)
{
struct local_handler *handler;
- HRESULT hr;
TRACE("%s, %s, %p.\n", debugstr_w(extension), debugstr_w(mime), activate);
if ((!extension && !mime) || !activate)
return E_INVALIDARG;
- if (!(handler = heap_alloc_zero(sizeof(*handler))))
+ if (!(handler = calloc(1, sizeof(*handler))))
return E_OUTOFMEMORY;
- hr = heap_strdupW(extension, &handler->u.bytestream.extension);
- if (SUCCEEDED(hr))
- hr = heap_strdupW(mime, &handler->u.bytestream.mime);
-
- if (FAILED(hr))
+ if (extension && !(handler->u.bytestream.extension = wcsdup(extension)))
+ goto failed;
+ if (mime && !(handler->u.bytestream.mime = wcsdup(mime)))
goto failed;
EnterCriticalSection(&local_handlers_section);
list_add_head(&local_bytestream_handlers, &handler->entry);
LeaveCriticalSection(&local_handlers_section);
- return hr;
+ return S_OK;
failed:
- heap_free(handler->u.bytestream.extension);
- heap_free(handler->u.bytestream.mime);
- heap_free(handler);
+ free(handler->u.bytestream.extension);
+ free(handler->u.bytestream.mime);
+ free(handler);
- return hr;
+ return E_OUTOFMEMORY;
}
struct property_store
@@ -8405,8 +8375,8 @@ static ULONG WINAPI property_store_Release(IPropertyStore *iface)
if (!refcount)
{
DeleteCriticalSection(&store->cs);
- heap_free(store->values);
- heap_free(store);
+ free(store->values);
+ free(store);
}
return refcount;
@@ -8540,7 +8510,7 @@ HRESULT WINAPI CreatePropertyStore(IPropertyStore **store)
if (!store)
return E_INVALIDARG;
- if (!(object = heap_alloc_zero(sizeof(*object))))
+ if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
object->IPropertyStore_iface.lpVtbl = &property_store_vtbl;
@@ -8640,8 +8610,8 @@ static ULONG WINAPI dxgi_device_manager_Release(IMFDXGIDeviceManager *iface)
if (manager->device)
IDXGIDevice_Release(manager->device);
DeleteCriticalSection(&manager->cs);
- heap_free(manager->handles);
- heap_free(manager);
+ free(manager->handles);
+ free(manager);
}
return refcount;
@@ -8926,7 +8896,7 @@ HRESULT WINAPI MFCreateDXGIDeviceManager(UINT *token, IMFDXGIDeviceManager **man
if (!token || !manager)
return E_POINTER;
- if (!(object = heap_alloc_zero(sizeof(*object))))
+ if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
object->IMFDXGIDeviceManager_iface.lpVtbl = &dxgi_device_manager_vtbl;
diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c
index 92d219f26e1..61f1a75d90b 100644
--- a/dlls/mfplat/mediatype.c
+++ b/dlls/mfplat/mediatype.c
@@ -157,7 +157,7 @@ static ULONG WINAPI mediatype_Release(IMFMediaType *iface)
clear_attributes_object(&media_type->attributes);
CoTaskMemFree(media_type->video_format);
CoTaskMemFree(media_type->audio_format);
- heap_free(media_type);
+ free(media_type);
}
return refcount;
@@ -1435,13 +1435,12 @@ static HRESULT create_media_type(struct media_type **ret)
struct media_type *object;
HRESULT hr;
- object = heap_alloc_zero(sizeof(*object));
- if (!object)
+ if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = init_attributes_object(&object->attributes, 0)))
{
- heap_free(object);
+ free(object);
return hr;
}
object->IMFMediaType_iface.lpVtbl = &mediatypevtbl;
@@ -1519,11 +1518,11 @@ static ULONG WINAPI stream_descriptor_Release(IMFStreamDescriptor *iface)
if (stream_desc->media_types[i])
IMFMediaType_Release(stream_desc->media_types[i]);
}
- heap_free(stream_desc->media_types);
+ free(stream_desc->media_types);
if (stream_desc->current_type)
IMFMediaType_Release(stream_desc->current_type);
clear_attributes_object(&stream_desc->attributes);
- heap_free(stream_desc);
+ free(stream_desc);
}
return refcount;
@@ -2052,19 +2051,18 @@ HRESULT WINAPI MFCreateStreamDescriptor(DWORD identifier, DWORD count,
if (!count)
return E_INVALIDARG;
- object = heap_alloc_zero(sizeof(*object));
- if (!object)
+ if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = init_attributes_object(&object->attributes, 0)))
{
- heap_free(object);
+ free(object);
return hr;
}
object->IMFStreamDescriptor_iface.lpVtbl = &streamdescriptorvtbl;
object->IMFMediaTypeHandler_iface.lpVtbl = &mediatypehandlervtbl;
object->identifier = identifier;
- object->media_types = heap_alloc(count * sizeof(*object->media_types));
+ object->media_types = calloc(count, sizeof(*object->media_types));
if (!object->media_types)
{
IMFStreamDescriptor_Release(&object->IMFStreamDescriptor_iface);
@@ -2127,8 +2125,8 @@ static ULONG WINAPI presentation_descriptor_Release(IMFPresentationDescriptor *i
IMFStreamDescriptor_Release(presentation_desc->descriptors[i].descriptor);
}
clear_attributes_object(&presentation_desc->attributes);
- heap_free(presentation_desc->descriptors);
- heap_free(presentation_desc);
+ free(presentation_desc->descriptors);
+ free(presentation_desc);
}
return refcount;
@@ -2491,8 +2489,7 @@ static HRESULT WINAPI presentation_descriptor_Clone(IMFPresentationDescriptor *i
TRACE("%p, %p.\n", iface, descriptor);
- object = heap_alloc_zero(sizeof(*object));
- if (!object)
+ if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
presentation_descriptor_init(object, presentation_desc->count);
@@ -2563,8 +2560,7 @@ static HRESULT presentation_descriptor_init(struct presentation_desc *object, DW
if (FAILED(hr = init_attributes_object(&object->attributes, 0)))
return hr;
object->IMFPresentationDescriptor_iface.lpVtbl = &presentationdescriptorvtbl;
- object->descriptors = heap_alloc_zero(count * sizeof(*object->descriptors));
- if (!object->descriptors)
+ if (!(object->descriptors = calloc(count, sizeof(*object->descriptors))))
{
IMFPresentationDescriptor_Release(&object->IMFPresentationDescriptor_iface);
return E_OUTOFMEMORY;
@@ -2595,13 +2591,12 @@ HRESULT WINAPI MFCreatePresentationDescriptor(DWORD count, IMFStreamDescriptor *
return E_INVALIDARG;
}
- object = heap_alloc_zero(sizeof(*object));
- if (!object)
+ if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = presentation_descriptor_init(object, count)))
{
- heap_free(object);
+ free(object);
return hr;
}
@@ -2818,7 +2813,7 @@ HRESULT WINAPI MFWrapMediaType(IMFMediaType *original, REFGUID major, REFGUID su
if (FAILED(hr = MFGetAttributesAsBlobSize((IMFAttributes *)original, &size)))
return hr;
- if (!(buffer = heap_alloc(size)))
+ if (!(buffer = malloc(size)))
return E_OUTOFMEMORY;
if (FAILED(hr = MFGetAttributesAsBlob((IMFAttributes *)original, buffer, size)))
@@ -2839,7 +2834,7 @@ HRESULT WINAPI MFWrapMediaType(IMFMediaType *original, REFGUID major, REFGUID su
*ret = mediatype;
failed:
- heap_free(buffer);
+ free(buffer);
return hr;
}
diff --git a/dlls/mfplat/mfplat_private.h b/dlls/mfplat/mfplat_private.h
index 117907bb1a9..b646d9e7cbb 100644
--- a/dlls/mfplat/mfplat_private.h
+++ b/dlls/mfplat/mfplat_private.h
@@ -25,7 +25,6 @@
#include "mferror.h"
#include "d3d9types.h"
-#include "wine/heap.h"
#include "wine/debug.h"
struct attribute
@@ -106,7 +105,7 @@ static inline BOOL mf_array_reserve(void **elements, size_t *capacity, size_t co
if (new_capacity < count)
new_capacity = max_capacity;
- if (!(new_elements = heap_realloc(*elements, new_capacity * size)))
+ if (!(new_elements = realloc(*elements, new_capacity * size)))
return FALSE;
*elements = new_elements;
diff --git a/dlls/mfplat/sample.c b/dlls/mfplat/sample.c
index cdd3d897169..93c5f923cc2 100644
--- a/dlls/mfplat/sample.c
+++ b/dlls/mfplat/sample.c
@@ -162,8 +162,8 @@ static void release_sample_object(struct sample *sample)
for (i = 0; i < sample->buffer_count; ++i)
IMFMediaBuffer_Release(sample->buffers[i]);
clear_attributes_object(&sample->attributes);
- heap_free(sample->buffers);
- heap_free(sample);
+ free(sample->buffers);
+ free(sample);
}
static ULONG WINAPI sample_Release(IMFSample *iface)
@@ -1020,13 +1020,12 @@ HRESULT WINAPI MFCreateSample(IMFSample **sample)
TRACE("%p.\n", sample);
- object = heap_alloc_zero(sizeof(*object));
- if (!object)
+ if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = init_attributes_object(&object->attributes, 0)))
{
- heap_free(object);
+ free(object);
return hr;
}
@@ -1049,13 +1048,12 @@ HRESULT WINAPI MFCreateTrackedSample(IMFTrackedSample **sample)
TRACE("%p.\n", sample);
- object = heap_alloc_zero(sizeof(*object));
- if (!object)
+ if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = init_attributes_object(&object->attributes, 0)))
{
- heap_free(object);
+ free(object);
return hr;
}
@@ -1112,13 +1110,13 @@ static void sample_allocator_release_samples(struct sample_allocator *allocator)
{
list_remove(&iter->entry);
IMFSample_Release(iter->sample);
- heap_free(iter);
+ free(iter);
}
LIST_FOR_EACH_ENTRY_SAFE(iter, iter2, &allocator->used_samples, struct queued_sample, entry)
{
list_remove(&iter->entry);
- heap_free(iter);
+ free(iter);
}
allocator->free_sample_count = 0;
@@ -1183,7 +1181,7 @@ static ULONG WINAPI sample_allocator_Release(IMFVideoSampleAllocatorEx *iface)
sample_allocator_set_attributes(allocator, NULL);
sample_allocator_release_samples(allocator);
DeleteCriticalSection(&allocator->cs);
- heap_free(allocator);
+ free(allocator);
}
return refcount;
@@ -1308,7 +1306,7 @@ static void sample_allocator_release_surface_service(struct sample_allocator *al
static HRESULT sample_allocator_allocate_sample(struct sample_allocator *allocator, const struct surface_service *service,
IMFSample **sample)
{
- struct queued_sample *queued_sample = heap_alloc(sizeof(*queued_sample));
+ struct queued_sample *queued_sample = malloc(sizeof(*queued_sample));
IMFTrackedSample *tracked_sample;
IMFMediaBuffer *buffer;
unsigned int i;
@@ -1445,7 +1443,7 @@ static HRESULT sample_allocator_initialize(struct sample_allocator *allocator, u
if (SUCCEEDED(hr = sample_allocator_allocate_sample(allocator, &service, &sample)))
{
- queued_sample = heap_alloc(sizeof(*queued_sample));
+ queued_sample = malloc(sizeof(*queued_sample));
queued_sample->sample = sample;
list_add_tail(&allocator->free_samples, &queued_sample->entry);
allocator->free_sample_count++;
@@ -1534,7 +1532,7 @@ static HRESULT WINAPI sample_allocator_AllocateSample(IMFVideoSampleAllocatorEx
{
if (SUCCEEDED(hr = sample_allocator_track_sample(allocator, sample)))
{
- struct queued_sample *queued_sample = heap_alloc(sizeof(*queued_sample));
+ struct queued_sample *queued_sample = malloc(sizeof(*queued_sample));
queued_sample->sample = sample;
list_add_tail(&allocator->used_samples, &queued_sample->entry);
@@ -1738,7 +1736,7 @@ HRESULT WINAPI MFCreateVideoSampleAllocatorEx(REFIID riid, void **obj)
TRACE("%s, %p.\n", debugstr_guid(riid), obj);
- if (!(object = heap_alloc_zero(sizeof(*object))))
+ if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
object->IMFVideoSampleAllocatorEx_iface.lpVtbl = &sample_allocator_vtbl;
--
2.30.2
1
0
12 May '21
Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com>
---
programs/reg/tests/copy.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/programs/reg/tests/copy.c b/programs/reg/tests/copy.c
index 31223a3d314..0d245dae4da 100644
--- a/programs/reg/tests/copy.c
+++ b/programs/reg/tests/copy.c
@@ -88,11 +88,38 @@ static void test_command_syntax(void)
run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" COPY_SRC, &r);
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+ run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" COPY_SRC, &r);
+ ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+
+ run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" COPY_SRC "\\", &r);
+ ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+
+ run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" COPY_SRC "\\", &r);
+ ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+
run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" COPY_SRC " /f", &r);
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+ run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" COPY_SRC " /f", &r);
+ ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+
+ run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" COPY_SRC "\\ /f", &r);
+ ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+
+ run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" COPY_SRC "\\ /f", &r);
+ ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+
run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" COPY_SRC " /s /f", &r);
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+
+ run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" COPY_SRC " /s /f", &r);
+ ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+
+ run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" COPY_SRC "\\ /s /f", &r);
+ ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+
+ run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" COPY_SRC "\\ /s /f", &r);
+ ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
}
START_TEST(copy)
--
2.31.1
1
0
12 May '21
Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com>
---
programs/reg/delete.c | 35 ++++++++++++++++++++++++++++-------
1 file changed, 28 insertions(+), 7 deletions(-)
diff --git a/programs/reg/delete.c b/programs/reg/delete.c
index f8e62e490b9..8804e16e52f 100644
--- a/programs/reg/delete.c
+++ b/programs/reg/delete.c
@@ -18,9 +18,27 @@
#include "reg.h"
+static BOOL op_delete_key = TRUE;
+
+static void output_error(LONG rc)
+{
+ if (rc == ERROR_FILE_NOT_FOUND)
+ {
+ if (op_delete_key)
+ output_message(STRING_KEY_NONEXIST);
+ else
+ output_message(STRING_VALUE_NONEXIST);
+ }
+ else
+ {
+ output_message(STRING_ACCESS_DENIED);
+ }
+}
+
static int run_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name,
BOOL value_empty, BOOL value_all, BOOL force)
{
+ LONG rc;
HKEY hkey;
if (!force)
@@ -44,26 +62,28 @@ static int run_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name
/* Delete registry key if no /v* option is given */
if (!value_name && !value_empty && !value_all)
{
- if (RegDeleteTreeW(root, path) != ERROR_SUCCESS)
+ if ((rc = RegDeleteTreeW(root, path)))
{
- output_message(STRING_KEY_NONEXIST);
+ output_error(rc);
return 1;
}
+
output_message(STRING_SUCCESS);
return 0;
}
- if (RegOpenKeyExW(root, path, 0, KEY_READ|KEY_SET_VALUE, &hkey))
+ if ((rc = RegOpenKeyExW(root, path, 0, KEY_READ|KEY_SET_VALUE, &hkey)))
{
- output_message(STRING_KEY_NONEXIST);
+ output_error(rc);
return 1;
}
+ op_delete_key = FALSE;
+
if (value_all)
{
DWORD max_value_len = 256, value_len;
WCHAR *value_name;
- LONG rc;
value_name = malloc(max_value_len * sizeof(WCHAR));
@@ -79,6 +99,7 @@ static int run_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name
free(value_name);
RegCloseKey(hkey);
output_message(STRING_VALUEALL_FAILED, key_name);
+ output_error(rc);
return 1;
}
}
@@ -93,10 +114,10 @@ static int run_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name
}
else if (value_name || value_empty)
{
- if (RegDeleteValueW(hkey, value_name))
+ if ((rc = RegDeleteValueW(hkey, value_name)))
{
RegCloseKey(hkey);
- output_message(STRING_VALUE_NONEXIST);
+ output_error(rc);
return 1;
}
}
--
2.31.1
1
2
12 May '21
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
include/msxml6.idl | 102 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 102 insertions(+)
diff --git a/include/msxml6.idl b/include/msxml6.idl
index 5bfb21d04ae..4948de39f1f 100644
--- a/include/msxml6.idl
+++ b/include/msxml6.idl
@@ -52,6 +52,8 @@ interface IXMLDOMEntity;
interface IXMLDOMEntityReference;
interface IXMLDOMParseError;
interface IXMLDOMParseErrorCollection;
+interface IXMLHTTPRequest2Callback;
+interface IXMLHTTPRequest3Callback;
interface IXTLRuntime;
interface IXSLTemplate;
interface IXSLProcessor;
@@ -254,6 +256,35 @@ typedef enum _SCHEMATYPEVARIETY
} SCHEMATYPEVARIETY;
cpp_quote("#endif /* __msxml_som_enums__ */")
+typedef [v1_enum] enum _XHR_PROPERTY
+{
+ XHR_PROP_NO_CRED_PROMPT,
+ XHR_PROP_NO_AUTH,
+ XHR_PROP_TIMEOUT,
+ XHR_PROP_NO_DEFAULT_HEADERS,
+ XHR_PROP_REPORT_REDIRECT_STATUS,
+ XHR_PROP_NO_CACHE,
+ XHR_PROP_EXTENDED_ERROR,
+ XHR_PROP_QUERY_STRING_UTF8,
+ XHR_PROP_IGNORE_CERT_ERRORS,
+} XHR_PROPERTY;
+
+typedef struct tagXHR_COOKIE
+{
+ [ref, string] WCHAR *pwszUrl;
+ [ref, string] WCHAR *pwszName;
+ [unique, string] WCHAR *pwszValue;
+ [unique, string] WCHAR *pwszP3PPolicy;
+ FILETIME ftExpires;
+ DWORD dwFlags;
+} XHR_COOKIE;
+
+typedef struct tagXHR_CERT
+{
+ DWORD cbCert;
+ [ref, size_is(cbCert)] BYTE *pbCert;
+} XHR_CERT;
+
[
local,
object,
@@ -1309,6 +1340,66 @@ interface IServerXMLHTTPRequest : IXMLHTTPRequest
[in] VARIANT value);
}
+[
+ object,
+ uuid(e5d37dc0-552a-4d52-9cc0-a14d546fbd04),
+]
+interface IXMLHTTPRequest2 : IUnknown
+{
+ HRESULT Open([in, string, ref] const WCHAR *method, [in, string, ref] const WCHAR *url,
+ [in] IXMLHTTPRequest2Callback *callback,
+ [in, string, unique] const WCHAR *username, [in, string, unique] const WCHAR *password,
+ [in, string, unique] const WCHAR *proxyuser, [in, string, unique] const WCHAR *proxypassword);
+
+ HRESULT Send([in, unique] ISequentialStream *body, [in] ULONGLONG length);
+ HRESULT Abort();
+ HRESULT SetCookie([in, ref] const XHR_COOKIE *cookie, [out] DWORD *state);
+ HRESULT SetCustomResponseStream([in] ISequentialStream *stream);
+ HRESULT SetProperty([in] XHR_PROPERTY property, [in] ULONGLONG value);
+ HRESULT SetRequestHeader([in, string, ref] const WCHAR *header, [in, string, unique] const WCHAR *value);
+ HRESULT GetAllResponseHeaders([out, string] WCHAR **headers);
+ HRESULT GetCookie( [in, ref, string] const WCHAR *url, [in, unique, string] const WCHAR *name,
+ [in] DWORD flags, [out] ULONG *cookies_cnt, [out, size_is(,*cookies_cnt)] XHR_COOKIE **cookies);
+ HRESULT GetResponseHeader([in, string, ref] const WCHAR *header, [out, string] WCHAR **value);
+};
+
+[
+ object,
+ uuid(a1c9feee-0617-4f23-9d58-8961ea43567c)
+]
+interface IXMLHTTPRequest3 : IXMLHTTPRequest2
+{
+ HRESULT SetClientCertificate([in] DWORD count, [in, unique, size_is(count)] const BYTE *hashes,
+ [in, string, unique] const WCHAR *pin);
+};
+
+[
+ object,
+ uuid(a44a9299-e321-40de-8866-341b41669162),
+ pointer_default(ref)
+]
+interface IXMLHTTPRequest2Callback : IUnknown
+{
+ HRESULT OnRedirect([in] IXMLHTTPRequest2 *xhr, [in, string] const WCHAR *url);
+ HRESULT OnHeadersAvailable([in] IXMLHTTPRequest2 *xhr, [in] DWORD status, [in, string] const WCHAR *msg);
+ HRESULT OnDataAvailable([in] IXMLHTTPRequest2 *xhr, [in] ISequentialStream *stream);
+ HRESULT OnResponseReceived([in] IXMLHTTPRequest2 *xhr, [in] ISequentialStream *stream);
+ HRESULT OnError([in] IXMLHTTPRequest2 *xhr, [in] HRESULT error);
+};
+
+[
+ object,
+ uuid(b9e57830-8c6c-4a6f-9c13-47772bb047bb)
+]
+interface IXMLHTTPRequest3Callback : IXMLHTTPRequest2Callback
+{
+ HRESULT OnServerCertificateReceived([in] IXMLHTTPRequest3 *xhr, [in] DWORD errors,
+ [in] DWORD count, [in, unique, size_is(count)] const XHR_CERT *certificates);
+
+ HRESULT OnClientCertificateRequested([in] IXMLHTTPRequest3 *xhr,
+ [in] DWORD count, [in, string, unique, size_is(count)] const WCHAR **list);
+};
+
[
object,
dual,
@@ -1607,6 +1698,17 @@ interface ISAXDeclHandler : IUnknown
[in] int nSystemId);
}
+[
+ helpstring("Free Threaded XML HTTP Request class 6.0"),
+ progid("Msxml2.FreeThreadedXMLHTTP60.6.0"),
+ threading(both),
+ uuid(88d96a09-f192-11d4-a65f-0040963251e5)
+]
+coclass FreeThreadedXMLHTTP60
+{
+ [default] interface IXMLHTTPRequest2;
+}
+
[
object,
local,
--
2.30.2
2
1
12 May '21
This used to default to false before Catalina, and it still does so when
the application is built with XCode 10 or earlier. When building with
XCode 11 or later Catalina and newer will create a high DPI GL view even
if the window is low dpi. Because we don't adjust glViewport parameters
(and glDrawPixels, etc) we render only to the lower left quadrant.
Signed-off-by: Stefan Dösinger <stefan(a)codeweavers.com>
---
Vulkan via MoltenVK already works correctly.
Try 4 with the signed-off-by: This time above the cut...
---
dlls/winemac.drv/cocoa_window.m | 2 ++
1 file changed, 2 insertions(+)
diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m
index b6c5386469c..29ac32d6be0 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -685,6 +685,7 @@ - (void) setRetinaMode:(int)mode
frame.size.width *= scale;
frame.size.height *= scale;
[self setFrame:frame];
+ [self setWantsBestResolutionOpenGLSurface:mode];
[self updateGLContexts];
[super setRetinaMode:mode];
@@ -3575,6 +3576,7 @@ macdrv_view macdrv_create_view(CGRect rect)
[view setAutoresizesSubviews:NO];
[view setAutoresizingMask:NSViewNotSizable];
[view setHidden:YES];
+ [view setWantsBestResolutionOpenGLSurface:retina_on];
[nc addObserver:view
selector:@selector(updateGLContexts)
name:NSViewGlobalFrameDidChangeNotification
--
2.30.1 (Apple Git-130)
1
0