about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-07-28 14:45:32 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-07-28 14:45:32 +0000
commit8665549030043b6eee46f60d52c57e8519372286 (patch)
tree8f2e50a6f567d9294e754f2569bec7b319ae8316
parenta680faf0502063ae7488b20a95d3d82f49a12120 (diff)
downloadzsh-8665549030043b6eee46f60d52c57e8519372286.tar.gz
zsh-8665549030043b6eee46f60d52c57e8519372286.tar.xz
zsh-8665549030043b6eee46f60d52c57e8519372286.zip
21541: remove some warnings from ZLE_UNICODE_SUPPORT
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/zle_hist.c15
-rw-r--r--Src/Zle/zle_main.c5
-rw-r--r--Src/Zle/zle_misc.c2
-rw-r--r--Src/Zle/zle_params.c7
-rw-r--r--Src/Zle/zle_tricky.c10
-rw-r--r--Src/Zle/zle_utils.c16
7 files changed, 46 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 08965d3fc..80aae540b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2005-07-28  Peter Stephenson  <pws@csr.com>
 
+	* 21541: Src/Zle/zle_hist.c, Src/Zle/zle_main.c,
+	Src/Zle/zle_misc.c, Src/Zle/zle_params.c, Src/Zle/zle_tricky.c,
+	Src/Zle/zle_utils.c: remove some warnings from
+	ZLE_UNICODE_SUPPORT.
+
 	* unposted: Completion/Unix/Command/_perforce: updated for
 	features of Perforce 2005.1 release.
 
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index 67827d530..bed66ac0e 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -1068,7 +1068,8 @@ doisearch(char **args, int dir)
 	rpt:
 	    if (!sbptr && previous_search_len) {
 		if (previous_search_len > sibuf - FIRST_SEARCH_CHAR - 2) {
-		    ibuf = hrealloc(ibuf, sibuf, (sibuf + previous_search_len)
+		    ibuf = hrealloc((char *)ibuf, sibuf * ZLE_CHAR_SIZE,
+				    (sibuf + previous_search_len)
 				    * ZLE_CHAR_SIZE);
 		    sbuf = ibuf + FIRST_SEARCH_CHAR;
 		    sibuf += previous_search_len;
@@ -1096,7 +1097,7 @@ doisearch(char **args, int dir)
 	    } else if (cmd == Th(z_selfinsert)) {
 #ifdef ZLE_UNICODE_SUPPORT
 		if (!lastchar_wide_valid)
-		    getfullcharrest(lastchar);
+		    getrestchar(lastchar);
 #else
 		;
 #endif
@@ -1113,7 +1114,8 @@ doisearch(char **args, int dir)
 	    }
 	    set_isrch_spot(top_spot++, hl, pos, zlecs, sbptr, dir, nomatch);
 	    if (sbptr >= sibuf - FIRST_SEARCH_CHAR - 2) {
-		ibuf = hrealloc(ibuf, sibuf, sibuf * 2 * ZLE_CHAR_SIZE);
+		ibuf = hrealloc((char *)ibuf, sibuf * ZLE_CHAR_SIZE,
+				sibuf * 2 * ZLE_CHAR_SIZE);
 		sbuf = ibuf + FIRST_SEARCH_CHAR;
 		sibuf *= 2;
 	    }
@@ -1298,9 +1300,10 @@ getvisrchstr(void)
 #endif
 	    }
 	  ins:
-	    if(sptr == ssbuf - 1) {
-		char *newbuf = zhalloc(ssbuf *= 2);
-		strcpy(newbuf, sbuf);
+	    if (sptr == ssbuf - 1) {
+		ZLE_STRING_T newbuf =
+		    (ZLE_STRING_T) zhalloc((ssbuf *= 2) * ZLE_CHAR_SIZE);
+		ZS_strcpy(newbuf, sbuf);
 		statusline = sbuf = newbuf;
 	    }
 	    sbuf[sptr++] = LASTFULLCHAR;
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 0f9d55226..e6f83cb3e 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -938,7 +938,7 @@ zleread(char **lp, char **rp, int flags, int context)
     zlecontext = context;
     histline = curhist;
     undoing = 1;
-    zleline = (unsigned char *)zalloc(((linesz = 256) + 2) * ZLE_CHAR_SIZE);
+    zleline = (ZLE_STRING_T)zalloc(((linesz = 256) + 2) * ZLE_CHAR_SIZE);
     *zleline = ZWC('\0');
     virangeflag = lastcmd = done = zlecs = zlell = mark = 0;
     vichgflag = 0;
@@ -1518,7 +1518,8 @@ wordcharstrigger(void)
 {
 #ifdef ZLE_UNICODE_SUPPORT
     zrealloc(zle_wordchars, strlen(wordchars)*MB_CUR_MAX);
-    mbsrtowcs(zle_wordchars, &wordchars, strlen(wordchars), NULL);
+    mbsrtowcs(zle_wordchars, (const char **)&wordchars,
+	      strlen(wordchars), NULL);
     /* TODO: error handling here */
 #endif
 }
diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c
index 022d98e64..44bc611d5 100644
--- a/Src/Zle/zle_misc.c
+++ b/Src/Zle/zle_misc.c
@@ -724,7 +724,7 @@ makequote(ZLE_STRING_T str, size_t *len)
 	if (*l == ZWC('\''))
 	    qtct++;
     *len += 2 + qtct*3;
-    l = ol = (char *)zhalloc(*len * ZLE_CHAR_SIZE);
+    l = ol = (ZLE_STRING_T)zhalloc(*len * ZLE_CHAR_SIZE);
     *l++ = ZWC('\'');
     for (; str < end; str++)
 	if (*str == ZWC('\'')) {
diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c
index f9ac4f284..f089a5f47 100644
--- a/Src/Zle/zle_params.c
+++ b/Src/Zle/zle_params.c
@@ -187,7 +187,7 @@ set_buffer(UNUSED(Param pm), char *x)
 static char *
 get_buffer(UNUSED(Param pm))
 {
-    return (char *)zlelineasstring((char *)zleline, zlell, 0, NULL, NULL, 1);
+    return (char *)zlelineasstring(zleline, zlell, 0, NULL, NULL, 1);
 }
 
 /**/
@@ -264,7 +264,7 @@ get_lbuffer(UNUSED(Param pm))
 static void
 set_rbuffer(UNUSED(Param pm), char *x)
 {
-    char *y;
+    ZLE_STRING_T y;
     int len;
 
     if (x && *x != ZWC('\0'))
@@ -610,7 +610,8 @@ static char *
 get_lsearch(UNUSED(Param pm))
 {
     if (previous_search_len)
-	return metafy(previous_search, previous_search_len, META_HEAPDUP);
+	return zlelineasstring(previous_search, previous_search_len, 0,
+			       NULL, NULL, 1);
     else
 	return "";
 }
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 778305d18..f59823f0b 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -2332,9 +2332,19 @@ magicspace(char **args)
 	 bangq += 2)
 	if (bangq[1] == '"' && (bangq == (char *)zleline || bangq[-1] != '\\'))
 	    break;
+#ifdef ZLE_UNICODE_SUPPORT
+    /*
+     * TODO: expansion and completion with Unicode are currently
+     * fundamentally broken.  Most of the code for this hasn't been
+     * commented out, but crashing the shell just because you entered
+     * a space seems to be worth guarding against.
+     */
+    ret = selfinsert(args);
+#else
     if (!(ret = selfinsert(args)) &&
 	(!bangq || bangq + 2 > (char *)zleline + zlecs))
 	doexpandhist();
+#endif
     return ret;
 }
 
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index 5d63a9ebc..aa691bcdc 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -85,10 +85,23 @@ sizeline(int sz)
 
 /**/
 mod_export void
-zleaddtoline(ZLE_CHAR_T chr)
+zleaddtoline(int chr)
 {
     spaceinline(1);
+#ifdef ZLE_UNICODE_SUPPORT
+    /*
+     * TODO: the main shell has as yet very little notion of multibyte
+     * characters.  Until this gets fixed we just have to assume
+     * this is a complete character.
+     *
+     * Possibly we could get away with attempting to build up a
+     * multibyte character here, storing partial characters between
+     * calls.
+     */
+    zleline[zlecs++] = (ZLE_CHAR_T)chr;
+#else
     zleline[zlecs++] = chr;
+#endif
 }
 
 /*
@@ -188,7 +201,6 @@ stringaszleline(unsigned char *instr, int *outll, int *outsz)
     ZLE_STRING_T outstr;
     int ll, sz;
 #ifdef ZLE_UNICODE_SUPPORT
-    int cll;
     mbstate_t ps;
 #endif