]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/view.c
ncurses 5.7 - patch 20091212
[ncurses.git] / test / view.c
index fe3a2114ea3a3ff3de30ed781dd1090e71d4f721..5b52e9807696c9a5f02ccd6ccdf2a73f2817f3a8 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -50,7 +50,7 @@
  * scroll operation worked, and the refresh() code only had to do a
  * partial repaint.
  *
- * $Id: view.c,v 1.70 2008/11/16 00:19:59 juergen Exp $
+ * $Id: view.c,v 1.76 2009/10/24 21:26:38 tom Exp $
  */
 
 #include <test.priv.h>
@@ -83,7 +83,7 @@
 
 #if USE_WIDEC_SUPPORT
 #if HAVE_MBTOWC && HAVE_MBLEN
-#define reset_mbytes(state) mblen(NULL, 0), mbtowc(NULL, NULL, 0)
+#define reset_mbytes(state) IGNORE_RC(mblen(NULL, 0)), IGNORE_RC(mbtowc(NULL, NULL, 0))
 #define count_mbytes(buffer,length,state) mblen(buffer,length)
 #define check_mbytes(wch,buffer,length,state) \
        (int) mbtowc(&wch, buffer, length)
@@ -151,11 +151,19 @@ ch_len(NCURSES_CH_T * src)
 {
     int result = 0;
 #if USE_WIDEC_SUPPORT
+    int count;
 #endif
 
 #if USE_WIDEC_SUPPORT
-    while (getcchar(src++, NULL, NULL, NULL, NULL) > 0)
-       result++;
+    for (;;) {
+       TEST_CCHAR(src, count, {
+           ++result;
+           ++src;
+       }
+       , {
+           break;
+       })
+    }
 #else
     while (*src++)
        result++;
@@ -283,7 +291,7 @@ main(int argc, char *argv[])
     if (optind + 1 != argc)
        usage();
 
-    if ((vec_lines = typeMalloc(NCURSES_CH_T *, MAXLINES + 2)) == 0)
+    if ((vec_lines = typeCalloc(NCURSES_CH_T *, MAXLINES + 2)) == 0)
        usage();
 
     fname = argv[optind];