aboutsummaryrefslogtreecommitdiff
path: root/platform/bb10/payment_service.cpp
diff options
context:
space:
mode:
authorRémi Verschelde2017-03-05 16:44:50 +0100
committerRémi Verschelde2017-03-05 16:44:50 +0100
commit5dbf1809c6e3e905b94b8764e99491e608122261 (patch)
tree5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /platform/bb10/payment_service.cpp
parent45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff)
downloadgodot-5dbf180.tar.gz
godot-5dbf180.tar.zst
godot-5dbf180.zip
A Whole New World (clang-format edition)
I can show you the code Pretty, with proper whitespace Tell me, coder, now when did You last write readable code? I can open your eyes Make you see your bad indent Force you to respect the style The core devs agreed upon A whole new world A new fantastic code format A de facto standard With some sugar Enforced with clang-format A whole new world A dazzling style we all dreamed of And when we read it through It's crystal clear That now we're in a whole new world of code
Diffstat (limited to 'platform/bb10/payment_service.cpp')
-rw-r--r--platform/bb10/payment_service.cpp36
1 files changed, 17 insertions, 19 deletions
diff --git a/platform/bb10/payment_service.cpp b/platform/bb10/payment_service.cpp
index 131c9712a..e78326e8b 100644
--- a/platform/bb10/payment_service.cpp
+++ b/platform/bb10/payment_service.cpp
@@ -31,18 +31,18 @@
#include "payment_service.h"
#include "bbutil.h"
-#include <string.h>
#include <errno.h>
+#include <string.h>
#include <unistd.h>
-extern char* launch_dir_ptr;
+extern char *launch_dir_ptr;
void PaymentService::_bind_methods() {
- ClassDB::bind_method(D_METHOD("request_product_info"),&PaymentService::request_product_info);
- ClassDB::bind_method(D_METHOD("purchase"),&PaymentService::purchase);
+ ClassDB::bind_method(D_METHOD("request_product_info"), &PaymentService::request_product_info);
+ ClassDB::bind_method(D_METHOD("purchase"), &PaymentService::purchase);
- ClassDB::bind_method(D_METHOD("get_pending_event_count"),&PaymentService::get_pending_event_count);
- ClassDB::bind_method(D_METHOD("pop_pending_event"),&PaymentService::pop_pending_event);
+ ClassDB::bind_method(D_METHOD("get_pending_event_count"), &PaymentService::get_pending_event_count);
+ ClassDB::bind_method(D_METHOD("pop_pending_event"), &PaymentService::pop_pending_event);
};
Error PaymentService::request_product_info(Variant p_params) {
@@ -55,16 +55,16 @@ Error PaymentService::purchase(Variant p_params) {
Dictionary params = p_params;
ERR_FAIL_COND_V((!params.has("product_id")) && (!params.has("product_sku")), ERR_INVALID_PARAMETER);
- char* id = NULL;
- char* sku = NULL;
+ char *id = NULL;
+ char *sku = NULL;
- CharString p_id = params.has("product_id")?String(params["product_id"]).ascii():CharString();
- CharString p_sku = params.has("product_sku")?String(params["product_sku"]).ascii():CharString();
+ CharString p_id = params.has("product_id") ? String(params["product_id"]).ascii() : CharString();
+ CharString p_sku = params.has("product_sku") ? String(params["product_sku"]).ascii() : CharString();
unsigned int request_id;
chdir(launch_dir_ptr);
int ret = paymentservice_purchase_request(params.has("product_sku") ? NULL : p_id.get_data(),
- params.has("product_sku") ? p_sku.get_data() : NULL,
- NULL, NULL, NULL, NULL, get_window_group_id(), &request_id);
+ params.has("product_sku") ? p_sku.get_data() : NULL,
+ NULL, NULL, NULL, NULL, get_window_group_id(), &request_id);
chdir("app/native");
if (ret != BPS_SUCCESS) {
@@ -76,8 +76,7 @@ Error PaymentService::purchase(Variant p_params) {
return OK;
};
-
-bool PaymentService::handle_event(bps_event_t* p_event) {
+bool PaymentService::handle_event(bps_event_t *p_event) {
if (bps_event_get_domain(p_event) != paymentservice_get_domain()) {
return false;
@@ -91,12 +90,12 @@ bool PaymentService::handle_event(bps_event_t* p_event) {
res = bps_event_get_code(p_event);
if (res == PURCHASE_RESPONSE) {
dict["type"] = "purchase";
- const char* pid = paymentservice_event_get_digital_good_id(p_event, 0);
- dict["product_id"] = String(pid?pid:"");
+ const char *pid = paymentservice_event_get_digital_good_id(p_event, 0);
+ dict["product_id"] = String(pid ? pid : "");
};
} else {
- const char* desc = paymentservice_event_get_error_text(p_event);
+ const char *desc = paymentservice_event_get_error_text(p_event);
if (strcmp(desc, "alreadyPurchased") == 0) {
dict["result"] = "ok";
} else {
@@ -142,9 +141,8 @@ PaymentService::PaymentService() {
#endif
};
-PaymentService::~PaymentService() {
+PaymentService::~PaymentService(){
};
-
#endif