mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-27 18:10:03 +01:00
Merge branch 'filename_max' into 'master'
Improve handling of FILENAME_MAX See merge request GNOME/glib!2055
This commit is contained in:
commit
0b863a4ea9
@ -135,7 +135,7 @@ _topendir (const _TCHAR *szPath)
|
||||
nd->dd_dir.d_ino = 0;
|
||||
nd->dd_dir.d_reclen = 0;
|
||||
nd->dd_dir.d_namlen = 0;
|
||||
memset (nd->dd_dir.d_name, 0, FILENAME_MAX);
|
||||
memset (nd->dd_dir.d_name, 0, sizeof (nd->dd_dir.d_name));
|
||||
|
||||
return nd;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ struct dirent
|
||||
long d_ino; /* Always zero. */
|
||||
unsigned short d_reclen; /* Always zero. */
|
||||
unsigned short d_namlen; /* Length of name in d_name. */
|
||||
char d_name[FILENAME_MAX]; /* File name. */
|
||||
char d_name[FILENAME_MAX+1]; /* File name plus nul delimiter. */
|
||||
};
|
||||
|
||||
#ifdef _WIN64
|
||||
@ -76,7 +76,7 @@ struct _wdirent
|
||||
long d_ino; /* Always zero. */
|
||||
unsigned short d_reclen; /* Always zero. */
|
||||
unsigned short d_namlen; /* Length of name in d_name. */
|
||||
wchar_t d_name[FILENAME_MAX]; /* File name. */
|
||||
wchar_t d_name[FILENAME_MAX+1]; /* File name plus nul delimiter. */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -60,7 +60,9 @@ struct _GDir
|
||||
DIR *dirp;
|
||||
#endif
|
||||
#ifdef G_OS_WIN32
|
||||
gchar utf8_buf[FILENAME_MAX*4];
|
||||
/* maximum encoding of FILENAME_MAX UTF-8 characters, plus a nul terminator
|
||||
* (FILENAME_MAX is not guaranteed to include one) */
|
||||
gchar utf8_buf[FILENAME_MAX*4 + 1];
|
||||
#endif
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user