Package: lbdb
Version: 0.34
Severity: normal
Tags: patch

Hi,

lbdbq always ignored the first entry in a VFC file here.

The reason is an improper usage of vf_get_next_object(). According to the
documentation for libvformat, vf_read_file() always points to the first
entry. As vcquery.c always does a vf_get_next_object() just after
vf_read_file(), the first entry is lost.

The attached patch fixes this problem by using vf_read_file() and
vf_get_next_object() like described in man 3 vf_get_next_object.

Regards,
Tino

-- System Information:
Debian Release: 4.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18.2
Locale: LANG=C, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)

Versions of packages lbdb depends on:
ii  libc6                        2.3.6.ds1-9 GNU C Library: Shared libraries
ii  libvformat1                  1.13-4      Library to read and write vcard fi
ii  perl                         5.8.8-7     Larry Wall's Practical Extraction 

lbdb recommends no packages.

-- no debconf information
--- lbdb-0.34.orig/vcquery.c	2006-11-12 13:08:21.000000000 +0100
+++ lbdb-0.34/vcquery.c	2007-01-02 14:56:26.450181847 +0100
@@ -47,7 +47,7 @@
     return 1;
   }
 
-  while (vf_get_next_object(&vfobj)) {
+  do {
     fullname = 0;
     /* First extract name */
     if (vf_get_property(&prop, vfobj, VFGP_FIND, NULL, "FN", NULL))
@@ -85,7 +85,7 @@
 
     if (fullname)
       free(fullname);
-  }
+  } while (vf_get_next_object(&vfobj));
 
   return 0;
 }

Reply via email to