/soc/2013/ankitkv/gobjectification: 0196a853776e: Merge gtkdoc-c...
Ankit Vani
a at nevitus.org
Sat Feb 8 05:34:36 EST 2014
Changeset: 0196a853776e392c5d0f2a81c07cb9c765c85927
Author: Ankit Vani <a at nevitus.org>
Date: 2014-02-08 16:00 +0530
Branch: soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/0196a853776e
Description:
Merge gtkdoc-conversion
diffstat:
configure.ac | 2 +-
libpurple/ciphers/pbkdf2cipher.c | 3 ++-
libpurple/dnssrv.c | 10 ++++++++++
libpurple/idle.c | 3 +--
libpurple/log.c | 8 +++++++-
libpurple/plugins/log_reader.c | 16 ++++++++++------
libpurple/plugins/ssl/ssl-gnutls.c | 7 +++++--
libpurple/util.c | 8 ++++++--
libpurple/xfer.c | 2 ++
9 files changed, 44 insertions(+), 15 deletions(-)
diffs (221 lines):
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1701,7 +1701,7 @@ if test "x$enable_kwallet" = "xyes"; the
if test "$ac_kwallet_includes" != "no"; then
KWALLET_CXXFLAGS="-I$ac_kwallet_includes"
elif test "x$KDE4_CONFIG" != "xno"; then
- KWALLET_CXXFLAGS="-I`$KDE4_CONFIG --path include`"
+ KWALLET_CXXFLAGS="$QT4_CFLAGS -I`$KDE4_CONFIG --path include`"
fi
CPPFLAGS="$CPPFLAGS $KWALLET_CXXFLAGS"
AC_CHECK_HEADER([kwallet.h], , [
diff --git a/libpurple/ciphers/pbkdf2cipher.c b/libpurple/ciphers/pbkdf2cipher.c
--- a/libpurple/ciphers/pbkdf2cipher.c
+++ b/libpurple/ciphers/pbkdf2cipher.c
@@ -208,7 +208,8 @@ purple_pbkdf2_cipher_digest(PurpleCipher
halfkey_pad = priv->out_len - (halfkey_count - 1) * halfkey_len;
salt_ext = g_new(guchar, salt_ext_len);
- memcpy(salt_ext, priv->salt, priv->salt_len);
+ if (priv->salt_len > 0)
+ memcpy(salt_ext, priv->salt, priv->salt_len);
for (halfkey_no = 1; halfkey_no <= halfkey_count; halfkey_no++) {
memset(halfkey, 0, halfkey_len);
diff --git a/libpurple/dnssrv.c b/libpurple/dnssrv.c
--- a/libpurple/dnssrv.c
+++ b/libpurple/dnssrv.c
@@ -134,6 +134,8 @@ select_random_response(GList *list, Purp
size_t runningtotal;
int r;
+ g_return_val_if_fail(list != NULL, NULL);
+
runningtotal = 0;
cur = list;
@@ -154,6 +156,8 @@ select_random_response(GList *list, Purp
r = runningtotal ? g_random_int_range(1, runningtotal + 1) : 0;
cur = list;
while (r > ((PurpleSrvResponseContainer *)cur->data)->sum) {
+ if (G_UNLIKELY(!cur->next))
+ break;
cur = cur->next;
}
@@ -177,6 +181,8 @@ srv_reorder(GList *list, int num)
/* Nothing to sort */
return;
+ g_return_if_fail(list != NULL);
+
/* First build a list of container structs */
for (i = 0, cur = list; i < num; i++, cur = cur->next) {
container = g_new(PurpleSrvResponseContainer, 1);
@@ -195,6 +201,7 @@ srv_reorder(GList *list, int num)
cur->data = container->response;
g_free(container);
cur = cur->next;
+ g_return_if_fail(cur);
}
}
@@ -224,6 +231,9 @@ purple_srv_sort(GList *list)
count = 1;
while (cur) {
PurpleSrvResponse *next_response;
+
+ g_return_val_if_fail(cur->data, list);
+
pref = ((PurpleSrvResponse *)cur->data)->pref;
next_response = cur->next ? cur->next->data : NULL;
if (!next_response || next_response->pref != pref) {
diff --git a/libpurple/idle.c b/libpurple/idle.c
--- a/libpurple/idle.c
+++ b/libpurple/idle.c
@@ -114,7 +114,7 @@ static gint time_until_next_idle_event;
static void
check_idleness(void)
{
- time_t time_idle;
+ time_t time_idle = 0;
gboolean auto_away;
const gchar *idle_reporting;
gboolean report_idle = TRUE;
@@ -142,7 +142,6 @@ check_idleness(void)
else
{
/* Don't report idle time */
- time_idle = 0;
report_idle = FALSE;
/* If we're not reporting idle, we can still do auto-away.
diff --git a/libpurple/log.c b/libpurple/log.c
--- a/libpurple/log.c
+++ b/libpurple/log.c
@@ -287,6 +287,10 @@ gint purple_log_get_activity_score(Purpl
while (logs) {
PurpleLog *log = (PurpleLog*)(logs->data);
+ if (!log) {
+ g_warn_if_reached();
+ continue;
+ }
/* Activity score counts bytes in the log, exponentially
decayed with a half-life of 14 days. */
score_double += purple_log_get_size(log) *
@@ -447,6 +451,8 @@ PurpleLogLogger *purple_log_logger_new(c
void purple_log_logger_free(PurpleLogLogger *logger)
{
+ if (!logger)
+ return;
g_free(logger->name);
g_free(logger->id);
g_free(logger);
@@ -1571,7 +1577,7 @@ static gsize txt_logger_write(PurpleLog
data = log->logger_data;
/* if we can't write to the file, give up before we hurt ourselves */
- if(!data->file)
+ if(!data || !data->file)
return 0;
if (log->type == PURPLE_LOG_SYSTEM)
diff --git a/libpurple/plugins/log_reader.c b/libpurple/plugins/log_reader.c
--- a/libpurple/plugins/log_reader.c
+++ b/libpurple/plugins/log_reader.c
@@ -917,7 +917,7 @@ static char * msn_logger_read (PurpleLog
PurpleXmlNode *to;
enum name_guesses name_guessed = NAME_GUESS_UNKNOWN;
const char *their_name;
- struct tm *tm;
+ struct tm *tm = NULL;
char *timestamp;
char *tmp;
const char *style;
@@ -1096,12 +1096,16 @@ static char * msn_logger_read (PurpleLog
text = g_string_append(text, ";\">");
}
- msn_logger_parse_timestamp(message, &tm);
-
- timestamp = g_strdup_printf("<font size=\"2\">(%02u:%02u:%02u)</font> ",
+ if (msn_logger_parse_timestamp(message, &tm)) {
+ timestamp = g_strdup_printf(
+ "<font size=\"2\">(%02u:%02u:%02u)</font> ",
tm->tm_hour, tm->tm_min, tm->tm_sec);
- text = g_string_append(text, timestamp);
- g_free(timestamp);
+ text = g_string_append(text, timestamp);
+ g_free(timestamp);
+ } else {
+ text = g_string_append(text,
+ "<font size=\"2\">(00:00:00)</font> ");
+ }
if (from_name) {
text = g_string_append(text, "<b>");
diff --git a/libpurple/plugins/ssl/ssl-gnutls.c b/libpurple/plugins/ssl/ssl-gnutls.c
--- a/libpurple/plugins/ssl/ssl-gnutls.c
+++ b/libpurple/plugins/ssl/ssl-gnutls.c
@@ -412,8 +412,10 @@ ssl_gnutls_connect(PurpleSslConnection *
gnutls_set_default_priority(gnutls_data->session);
#endif
- gnutls_server_name_set(gnutls_data->session, GNUTLS_NAME_DNS, gsc->host,
- strlen(gsc->host));
+ if (gsc->host) {
+ gnutls_server_name_set(gnutls_data->session, GNUTLS_NAME_DNS,
+ gsc->host, strlen(gsc->host));
+ }
gnutls_credentials_set(gnutls_data->session, GNUTLS_CRD_CERTIFICATE,
xcred);
@@ -1192,6 +1194,7 @@ x509_display_string(PurpleCertificate *c
/* Pull out the SHA1 checksum */
sha_bin = x509_sha1sum(crt);
+ g_return_val_if_fail(sha_bin != NULL, NULL);
sha_asc = purple_base16_encode_chunked(sha_bin->data, sha_bin->len);
/* Get the cert Common Name */
diff --git a/libpurple/util.c b/libpurple/util.c
--- a/libpurple/util.c
+++ b/libpurple/util.c
@@ -3720,7 +3720,7 @@ purple_str_seconds_to_string(guint secs)
hrs = secs / (60 * 60);
secs = secs % (60 * 60);
mins = secs / 60;
- secs = secs % 60;
+ /* secs = secs % 60; */
if (days > 0)
{
@@ -3859,8 +3859,12 @@ void purple_got_protocol_handler_uri(con
while (*tmp || *pairstart) {
if (*tmp == delimiter || !(*tmp)) {
/* If there is no explicit value */
- if (keyend == NULL)
+ if (keyend == NULL) {
keyend = tmp;
+ }
+ /* without these brackets, clang won't
+ * recognize tmp as a non-NULL
+ */
if (keyend && keyend != pairstart) {
char *p;
diff --git a/libpurple/xfer.c b/libpurple/xfer.c
--- a/libpurple/xfer.c
+++ b/libpurple/xfer.c
@@ -609,6 +609,8 @@ purple_xfer_request_accepted(PurpleXfer
purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_ACCEPTED);
priv->ops.init(xfer);
return;
+ } else {
+ g_return_if_fail(filename != NULL);
}
buddy = purple_blist_find_buddy(account, priv->who);
More information about the Commits
mailing list