[epiphany/wip/ephy-sync: 47/48] ephy-sync: Replace gchar with char
- From: Gabriel - Cristian Ivascu <gabrielivascu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/ephy-sync: 47/48] ephy-sync: Replace gchar with char
- Date: Sat, 20 Aug 2016 17:07:19 +0000 (UTC)
commit b113be18bd017584139da3e0aac0ebc33443aa40
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date: Sat Aug 20 14:10:51 2016 +0300
ephy-sync: Replace gchar with char
src/ephy-sync-crypto.c | 230 +++++++++++++++++++++++-----------------------
src/ephy-sync-crypto.h | 112 ++++++++++++------------
src/ephy-sync-secret.c | 14 ++--
src/ephy-sync-secret.h | 4 +-
src/ephy-sync-service.c | 158 ++++++++++++++++----------------
src/ephy-sync-service.h | 24 +++---
src/ephy-sync-utils.c | 52 ++++++------
src/ephy-sync-utils.h | 28 +++---
src/prefs-dialog.c | 42 +++++-----
9 files changed, 332 insertions(+), 332 deletions(-)
---
diff --git a/src/ephy-sync-crypto.c b/src/ephy-sync-crypto.c
index 73a2f30..27ef6ef 100644
--- a/src/ephy-sync-crypto.c
+++ b/src/ephy-sync-crypto.c
@@ -28,18 +28,18 @@
#define HAWK_VERSION 1
-static const gchar hex_digits[] = "0123456789abcdef";
+static const char hex_digits[] = "0123456789abcdef";
EphySyncCryptoHawkOptions *
-ephy_sync_crypto_hawk_options_new (const gchar *app,
- const gchar *dlg,
- const gchar *ext,
- const gchar *content_type,
- const gchar *hash,
- const gchar *local_time_offset,
- const gchar *nonce,
- const gchar *payload,
- const gchar *timestamp)
+ephy_sync_crypto_hawk_options_new (const char *app,
+ const char *dlg,
+ const char *ext,
+ const char *content_type,
+ const char *hash,
+ const char *local_time_offset,
+ const char *nonce,
+ const char *payload,
+ const char *timestamp)
{
EphySyncCryptoHawkOptions *options;
@@ -59,16 +59,16 @@ ephy_sync_crypto_hawk_options_new (const gchar *app,
static EphySyncCryptoHawkArtifacts *
-ephy_sync_crypto_hawk_artifacts_new (const gchar *app,
- const gchar *dlg,
- const gchar *ext,
- const gchar *hash,
- const gchar *host,
- const gchar *method,
- const gchar *nonce,
- guint port,
- const gchar *resource,
- gint64 ts)
+ephy_sync_crypto_hawk_artifacts_new (const char *app,
+ const char *dlg,
+ const char *ext,
+ const char *hash,
+ const char *host,
+ const char *method,
+ const char *nonce,
+ guint port,
+ const char *resource,
+ gint64 ts)
{
EphySyncCryptoHawkArtifacts *artifacts;
@@ -88,7 +88,7 @@ ephy_sync_crypto_hawk_artifacts_new (const gchar *app,
}
static EphySyncCryptoHawkHeader *
-ephy_sync_crypto_hawk_header_new (gchar *header,
+ephy_sync_crypto_hawk_header_new (char *header,
EphySyncCryptoHawkArtifacts *artifacts)
{
EphySyncCryptoHawkHeader *hheader;
@@ -172,8 +172,8 @@ ephy_sync_crypto_rsa_key_pair_free (EphySyncCryptoRSAKeyPair *keypair)
g_slice_free (EphySyncCryptoRSAKeyPair, keypair);
}
-static gchar *
-ephy_sync_crypto_kw (const gchar *name)
+static char *
+ephy_sync_crypto_kw (const char *name)
{
g_return_val_if_fail (name != NULL, NULL);
@@ -212,16 +212,16 @@ ephy_sync_crypto_equals (guint8 *a,
return TRUE;
}
-static gchar *
-ephy_sync_crypto_normalize_string (const gchar *type,
+static char *
+ephy_sync_crypto_normalize_string (const char *type,
EphySyncCryptoHawkArtifacts *artifacts)
{
- gchar *host;
- gchar *info;
- gchar *method;
- gchar *n_ext = NULL;
- gchar *normalized;
- gchar *tmp;
+ char *host;
+ char *info;
+ char *method;
+ char *n_ext = NULL;
+ char *normalized;
+ char *tmp;
g_return_val_if_fail (type != NULL, NULL);
g_return_val_if_fail (artifacts != NULL, NULL);
@@ -260,11 +260,11 @@ ephy_sync_crypto_normalize_string (const gchar *type,
return normalized;
}
-static gchar *
-ephy_sync_crypto_parse_content_type (const gchar *content_type)
+static char *
+ephy_sync_crypto_parse_content_type (const char *content_type)
{
- gchar **tokens;
- gchar *retval;
+ char **tokens;
+ char *retval;
g_return_val_if_fail (content_type != NULL, NULL);
@@ -275,15 +275,15 @@ ephy_sync_crypto_parse_content_type (const gchar *content_type)
return retval;
}
-static gchar *
-ephy_sync_crypto_calculate_payload_hash (const gchar *payload,
- const gchar *content_type)
+static char *
+ephy_sync_crypto_calculate_payload_hash (const char *payload,
+ const char *content_type)
{
guint8 *digest;
- gchar *digest_hex;
- gchar *content;
- gchar *update;
- gchar *hash;
+ char *digest_hex;
+ char *content;
+ char *update;
+ char *hash;
g_return_val_if_fail (payload != NULL, NULL);
g_return_val_if_fail (content_type != NULL, NULL);
@@ -304,16 +304,16 @@ ephy_sync_crypto_calculate_payload_hash (const gchar *payload,
return hash;
}
-static gchar *
-ephy_sync_crypto_calculate_mac (const gchar *type,
+static char *
+ephy_sync_crypto_calculate_mac (const char *type,
guint8 *key,
gsize key_len,
EphySyncCryptoHawkArtifacts *artifacts)
{
guint8 *digest;
- gchar *digest_hex;
- gchar *normalized;
- gchar *mac;
+ char *digest_hex;
+ char *normalized;
+ char *mac;
g_return_val_if_fail (type != NULL, NULL);
g_return_val_if_fail (key != NULL, NULL);
@@ -331,13 +331,13 @@ ephy_sync_crypto_calculate_mac (const gchar *type,
return mac;
}
-static gchar *
-ephy_sync_crypto_append_to_header (gchar *header,
- const gchar *name,
- gchar *value)
+static char *
+ephy_sync_crypto_append_to_header (char *header,
+ const char *name,
+ char *value)
{
- gchar *new_header;
- gchar *tmp;
+ char *new_header;
+ char *tmp;
g_return_val_if_fail (header != NULL, NULL);
g_return_val_if_fail (name != NULL, NULL);
@@ -360,8 +360,8 @@ ephy_sync_crypto_hkdf (guint8 *in,
guint8 *out,
gsize out_len)
{
- gchar *prk_hex;
- gchar *tmp_hex;
+ char *prk_hex;
+ char *tmp_hex;
guint8 *tmp;
guint8 *prk;
guint8 *out_full;
@@ -431,7 +431,7 @@ ephy_sync_crypto_random_gen (void *ctx,
}
static void
-ephy_sync_crypto_b64_to_b64_urlsafe (gchar *text)
+ephy_sync_crypto_b64_to_b64_urlsafe (char *text)
{
g_return_if_fail (text != NULL);
@@ -441,7 +441,7 @@ ephy_sync_crypto_b64_to_b64_urlsafe (gchar *text)
}
static void
-ephy_sync_crypto_b64_urlsafe_to_b64 (gchar *text)
+ephy_sync_crypto_b64_urlsafe_to_b64 (char *text)
{
g_return_if_fail (text != NULL);
@@ -451,18 +451,18 @@ ephy_sync_crypto_b64_urlsafe_to_b64 (gchar *text)
}
void
-ephy_sync_crypto_process_key_fetch_token (const gchar *keyFetchToken,
- guint8 **tokenID,
- guint8 **reqHMACkey,
- guint8 **respHMACkey,
- guint8 **respXORkey)
+ephy_sync_crypto_process_key_fetch_token (const char *keyFetchToken,
+ guint8 **tokenID,
+ guint8 **reqHMACkey,
+ guint8 **respHMACkey,
+ guint8 **respXORkey)
{
guint8 *kft;
guint8 *out1;
guint8 *out2;
guint8 *keyRequestKey;
- gchar *info_kft;
- gchar *info_keys;
+ char *info_kft;
+ char *info_keys;
g_return_if_fail (keyFetchToken != NULL);
g_return_if_fail (tokenID != NULL);
@@ -507,14 +507,14 @@ ephy_sync_crypto_process_key_fetch_token (const gchar *keyFetchToken,
}
void
-ephy_sync_crypto_process_session_token (const gchar *sessionToken,
- guint8 **tokenID,
- guint8 **reqHMACkey,
- guint8 **requestKey)
+ephy_sync_crypto_process_session_token (const char *sessionToken,
+ guint8 **tokenID,
+ guint8 **reqHMACkey,
+ guint8 **requestKey)
{
guint8 *st;
guint8 *out;
- gchar *info;
+ char *info;
g_return_if_fail (sessionToken != NULL);
g_return_if_fail (tokenID != NULL);
@@ -543,12 +543,12 @@ ephy_sync_crypto_process_session_token (const gchar *sessionToken,
}
void
-ephy_sync_crypto_compute_sync_keys (const gchar *bundle,
- guint8 *respHMACkey,
- guint8 *respXORkey,
- guint8 *unwrapBKey,
- guint8 **kA,
- guint8 **kB)
+ephy_sync_crypto_compute_sync_keys (const char *bundle,
+ guint8 *respHMACkey,
+ guint8 *respXORkey,
+ guint8 *unwrapBKey,
+ guint8 **kA,
+ guint8 **kB)
{
guint8 *bdl;
guint8 *ciphertext;
@@ -556,7 +556,7 @@ ephy_sync_crypto_compute_sync_keys (const gchar *bundle,
guint8 *respMAC2;
guint8 *xored;
guint8 *wrapKB;
- gchar *respMAC2_hex;
+ char *respMAC2_hex;
g_return_if_fail (bundle != NULL);
g_return_if_fail (respHMACkey != NULL);
@@ -594,22 +594,22 @@ ephy_sync_crypto_compute_sync_keys (const gchar *bundle,
}
EphySyncCryptoHawkHeader *
-ephy_sync_crypto_compute_hawk_header (const gchar *url,
- const gchar *method,
- const gchar *id,
+ephy_sync_crypto_compute_hawk_header (const char *url,
+ const char *method,
+ const char *id,
guint8 *key,
gsize key_len,
EphySyncCryptoHawkOptions *options)
{
EphySyncCryptoHawkArtifacts *artifacts;
SoupURI *uri;
- gchar *resource;
- gchar *hash;
- gchar *header;
- gchar *mac;
- gchar *nonce;
- gchar *payload;
- gchar *timestamp;
+ char *resource;
+ char *hash;
+ char *header;
+ char *mac;
+ char *nonce;
+ char *payload;
+ char *timestamp;
gint64 ts;
g_return_val_if_fail (url != NULL, NULL);
@@ -623,13 +623,13 @@ ephy_sync_crypto_compute_hawk_header (const gchar *url,
payload = options ? options->payload : NULL;
timestamp = options ? options->timestamp : NULL;
uri = soup_uri_new (url);
- resource = (gchar *) soup_uri_get_path (uri);
+ resource = (char *) soup_uri_get_path (uri);
if (soup_uri_get_query (uri) != NULL)
resource = g_strconcat (resource, "?", soup_uri_get_query (uri), NULL);
if (timestamp != NULL) {
- gchar *local_time_offset;
+ char *local_time_offset;
gint64 offset;
local_time_offset = options ? options->local_time_offset : NULL;
@@ -638,7 +638,7 @@ ephy_sync_crypto_compute_hawk_header (const gchar *url,
}
if (hash == NULL && payload != NULL) {
- const gchar *content_type = options ? options->content_type : "text/plain";
+ const char *content_type = options ? options->content_type : "text/plain";
hash = ephy_sync_crypto_calculate_payload_hash (payload, content_type);
}
@@ -664,8 +664,8 @@ ephy_sync_crypto_compute_hawk_header (const gchar *url,
header = ephy_sync_crypto_append_to_header (header, "hash", artifacts->hash);
if (artifacts->ext != NULL && strlen (artifacts->ext) > 0) {
- gchar *h_ext;
- gchar *tmp_ext;
+ char *h_ext;
+ char *tmp_ext;
tmp_ext = ephy_sync_utils_find_and_replace (artifacts->ext, "\\", "\\\\");
h_ext = ephy_sync_utils_find_and_replace (tmp_ext, "\n", "\\n");
@@ -700,7 +700,7 @@ ephy_sync_crypto_generate_rsa_key_pair (void)
{
struct rsa_public_key public;
struct rsa_private_key private;
- gint retval;
+ int retval;
rsa_public_key_init (&public);
rsa_private_key_init (&private);
@@ -722,21 +722,21 @@ ephy_sync_crypto_generate_rsa_key_pair (void)
return ephy_sync_crypto_rsa_key_pair_new (public, private);
}
-gchar *
-ephy_sync_crypto_create_assertion (const gchar *certificate,
- const gchar *audience,
+char *
+ephy_sync_crypto_create_assertion (const char *certificate,
+ const char *audience,
guint64 duration,
EphySyncCryptoRSAKeyPair *keypair)
{
mpz_t signature;
- const gchar *header = "{\"alg\": \"RS256\"}";
- gchar *body;
- gchar *body_b64;
- gchar *header_b64;
- gchar *to_sign;
- gchar *sig_b64 = NULL;
- gchar *assertion = NULL;
- gchar *digest_hex;
+ const char *header = "{\"alg\": \"RS256\"}";
+ char *body;
+ char *body_b64;
+ char *header_b64;
+ char *to_sign;
+ char *sig_b64 = NULL;
+ char *assertion = NULL;
+ char *digest_hex;
guint8 *digest;
guint8 *sig = NULL;
guint64 expires_at;
@@ -790,14 +790,14 @@ out:
return assertion;
}
-gchar *
+char *
ephy_sync_crypto_generate_random_hex (gsize length)
{
FILE *fp;
gsize num_bytes;
guint8 *bytes;
- gchar *hex;
- gchar *out;
+ char *hex;
+ char *out;
g_assert (length > 0);
num_bytes = (length + 1) / 2;
@@ -815,13 +815,13 @@ ephy_sync_crypto_generate_random_hex (gsize length)
return out;
}
-gchar *
+char *
ephy_sync_crypto_base64_urlsafe_encode (guint8 *data,
gsize data_len,
gboolean strip)
{
- gchar *base64;
- gchar *out;
+ char *base64;
+ char *out;
gsize start = 0;
gssize end;
@@ -847,13 +847,13 @@ ephy_sync_crypto_base64_urlsafe_encode (guint8 *data,
}
guint8 *
-ephy_sync_crypto_base64_urlsafe_decode (const gchar *text,
+ephy_sync_crypto_base64_urlsafe_decode (const char *text,
gsize *out_len,
gboolean fill)
{
guint8 *out;
- gchar *to_decode;
- gchar *suffix = NULL;
+ char *to_decode;
+ char *suffix = NULL;
g_return_val_if_fail (text != NULL, NULL);
g_return_val_if_fail (out_len != NULL, NULL);
@@ -911,11 +911,11 @@ ephy_sync_crypto_aes_256 (EphySyncCryptoAES256Mode mode,
return out;
}
-gchar *
+char *
ephy_sync_crypto_encode_hex (guint8 *data,
gsize data_len)
{
- gchar *retval;
+ char *retval;
gsize length;
g_return_val_if_fail (data != NULL, NULL);
@@ -936,7 +936,7 @@ ephy_sync_crypto_encode_hex (guint8 *data,
}
guint8 *
-ephy_sync_crypto_decode_hex (const gchar *hex)
+ephy_sync_crypto_decode_hex (const char *hex)
{
guint8 *retval;
gsize hex_len = strlen (hex);
diff --git a/src/ephy-sync-crypto.h b/src/ephy-sync-crypto.h
index 628cb30..a2dfb90 100644
--- a/src/ephy-sync-crypto.h
+++ b/src/ephy-sync-crypto.h
@@ -32,32 +32,32 @@ typedef enum {
} EphySyncCryptoAES256Mode;
typedef struct {
- gchar *app;
- gchar *dlg;
- gchar *ext;
- gchar *content_type;
- gchar *hash;
- gchar *local_time_offset;
- gchar *nonce;
- gchar *payload;
- gchar *timestamp;
+ char *app;
+ char *dlg;
+ char *ext;
+ char *content_type;
+ char *hash;
+ char *local_time_offset;
+ char *nonce;
+ char *payload;
+ char *timestamp;
} EphySyncCryptoHawkOptions;
typedef struct {
- gchar *app;
- gchar *dlg;
- gchar *ext;
- gchar *hash;
- gchar *host;
- gchar *method;
- gchar *nonce;
- gchar *port;
- gchar *resource;
- gchar *ts;
+ char *app;
+ char *dlg;
+ char *ext;
+ char *hash;
+ char *host;
+ char *method;
+ char *nonce;
+ char *port;
+ char *resource;
+ char *ts;
} EphySyncCryptoHawkArtifacts;
typedef struct {
- gchar *header;
+ char *header;
EphySyncCryptoHawkArtifacts *artifacts;
} EphySyncCryptoHawkHeader;
@@ -66,59 +66,59 @@ typedef struct {
struct rsa_private_key private;
} EphySyncCryptoRSAKeyPair;
-EphySyncCryptoHawkOptions *ephy_sync_crypto_hawk_options_new (const gchar *app,
- const gchar *dlg,
- const gchar *ext,
- const gchar *content_type,
- const gchar *hash,
- const gchar *local_time_offset,
- const gchar *nonce,
- const gchar *payload,
- const gchar *timestamp);
+EphySyncCryptoHawkOptions *ephy_sync_crypto_hawk_options_new (const char *app,
+ const char *dlg,
+ const char *ext,
+ const char *content_type,
+ const char *hash,
+ const char *local_time_offset,
+ const char *nonce,
+ const char *payload,
+ const char *timestamp);
void ephy_sync_crypto_hawk_options_free (EphySyncCryptoHawkOptions *options);
void ephy_sync_crypto_hawk_header_free (EphySyncCryptoHawkHeader *header);
void ephy_sync_crypto_rsa_key_pair_free (EphySyncCryptoRSAKeyPair *keypair);
-void ephy_sync_crypto_process_key_fetch_token (const gchar *keyFetchToken,
- guint8 **tokenID,
- guint8 **reqHMACkey,
- guint8 **respHMACkey,
- guint8 **respXORkey);
-void ephy_sync_crypto_process_session_token (const gchar *sessionToken,
- guint8 **tokenID,
- guint8 **reqHMACkey,
- guint8 **requestKey);
-void ephy_sync_crypto_compute_sync_keys (const gchar *bundle,
- guint8 *respHMACkey,
- guint8 *respXORkey,
- guint8 *unwrapBKey,
- guint8 **kA,
- guint8 **kB);
-EphySyncCryptoHawkHeader *ephy_sync_crypto_compute_hawk_header (const gchar *url,
- const gchar *method,
- const gchar *id,
+void ephy_sync_crypto_process_key_fetch_token (const char *keyFetchToken,
+ guint8 **tokenID,
+ guint8 **reqHMACkey,
+ guint8 **respHMACkey,
+ guint8 **respXORkey);
+void ephy_sync_crypto_process_session_token (const char *sessionToken,
+ guint8 **tokenID,
+ guint8 **reqHMACkey,
+ guint8 **requestKey);
+void ephy_sync_crypto_compute_sync_keys (const char *bundle,
+ guint8 *respHMACkey,
+ guint8 *respXORkey,
+ guint8 *unwrapBKey,
+ guint8 **kA,
+ guint8 **kB);
+EphySyncCryptoHawkHeader *ephy_sync_crypto_compute_hawk_header (const char *url,
+ const char *method,
+ const char *id,
guint8 *key,
gsize key_len,
EphySyncCryptoHawkOptions *options);
EphySyncCryptoRSAKeyPair *ephy_sync_crypto_generate_rsa_key_pair (void);
-gchar *ephy_sync_crypto_create_assertion (const gchar *certificate,
- const gchar *audience,
+char *ephy_sync_crypto_create_assertion (const char *certificate,
+ const char *audience,
guint64 duration,
EphySyncCryptoRSAKeyPair *keypair);
-gchar *ephy_sync_crypto_generate_random_hex (gsize length);
-gchar *ephy_sync_crypto_base64_urlsafe_encode (guint8 *data,
+char *ephy_sync_crypto_generate_random_hex (gsize length);
+char *ephy_sync_crypto_base64_urlsafe_encode (guint8 *data,
gsize data_len,
gboolean strip);
-guint8 *ephy_sync_crypto_base64_urlsafe_decode (const gchar *text,
- gsize *out_len,
- gboolean fill);
+guint8 *ephy_sync_crypto_base64_urlsafe_decode (const char *text,
+ gsize *out_len,
+ gboolean fill);
guint8 *ephy_sync_crypto_aes_256 (EphySyncCryptoAES256Mode mode,
const guint8 *key,
const guint8 *data,
gsize data_len,
gsize *out_len);
-gchar *ephy_sync_crypto_encode_hex (guint8 *data,
+char *ephy_sync_crypto_encode_hex (guint8 *data,
gsize data_len);
-guint8 *ephy_sync_crypto_decode_hex (const gchar *hex_string);
+guint8 *ephy_sync_crypto_decode_hex (const char *hex);
G_END_DECLS
diff --git a/src/ephy-sync-secret.c b/src/ephy-sync-secret.c
index 58603eb..486299d 100644
--- a/src/ephy-sync-secret.c
+++ b/src/ephy-sync-secret.c
@@ -83,9 +83,9 @@ ephy_sync_secret_load_tokens (EphySyncService *service)
GError *error = NULL;
GList *matches;
EphySyncTokenType type;
- const gchar *email;
- const gchar *value;
- gchar *user_email;
+ const char *email;
+ const char *value;
+ char *user_email;
user_email = ephy_sync_service_get_user_email (service);
attributes = secret_attributes_build (EPHY_SYNC_TOKEN_SCHEMA, NULL);
@@ -115,14 +115,14 @@ ephy_sync_secret_load_tokens (EphySyncService *service)
}
void
-ephy_sync_secret_store_token (const gchar *email,
- gchar *value,
+ephy_sync_secret_store_token (const char *email,
+ char *value,
EphySyncTokenType type)
{
SecretValue *secret_value;
GHashTable *attributes;
- const gchar *name;
- gchar *label;
+ const char *name;
+ char *label;
g_return_if_fail (email);
g_return_if_fail (value);
diff --git a/src/ephy-sync-secret.h b/src/ephy-sync-secret.h
index cd1e8b5..c2c285f 100644
--- a/src/ephy-sync-secret.h
+++ b/src/ephy-sync-secret.h
@@ -36,8 +36,8 @@ const SecretSchema *ephy_sync_secret_get_token_schema (void) G_GNUC_CONST;
void ephy_sync_secret_forget_tokens (void);
void ephy_sync_secret_load_tokens (EphySyncService *service);
-void ephy_sync_secret_store_token (const gchar *email,
- gchar *value,
+void ephy_sync_secret_store_token (const char *email,
+ char *value,
EphySyncTokenType type);
G_END_DECLS
diff --git a/src/ephy-sync-service.c b/src/ephy-sync-service.c
index 2e9a366..606fcd8 100644
--- a/src/ephy-sync-service.c
+++ b/src/ephy-sync-service.c
@@ -41,25 +41,25 @@ struct _EphySyncService {
SoupSession *session;
guint sync_frequency;
- gchar *uid;
- gchar *sessionToken;
- gchar *keyFetchToken;
- gchar *unwrapBKey;
- gchar *kA;
- gchar *kB;
-
- gchar *user_email;
+ char *uid;
+ char *sessionToken;
+ char *keyFetchToken;
+ char *unwrapBKey;
+ char *kA;
+ char *kB;
+
+ char *user_email;
double sync_time;
gint64 auth_at;
gboolean locked;
- gchar *storage_endpoint;
- gchar *storage_credentials_id;
- gchar *storage_credentials_key;
+ char *storage_endpoint;
+ char *storage_credentials_id;
+ char *storage_credentials_key;
gint64 storage_credentials_expiry_time;
GQueue *storage_queue;
- gchar *certificate;
+ char *certificate;
EphySyncCryptoRSAKeyPair *keypair;
};
@@ -67,9 +67,9 @@ G_DEFINE_TYPE (EphySyncService, ephy_sync_service, G_TYPE_OBJECT);
typedef struct {
EphySyncService *service;
- gchar *endpoint;
- const gchar *method;
- gchar *request_body;
+ char *endpoint;
+ const char *method;
+ char *request_body;
double modified_since;
double unmodified_since;
SoupSessionCallback callback;
@@ -78,9 +78,9 @@ typedef struct {
static StorageServerRequestAsyncData *
storage_server_request_async_data_new (EphySyncService *service,
- gchar *endpoint,
- const gchar *method,
- gchar *request_body,
+ char *endpoint,
+ const char *method,
+ char *request_body,
double modified_since,
double unmodified_since,
SoupSessionCallback callback,
@@ -154,19 +154,19 @@ ephy_sync_service_storage_credentials_is_expired (EphySyncService *self)
static void
ephy_sync_service_fxa_hawk_post_async (EphySyncService *self,
- const gchar *endpoint,
- const gchar *id,
+ const char *endpoint,
+ const char *id,
guint8 *key,
gsize key_length,
- gchar *request_body,
+ char *request_body,
SoupSessionCallback callback,
gpointer user_data)
{
EphySyncCryptoHawkOptions *hoptions;
EphySyncCryptoHawkHeader *hheader;
SoupMessage *msg;
- gchar *url;
- const gchar *content_type = "application/json";
+ char *url;
+ const char *content_type = "application/json";
g_return_if_fail (EPHY_IS_SYNC_SERVICE (self));
g_return_if_fail (endpoint != NULL);
@@ -193,8 +193,8 @@ ephy_sync_service_fxa_hawk_post_async (EphySyncService *self,
static guint
ephy_sync_service_fxa_hawk_get_sync (EphySyncService *self,
- const gchar *endpoint,
- const gchar *id,
+ const char *endpoint,
+ const char *id,
guint8 *key,
gsize key_length,
JsonNode **node)
@@ -202,7 +202,7 @@ ephy_sync_service_fxa_hawk_get_sync (EphySyncService *self,
EphySyncCryptoHawkHeader *hheader;
SoupMessage *msg;
JsonParser *parser;
- gchar *url;
+ char *url;
g_return_val_if_fail (EPHY_IS_SYNC_SERVICE (self), 0);
g_return_val_if_fail (endpoint != NULL, 0);
@@ -235,10 +235,10 @@ ephy_sync_service_send_storage_request (EphySyncService *self,
EphySyncCryptoHawkOptions *hoptions = NULL;
EphySyncCryptoHawkHeader *hheader;
SoupMessage *msg;
- gchar *url;
- gchar *if_modified_since = NULL;
- gchar *if_unmodified_since = NULL;
- const gchar *content_type = "application/json";
+ char *url;
+ char *if_modified_since = NULL;
+ char *if_unmodified_since = NULL;
+ const char *content_type = "application/json";
g_return_if_fail (EPHY_IS_SYNC_SERVICE (self));
g_return_if_fail (data != NULL);
@@ -285,18 +285,18 @@ ephy_sync_service_send_storage_request (EphySyncService *self,
static gboolean
ephy_sync_service_certificate_is_valid (EphySyncService *self,
- const gchar *certificate)
+ const char *certificate)
{
JsonParser *parser;
JsonObject *json;
JsonObject *principal;
SoupURI *uri;
- gchar **pieces;
- gchar *header;
- gchar *payload;
- gchar *uid_email = NULL;
- const gchar *alg;
- const gchar *email;
+ char **pieces;
+ char *header;
+ char *payload;
+ char *uid_email = NULL;
+ const char *alg;
+ const char *email;
gsize len;
gboolean retval = FALSE;
@@ -305,8 +305,8 @@ ephy_sync_service_certificate_is_valid (EphySyncService *self,
uri = soup_uri_new (MOZILLA_FXA_SERVER_URL);
pieces = g_strsplit (certificate, ".", 0);
- header = (gchar *) ephy_sync_crypto_base64_urlsafe_decode (pieces[0], &len, TRUE);
- payload = (gchar *) ephy_sync_crypto_base64_urlsafe_decode (pieces[1], &len, TRUE);
+ header = (char *) ephy_sync_crypto_base64_urlsafe_decode (pieces[0], &len, TRUE);
+ payload = (char *) ephy_sync_crypto_base64_urlsafe_decode (pieces[1], &len, TRUE);
parser = json_parser_new ();
json_parser_load_from_data (parser, header, -1, NULL);
@@ -402,11 +402,11 @@ ephy_sync_service_obtain_storage_credentials (EphySyncService *self,
{
SoupMessage *msg;
guint8 *kB;
- gchar *hashed_kB;
- gchar *client_state;
- gchar *audience;
- gchar *assertion;
- gchar *authorization;
+ char *hashed_kB;
+ char *client_state;
+ char *audience;
+ char *assertion;
+ char *authorization;
g_return_if_fail (EPHY_IS_SYNC_SERVICE (self));
g_return_if_fail (self->certificate != NULL);
@@ -446,7 +446,7 @@ obtain_signed_certificate_response_cb (SoupSession *session,
EphySyncService *service;
JsonParser *parser;
JsonObject *json;
- const gchar *certificate;
+ const char *certificate;
data = (StorageServerRequestAsyncData *) user_data;
service = EPHY_SYNC_SERVICE (data->service);
@@ -487,11 +487,11 @@ ephy_sync_service_obtain_signed_certificate (EphySyncService *self,
guint8 *tokenID;
guint8 *reqHMACkey;
guint8 *requestKey;
- gchar *tokenID_hex;
- gchar *public_key_json;
- gchar *request_body;
- gchar *n;
- gchar *e;
+ char *tokenID_hex;
+ char *public_key_json;
+ char *request_body;
+ char *n;
+ char *e;
g_return_if_fail (EPHY_IS_SYNC_SERVICE (self));
g_return_if_fail (self->sessionToken != NULL);
@@ -590,7 +590,7 @@ ephy_sync_service_class_init (EphySyncServiceClass *klass)
static void
ephy_sync_service_init (EphySyncService *self)
{
- gchar *email;
+ char *email;
self->session = soup_session_new ();
self->storage_queue = g_queue_new ();
@@ -622,7 +622,7 @@ ephy_sync_service_is_signed_in (EphySyncService *self)
return self->user_email != NULL;
}
-gchar *
+char *
ephy_sync_service_get_user_email (EphySyncService *self)
{
g_return_val_if_fail (EPHY_IS_SYNC_SERVICE (self), NULL);
@@ -632,7 +632,7 @@ ephy_sync_service_get_user_email (EphySyncService *self)
void
ephy_sync_service_set_user_email (EphySyncService *self,
- const gchar *email)
+ const char *email)
{
g_return_if_fail (EPHY_IS_SYNC_SERVICE (self));
@@ -680,7 +680,7 @@ ephy_sync_service_set_sync_frequency (EphySyncService *self,
self->sync_frequency = sync_frequency;
}
-gchar *
+char *
ephy_sync_service_get_token (EphySyncService *self,
EphySyncTokenType type)
{
@@ -706,7 +706,7 @@ ephy_sync_service_get_token (EphySyncService *self,
void
ephy_sync_service_set_token (EphySyncService *self,
- gchar *value,
+ char *value,
EphySyncTokenType type)
{
g_return_if_fail (EPHY_IS_SYNC_SERVICE (self));
@@ -744,12 +744,12 @@ ephy_sync_service_set_token (EphySyncService *self,
void
ephy_sync_service_set_and_store_tokens (EphySyncService *self,
- gchar *value,
+ char *value,
EphySyncTokenType type,
...)
{
EphySyncTokenType next_type;
- gchar *next_value;
+ char *next_value;
va_list args;
g_return_if_fail (EPHY_IS_SYNC_SERVICE (self));
@@ -759,7 +759,7 @@ ephy_sync_service_set_and_store_tokens (EphySyncService *self,
ephy_sync_secret_store_token (self->user_email, value, type);
va_start (args, type);
- while ((next_value = va_arg (args, gchar *)) != NULL) {
+ while ((next_value = va_arg (args, char *)) != NULL) {
next_type = va_arg (args, EphySyncTokenType);
ephy_sync_service_set_token (self, next_value, next_type);
ephy_sync_secret_store_token (self->user_email, next_value, next_type);
@@ -794,7 +794,7 @@ ephy_sync_service_clear_tokens (EphySyncService *self)
void
ephy_sync_service_destroy_session (EphySyncService *self,
- const gchar *sessionToken)
+ const char *sessionToken)
{
EphySyncCryptoHawkOptions *hoptions;
EphySyncCryptoHawkHeader *hheader;
@@ -802,11 +802,11 @@ ephy_sync_service_destroy_session (EphySyncService *self,
guint8 *tokenID;
guint8 *reqHMACkey;
guint8 *requestKey;
- gchar *tokenID_hex;
- gchar *url;
- const gchar *content_type = "application/json";
- const gchar *endpoint = "session/destroy";
- const gchar *request_body = "{}";
+ char *tokenID_hex;
+ char *url;
+ const char *content_type = "application/json";
+ const char *endpoint = "session/destroy";
+ const char *request_body = "{}";
g_return_if_fail (EPHY_IS_SYNC_SERVICE (self));
@@ -841,9 +841,9 @@ ephy_sync_service_destroy_session (EphySyncService *self,
gboolean
ephy_sync_service_fetch_sync_keys (EphySyncService *self,
- const gchar *email,
- const gchar *keyFetchToken,
- const gchar *unwrapBKey)
+ const char *email,
+ const char *keyFetchToken,
+ const char *unwrapBKey)
{
JsonNode *node;
JsonObject *json;
@@ -854,7 +854,7 @@ ephy_sync_service_fetch_sync_keys (EphySyncService *self,
guint8 *respXORkey;
guint8 *kA;
guint8 *kB;
- gchar *tokenID_hex;
+ char *tokenID_hex;
guint status_code;
gboolean retval = FALSE;
@@ -909,9 +909,9 @@ out:
void
ephy_sync_service_send_storage_message (EphySyncService *self,
- gchar *endpoint,
- const gchar *method,
- gchar *request_body,
+ char *endpoint,
+ const char *method,
+ char *request_body,
double modified_since,
double unmodified_since,
SoupSessionCallback callback,
@@ -990,8 +990,8 @@ ephy_sync_service_upload_bookmark (EphySyncService *self,
EphyBookmark *bookmark,
gboolean force)
{
- gchar *endpoint;
- gchar *bso;
+ char *endpoint;
+ char *bso;
double modified;
g_return_if_fail (EPHY_IS_SYNC_SERVICE (self));
@@ -1024,7 +1024,7 @@ download_bookmark_response_cb (SoupSession *session,
GSequenceIter *iter;
JsonParser *parser;
JsonObject *bso;
- const gchar *id;
+ const char *id;
if (msg->status_code != 200) {
LOG ("Failed to download from server. Status code: %u, response: %s",
@@ -1060,7 +1060,7 @@ void
ephy_sync_service_download_bookmark (EphySyncService *self,
EphyBookmark *bookmark)
{
- gchar *endpoint;
+ char *endpoint;
g_return_if_fail (EPHY_IS_SYNC_SERVICE (self));
g_return_if_fail (ephy_sync_service_is_signed_in (self));
@@ -1123,7 +1123,7 @@ ephy_sync_service_delete_bookmark (EphySyncService *self,
EphyBookmark *bookmark,
gboolean conditional)
{
- gchar *endpoint;
+ char *endpoint;
g_return_if_fail (EPHY_IS_SYNC_SERVICE (self));
g_return_if_fail (ephy_sync_service_is_signed_in (self));
@@ -1161,7 +1161,7 @@ sync_bookmarks_first_time_response_cb (SoupSession *session,
GHashTable *marked;
JsonParser *parser;
JsonArray *array;
- const gchar *timestamp;
+ const char *timestamp;
double server_time;
service = ephy_shell_get_sync_service (ephy_shell_get_default ());
@@ -1278,7 +1278,7 @@ sync_bookmarks_response_cb (SoupSession *session,
GSequenceIter *iter;
JsonParser *parser;
JsonArray *array;
- const gchar *timestamp;
+ const char *timestamp;
double server_time;
service = ephy_shell_get_sync_service (ephy_shell_get_default ());
@@ -1363,7 +1363,7 @@ void
ephy_sync_service_sync_bookmarks (EphySyncService *self,
gboolean first)
{
- gchar *endpoint;
+ char *endpoint;
g_return_if_fail (EPHY_IS_SYNC_SERVICE (self));
g_return_if_fail (ephy_sync_service_is_signed_in (self));
diff --git a/src/ephy-sync-service.h b/src/ephy-sync-service.h
index 2bb0561..0cb8d6b 100644
--- a/src/ephy-sync-service.h
+++ b/src/ephy-sync-service.h
@@ -33,36 +33,36 @@ G_DECLARE_FINAL_TYPE (EphySyncService, ephy_sync_service, EPHY, SYNC_SERVICE, GO
EphySyncService *ephy_sync_service_new (void);
gboolean ephy_sync_service_is_signed_in (EphySyncService *self);
-gchar *ephy_sync_service_get_user_email (EphySyncService *self);
+char *ephy_sync_service_get_user_email (EphySyncService *self);
void ephy_sync_service_set_user_email (EphySyncService *self,
- const gchar *email);
+ const char *email);
double ephy_sync_service_get_sync_time (EphySyncService *self);
void ephy_sync_service_set_sync_time (EphySyncService *self,
double time);
guint ephy_sync_service_get_sync_frequency (EphySyncService *self);
void ephy_sync_service_set_sync_frequency (EphySyncService *self,
guint sync_frequency);
-gchar *ephy_sync_service_get_token (EphySyncService *self,
+char *ephy_sync_service_get_token (EphySyncService *self,
EphySyncTokenType type);
void ephy_sync_service_set_token (EphySyncService *self,
- gchar *value,
+ char *value,
EphySyncTokenType type);
void ephy_sync_service_set_and_store_tokens (EphySyncService *self,
- gchar *value,
+ char *value,
EphySyncTokenType type,
...) G_GNUC_NULL_TERMINATED;
void ephy_sync_service_clear_storage_credentials (EphySyncService *self);
void ephy_sync_service_clear_tokens (EphySyncService *self);
void ephy_sync_service_destroy_session (EphySyncService *self,
- const gchar *sessionToken);
+ const char *sessionToken);
gboolean ephy_sync_service_fetch_sync_keys (EphySyncService *self,
- const gchar *email,
- const gchar *keyFetchToken,
- const gchar *unwrapBKey);
+ const char *email,
+ const char *keyFetchToken,
+ const char *unwrapBKey);
void ephy_sync_service_send_storage_message (EphySyncService *self,
- gchar *endpoint,
- const gchar *method,
- gchar *request_body,
+ char *endpoint,
+ const char *method,
+ char *request_body,
double modified_since,
double unmodified_since,
SoupSessionCallback callback,
diff --git a/src/ephy-sync-utils.c b/src/ephy-sync-utils.c
index 702fba7..e76e667 100644
--- a/src/ephy-sync-utils.c
+++ b/src/ephy-sync-utils.c
@@ -22,22 +22,22 @@
#include <libsoup/soup.h>
#include <string.h>
-gchar *
-ephy_sync_utils_build_json_string (const gchar *key,
- const gchar *value,
+char *
+ephy_sync_utils_build_json_string (const char *key,
+ const char *value,
...)
{
va_list args;
- gchar *json;
- gchar *next_key;
- gchar *next_value;
- gchar *tmp;
+ char *json;
+ char *next_key;
+ char *next_value;
+ char *tmp;
json = g_strconcat ("{\"", key, "\": \"", value, "\"", NULL);
va_start (args, value);
- while ((next_key = va_arg (args, gchar *)) != NULL) {
- next_value = va_arg (args, gchar *);
+ while ((next_key = va_arg (args, char *)) != NULL) {
+ next_value = va_arg (args, char *);
tmp = json;
json = g_strconcat (json, ", \"", next_key, "\": \"", next_value, "\"", NULL);
g_free (tmp);
@@ -51,21 +51,21 @@ ephy_sync_utils_build_json_string (const gchar *key,
return json;
}
-gchar *
-ephy_sync_utils_create_bso_json (const gchar *id,
- const gchar *payload)
+char *
+ephy_sync_utils_create_bso_json (const char *id,
+ const char *payload)
{
return ephy_sync_utils_build_json_string ("id", id, "payload", payload, NULL);
}
-gchar *
-ephy_sync_utils_make_audience (const gchar *url)
+char *
+ephy_sync_utils_make_audience (const char *url)
{
SoupURI *uri;
- const gchar *scheme;
- const gchar *host;
- gchar *audience;
- gchar *port;
+ const char *scheme;
+ const char *host;
+ char *audience;
+ char *port;
g_return_val_if_fail (url != NULL, NULL);
@@ -89,7 +89,7 @@ ephy_sync_utils_make_audience (const gchar *url)
return audience;
}
-const gchar *
+const char *
ephy_sync_utils_token_name_from_type (EphySyncTokenType type)
{
switch (type) {
@@ -110,19 +110,19 @@ ephy_sync_utils_token_name_from_type (EphySyncTokenType type)
}
}
-gchar *
-ephy_sync_utils_find_and_replace (const gchar *src,
- const gchar *find,
- const gchar *repl)
+char *
+ephy_sync_utils_find_and_replace (const char *src,
+ const char *find,
+ const char *repl)
{
- const gchar *haystack = src;
- const gchar *needle = NULL;
+ const char *haystack = src;
+ const char *needle = NULL;
gsize haystack_len = strlen (src);
gsize find_len = strlen (find);
gsize repl_len = strlen (repl);
gsize new_len = 0;
gsize skip_len = 0;
- gchar *out = g_malloc (haystack_len + 1);
+ char *out = g_malloc (haystack_len + 1);
while ((needle = g_strstr_len (haystack, -1, find)) != NULL) {
haystack_len += find_len - repl_len;
diff --git a/src/ephy-sync-utils.h b/src/ephy-sync-utils.h
index 2bfc94a..f6c0f89 100644
--- a/src/ephy-sync-utils.h
+++ b/src/ephy-sync-utils.h
@@ -32,20 +32,20 @@ typedef enum {
G_BEGIN_DECLS
-gchar *ephy_sync_utils_build_json_string (const gchar *key,
- const gchar *value,
- ...) G_GNUC_NULL_TERMINATED;
-gchar *ephy_sync_utils_create_bso_json (const gchar *id,
- const gchar *payload);
-gchar *ephy_sync_utils_make_audience (const gchar *url);
-const gchar *ephy_sync_utils_token_name_from_type (EphySyncTokenType type);
-gchar *ephy_sync_utils_find_and_replace (const gchar *src,
- const gchar *find,
- const gchar *repl);
-guint8 *ephy_sync_utils_concatenate_bytes (guint8 *bytes,
- gsize bytes_len,
- ...) G_GNUC_NULL_TERMINATED;
-gint64 ephy_sync_utils_current_time_seconds (void);
+char *ephy_sync_utils_build_json_string (const char *key,
+ const char *value,
+ ...) G_GNUC_NULL_TERMINATED;
+char *ephy_sync_utils_create_bso_json (const char *id,
+ const char *payload);
+char *ephy_sync_utils_make_audience (const char *url);
+const char *ephy_sync_utils_token_name_from_type (EphySyncTokenType type);
+char *ephy_sync_utils_find_and_replace (const char *src,
+ const char *find,
+ const char *repl);
+guint8 *ephy_sync_utils_concatenate_bytes (guint8 *bytes,
+ gsize bytes_len,
+ ...) G_GNUC_NULL_TERMINATED;
+gint64 ephy_sync_utils_current_time_seconds (void);
G_END_DECLS
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 36a2006..ff306d9 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -150,12 +150,12 @@ prefs_dialog_finalize (GObject *object)
static void
inject_data_to_server (PrefsDialog *dialog,
- const gchar *type,
- const gchar *status,
- const gchar *data)
+ const char *type,
+ const char *status,
+ const char *data)
{
- gchar *json;
- gchar *script;
+ char *json;
+ char *script;
if (data == NULL)
json = g_strdup_printf ("{'type': '%s', 'content': {'status': '%s'}}",
@@ -192,9 +192,9 @@ server_message_received_cb (WebKitUserContentManager *manager,
JsonParser *parser;
JsonObject *object;
JsonObject *detail;
- gchar *json_string;
- const gchar *type;
- const gchar *command;
+ char *json_string;
+ const char *type;
+ const char *command;
service = ephy_shell_get_sync_service (ephy_shell_get_default ());
json_string = ephy_embed_utils_get_js_result_as_string (result);
@@ -219,12 +219,12 @@ server_message_received_cb (WebKitUserContentManager *manager,
inject_data_to_server (dialog, "message", "can_link_account", "{'ok': true}");
} else if (g_strcmp0 (command, "login") == 0) {
JsonObject *data = json_object_get_object_member (detail, "data");
- const gchar *email = json_object_get_string_member (data, "email");
- const gchar *uid = json_object_get_string_member (data, "uid");
- const gchar *sessionToken = json_object_get_string_member (data, "sessionToken");
- const gchar *keyFetchToken = json_object_get_string_member (data, "keyFetchToken");
- const gchar *unwrapBKey = json_object_get_string_member (data, "unwrapBKey");
- gchar *text;
+ const char *email = json_object_get_string_member (data, "email");
+ const char *uid = json_object_get_string_member (data, "uid");
+ const char *sessionToken = json_object_get_string_member (data, "sessionToken");
+ const char *keyFetchToken = json_object_get_string_member (data, "keyFetchToken");
+ const char *unwrapBKey = json_object_get_string_member (data, "unwrapBKey");
+ char *text;
inject_data_to_server (dialog, "message", "login", NULL);
gtk_widget_set_visible (dialog->sync_sign_in_details, FALSE);
@@ -301,12 +301,12 @@ out:
static void
setup_fxa_sign_in_view (PrefsDialog *dialog)
{
- const gchar *js = "\"use strict\";"
- "function handleAccountsCommand(evt) {"
- " let j = {type: evt.type, detail: evt.detail};"
- " window.webkit.messageHandlers.accountsCommandHandler.postMessage(JSON.stringify(j));"
- "};"
- "window.addEventListener(\"FirefoxAccountsCommand\", handleAccountsCommand);";
+ const char *js = "\"use strict\";"
+ "function handleAccountsCommand(evt) {"
+ " let j = {type: evt.type, detail: evt.detail};"
+ " window.webkit.messageHandlers.accountsCommandHandler.postMessage(JSON.stringify(j));"
+ "};"
+ "window.addEventListener(\"FirefoxAccountsCommand\", handleAccountsCommand);";
dialog->fxa_script = webkit_user_script_new (js,
WEBKIT_USER_CONTENT_INJECT_TOP_FRAME,
@@ -1475,7 +1475,7 @@ static void
setup_sync_page (PrefsDialog *dialog)
{
EphySyncService *service;
- gchar *text;
+ char *text;
service = ephy_shell_get_sync_service (ephy_shell_get_default ());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]