~ubuntu-branches/debian/sid/flickcurl/sid

« back to all changes in this revision

Viewing changes to src/location.c

  • Committer: Package Import Robot
  • Author(s): Kumar Appaiah
  • Date: 2013-05-20 21:15:09 UTC
  • mfrom: (1.4.1) (15.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130520211509-e701o5dlwa04aqiw
Tags: 1.24-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include <win32_flickcurl_config.h>
31
31
#endif
32
32
 
 
33
/* for atof() */
 
34
#ifdef HAVE_STDLIB_H
 
35
#include <stdlib.h>
 
36
#undef HAVE_STDLIB_H
 
37
#endif
 
38
 
33
39
#include <flickcurl.h>
34
40
#include <flickcurl_internal.h>
35
41
 
87
93
    for(attr = node->properties; attr; attr = attr->next) {
88
94
      const char *attr_name = (const char*)attr->name;
89
95
      char *attr_value;
90
 
 
91
 
      attr_value = (char*)malloc(strlen((const char*)attr->children->content)+1);
92
 
      strcpy(attr_value, (const char*)attr->children->content);
 
96
      size_t attr_value_len = strlen((const char*)attr->children->content);
 
97
      
 
98
      attr_value = (char*)malloc(attr_value_len + 1);
 
99
      memcpy(attr_value, attr->children->content, attr_value_len + 1);
93
100
      
94
101
      if(!strcmp(attr_name, "latitude"))
95
 
        location->latitude = atoi(attr_value);
 
102
        location->latitude = atof(attr_value);
96
103
      else if(!strcmp(attr_name, "longitude"))
97
 
        location->longitude = atoi(attr_value);
 
104
        location->longitude = atof(attr_value);
98
105
      else if(!strcmp(attr_name, "accuracy"))
99
106
        location->accuracy = atoi(attr_value);
 
107
 
 
108
      free(attr_value);
100
109
    }
101
110
 
102
111