Jeff Muizelaar
87bd8a4d1a
Add an unsafe method to convert CFDictionary to CFMutableDictionary
2019-03-28 18:02:12 -04:00
Bruce Mitchener
0fbabb35e9
Use assert_eq! when possible instead of assert!
2019-03-21 21:55:00 +07:00
Bruce Mitchener
585437bb3a
core-foundation: Remove unnecessary transmutes.
2019-03-18 15:45:11 +07:00
Kornel
68b75cd9fd
Add keywords to Cargo.toml
2019-03-16 21:58:49 +00:00
Bruce Mitchener
8632671479
clippy: Remove transmutes to the same type.
2019-03-16 22:07:27 +07:00
bors-servo
058fdd8f43
Auto merge of #300 - waywardmonkeys:clippy-use-is-null, r=jdm
...
clippy: Use is_null instead of != ptr::null().
<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg " height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/300 )
<!-- Reviewable:end -->
2019-03-14 10:24:46 -04:00
bors-servo
920db7be0d
Auto merge of #297 - waywardmonkeys:macro-docs, r=jdm
...
Begin documenting core-foundation macros.
I started doing this after talking through some issues with @raphlinus. Clearly more to do, but would like to get this in sooner rather than later.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg " height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/297 )
<!-- Reviewable:end -->
2019-03-14 10:12:14 -04:00
Bruce Mitchener
3e8acddee2
clippy: Use is_null instead of != ptr::null().
2019-03-14 21:12:12 +07:00
bors-servo
348f7de691
Auto merge of #296 - waywardmonkeys:clippy-core-foundation-missing-default, r=jdm
...
clippy: Add missing Default impls.
<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg " height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/296 )
<!-- Reviewable:end -->
2019-03-14 10:03:40 -04:00
bors-servo
f8c1aaa3d3
Auto merge of #295 - waywardmonkeys:clippy-core-foundation-expect-with-function-call, r=jdm
...
clippy: Don't call expect with the result of a function call.
<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg " height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/295 )
<!-- Reviewable:end -->
2019-03-14 09:55:14 -04:00
Bruce Mitchener
d2d3b3362a
Refer to macOS rather than OS X.
2019-03-14 17:47:00 +07:00
Bruce Mitchener
ea446521fb
Begin documenting core-foundation macros.
2019-03-14 15:19:39 +07:00
Bruce Mitchener
291a606fec
clippy: Don't call expect with the result of a function call.
2019-03-14 09:40:33 +07:00
Bruce Mitchener
20d3a3f102
clippy: Add missing Default impls.
2019-03-14 09:36:00 +07:00
Wolfgang Silbermayr
e2ae28c815
Use libc c_char instead of i8 for libc strlen() call
2018-12-07 07:06:09 +01:00
Patrick Walton
90ddbb60b2
Allow a CFArray to be constructed from Copy data.
...
This is necessary for the bindings to Quartz Window Services to work, since
those APIs don't wrap `CGWindowID` objects in `CFNumber` wrappers.
2018-11-01 19:39:48 -07:00
Linus Färnstrand
1cb7f0816f
Change as_immutable to to_immutable
2018-10-23 09:38:46 +02:00
Linus Färnstrand
c539fbc644
Fix indentation
2018-10-23 09:38:46 +02:00
Linus Färnstrand
f8c0f59a48
Add as_immutable to CFMutableDictionary
2018-10-23 09:38:46 +02:00
Linus Färnstrand
57170cf838
Allow converting dictionaries to their untyped counterparts
2018-10-23 09:38:46 +02:00
Linus Färnstrand
8ca2746589
Implement ConcreteCFType for CFDictionary<*void, *void>
2018-10-23 09:38:35 +02:00
Linus Färnstrand
1dd66bd610
Add conversion from CFDictionary to CFMutableDictionary
2018-10-19 10:27:24 +02:00
Patrick Walton
33ed5ec8e6
Bump some versions
2018-10-16 15:46:01 -07:00
Patrick Walton
6eb7c9d1cb
Add bindings to CFBundleGetBundleWithIdentifier and
...
`CFBundleGetFunctionPointerForName`.
2018-10-16 15:34:43 -07:00
Jeff Muizelaar
0b377a959b
Bump the versions of a bunch crates.
2018-09-28 13:19:37 -04:00
sib
6b3205e3e4
to_i32 shortcut for CFNumber
2018-09-23 16:41:24 -04:00
Ryan Leckey
085aa65b02
Add ItemMutRef and FromMutVoid
2018-08-01 09:29:50 -07:00
Bruce Mitchener
2c7ecae7a1
core-foundation: Remove 2 transmutes in macros.
...
These transmutes were going from one type of pointer to another,
and so can be done as casts instead.
Doing so also means that one unsafe block can be removed.
This was found via clippy.
2018-07-19 22:18:06 +07:00
Jeff Muizelaar
4fe550a8fc
Bump minor version of core-foundation for past changes.
2018-07-12 10:14:25 -04:00
Ryan Leckey
1d369075c3
Add CF(Mutable)AttributedString and a couple helpers
2018-07-06 12:25:18 -07:00
Tim Neumann
dd3a4b5af0
CFString: remove unnecessary casts
2018-05-29 21:29:28 +02:00
Tim Neumann
5faf448418
CFString: extract to Cow conversion
2018-05-29 21:27:58 +02:00
bors-servo
2ba1ea2405
Auto merge of #158 - faern:unsound-casting, r=jrmuizel
...
BUG: Add test showing how downcasting to CFArray is unsound
This PR is not intended to me merged directly. It adds a test that causes undefined behavior without using `unsafe {}`. So it's more to show the problem and discuss a solution.
The problem here is that if you have a `CFArray<X>` you can cast it up to a `CFType` and then down to a `CFArray<Y>` for any `Y: TCFType`. It never checks that the elements in the array are of type `Y` or not. At this point `CFArray::iter` will happily give out `&Y` references, while in fact the pointers backing those objects are pointing to `XRef` instances. So doing anything with the `&Y` will likely cause invalid memory access.
How do we solve this?
Ping @jrmuizel
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg " height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/158 )
<!-- Reviewable:end -->
2018-05-07 11:10:22 -04:00
Jeff Muizelaar
bb9ce9e8e1
Update all of the major versions for the new releases
...
Basically everything needed to be bumped because of changes to
core-foundation-sys
2018-05-02 17:46:00 -04:00
Linus Färnstrand
6c63acc55a
Add test showing how downcasting to CFArray with generic is prohibited
2018-03-20 22:36:47 +01:00
bors-servo
680013abf1
Auto merge of #199 - jrmuizel:info-dict, r=jdm
...
Make info_dictionary() return a more specific CFDictionary
<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg " height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/199 )
<!-- Reviewable:end -->
2018-02-08 10:08:11 -05:00
bors-servo
a2b24c9fc8
Auto merge of #198 - jrmuizel:set, r=jdm
...
Give CFSet a type parameter
<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg " height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/198 )
<!-- Reviewable:end -->
2018-02-08 10:04:51 -05:00
Jeff Muizelaar
5a438ccece
Make info_dictionary() return a more specific CFDictionary
2018-02-08 07:55:30 -05:00
Jeff Muizelaar
ff7d421c32
Give CFSet a type parameter
2018-02-08 07:48:36 -05:00
Jeff Muizelaar
97ec75c14d
Redo the interface of CFDictionary and CFMutableDictionary
...
This is a pretty big change to take advantge of the type parameters.
It simplifies things and makes them more safe.
2018-02-07 10:58:33 -05:00
Jeff Muizelaar
8e943b19b5
Move FromVoid and ItemRef to base
...
This will let us reuse them in dictionary.rs
2018-02-07 10:58:30 -05:00
Jeff Muizelaar
5616935b56
Give CFDictionary type parameters for keys and values
...
There's more to be done to clean up the interface now that we have
type parameters but this is a good place to start.
2018-02-02 16:56:37 -05:00
Jeff Muizelaar
6b526436c2
Unify the impl macros
...
Using some more macro magic we can avoid having to duplicate
our impl macro implementation for generic types. This will help
when we want a version for CFDictionary with two type parameters.
2018-02-02 16:18:23 -05:00
bors-servo
fb8a43f29d
Auto merge of #156 - waywardmonkeys:reduce-libc-usage, r=jdm
...
Reduce usage of libc crate.
Switch from using `libc` types to `::std::os::raw`. This is a breaking
change due to the differences in how `c_void` is defined.
`core-foundation-sys` no longer needs the `libc` dependency.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg " height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/156 )
<!-- Reviewable:end -->
2018-02-02 16:11:19 -05:00
Jeff Muizelaar
ec118b30e1
Add a ConcreteCFType trait
...
We'll use this to distinguish between generic and concrete CFTypes.
This lets us prevent downcast()ing to arbitrary generic types.
2018-02-01 13:04:28 -05:00
Bruce Mitchener
7e7d65bb4d
Reduce usage of libc crate.
...
Switch from using `libc` types to `::std::os::raw`. This is a breaking
change due to the differences in how `c_void` is defined.
`core-foundation-sys` no longer needs the `libc` dependency.
2018-02-01 20:39:10 +07:00
Bruce Mitchener
bf3a9c89bd
Add missing license headers to src files.
2018-02-01 09:32:29 +07:00
Linus Färnstrand
dc9392c19e
Add possibility to iterate untyped CFArray
2018-01-27 10:50:06 +01:00
bors-servo
ff67c15632
Auto merge of #153 - servo:updateversion, r=jdm
...
Bump version to 0.5.1.
<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg " height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/153 )
<!-- Reviewable:end -->
2018-01-26 13:01:11 -06:00
Josh Matthews
5d7753a78a
Bump version to 0.5.1.
2018-01-26 13:48:25 -05:00