~ubuntu-branches/ubuntu/oneiric/libdebian-installer/oneiric

« back to all changes in this revision

Viewing changes to src/release.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2011-05-02 09:04:49 UTC
  • mfrom: (8.2.12 sid)
  • Revision ID: james.westby@ubuntu.com-20110502090449-x1ipxaif8rhufsfg
Tags: 0.78ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Appease the combination of _FORTIFY_SOURCE=2 (used by default on
    Ubuntu) and -Werror.
  - Add Dove SoC subarchitecture.
  - Add Beagle OMAP3 support.
  - Add the i386/efi and amd64/efi platforms.
  - Add OMAP4 Panda and Blaze support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 * GNU General Public License for more details.
15
15
 *
16
16
 * You should have received a copy of the GNU General Public License
17
 
 * along with this program; if not, write to the Free Software
18
 
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19
 
 *
20
 
 * $Id$
 
17
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
18
 */
22
19
 
23
20
#include <config.h>
70
67
      "MD5Sum",
71
68
      di_release_parser_read_file,
72
69
      NULL,
73
 
      offsetof (di_release, md5sum)
 
70
      0
 
71
    ),
 
72
  internal_di_release_parser_field_sha1 =
 
73
    DI_PARSER_FIELDINFO
 
74
    (
 
75
      "SHA1",
 
76
      di_release_parser_read_file,
 
77
      NULL,
 
78
      1
74
79
    );
75
80
 
76
81
/**
82
87
  &internal_di_release_parser_field_suite,
83
88
  &internal_di_release_parser_field_codename,
84
89
  &internal_di_release_parser_field_md5sum,
 
90
  &internal_di_release_parser_field_sha1,
85
91
  NULL
86
92
};
87
93
 
92
98
  di_release_file *file = data;
93
99
 
94
100
  di_free (file->filename);
95
 
  di_free (file->sum);
 
101
  di_free (file->sum[0]);
 
102
  di_free (file->sum[1]);
96
103
}
97
104
 
98
105
/**
158
165
  void *user_data __attribute__ ((unused));
159
166
{
160
167
  char *begin = value->string, *next = begin, *end = value->string + value->size;
161
 
  char buf_sum[65], buf_filename[129];
 
168
  char *buf_sum, buf_filename[129];
162
169
  int ret;
163
170
  size_t buf_size;
164
171
  di_release *release = *data;
165
 
  di_hash_table *table = *(di_hash_table **)((char *)*data + fip->integer);
 
172
  di_hash_table *table = release->md5sum;
166
173
 
167
174
  while (1)
168
175
  {
170
177
    if (!next)
171
178
      next = end;
172
179
 
173
 
    ret = sscanf (begin, "%64s %zu %128s", buf_sum, &buf_size, buf_filename);
 
180
    ret = sscanf (begin, "%ms %zu %128s", &buf_sum, &buf_size, buf_filename);
174
181
 
175
182
    if (ret == 3)
176
183
    {
177
 
      di_release_file *file = di_mem_chunk_alloc (release->release_file_mem_chunk);
178
 
      file->key.string = strdup (buf_filename);
179
 
      file->key.size = strlen (buf_filename);
 
184
      di_rstring key = { buf_filename, strlen (buf_filename) };
 
185
      di_release_file *file = di_hash_table_lookup (table, &key);
 
186
      if (!file)
 
187
      {
 
188
        file = di_mem_chunk_alloc0 (release->release_file_mem_chunk);
 
189
        file->key.string = strdup (buf_filename);
 
190
        file->key.size = strlen (buf_filename);
 
191
        di_hash_table_insert (table, &file->key, file);
 
192
      }
180
193
      file->size = buf_size;
181
 
      file->sum = strdup (buf_sum);
182
 
      di_hash_table_insert (table, &file->key, file);
 
194
      file->sum[fip->integer] = buf_sum;
183
195
    }
184
196
 
185
197
    begin = next + 1;