summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2013-10-14adapter: Implement TagFound signalSamuel Ortiz4-30/+121
And TagLost as well. Those signals fix the current racy behaviour where apps get a Tags property change notification and then ask for the tag properties. The tag may have disappeared in the meantime. Eventually, the Tags property should disappear.
2013-10-11adapter: Do not send a poll command when adapter is downSamuel Ortiz1-0/+5
No need to go through the kernel netlink NFC API if the adapter is known to be down.
2013-10-11AUTHORS: Mention Dmytro's contributionsSamuel Ortiz1-0/+1
2013-10-11nfctool: Fix options typeDmytro Bagrii1-10/+10
G_OPTION_ARG_NONE flag in GOptionEntry expects gboolean type instead of bool. On platforms where sizeof(bool) != sizeof(gboolean), this patch fixes runtime parsing error for nfctool.
2013-10-11build: Fix build in separate directoryDmytro Bagrii1-2/+2
neard build fails when performed in a separate directory. In this case include/near directory contains broken symlinks and error appears: neard/plugins/phdc.c:32:23: fatal error: near/dbus.h: No such file or directory
2013-10-11nfctype2: Remove not needed NULL assignmentSzymon Janc1-1/+0
cookie is local pointer so there is no need to NULL it when memory gets released.
2013-10-11nfctype1: Remove dead code from nfctype1_writeSzymon Janc1-5/+0
This was never called and cb will be called by data_write in case of failure so 'return data_write()' is OK.
2013-09-23npp: Implement npp_pushSamuel Ortiz1-0/+42
NPP is simple: Get the NDEF, include it in an NPP NDEF entry, add an header and just send it to the peer. That's it.
2013-09-23npp: Fix npp_readSamuel Ortiz1-1/+12
Data needs to be added to the device, not the tag. Also, check the version number.
2013-09-19Release 0.130.13Samuel Ortiz2-1/+12
2013-09-12gdbus/client: Use g_dbus_add_properties_watch to track propertiesLuiz Augusto von Dentz1-79/+56
This make the handling much simpler and avoids duplicates of the same match rule.
2013-09-12gdbus/client: Use g_dbus_add_signal_watch to track signalsLuiz Augusto von Dentz1-36/+37
This make the handling much simpler and avoids duplicates of the same match rule.
2013-09-12gdbus/client: Use g_dbus_add_service_watch to track servicesLuiz Augusto von Dentz1-135/+38
This make the handling much simpler and avoids duplicates of the same match rule.
2013-09-12gdbus/watch: Fix crash when disconnecting from D-BusLuiz Augusto von Dentz1-0/+2
When disconnecting from D-Bus a message could be recieved with no sender: Invalid read of size 1 at 0x4A09EE1: strcmp (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x3B03C386B8: g_str_equal (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x4065D6: message_filter (watch.c:529) by 0x3B0700F9E5: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.7.4) by 0x4052E7: message_dispatch (mainloop.c:76) by 0x3B03C48962: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3B03C47E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3B03C48157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3B03C48559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x4038C5: client_proxy_removed (test-gdbus-client.c:902) by 0x3B03C6B566: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3B03C6B6E5: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3) Address 0x0 is not stack'd, malloc'd or (recently) free'd
2013-09-12gdbus/watch: Fix aborting when removing D-Bus filterLuiz Augusto von Dentz1-17/+8
In case of filter_data having a watch to a service name it may call dbus_connection_remove_filter twice causing libdbus to abort: process 24723: Attempt to remove filter function 0x4063e0 user data (nil), but no such filter has been added To fix this the code will now only attempt to call dbus_connection_remove_filter once in filter_data_free which is the counterpart of filter_data_get where dbus_connection_add_filter is called.
2013-09-12gdbus/watch: Fix crash when g_dbus_remove_watch is called from connect callbackLuiz Augusto von Dentz1-2/+6
at 0x40570C: update_service (watch.c:601) by 0x40584B: service_reply (watch.c:627) by 0x3B0700C511: ??? (in /usr/lib64/libdbus-1.so.3.7.4) by 0x3B0700F740: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.7.4) by 0x405167: message_dispatch (mainloop.c:76) by 0x3B03C48962: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3B03C47E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3B03C48157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3B03C48559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3) Address 0x4c58a30 is 32 bytes inside a block of size 56 free'd at 0x4A074C4: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x3B03C4D9AE: g_free (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x406102: filter_data_remove_callback (watch.c:378) by 0x405FC0: g_dbus_remove_watch (watch.c:798) by 0x40A22B: g_dbus_client_unref (client.c:1227) by 0x40570B: update_service (watch.c:599) by 0x40584B: service_reply (watch.c:627)
2013-09-10gdbus: Fix emitting PropertiesChanged twiceLuiz Augusto von Dentz1-2/+2
This fixes double emission of PropertiesChanged introduced by flushing changes, the flushing can happen during the pending processing so the pending_prop flag needs to be updated in the beginning and the list of properties can be freed before g_dbus_send_message as it is not required anymore.
2013-09-10gdbus: Avoid calling dbus_connection_send*Luiz Augusto von Dentz2-64/+42
dbus_connection_send* should not be called directly except by g_dbus_send_message.
2013-09-10gdbus: Add g_dbus_send_message_with_replyLuiz Augusto von Dentz2-0/+14
g_dbus_send_message_with_reply flushes pending signals before calling dbus_connection_send_with_reply so it does not alter the message order
2013-09-10gdbus: Fix sending ObjectManager/Properties signals out of orderLuiz Augusto von Dentz1-16/+53
In some cases the order of the messages is altered when a message is sent without processing the pending signals first, currently this affect client_check_order unit test: /gdbus/client_check_order: ** ERROR:unit/test-gdbus-client.c:795:property_check_order: assertion failed: (g_strcmp0(string, "value1") == 0) As can be observed the value of the property is not yet updated because the signal it is still pending, once this fix is applied the test pass: /gdbus/client_check_order: OK Note that the flushing only works when g_dbus_send_message is used so places where dbus_connection_send and other variants are called directly may still change the order.
2013-09-10nfctool: Add firmware download commandThierry Escande4-4/+100
This adds a command line option (--fw-download or -w) to start firmware download process on the specified device with the passed firmware filename. e.g. nfctool -d nfc0 --fw-download fw_filename
2013-09-10nfctool: netlink: Pass attributes to registered callbacksThierry Escande1-1/+1
This passes the netlink attributes structure of an event to the registered callback through its data argument.
2013-09-10nfc_copy: Update nfc_copy.h with SE command and firmware download statusThierry Escande1-3/+7
It also renames NFC_CMD_FW_UPLOAD to NFC_CMD_FW_DOWNLOAD.
2013-09-02phdc: API documentation and sample codeOlivier Guiter3-2/+276
This sample code publishes two phdc Managers, to validate the phdc driver. It relies on nfcpy test code for simulating a phdc thermometer.
2013-09-02neard: Change in dbus conf to allow PHDC managers and agentsOlivier Guiter1-0/+2
2013-09-02phdc: Initial PHDC implementationOlivier Guiter4-1/+565
Code to add the PHDC p2p driver. This driver will publish a dbus interface to facilitate PHDC Managers registration. This code handles multiple Managers. Managers (or Agents) should register using RegisterAgent(), and should publish a specific interface "org.neard.PHDC.Manager" or "org.neard.PHDC.Agent". PHDC is different from usual p2p services as it is a proprietary service. The PHDC Manager (external to neard) notify neard for being registered on specific services urn (e.g: urn:nfc:sn:phdc) The PHDC Agent connects to this specific urn using p2p, and the newly created p2p file descriptor is forwarded to the PHDC Manager. Doing this, the PHDC driver acts as a passthru, allowing the Agent to exchange with the Manager.
2013-09-02p2p: Add new_client method in p2p structOlivier Guiter2-3/+11
p2p registrees will be notified through this method of a new client connection.
2013-09-02p2p: Add a user_data pointer to p2p structOlivier Guiter10-37/+60
user_data pointer is added to p2p internal structure and is sent (as param) in every p2p functions (read, push, close,...).
2013-09-02main: Use gboolean type in GOptionEntryPatrik Flykt3-4/+4
The GOptionEntry options need to be of gboolean type as they are passed as pointers. When the size of gboolean is different from the size of bool, it will cause option variables to be overwritten by each other.
2013-08-28p2p: Remove const from service and driver nameOlivier Guiter1-2/+2
Removing const qualifier allows drivers to be added dynamically (at execution time). This will be used for PHDC managers.
2013-08-28p2p: Change p2p_register to look for service nameOlivier Guiter1-4/+7
On p2p driver registration, the search is now done with the service name (instead of the driver name).
2013-08-28error: Add ENOMEM error string messageOlivier Guiter2-0/+9
2013-08-27nfctype4: Fix a memory leak in t4_readbin_ccLars Poeschel1-11/+1
In t4_readbin_cc memory is allocated and response data is copied into it just do read access on different fields of this memory. The allocated memory was never freed. This patch replaces the allocation and copy by just casting the response data to a pointer thus eleminating the memory leak.
2013-08-23bluetooth: Make the default adapter callback error less confusingSamuel Ortiz1-1/+1
Many people translated the "No such adapter" error string as "Hey, there is no NFC adapter on this machine". Let's be a little clearer.
2013-08-20AUTHORS: Mention Daniel's contributionsSamuel Ortiz1-0/+1
2013-08-20doc: Change coding style for NULL pointer checksDaniel Wagner1-7/+7
2013-08-20unit: Do not compare expression against NULLDaniel Wagner3-18/+18
This patch generate via coccinelle with: @ disable is_null,isnt_null1 @ expression E; @@ ( - E == NULL + !E | - E != NULL + E )
2013-08-20tools: Do not compare expression against NULLDaniel Wagner8-69/+69
This patch generate via coccinelle with: @ disable is_null,isnt_null1 @ expression E; @@ ( - E == NULL + !E | - E != NULL + E )
2013-08-20core: Do not compare expression against NULLDaniel Wagner13-450/+446
This patch generate via coccinelle with: @ disable is_null,isnt_null1 @ expression E; @@ ( - E == NULL + !E | - E != NULL + E )
2013-08-20plugins: Do not compare expression against NULLDaniel Wagner11-127/+127
This patch generate via coccinelle with: @ disable is_null,isnt_null1 @ expression E; @@ ( - E == NULL + !E | - E != NULL + E )
2013-08-20types: Remove near_bool_t definitionDaniel Wagner1-10/+0
2013-08-20unit: Use stdbool instead gboolean or near_bool_tDaniel Wagner1-21/+21
This patch has been created via coccinelle: // Rule set 1 f(es, ( - FALSE + false | - TRUE + true ) ,...) @r2@ type T; identifier f; parameter list[n] ps; identifier i; @@ T f(ps, near_bool_t i, ...); @@ identifier r2.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) @@ typedef bool; @@ - near_bool_t + bool // Rule set 2 // This is not a beautiful script but it does the job. // Improvemtents are welcome. // Fix all assigments but do not convert yet the type @@ gboolean x; @@ x = ( - TRUE + true | - FALSE + false ) // Figure out which function signature will to be fixed... // when we have the defitition @r@ identifier f; parameter list[n] ps; identifier i; @@ f(ps, gboolean i, ...) { ... } // ... and now convert all call sites @@ identifier r.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) // Figure out which function signature will to be fixed... // when we have the declaration only @r2@ type T; identifier f; parameter list[n] ps; identifier i; @@ T f(ps, gboolean i, ...); // ... and now convert all call sites @@ identifier r2.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) // A handfull of the GLib hooks we can't change. Let's remember // all ther positions. // 1. timeouts @k1@ identifier f; position p; typedef gpointer; identifier ptr; @@ static gboolean@p f(gpointer ptr); @k2@ identifier f; position p; identifier ptr; @@ static gboolean@p f(gpointer ptr) { ... } // hash map iterator functions @k3@ identifier f; position p; identifier p1, p2, p3; @@ static gboolean@p f(gpointer p1, gpointer p2, gpointer p3) { ... } // 2. GIOChannel @k4@ identifier f; position p; typedef GIOChannel, GIOCondition; identifier ptr; identifier ch, cn; @@ static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr); @k5@ identifier f; position p; identifier ptr; identifier ch, cn; @@ static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr) { ... } // 3. GSourceFuncs @k6@ identifier f; position p; typedef GSource; identifier src; @@ static gboolean@p f(GSource *src, ...) { ... } // gdbus functions @k7@ identifier f; position p; typedef DBusConnection; identifier con; @@ static gboolean@p f(DBusConnection *con, ...) { ... } // Now convert all gboolean which are are not used for interactin // with GLib // Note here happens the magic! @@ typedef bool; position p != {k1.p,k2.p,k3.p,k4.p,k5.p,k6.p,k7.p}; @@ - gboolean@p + bool // Update all return types @@ identifier f; @@ bool f(...) { <... - return TRUE; + return true; ...> } @@ identifier f; @@ bool f(...) { <... - return FALSE; + return false; ...> } // Rule set 3 @@ expression E; symbol TRUE; symbol FALSE; @@ ( E - == TRUE | - TRUE == E + E | - E != TRUE + !E | - TRUE != E + !E | - E == FALSE + !E | - FALSE == E + !E | E - != FALSE | - FALSE != E + E )
2013-08-20tools: Use stdbool instead gboolean or near_bool_tDaniel Wagner7-46/+46
This patch has been created via coccinelle: // Rule set 1 f(es, ( - FALSE + false | - TRUE + true ) ,...) @r2@ type T; identifier f; parameter list[n] ps; identifier i; @@ T f(ps, near_bool_t i, ...); @@ identifier r2.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) @@ typedef bool; @@ - near_bool_t + bool // Rule set 2 // This is not a beautiful script but it does the job. // Improvemtents are welcome. // Fix all assigments but do not convert yet the type @@ gboolean x; @@ x = ( - TRUE + true | - FALSE + false ) // Figure out which function signature will to be fixed... // when we have the defitition @r@ identifier f; parameter list[n] ps; identifier i; @@ f(ps, gboolean i, ...) { ... } // ... and now convert all call sites @@ identifier r.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) // Figure out which function signature will to be fixed... // when we have the declaration only @r2@ type T; identifier f; parameter list[n] ps; identifier i; @@ T f(ps, gboolean i, ...); // ... and now convert all call sites @@ identifier r2.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) // A handfull of the GLib hooks we can't change. Let's remember // all ther positions. // 1. timeouts @k1@ identifier f; position p; typedef gpointer; identifier ptr; @@ static gboolean@p f(gpointer ptr); @k2@ identifier f; position p; identifier ptr; @@ static gboolean@p f(gpointer ptr) { ... } // hash map iterator functions @k3@ identifier f; position p; identifier p1, p2, p3; @@ static gboolean@p f(gpointer p1, gpointer p2, gpointer p3) { ... } // 2. GIOChannel @k4@ identifier f; position p; typedef GIOChannel, GIOCondition; identifier ptr; identifier ch, cn; @@ static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr); @k5@ identifier f; position p; identifier ptr; identifier ch, cn; @@ static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr) { ... } // 3. GSourceFuncs @k6@ identifier f; position p; typedef GSource; identifier src; @@ static gboolean@p f(GSource *src, ...) { ... } // gdbus functions @k7@ identifier f; position p; typedef DBusConnection; identifier con; @@ static gboolean@p f(DBusConnection *con, ...) { ... } // Now convert all gboolean which are are not used for interactin // with GLib // Note here happens the magic! @@ typedef bool; position p != {k1.p,k2.p,k3.p,k4.p,k5.p,k6.p,k7.p}; @@ - gboolean@p + bool // Update all return types @@ identifier f; @@ bool f(...) { <... - return TRUE; + return true; ...> } @@ identifier f; @@ bool f(...) { <... - return FALSE; + return false; ...> } // Rule set 3 @@ expression E; symbol TRUE; symbol FALSE; @@ ( E - == TRUE | - TRUE == E + E | - E != TRUE + !E | - TRUE != E + !E | - E == FALSE + !E | - FALSE == E + !E | E - != FALSE | - FALSE != E + E )
2013-08-20core: Use stdbool instead gboolean or near_bool_tDaniel Wagner13-228/+227
This patch has been created via coccinelle: // Rule set 1 f(es, ( - FALSE + false | - TRUE + true ) ,...) @r2@ type T; identifier f; parameter list[n] ps; identifier i; @@ T f(ps, near_bool_t i, ...); @@ identifier r2.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) @@ typedef bool; @@ - near_bool_t + bool // Rule set 2 // This is not a beautiful script but it does the job. // Improvemtents are welcome. // Fix all assigments but do not convert yet the type @@ gboolean x; @@ x = ( - TRUE + true | - FALSE + false ) // Figure out which function signature will to be fixed... // when we have the defitition @r@ identifier f; parameter list[n] ps; identifier i; @@ f(ps, gboolean i, ...) { ... } // ... and now convert all call sites @@ identifier r.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) // Figure out which function signature will to be fixed... // when we have the declaration only @r2@ type T; identifier f; parameter list[n] ps; identifier i; @@ T f(ps, gboolean i, ...); // ... and now convert all call sites @@ identifier r2.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) // A handfull of the GLib hooks we can't change. Let's remember // all ther positions. // 1. timeouts @k1@ identifier f; position p; typedef gpointer; identifier ptr; @@ static gboolean@p f(gpointer ptr); @k2@ identifier f; position p; identifier ptr; @@ static gboolean@p f(gpointer ptr) { ... } // hash map iterator functions @k3@ identifier f; position p; identifier p1, p2, p3; @@ static gboolean@p f(gpointer p1, gpointer p2, gpointer p3) { ... } // 2. GIOChannel @k4@ identifier f; position p; typedef GIOChannel, GIOCondition; identifier ptr; identifier ch, cn; @@ static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr); @k5@ identifier f; position p; identifier ptr; identifier ch, cn; @@ static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr) { ... } // 3. GSourceFuncs @k6@ identifier f; position p; typedef GSource; identifier src; @@ static gboolean@p f(GSource *src, ...) { ... } // gdbus functions @k7@ identifier f; position p; typedef DBusConnection; identifier con; @@ static gboolean@p f(DBusConnection *con, ...) { ... } // Now convert all gboolean which are are not used for interactin // with GLib // Note here happens the magic! @@ typedef bool; position p != {k1.p,k2.p,k3.p,k4.p,k5.p,k6.p,k7.p}; @@ - gboolean@p + bool // Update all return types @@ identifier f; @@ bool f(...) { <... - return TRUE; + return true; ...> } @@ identifier f; @@ bool f(...) { <... - return FALSE; + return false; ...> } // Rule set 3 @@ expression E; symbol TRUE; symbol FALSE; @@ ( E - == TRUE | - TRUE == E + E | - E != TRUE + !E | - TRUE != E + !E | - E == FALSE + !E | - FALSE == E + !E | E - != FALSE | - FALSE != E + E )
2013-08-20plugins: Use stdbool instead gboolean or near_bool_tDaniel Wagner8-75/+75
This patch has been created via coccinelle: // Rule set 1 f(es, ( - FALSE + false | - TRUE + true ) ,...) @r2@ type T; identifier f; parameter list[n] ps; identifier i; @@ T f(ps, near_bool_t i, ...); @@ identifier r2.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) @@ typedef bool; @@ - near_bool_t + bool // Rule set 2 // This is not a beautiful script but it does the job. // Improvemtents are welcome. // Fix all assigments but do not convert yet the type @@ gboolean x; @@ x = ( - TRUE + true | - FALSE + false ) // Figure out which function signature will to be fixed... // when we have the defitition @r@ identifier f; parameter list[n] ps; identifier i; @@ f(ps, gboolean i, ...) { ... } // ... and now convert all call sites @@ identifier r.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) // Figure out which function signature will to be fixed... // when we have the declaration only @r2@ type T; identifier f; parameter list[n] ps; identifier i; @@ T f(ps, gboolean i, ...); // ... and now convert all call sites @@ identifier r2.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) // A handfull of the GLib hooks we can't change. Let's remember // all ther positions. // 1. timeouts @k1@ identifier f; position p; typedef gpointer; identifier ptr; @@ static gboolean@p f(gpointer ptr); @k2@ identifier f; position p; identifier ptr; @@ static gboolean@p f(gpointer ptr) { ... } // hash map iterator functions @k3@ identifier f; position p; identifier p1, p2, p3; @@ static gboolean@p f(gpointer p1, gpointer p2, gpointer p3) { ... } // 2. GIOChannel @k4@ identifier f; position p; typedef GIOChannel, GIOCondition; identifier ptr; identifier ch, cn; @@ static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr); @k5@ identifier f; position p; identifier ptr; identifier ch, cn; @@ static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr) { ... } // 3. GSourceFuncs @k6@ identifier f; position p; typedef GSource; identifier src; @@ static gboolean@p f(GSource *src, ...) { ... } // gdbus functions @k7@ identifier f; position p; typedef DBusConnection; identifier con; @@ static gboolean@p f(DBusConnection *con, ...) { ... } // Now convert all gboolean which are are not used for interactin // with GLib // Note here happens the magic! @@ typedef bool; position p != {k1.p,k2.p,k3.p,k4.p,k5.p,k6.p,k7.p}; @@ - gboolean@p + bool // Update all return types @@ identifier f; @@ bool f(...) { <... - return TRUE; + return true; ...> } @@ identifier f; @@ bool f(...) { <... - return FALSE; + return false; ...> } // Rule set 3 @@ expression E; symbol TRUE; symbol FALSE; @@ ( E - == TRUE | - TRUE == E + E | - E != TRUE + !E | - TRUE != E + !E | - E == FALSE + !E | - FALSE == E + !E | E - != FALSE | - FALSE != E + E )
2013-08-20include: Use stdbool instead gboolean or near_bool_tDaniel Wagner4-9/+9
This patch has been created via coccinelle: // Rule set 1 f(es, ( - FALSE + false | - TRUE + true ) ,...) @r2@ type T; identifier f; parameter list[n] ps; identifier i; @@ T f(ps, near_bool_t i, ...); @@ identifier r2.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) @@ typedef bool; @@ - near_bool_t + bool // Rule set 2 // This is not a beautiful script but it does the job. // Improvemtents are welcome. // Fix all assigments but do not convert yet the type @@ gboolean x; @@ x = ( - TRUE + true | - FALSE + false ) // Figure out which function signature will to be fixed... // when we have the defitition @r@ identifier f; parameter list[n] ps; identifier i; @@ f(ps, gboolean i, ...) { ... } // ... and now convert all call sites @@ identifier r.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) // Figure out which function signature will to be fixed... // when we have the declaration only @r2@ type T; identifier f; parameter list[n] ps; identifier i; @@ T f(ps, gboolean i, ...); // ... and now convert all call sites @@ identifier r2.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) // A handfull of the GLib hooks we can't change. Let's remember // all ther positions. // 1. timeouts @k1@ identifier f; position p; typedef gpointer; identifier ptr; @@ static gboolean@p f(gpointer ptr); @k2@ identifier f; position p; identifier ptr; @@ static gboolean@p f(gpointer ptr) { ... } // hash map iterator functions @k3@ identifier f; position p; identifier p1, p2, p3; @@ static gboolean@p f(gpointer p1, gpointer p2, gpointer p3) { ... } // 2. GIOChannel @k4@ identifier f; position p; typedef GIOChannel, GIOCondition; identifier ptr; identifier ch, cn; @@ static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr); @k5@ identifier f; position p; identifier ptr; identifier ch, cn; @@ static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr) { ... } // 3. GSourceFuncs @k6@ identifier f; position p; typedef GSource; identifier src; @@ static gboolean@p f(GSource *src, ...) { ... } // gdbus functions @k7@ identifier f; position p; typedef DBusConnection; identifier con; @@ static gboolean@p f(DBusConnection *con, ...) { ... } // Now convert all gboolean which are are not used for interactin // with GLib // Note here happens the magic! @@ typedef bool; position p != {k1.p,k2.p,k3.p,k4.p,k5.p,k6.p,k7.p}; @@ - gboolean@p + bool // Update all return types @@ identifier f; @@ bool f(...) { <... - return TRUE; + return true; ...> } @@ identifier f; @@ bool f(...) { <... - return FALSE; + return false; ...> } // Rule set 3 @@ expression E; symbol TRUE; symbol FALSE; @@ ( E - == TRUE | - TRUE == E + E | - E != TRUE + !E | - TRUE != E + !E | - E == FALSE + !E | - FALSE == E + !E | E - != FALSE | - FALSE != E + E )
2013-08-20core: Include stdbool.hDaniel Wagner1-0/+1
In preperation to drop near_bool_t and use stdbool instead.
2013-08-20include: Include stdbool.hDaniel Wagner4-0/+7
In preperation to drop near_bool_t and use stdbool instead.
2013-08-20plugins: Include stdbool.hDaniel Wagner11-16/+27
In preperation to drop near_bool_t and use stdbool instead.
2013-08-20tag: Use dbus_bool_t for D-Bus functionDaniel Wagner1-1/+3