summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1997-10-09 14:40:46 +0000
committerLuke Leighton <lkcl@samba.org>1997-10-09 14:40:46 +0000
commitad54a5671405374b6308929154c6922bc6a7d0d7 (patch)
tree1a9d7dae275a6e395cd9c6c3e65f485f2ab04c2f /source3/lib
parent228cef8d01081e7cac1d90e5b568a19937404245 (diff)
downloadsamba-ad54a5671405374b6308929154c6922bc6a7d0d7.tar.gz
samba-ad54a5671405374b6308929154c6922bc6a7d0d7.tar.bz2
samba-ad54a5671405374b6308929154c6922bc6a7d0d7.zip
credentials.c:
use UTIME structure (defined and commented in smb.h to be time, secs, since 01jan1970) pipes.c: another sub-function. util.c: added char *unistr2(uint16 *buff) function. same as unistr except it takes uint16* instead of char*. smbparse.c smb.h: more structure sorting. proto.h: the usual. (This used to be commit 72a86f514f0c92b69499718e63f5dd73ebece56e)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 39d3c61b9e..701f324554 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -4216,7 +4216,27 @@ char *skip_unicode_string(char *buf,int n)
/*******************************************************************
Return a ascii version of a unicode string
-Hack alert: uses fixed buffer and only handles ascii strings
+Hack alert: uses fixed buffer(s) and only handles ascii strings
+********************************************************************/
+#define MAXUNI 1024
+char *unistr2(uint16 *buf)
+{
+ static char lbufs[8][MAXUNI];
+ static int nexti;
+ char *lbuf = lbufs[nexti];
+ char *p;
+ nexti = (nexti+1)%8;
+ for (p = lbuf; *buf && p-lbuf < MAXUNI-2; p++, buf++)
+ {
+ *p = *buf;
+ }
+ *p = 0;
+ return lbuf;
+}
+
+/*******************************************************************
+Return a ascii version of a unicode string
+Hack alert: uses fixed buffer(s) and only handles ascii strings
********************************************************************/
#define MAXUNI 1024
char *unistr(char *buf)
@@ -4225,9 +4245,13 @@ char *unistr(char *buf)
static int nexti;
char *lbuf = lbufs[nexti];
char *p;
+
nexti = (nexti+1)%8;
- for (p = lbuf; *buf && p -lbuf < MAXUNI-2; p++, buf += 2)
+
+ for (p = lbuf; *buf && p-lbuf < MAXUNI-2; p++, buf += 2)
+ {
*p = *buf;
+ }
*p = 0;
return lbuf;
}