diff options
author | costan@gmail.com <costan@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-03 07:02:29 +0000 |
---|---|---|
committer | costan@gmail.com <costan@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-03 07:02:29 +0000 |
commit | d54d55c1ec3e8097999932fd90480bdc6b3e44aa (patch) | |
tree | e3e38bf6c1486ea87573aebd1e15a073eed8500e /device/hid | |
parent | 987c40244380024d0468f650109b838f514b2261 (diff) | |
download | chromium_src-d54d55c1ec3e8097999932fd90480bdc6b3e44aa.zip chromium_src-d54d55c1ec3e8097999932fd90480bdc6b3e44aa.tar.gz chromium_src-d54d55c1ec3e8097999932fd90480bdc6b3e44aa.tar.bz2 |
Fix compilation error on Fedora 20.
The libudev commit below changed the return types of _undef functions
from void to the matching the argument type, e.g. void udev_unref(udev*)
became udev* udev_unref(udev*).
http://cgit.freedesktop.org/systemd/systemd/commit/?id=20bbd54f603994a3cc211d2795de16550882ed8d
This change adds a bit of template magic to make Chromium compile with
either version of the libudev headers.
BUG=340108
TEST=ninja -C out/Debug chrome
Review URL: https://codereview.chromium.org/138783005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248447 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'device/hid')
-rw-r--r-- | device/hid/hid_service_linux.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/device/hid/hid_service_linux.h b/device/hid/hid_service_linux.h index 415db80..ba58fad 100644 --- a/device/hid/hid_service_linux.h +++ b/device/hid/hid_service_linux.h @@ -18,6 +18,11 @@ namespace device { class HidConnection; template<typename T, void func(T*)> +void DiscardReturnType(T* arg) { func(arg); } +template<typename T, T* func(T*)> +void DiscardReturnType(T* arg) { func(arg); } + +template<typename T, void func(T*)> struct Deleter { void operator()(T* enumerate) const { if (enumerate != NULL) @@ -25,10 +30,17 @@ struct Deleter { } }; -typedef Deleter<udev_enumerate, udev_enumerate_unref> UdevEnumerateDeleter; -typedef Deleter<udev_device, udev_device_unref> UdevDeviceDeleter; -typedef Deleter<udev, udev_unref> UdevDeleter; -typedef Deleter<udev_monitor, udev_monitor_unref> UdevMonitorDeleter; +typedef Deleter< + udev_enumerate, + DiscardReturnType<udev_enumerate, udev_enumerate_unref> > + UdevEnumerateDeleter; +typedef Deleter< + udev_device, + DiscardReturnType<udev_device, udev_device_unref> > UdevDeviceDeleter; +typedef Deleter<udev, DiscardReturnType<udev, udev_unref> > UdevDeleter; +typedef Deleter< + udev_monitor, + DiscardReturnType<udev_monitor, udev_monitor_unref> > UdevMonitorDeleter; typedef scoped_ptr<udev_device, UdevDeviceDeleter> ScopedUdevDevicePtr; typedef scoped_ptr<udev_enumerate, UdevEnumerateDeleter> ScopedUdevEnumeratePtr; |