1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

include/includes.h: Trimmed down unicode directory entry to be POSIX complient.

lib/system.c: Trimmed down unicode directory entry to be POSIX complient.
lib/util_unistr.c: Added wstrdup().
Jeremy.
(This used to be commit ca64f4ab00)
This commit is contained in:
Jeremy Allison 1999-12-22 18:46:05 +00:00
parent fc4e722127
commit 5b3096a32f
3 changed files with 19 additions and 6 deletions

View File

@ -651,12 +651,10 @@ extern int errno;
/*
* Type for wide character dirent structure.
* Only d_name is defined by POSIX.
*/
typedef struct smb_wdirent {
SMB_INO_T d_ino;
SMB_OFF_T d_off;
unsigned short d_reclen;
wpstring d_name;
} SMB_STRUCT_WDIRENT;

View File

@ -802,10 +802,11 @@ SMB_STRUCT_WDIRENT *wsys_readdir(DIR *dirp)
if(!dirval)
return NULL;
retval.d_ino = (SMB_INO_T)dirval->d_ino;
retval.d_off = (SMB_OFF_T)dirval->d_off;
/*
* The only POSIX defined member of this struct is d_name.
*/
unix_to_unicode(retval.d_name,dirval->d_name,sizeof(retval.d_name));
retval.d_reclen = wstrlen(retval.d_name);
return &retval;
}

View File

@ -891,3 +891,17 @@ smb_ucs2_t *wstrtok(smb_ucs2_t *s1, const smb_ucs2_t *s2)
return NULL;
}
/*******************************************************************
Duplicate a ucs2 string.
********************************************************************/
smb_ucs2_t *wstrdup(const smb_ucs2_t *s)
{
size_t newlen = (wstrlen(s)*sizeof(smb_ucs2_t)) + 1;
smb_ucs2_t *newstr = (smb_ucs2_t *)malloc(newlen);
if (newstr == NULL)
return NULL;
safe_wstrcpy(newstr, s, newlen);
return newstr;
}