~ubuntu-branches/debian/squeeze/hal/squeeze

« back to all changes in this revision

Viewing changes to hald/util.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2008-03-05 18:14:57 UTC
  • Revision ID: james.westby@ubuntu.com-20080305181457-fj989u7likg0vd6b
Tags: upstream-0.5.10+git20080301
ImportĀ upstreamĀ versionĀ 0.5.10+git20080301

Show diffs side-by-side

added added

removed removed

Lines of Context:
179
179
        char buf[64];
180
180
        gchar path[HAL_PATH_MAX];
181
181
        gboolean ret;
 
182
        gint _result;
182
183
 
183
184
        f = NULL;
184
185
        ret = FALSE;
196
197
                goto out;
197
198
        }
198
199
 
199
 
        /* TODO: handle error condition */
200
 
        *result = strtol (buf, NULL, base);
201
 
        ret = TRUE;
 
200
        errno = 0;
 
201
        _result = strtol (buf, NULL, base);
 
202
        if (errno == 0) {
 
203
                ret = TRUE;
 
204
                *result = _result;
 
205
        }
202
206
 
203
207
out:
204
208
        if (f != NULL)
229
233
        char buf[64];
230
234
        gchar path[HAL_PATH_MAX];
231
235
        gboolean ret;
 
236
        guint64 _result;
232
237
 
233
238
        f = NULL;
234
239
        ret = FALSE;
246
251
                goto out;
247
252
        }
248
253
 
249
 
        /* TODO: handle error condition */
250
 
        *result = strtoll (buf, NULL, base);
251
 
 
252
 
        ret = TRUE;
 
254
        errno = 0;
 
255
        _result = strtoll (buf, NULL, base);
 
256
        if (errno == 0) {
 
257
                ret = TRUE;
 
258
                *result = _result;
 
259
        }
253
260
 
254
261
out:
255
262
        if (f != NULL)
451
458
        ret = FALSE;
452
459
 
453
460
        if ((buf = hal_util_get_string_from_file (directory, file)) != NULL) {
 
461
                errno = 0;
454
462
                value = strtod(buf, &end);
455
463
                if (errno != ERANGE) {
456
464
                        ret = hal_device_property_set_double (d, key, value);