Commit 8828843f authored by Matthias Klumpp's avatar Matthias Klumpp

New upstream version 3.7.3

parent e77c5559
......@@ -4,10 +4,12 @@ import core.stdc.stdlib: exit;
import std.algorithm;
import std.array;
import std.conv;
import std.file;
import std.getopt;
import std.path;
import std.process;
import std.range;
import std.stdio;
import std.string;
......@@ -82,19 +84,23 @@ void build(string dir, string lib)
{
if (lib == "gtkd")
{
string[] subDirs = ["atk", "cairo", "gdk", "gdkpixbuf", "gio", "glib", "gobject", "gthread", "gtk", "gtkc", "gtkd", "pango", "rsvg"];
string[] subDirs = ["atk", "cairo", "gdk", "gdkpixbuf", "gio", "glib", "gobject", "gthread", "gtkc", "gtkd", "pango", "rsvg"];
foreach(directory; subDirs)
buildObj(dFiles("generated\\gtkd\\"~ directory), directory);
string[] files = dFiles("generated\\gtkd\\gtk").split();
files.chunks((files.length / 4) + 1).enumerate(1).each!((index, value){buildObj(value.join(' '), "gtk"~to!string(index));});
string objects;
foreach(directory; subDirs)
objects ~= directory ~".obj ";
objects ~= "gtk1.obj gtk2.obj gtk3.obj gtk4.obj";
executeShell(format("dmd -lib %s -of%s.lib %s", ldflags, lib, objects));
foreach(directory; subDirs)
std.file.remove(directory ~".obj");
foreach(string obj; objects.split())
std.file.remove(obj);
}
else
{
......
GtkD ChangeLog
==============
Release: 3.7.3
--------------
-Use the Slice allocator to allocate structs. #221
Release: 3.7.2
--------------
-Don't use the phobos version of Scoped, to avoid issues when the struct is moved.
-Fix the Windows build script for dmd 2.077.
Release: 3.7.1
--------------
-Revert the opCast changes for the 3.7 release.
......
......@@ -59,7 +59,7 @@ RANLIB=ranlib
#######################################################################
GTKD_VERSION=3.7.0
GTKD_VERSION=3.7.3
SO_VERSION=0
MAJOR = $(word 1,$(subst ., ,$(GTKD_VERSION)))
......
......@@ -20,6 +20,7 @@ int main(string[] args) {
if(args.length > 1) {
writefln("Loading %s", args[1]);
gladefile = args[1];
args = args[0..1];
} else {
writeln("No glade file specified, using default \"builderTest.glade\"");
gladefile = "builderTest.glade";
......
......@@ -24,6 +24,7 @@
module gst.base.BaseSrc;
private import glib.MemorySlice;
private import gobject.ObjectG;
private import gst.base.c.functions;
public import gst.base.c.types;
......@@ -204,7 +205,7 @@ public class BaseSrc : Element
public void getAllocator(out Allocator allocator, out AllocationParams params)
{
GstAllocator* outallocator = null;
GstAllocationParams* outparams = gMalloc!GstAllocationParams();
GstAllocationParams* outparams = sliceNew!GstAllocationParams();
gst_base_src_get_allocator(gstBaseSrc, &outallocator, outparams);
......
......@@ -24,6 +24,7 @@
module gst.base.BaseTransform;
private import glib.MemorySlice;
private import gobject.ObjectG;
private import gst.base.c.functions;
public import gst.base.c.types;
......@@ -196,7 +197,7 @@ public class BaseTransform : Element
public void getAllocator(out Allocator allocator, out AllocationParams params)
{
GstAllocator* outallocator = null;
GstAllocationParams* outparams = gMalloc!GstAllocationParams();
GstAllocationParams* outparams = sliceNew!GstAllocationParams();
gst_base_transform_get_allocator(gstBaseTransform, &outallocator, outparams);
......
......@@ -25,6 +25,7 @@
module gstreamer.BufferPool;
private import glib.ConstructionException;
private import glib.MemorySlice;
private import glib.Str;
private import gobject.ObjectG;
private import gstreamer.AllocationParams;
......@@ -165,7 +166,7 @@ public class BufferPool : ObjectGst
public static bool configGetAllocator(Structure config, ref Allocator allocator, out AllocationParams params)
{
GstAllocator* outallocator = allocator.getAllocatorStruct();
GstAllocationParams* outparams = gMalloc!GstAllocationParams();
GstAllocationParams* outparams = sliceNew!GstAllocationParams();
auto p = gst_buffer_pool_config_get_allocator((config is null) ? null : config.getStructureStruct(), &outallocator, outparams) != 0;
......
......@@ -24,6 +24,7 @@
module gstreamer.ChildProxyIF;
private import glib.MemorySlice;
private import glib.Str;
private import gobject.ObjectG;
private import gobject.ParamSpec;
......
......@@ -24,6 +24,7 @@
module gstreamer.ChildProxyT;
public import glib.MemorySlice;
public import glib.Str;
public import gobject.ObjectG;
public import gobject.ParamSpec;
......@@ -157,7 +158,7 @@ public template ChildProxyT(TStruct)
*/
public void childGetProperty(string name, out Value value)
{
GValue* outvalue = gMalloc!GValue();
GValue* outvalue = sliceNew!GValue();
gst_child_proxy_get_property(getChildProxyStruct(), Str.toStringz(name), outvalue);
......
......@@ -26,6 +26,7 @@ module gstreamer.Iterator;
private import glib.ConstructionException;
private import glib.ListG;
private import glib.MemorySlice;
private import glib.Mutex;
private import gobject.ObjectG;
private import gobject.Value;
......@@ -294,7 +295,7 @@ public class Iterator
*/
public bool findCustom(GCompareFunc func, out Value elem, void* userData)
{
GValue* outelem = gMalloc!GValue();
GValue* outelem = sliceNew!GValue();
auto p = gst_iterator_find_custom(gstIterator, func, outelem, userData) != 0;
......@@ -390,7 +391,7 @@ public class Iterator
*/
public GstIteratorResult next(out Value elem)
{
GValue* outelem = gMalloc!GValue();
GValue* outelem = sliceNew!GValue();
auto p = gst_iterator_next(gstIterator, outelem);
......
......@@ -25,6 +25,7 @@
module gstreamer.Query;
private import glib.ConstructionException;
private import glib.MemorySlice;
private import glib.Str;
private import gobject.ObjectG;
private import gstreamer.AllocationParams;
......@@ -926,7 +927,7 @@ public class Query
public void parseNthAllocationParam(uint index, out Allocator allocator, out AllocationParams params)
{
GstAllocator* outallocator = null;
GstAllocationParams* outparams = gMalloc!GstAllocationParams();
GstAllocationParams* outparams = sliceNew!GstAllocationParams();
gst_query_parse_nth_allocation_param(gstQuery, index, &outallocator, outparams);
......
......@@ -26,6 +26,7 @@ module gstreamer.TagList;
private import glib.ConstructionException;
private import glib.Date;
private import glib.MemorySlice;
private import glib.Str;
private import gobject.ObjectG;
private import gobject.Value;
......@@ -904,7 +905,7 @@ public class TagList
*/
public static bool copyValue(out Value dest, TagList list, string tag)
{
GValue* outdest = gMalloc!GValue();
GValue* outdest = sliceNew!GValue();
auto p = gst_tag_list_copy_value(outdest, (list is null) ? null : list.getTagListStruct(), Str.toStringz(tag)) != 0;
......@@ -992,7 +993,7 @@ public class TagList
*/
public static void mergeStringsWithComma(out Value dest, Value src)
{
GValue* outdest = gMalloc!GValue();
GValue* outdest = sliceNew!GValue();
gst_tag_merge_strings_with_comma(outdest, (src is null) ? null : src.getValueStruct());
......@@ -1009,7 +1010,7 @@ public class TagList
*/
public static void mergeUseFirst(out Value dest, Value src)
{
GValue* outdest = gMalloc!GValue();
GValue* outdest = sliceNew!GValue();
gst_tag_merge_use_first(outdest, (src is null) ? null : src.getValueStruct());
......
......@@ -24,6 +24,7 @@
module gstreamer.Utils;
private import glib.MemorySlice;
private import glib.Str;
private import gobject.ObjectG;
private import gobject.Value;
......@@ -289,7 +290,7 @@ public struct Utils
*/
public static void setValueFromString(out Value value, string valueStr)
{
GValue* outvalue = gMalloc!GValue();
GValue* outvalue = sliceNew!GValue();
gst_util_set_value_from_string(outvalue, Str.toStringz(valueStr));
......
......@@ -24,6 +24,7 @@
module gstreamer.ValueGst;
private import glib.MemorySlice;
private import glib.Str;
private import gobject.ObjectG;
private import gobject.Value;
......@@ -135,7 +136,7 @@ public struct ValueGst
*/
public static bool deserialize(out Value dest, string src)
{
GValue* outdest = gMalloc!GValue();
GValue* outdest = sliceNew!GValue();
auto p = gst_value_deserialize(outdest, Str.toStringz(src)) != 0;
......@@ -494,7 +495,7 @@ public struct ValueGst
*/
public static void initAndCopy(out Value dest, Value src)
{
GValue* outdest = gMalloc!GValue();
GValue* outdest = sliceNew!GValue();
gst_value_init_and_copy(outdest, (src is null) ? null : src.getValueStruct());
......@@ -518,7 +519,7 @@ public struct ValueGst
*/
public static bool intersect(out Value dest, Value value1, Value value2)
{
GValue* outdest = gMalloc!GValue();
GValue* outdest = sliceNew!GValue();
auto p = gst_value_intersect(outdest, (value1 is null) ? null : value1.getValueStruct(), (value2 is null) ? null : value2.getValueStruct()) != 0;
......@@ -765,7 +766,7 @@ public struct ValueGst
*/
public static bool subtract(out Value dest, Value minuend, Value subtrahend)
{
GValue* outdest = gMalloc!GValue();
GValue* outdest = sliceNew!GValue();
auto p = gst_value_subtract(outdest, (minuend is null) ? null : minuend.getValueStruct(), (subtrahend is null) ? null : subtrahend.getValueStruct()) != 0;
......@@ -786,7 +787,7 @@ public struct ValueGst
*/
public static bool unio(out Value dest, Value value1, Value value2)
{
GValue* outdest = gMalloc!GValue();
GValue* outdest = sliceNew!GValue();
auto p = gst_value_union(outdest, (value1 is null) ? null : value1.getValueStruct(), (value2 is null) ? null : value2.getValueStruct()) != 0;
......
......@@ -24,6 +24,7 @@
module gstreamer.ValueList;
private import glib.MemorySlice;
private import gobject.ObjectG;
private import gobject.Value;
private import gstreamer.c.functions;
......@@ -79,7 +80,7 @@ public class ValueList
*/
public static void concat(out Value dest, Value value1, Value value2)
{
GValue* outdest = gMalloc!GValue();
GValue* outdest = sliceNew!GValue();
gst_value_list_concat(outdest, (value1 is null) ? null : value1.getValueStruct(), (value2 is null) ? null : value2.getValueStruct());
......@@ -136,7 +137,7 @@ public class ValueList
*/
public static void merge(out Value dest, Value value1, Value value2)
{
GValue* outdest = gMalloc!GValue();
GValue* outdest = sliceNew!GValue();
gst_value_list_merge(outdest, (value1 is null) ? null : value1.getValueStruct(), (value2 is null) ? null : value2.getValueStruct());
......
......@@ -28,6 +28,7 @@ private import atk.Range;
private import atk.c.functions;
public import atk.c.types;
private import glib.ListSG;
private import glib.MemorySlice;
private import glib.Str;
private import gobject.ObjectG;
private import gobject.Signals;
......
......@@ -28,6 +28,7 @@ public import atk.Range;
public import atk.c.functions;
public import atk.c.types;
public import glib.ListSG;
public import glib.MemorySlice;
public import glib.Str;
public import gobject.ObjectG;
public import gobject.Signals;
......@@ -200,7 +201,7 @@ public template ValueT(TStruct)
*/
public void getCurrentValue(out Value value)
{
GValue* outvalue = gMalloc!GValue();
GValue* outvalue = sliceNew!GValue();
atk_value_get_current_value(getValueStruct(), outvalue);
......@@ -233,7 +234,7 @@ public template ValueT(TStruct)
*/
public void getMaximumValue(out Value value)
{
GValue* outvalue = gMalloc!GValue();
GValue* outvalue = sliceNew!GValue();
atk_value_get_maximum_value(getValueStruct(), outvalue);
......@@ -254,7 +255,7 @@ public template ValueT(TStruct)
*/
public void getMinimumIncrement(out Value value)
{
GValue* outvalue = gMalloc!GValue();
GValue* outvalue = sliceNew!GValue();
atk_value_get_minimum_increment(getValueStruct(), outvalue);
......@@ -271,7 +272,7 @@ public template ValueT(TStruct)
*/
public void getMinimumValue(out Value value)
{
GValue* outvalue = gMalloc!GValue();
GValue* outvalue = sliceNew!GValue();
atk_value_get_minimum_value(getValueStruct(), outvalue);
......
......@@ -2967,7 +2967,7 @@ public alias extern(C) void function(AtkObject* obj, AtkPropertyValues* vals) At
* application compile time, rather than from the library linked
* against at application run time.
*/
enum BINARY_AGE = 22610;
enum BINARY_AGE = 22611;
alias ATK_BINARY_AGE = BINARY_AGE;
/**
......@@ -2991,7 +2991,7 @@ alias ATK_MAJOR_VERSION = MAJOR_VERSION;
* application compile time, rather than from the library linked
* against at application run time.
*/
enum MICRO_VERSION = 0;
enum MICRO_VERSION = 1;
alias ATK_MICRO_VERSION = MICRO_VERSION;
/**
......
......@@ -26,6 +26,7 @@ module gdk.Color;
private import gdk.c.functions;
public import gdk.c.types;
private import glib.MemorySlice;
private import glib.Str;
private import glib.c.functions;
private import gobject.ObjectG;
......@@ -284,7 +285,7 @@ public final class Color
*/
public static bool parse(string spec, out Color color)
{
GdkColor* outcolor = gMalloc!GdkColor();
GdkColor* outcolor = sliceNew!GdkColor();
auto p = gdk_color_parse(Str.toStringz(spec), outcolor) != 0;
......
......@@ -110,7 +110,7 @@ public class MonitorG : ObjectG
* not in ”device pixels” (see gdk_monitor_get_scale_factor()).
*
* Params:
* geometry = a #GdkRectangle to be filled wiht the monitor geometry
* geometry = a #GdkRectangle to be filled with the monitor geometry
*
* Since: 3.22
*/
......
......@@ -257,7 +257,7 @@ public class Application : ObjectG, ActionGroupIF, ActionMapIF
extern(C) static int callBackScopedCommandLine(GApplication* applicationStruct, GApplicationCommandLine* commandLine, ScopedOnCommandLineDelegateWrapper wrapper)
{
return wrapper.dlg(scoped!ApplicationCommandLine(commandLine), wrapper.outer);
return wrapper.dlg(getScopedGobject!ApplicationCommandLine(commandLine), wrapper.outer);
}
extern(C) static void callBackScopedCommandLineDestroy(ScopedOnCommandLineDelegateWrapper wrapper, GClosure* closure)
......
......@@ -31,6 +31,7 @@ private import gio.c.functions;
public import gio.c.types;
private import glib.ErrorG;
private import glib.GException;
private import glib.MemorySlice;
private import glib.Str;
private import glib.Variant;
private import glib.VariantType;
......@@ -298,7 +299,7 @@ public struct DBusUtilities
*/
public static void gvariantToGvalue(Variant value, out Value outGvalue)
{
GValue* outoutGvalue = gMalloc!GValue();
GValue* outoutGvalue = sliceNew!GValue();
g_dbus_gvariant_to_gvalue((value is null) ? null : value.getVariantStruct(), outoutGvalue);
......
......@@ -30,6 +30,7 @@ private import gio.c.functions;
public import gio.c.types;
private import glib.ConstructionException;
private import glib.DateTime;
private import glib.MemorySlice;
private import glib.Str;
private import glib.TimeVal;
private import gobject.ObjectG;
......@@ -496,7 +497,7 @@ public class FileInfo : ObjectG
*/
public void getModificationTime(out TimeVal result)
{
GTimeVal* outresult = gMalloc!GTimeVal();
GTimeVal* outresult = sliceNew!GTimeVal();
g_file_info_get_modification_time(gFileInfo, outresult);
......
......@@ -30,156 +30,162 @@ public import gtkc.glibtypes;
/** */
public struct MemorySlice
public T* sliceNew(T)()
{
public static T* mewSlice(T)()
{
return cast(T*)g_slice_alloc(T.sizeof);
}
public static T* mewSlice0(T)()
{
// We cant use sliceAlloc for the GLib array types.
// the actual array structs are larger than the ones used in the API.
static if ( is( T == GArray ) )
return g_array_new(false, false, 1);
else static if ( is( T == GByteArray ) )
return g_byte_array_new();
else static if ( is( T == GPtrArray ) )
return g_ptr_array_new();
else
return cast(T*)g_slice_alloc0(T.sizeof);
}
public static T* dup(T)(T* memBlock)
{
return cast(T*)g_slice_copy(T.sizeof, memBlock);
}
public static void free(T)(T* memBlock)
{
g_slice_free1(T.sizeof, memBlock);
}
/**
*/
/**
* Allocates a block of memory from the slice allocator.
* The block adress handed out can be expected to be aligned
* to at least 1 * sizeof (void*),
* though in general slices are 2 * sizeof (void*) bytes aligned,
* if a malloc() fallback implementation is used instead,
* the alignment may be reduced in a libc dependent fashion.
* Note that the underlying slice allocation mechanism can
* be changed with the [`G_SLICE=always-malloc`][G_SLICE]
* environment variable.
*
* Params:
* blockSize = the number of bytes to allocate
*
* Returns: a pointer to the allocated memory block, which will be %NULL if and
* only if @mem_size is 0
*
* Since: 2.10
*/
public static void* sliceAlloc(size_t blockSize)
{
return g_slice_alloc(blockSize);
}
/**
* Allocates a block of memory via g_slice_alloc() and initializes
* the returned memory to 0. Note that the underlying slice allocation
* mechanism can be changed with the [`G_SLICE=always-malloc`][G_SLICE]
* environment variable.
*
* Params:
* blockSize = the number of bytes to allocate
*
* Returns: a pointer to the allocated block, which will be %NULL if and only
* if @mem_size is 0
*
* Since: 2.10
*/
public static void* sliceAlloc0(size_t blockSize)
{
return g_slice_alloc0(blockSize);
}
/**
* Allocates a block of memory from the slice allocator
* and copies @block_size bytes into it from @mem_block.
*
* @mem_block must be non-%NULL if @block_size is non-zero.
*
* Params:
* blockSize = the number of bytes to allocate
* memBlock = the memory to copy
*
* Returns: a pointer to the allocated memory block, which will be %NULL if and
* only if @mem_size is 0
*
* Since: 2.14
*/
public static void* sliceCopy(size_t blockSize, void* memBlock)
{
return g_slice_copy(blockSize, memBlock);
}
/**
* Frees a block of memory.
*
* The memory must have been allocated via g_slice_alloc() or
* g_slice_alloc0() and the @block_size has to match the size
* specified upon allocation. Note that the exact release behaviour
* can be changed with the [`G_DEBUG=gc-friendly`][G_DEBUG] environment
* variable, also see [`G_SLICE`][G_SLICE] for related debugging options.
*
* If @mem_block is %NULL, this function does nothing.
*
* Params:
* blockSize = the size of the block
* memBlock = a pointer to the block to free
*
* Since: 2.10
*/
public static void sliceFree1(size_t blockSize, void* memBlock)
{
g_slice_free1(blockSize, memBlock);
}
/**
* Frees a linked list of memory blocks of structure type @type.
*
* The memory blocks must be equal-sized, allocated via
* g_slice_alloc() or g_slice_alloc0() and linked together by a
* @next pointer (similar to #GSList). The offset of the @next
* field in each block is passed as third argument.
* Note that the exact release behaviour can be changed with the
* [`G_DEBUG=gc-friendly`][G_DEBUG] environment variable, also see
* [`G_SLICE`][G_SLICE] for related debugging options.
*
* If @mem_chain is %NULL, this function does nothing.
*
* Params:
* blockSize = the size of the blocks
* memChain = a pointer to the first block of the chain
* nextOffset = the offset of the @next field in the blocks
*
* Since: 2.10
*/
public static void sliceFreeChainWithOffset(size_t blockSize, void* memChain, size_t nextOffset)
{
g_slice_free_chain_with_offset(blockSize, memChain, nextOffset);
}
/** */
public static long sliceGetConfig(GSliceConfig ckey)
{
return g_slice_get_config(ckey);
}
/** */
public static long* sliceGetConfigState(GSliceConfig ckey, long address, uint* nValues)
{
return g_slice_get_config_state(ckey, address, nValues);
}
/** */
public static void sliceSetConfig(GSliceConfig ckey, long value)
{
g_slice_set_config(ckey, value);
}
}
public T* sliceAlloc(T)()
{
return cast(T*)g_slice_alloc0(T.sizeof);
}
public T* sliceDup(T)(T* memBlock)
{
return cast(T*)g_slice_copy(T.sizeof, memBlock);
}
public void sliceFree(T)(T* memBlock)
{
g_slice_free1(T.sizeof, memBlock);
}
/**
*/
/**
* Allocates a block of memory from the slice allocator.
* The block adress handed out can be expected to be aligned
* to at least 1 * sizeof (void*),
* though in general slices are 2 * sizeof (void*) bytes aligned,
* if a malloc() fallback implementation is used instead,
* the alignment may be reduced in a libc dependent fashion.
* Note that the underlying slice allocation mechanism can
* be changed with the [`G_SLICE=always-malloc`][G_SLICE]
* environment variable.
*
* Params:
* blockSize = the number of bytes to allocate
*
* Returns: a pointer to the allocated memory block, which will be %NULL if and
* only if @mem_size is 0
*
* Since: 2.10
*/
public void* sliceAlloc(size_t blockSize)
{
return g_slice_alloc(blockSize);
}
/**
* Allocates a block of memory via g_slice_alloc() and initializes
* the returned memory to 0. Note that the underlying slice allocation
* mechanism can be changed with the [`G_SLICE=always-malloc`][G_SLICE]
* environment variable.
*
* Params:
* blockSize = the number of bytes to allocate
*
* Returns: a pointer to the allocated block, which will be %NULL if and only
* if @mem_size is 0
*
* Since: 2.10
*/
public void* sliceAlloc0(size_t blockSize)
{
return g_slice_alloc0(blockSize);
}
/**
* Allocates a block of memory from the slice allocator
* and copies @block_size bytes into it from @mem_block.
*
* @mem_block must be non-%NULL if @block_size is non-zero.
*
* Params:
* blockSize = the number of bytes to allocate
* memBlock = the memory to copy
*
* Returns: a pointer to the allocated memory block, which will be %NULL if and
* only if @mem_size is 0