|
From: Sev B. <se...@bn...> - 2005-01-13 16:08:34
|
32c32,33
<
---
> #include <string.h>
> #include <stdio.h>
105a107
>
246a249,250
> Char ** dnames = NULL; //sev - create a dir table
> UInt last_dir_entry = 0; //sev - and keep an index
337a342,343
>
> /*
339c345,346
< {
---
> {
> UChar * name;
341c348,375
< }
---
>
> }
> */
>
> //sev - lets not ignore dir
> // lets save them so we can use them later to create the full
> // path
> while (* data != 0)
> {
> UChar * name;
>
> ++ last_dir_entry;
>
> name = data;
>
> /* Since we don't have realloc (0, ....) == malloc (...)
> semantics, we need to malloc the first time. */
>
> if (dnames == NULL)
> dnames = VG_(arena_malloc)(VG_AR_SYMTAB, sizeof (UInt) * 2);
> else
> dnames = VG_(arena_realloc)(VG_AR_SYMTAB, dnames, /*alignment*/4,
> sizeof(UInt) * (last_dir_entry + 1));
> data += VG_(strlen) ((Char *) data) + 1;
> dnames[last_dir_entry] = VG_(addStr) (si,name, -1);
> /* printf("dir = %s \n", dnames[last_dir_entry]); */
> }
> /* printf("***************************\n"); */
362a397,398
> /*sev*/
>
363a400
> /*printf("file = %s \n", name); */
374d410
< fnames[state_machine_regs.last_file_entry] = VG_(addStr) (si,name, -1);
376c412,417
< read_leb128 (data, & bytes_read, 0);
---
> //sev - what I need to do here is concatenate the dir
> //from above with name & pass it in
>
> // fnames[state_machine_regs.last_file_entry] = VG_(addStr) (si,name, -1);
>
> unsigned int dirindex = read_leb128 (data, & bytes_read, 0);
381a423,444
>
> {
> /* sev -- append the dir name to file name and save */
> /*printf("dirindex = %u \n", dirindex ); */
> if (dirindex > last_dir_entry ) printf("dirindex too large \n");
> char fullname[2000];
> fullname[0] = '\0';
> if ((dirindex <=0) || (dirindex > last_dir_entry) )
> {/* if dont have a dir name then skip it */
> /*printf("dirindex <= 0 \n"); */
> strcpy(fullname, name);
> }
> else
> {
> /*printf("dirnameB %s\n", dnames[dirindex ]); */
> sprintf(fullname,"%s/",dnames[dirindex]);
> strcat(fullname, name);
> }
> /* printf( "fullname = %s \n", fullname); */
> fnames[state_machine_regs.last_file_entry] = VG_(addStr) (si, fullname, -1);
> /*printf("***************************\n"); */
> }
384a448,452
> //sev - clean up dir structure and index
> VG_(arena_free)(VG_AR_SYMTAB, dnames);
> dnames = NULL;
> last_dir_entry = 0;
>
530a599
>
|