~ubuntu-branches/ubuntu/quantal/vice/quantal

« back to all changes in this revision

Viewing changes to src/arch/win32/dirent.c

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2010-02-11 18:30:16 UTC
  • mfrom: (1.1.8 upstream) (9.2.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100211183016-f6n8usn3tzp0u6dp
Tags: 2.2.dfsg-1
* New upstream release, C64 DTV is included so update package description
  and add it to the menu.
* Drop patch fixing build failure with gcc-4.4 , applied upstream.
* Fix some lintian problems and clean up debian/rules .

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
#include "system.h"
43
43
#include "util.h"
44
44
 
45
 
 
46
45
struct _vice_dir {
47
46
    WIN32_FIND_DATA find_data;
48
47
    HANDLE handle;
49
48
    int first_passed;
50
49
    char *filter;
51
50
};
52
 
/*typedef struct _vice_dir DIR;*/
53
51
 
54
52
DIR *opendir(const char *path)
55
53
{
62
60
    st_filter = system_mbstowcs_alloc(dir->filter);
63
61
    dir->handle = FindFirstFile(st_filter, &dir->find_data);
64
62
    system_mbstowcs_free(st_filter);
65
 
    if (dir->handle == INVALID_HANDLE_VALUE)
 
63
    if (dir->handle == INVALID_HANDLE_VALUE) {
66
64
        return NULL;
 
65
    }
67
66
 
68
67
    dir->first_passed = 0;
69
68
    return dir;
73
72
{
74
73
    static struct dirent ret;
75
74
 
76
 
    if (dir->first_passed)
77
 
        if (!FindNextFile(dir->handle, &dir->find_data))
 
75
    if (dir->first_passed) {
 
76
        if (!FindNextFile(dir->handle, &dir->find_data)) {
78
77
            return NULL;
 
78
        }
 
79
    }
79
80
 
80
81
    dir->first_passed = 1;
81
82
    ret.d_name = dir->find_data.cFileName;
82
 
    ret.d_namlen = strlen(ret.d_name);
 
83
    ret.d_namlen = (int)strlen(ret.d_name);
83
84
 
84
85
    return &ret;
85
86
}
90
91
    lib_free(dir->filter);
91
92
    lib_free(dir);
92
93
}
93