Commit d28e7d8b authored by Jussi Kukkonen's avatar Jussi Kukkonen

Added missing includes, removed unused variables,

fixed indenting and whitespace issues in backend/*

geoclue_map_server_yahoo.c: In function ‘geoclue_map_map_thread’:
geoclue_map_server_yahoo.c:256: warning: unused variable ‘fd’
geoclue_map_server_yahoo.c: In function ‘main’:
geoclue_map_server_yahoo.c:528: warning: unused variable ‘request_name_result’
geoclue_position_server_manual.c: In function ‘main’:
geoclue_position_server_manual.c:269: warning: implicit declaration of function ‘geoclue_map_init’
geoclue_geocode_server_yahoo.c: In function ‘geoclue_geocode_to_lat_lon’:
geoclue_geocode_server_yahoo.c:191: warning: unused variable ‘pngurl’
geoclue_geocode_server_yahoo.c:153: warning: unused variable ‘fd’
geoclue_geocode_server_yahoo.c: In function ‘geoclue_geocode_free_text_to_lat_lon’:
geoclue_geocode_server_yahoo.c:301: warning: unused variable ‘pngurl’
geoclue_geocode_server_yahoo.c:263: warning: unused variable ‘fd’
geoclue_geocode_server_yahoo.c: In function ‘main’:
geoclue_geocode_server_yahoo.c:393: warning: unused variable ‘request_name_result’
geoclue_position_server_hostip.c: In function ‘geoclue_position_current_position’:
geoclue_position_server_hostip.c:206: warning: implicit declaration of function ‘strcmp’
geoclue_position_server_hostip.c:186: warning: unused variable ‘pngurl’
geoclue_position_server_hostip.c:148: warning: unused variable ‘fd’
geoclue_position_server_hostip.c: In function ‘main’:
geoclue_position_server_hostip.c:314: warning: unused variable ‘request_name_result’
geoclue_position_server_gpsd.c: In function ‘main’:
geoclue_position_server_gpsd.c:252: warning: unused variable ‘request_name_result’
parent cea23f73
......@@ -150,9 +150,6 @@ gboolean geoclue_geocode_to_lat_lon (GeoclueGeocode *obj, const char * IN_street
SoupMessage *msg;
const char *cafile = NULL;
SoupUri *proxy = NULL;
int fd;
char* proxy_env;
......@@ -188,7 +185,6 @@ gboolean geoclue_geocode_to_lat_lon (GeoclueGeocode *obj, const char * IN_street
char *name, *value;
xmlTextReaderPtr reader;
int ret;
char* pngurl;
reader = xmlReaderForMemory (msg->response.body,
......@@ -260,9 +256,7 @@ gboolean geoclue_geocode_free_text_to_lat_lon (GeoclueGeocode *obj, const char *
SoupMessage *msg;
const char *cafile = NULL;
SoupUri *proxy = NULL;
int fd;
char* proxy_env;
......@@ -298,8 +292,7 @@ gboolean geoclue_geocode_free_text_to_lat_lon (GeoclueGeocode *obj, const char *
char *name, *value;
xmlTextReaderPtr reader;
int ret;
char* pngurl;
reader = xmlReaderForMemory (msg->response.body,
msg->response.length,
......@@ -308,7 +301,7 @@ gboolean geoclue_geocode_free_text_to_lat_lon (GeoclueGeocode *obj, const char *
0);
ret = xmlTextReaderRead(reader);
//FIXME: super hack because I don't know how to use the XML libraries. This just works for now
......@@ -317,9 +310,9 @@ gboolean geoclue_geocode_free_text_to_lat_lon (GeoclueGeocode *obj, const char *
name = (char*)xmlTextReaderConstName(reader);
printf("%s\n", name);
if (!strcmp(name,YAHOO_LAT))
{
if (!strcmp(name,YAHOO_LAT))
{
//read next and grab text value. For some reason there is two so do it twice
ret = xmlTextReaderRead(reader);
name = (char*)xmlTextReaderConstName(reader);
......@@ -332,9 +325,9 @@ gboolean geoclue_geocode_free_text_to_lat_lon (GeoclueGeocode *obj, const char *
ret = xmlTextReaderRead(reader);
name = (char*)xmlTextReaderConstName(reader);
}
if (!strcmp(name,YAHOO_LON))
{
}
if (!strcmp(name,YAHOO_LON))
{
//read next and grab text value. For some reason there is two so do it twice
ret = xmlTextReaderRead(reader);
name = (char*)xmlTextReaderConstName(reader);
......@@ -347,7 +340,7 @@ gboolean geoclue_geocode_free_text_to_lat_lon (GeoclueGeocode *obj, const char *
ret = xmlTextReaderRead(reader);
name = (char*)xmlTextReaderConstName(reader);
}
}
ret = xmlTextReaderRead(reader);
}
xmlFreeTextReader(reader);
......@@ -390,15 +383,10 @@ gboolean geoclue_geocode_shutdown(GeoclueGeocode *obj, GError** error)
int main( int argc,
char *argv[] )
{
guint request_name_result;
g_type_init ();
g_thread_init (NULL);
/*
* this initialize the library and check potential ABI mismatches
* between the version it was compiled for and the actual shared
......@@ -413,9 +401,7 @@ int main( int argc,
obj->loop = g_main_loop_new(NULL,TRUE);
g_main_loop_run(obj->loop);
g_object_unref(obj);
......
......@@ -253,7 +253,6 @@ gint IN_zoom = obj->IN_zoom;
const char *cafile = NULL;
SoupUri *proxy = NULL;
SoupUri *base_uri = NULL;
int fd;
base_uri = soup_uri_new ("http://api.local.yahoo.com/MapsService/V1/mapImage?appid=libgeomap&latitude=38.0&longitude=-122.0&imagetype=png&image_height=800&image_width=800&zoom=7");
......@@ -304,45 +303,35 @@ gint IN_zoom = obj->IN_zoom;
0);
ret = xmlTextReaderRead(reader);
//FIXME: super hack because I don't know how to use the XML libraries. This just works for now
while (ret == 1) {
name = (char*)xmlTextReaderConstName(reader);
if (!strcmp(name,"#text"))
{
value = (char*)xmlTextReaderConstValue(reader);
printf("%s %s\n", name, value);
int size = strlen(value);
pngurl = malloc(size);
strcpy(pngurl, value);
}
ret = xmlTextReaderRead(reader);
ret = xmlTextReaderRead(reader);
//FIXME: super hack because I don't know how to use the XML libraries. This just works for now
while (ret == 1) {
name = (char*)xmlTextReaderConstName(reader);
if (!strcmp(name,"#text"))
{
value = (char*)xmlTextReaderConstValue(reader);
printf("%s %s\n", name, value);
int size = strlen(value);
pngurl = malloc(size);
strcpy(pngurl, value);
}
xmlFreeTextReader(reader);
ret = xmlTextReaderRead(reader);
}
xmlFreeTextReader(reader);
// A very bad rough sanity check
if(pngurl != NULL)
{
if(pngurl[0] == 'h')
{
printf("Trying to grab image %s\n", pngurl);
msg2 = soup_message_new ("GET", pngurl);
soup_session_send_message(session, msg2);
printf("got message\n, parsing\n");
GArray *mydata;
mydata = g_array_new(FALSE,FALSE, sizeof(guint8));
mydata->data = msg2->response.body;
......@@ -353,9 +342,7 @@ gint IN_zoom = obj->IN_zoom;
0, mydata, "image/png");
}
}
};
......@@ -498,10 +485,8 @@ gboolean geoclue_map_find_zoom_level (GeoclueMap *obj, const gdouble IN_latitude
*OUT_zoom++;
make_me_one *= 2.0;
}
printf("Long offset \n");
printf("Long offset \n");
return TRUE;
......@@ -520,20 +505,13 @@ gboolean geoclue_map_shutdown(GeoclueMap *obj, GError** error)
}
int main( int argc,
char *argv[] )
{
guint request_name_result;
g_type_init ();
g_thread_init (NULL);
/*
* this initialize the library and check potential ABI mismatches
* between the version it was compiled for and the actual shared
......@@ -543,28 +521,16 @@ int main( int argc,
GeoclueMap* obj = NULL;
obj = GEOCLUE_MAP(g_type_create_instance (geoclue_map_get_type()));
obj->loop = g_main_loop_new(NULL,TRUE);
g_main_loop_run(obj->loop);
g_object_unref(obj);
g_main_loop_unref(obj->loop);
return 0;
}
......@@ -249,26 +249,23 @@ static void update_gps(struct gps_data_t *gpsdata,
int main(int argc, char **argv)
{
guint request_name_result;
g_type_init ();
g_thread_init (NULL);
printf("Starting GPSD\n");
/*
* this initialize the library and check potential ABI mismatches
* between the version it was compiled for and the actual shared
* library used.
*/
LIBXML_TEST_VERSION
GeocluePosition* obj = NULL;
obj = GEOCLUE_POSITION(g_type_create_instance (geoclue_position_get_type()));
obj->loop = g_main_loop_new(NULL,TRUE);
......@@ -296,14 +293,6 @@ int main(int argc, char **argv)
{
g_printerr("Cannot Find GPSD\n");
}
return(0);
}
......@@ -29,7 +29,7 @@
#include <fcntl.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define PROGRAM_HEIGHT 640
#define PROGRAM_WIDTH 480
......@@ -145,16 +145,14 @@ gboolean geoclue_position_current_position(GeocluePosition *obj, gdouble* OUT_la
SoupMessage *msg;
const char *cafile = NULL;
SoupUri *proxy = NULL;
int fd;
char* proxy_env;
proxy_env = getenv ("http_proxy");
printf("found proxy %s:end\n", proxy_env);
if (proxy_env != NULL) {
printf("added proxy %s\n", proxy_env);
......@@ -183,8 +181,7 @@ gboolean geoclue_position_current_position(GeocluePosition *obj, gdouble* OUT_la
char *name, *value;
xmlTextReaderPtr reader;
int ret;
char* pngurl;
reader = xmlReaderForMemory (msg->response.body,
msg->response.length,
......@@ -311,8 +308,6 @@ gboolean geoclue_position_shutdown(GeocluePosition *obj, GError** error)
int main(int argc, char **argv)
{
guint request_name_result;
g_type_init ();
g_thread_init (NULL);
......@@ -329,10 +324,8 @@ int main(int argc, char **argv)
obj = GEOCLUE_POSITION(g_type_create_instance (geoclue_position_get_type()));
obj->loop = g_main_loop_new(NULL,TRUE);
g_main_loop_run(obj->loop);
g_object_unref(obj);
......@@ -340,8 +333,3 @@ int main(int argc, char **argv)
return(0);
}
......@@ -26,6 +26,7 @@
#include <gtk/gtk.h>
#include <geoclue/map.h>
#include <geoclue/map_gtk_layout.h>
#include <stdio.h>
#include <string.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment