]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - progs/transform.c
ncurses 6.2 - patch 20210323
[ncurses.git] / progs / transform.c
index 3c9a4e964ca75537e848bbf7192258b0619320fb..67caf2d23f1a477726042b0f99d4b1ca5bd80d56 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 2009 Free Software Foundation, Inc.                        *
+ * Copyright 2020 Thomas E. Dickey                                          *
+ * Copyright 2009-2010,2011 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            *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
 
 #include <transform.h>
 
 
 #include <transform.h>
 
-MODULE_ID("$Id: transform.c,v 1.1 2009/03/14 19:08:28 tom Exp $")
+MODULE_ID("$Id: transform.c,v 1.4 2020/02/02 23:34:34 tom Exp $")
 
 #ifdef SUFFIX_IGNORED
 static void
 
 #ifdef SUFFIX_IGNORED
 static void
-trim_suffix(const char *a, unsigned *len)
+trim_suffix(const char *a, size_t *len)
 {
     const char ignore[] = SUFFIX_IGNORED;
 
     if (sizeof(ignore) != 0) {
        bool trim = FALSE;
 {
     const char ignore[] = SUFFIX_IGNORED;
 
     if (sizeof(ignore) != 0) {
        bool trim = FALSE;
-       unsigned need = (sizeof(ignore) - 1);
+       size_t need = (sizeof(ignore) - 1);
 
        if (*len > need) {
 
        if (*len > need) {
-           unsigned first = *len - need;
-           unsigned n;
+           size_t first = *len - need;
+           size_t n;
            trim = TRUE;
            for (n = first; n < *len; ++n) {
            trim = TRUE;
            for (n = first; n < *len; ++n) {
-               if (tolower(a[n]) != tolower(ignore[n - first])) {
+               if (tolower(UChar(a[n])) != tolower(UChar(ignore[n - first]))) {
                    trim = FALSE;
                    break;
                }
                    trim = FALSE;
                    break;
                }
@@ -63,14 +64,14 @@ trim_suffix(const char *a, unsigned *len)
     }
 }
 #else
     }
 }
 #else
-#define trim_suffix(a, len) /* nothing */
+#define trim_suffix(a, len)    /* nothing */
 #endif
 
 bool
 same_program(const char *a, const char *b)
 {
 #endif
 
 bool
 same_program(const char *a, const char *b)
 {
-    unsigned len_a = strlen(a);
-    unsigned len_b = strlen(b);
+    size_t len_a = strlen(a);
+    size_t len_b = strlen(b);
 
     trim_suffix(a, &len_a);
     trim_suffix(b, &len_b);
 
     trim_suffix(a, &len_a);
     trim_suffix(b, &len_b);