--- a/CMakeLists.txt Thu Mar 25 20:46:24 2010 +0200
+++ b/CMakeLists.txt Tue Mar 30 22:09:54 2010 +0300
@@ -63,6 +63,7 @@
${MCABBER_LIBRARIES})
include_directories(${avatar_SOURCE_DIR}
${avatar_BINARY_DIR})
+set_target_properties(avatar PROPERTIES COMPILE_FLAGS "-Wall")
## Packaging information
set(CPACK_PACKAGE_NAME libmcabber-avatar)
--- a/avatar.c Thu Mar 25 20:46:24 2010 +0200
+++ b/avatar.c Tue Mar 30 22:09:54 2010 +0300
@@ -42,6 +42,7 @@
#include <mcabber/hooks.h>
#include <mcabber/settings.h>
#include <mcabber/modules.h>
+#include <mcabber/xmpp_helper.h>
#include <mcabber/pep.h>
@@ -86,7 +87,6 @@
#define NS_AVATAR_METADATA ( "urn:xmpp:avatar:metadata" )
#define NS_AVATAR_METADATA_NOTIFY ( "urn:xmpp:avatar:metadata+notify" )
-static guint avatar_cid = 0;
static guint avatar_hid_connect = 0;
static guint avatar_hid_disconnect = 0;
@@ -96,7 +96,7 @@
static gboolean publish_delayed = FALSE;
static gsize publish_len = 0;
-static gchar *publish_data = NULL;
+static guchar *publish_data = NULL;
// predeclarations
@@ -131,7 +131,7 @@
return NULL;
{ // check signature
- char header[8];
+ png_byte header[8];
fread (header, 1, 8, fd);
@@ -269,11 +269,11 @@
// font size in font pixels (real?)
//int fonth = 16;
//int fontw = 8;
- float fontaspect = (float) fontw / fonth;
+ //float fontaspect = (float) fontw / fonth;
// aa pixels per character
const int aappch = 2;
const int aappcw = 2;
- const float aaaspect = (float) aappcw / aappch;
+ //const float aaaspect = (float) aappcw / aappch;
// font pixels per aa pixel
int aappph = (float) fonth / aappch;
int aapppw = (float) fontw / aappcw;
@@ -333,8 +333,8 @@
resw = resw_rp;
}
// number of original image pixels per one resulting image pixel
- int ratioh = (float) originh / resh;
- int ratiow = (float) originw / resw;
+ //int ratioh = (float) originh / resh;
+ //int ratiow = (float) originw / resw;
// resulting image size in chars
int rescharh = (float) resh / aappch;
int rescharw = (float) resw / aappcw;
@@ -415,7 +415,7 @@
aa_flush (context);
{ // format the result
- char *text = aa_text (context);
+ char *text = (char *) aa_text (context);
int width = aa_scrwidth (context);
int height = aa_scrheight (context);
GString *avatar = g_string_new (NULL);
@@ -748,7 +748,7 @@
{ // save to file and display in ascii
const gchar *base64 = lm_message_node_get_value (data);
- gchar *png;
+ guchar *png;
gsize len;
gchar *file;
@@ -827,21 +827,20 @@
// data is image/png data of length len
// call with len = 0 to publish empty avatar
-static void avatar_publish (const gchar *data, gsize len)
+static void avatar_publish (const guchar *data, gsize len)
{
- LmMessage *datarequest;
- LmMessageHandler *handler;
- gchar *id;
- LmMessage *request;
- LmMessageNode *node;
- GError *error = NULL;
+ LmMessage *datarequest;
+ gchar *id;
+ LmMessage *request;
+ LmMessageNode *node;
+ GError *error = NULL;
if (!xmpp_is_online ()) {
scr_log_print (LPRINT_DEBUG, "avatar: Not connected, delaying publish.");
g_free (publish_data);
- publish_data = g_strndup (data, len);
+ publish_data = (guchar *) g_strndup ((gchar *) data, len);
publish_len = len;
publish_delayed = TRUE;
@@ -1042,9 +1041,9 @@
// /AVATAR [filename|-]
static void do_avatar (char *arg)
{
- gchar *fname;
- gchar *data;
- gsize len;
+ gchar *fname;
+ guchar *data;
+ gsize len;
if (!*arg) { // print current byddy's avatar
const gchar *jid = CURRENT_JID;
@@ -1093,7 +1092,7 @@
close (fd);
len = datastring->len;
- data = g_string_free (datastring, FALSE);
+ data = (guchar *) g_string_free (datastring, FALSE);
}
g_free (fname);
@@ -1135,7 +1134,7 @@
static guint avatar_hch (const gchar *hid, hk_arg_t *args, gpointer userdata)
{
if (publish_data) {
- char *tmp_data = publish_data;
+ guchar *tmp_data = publish_data;
scr_log_print (LPRINT_DEBUG, "avatar: Publishing delayed data.");