Commit d4045524 authored by Per Cederqvist's avatar Per Cederqvist

(s_strcmp): Changed type of loop variable from "unsigned int" to

	"String_size".
(s_usr_strcmp): Likewise.
(char2digit): Added const qualifier to translate_table.  Use an
	int as argument to isalpha and tolower to avoid problems with
	signed chars.
(rcsid): Added a missing const.
parent edbfec79
/*
* $Id: s-string.c,v 1.19 1996/08/03 01:30:04 ceder Exp $
* $Id: s-string.c,v 1.20 1998/07/08 13:57:47 ceder Exp $
* Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -46,7 +46,8 @@
* even if so stated.
*/
static char *rcsid = "$Id: s-string.c,v 1.19 1996/08/03 01:30:04 ceder Exp $";
static const char *
rcsid = "$Id: s-string.c,v 1.20 1998/07/08 13:57:47 ceder Exp $";
#include <sys/types.h>
#include <stdio.h>
......@@ -468,7 +469,7 @@ s_strcmp (String str1,
String str2)
{
unsigned int index;
String_size index;
String_size shortest; /* Length of the shortest string */
int retval_based_on_lengths;
......@@ -524,7 +525,7 @@ s_usr_strcmp (String str1,
char * collat_tab)
{
unsigned int index;
String_size index;
String_size shortest; /* Length of the shortest string */
int retval_based_on_lengths;
......@@ -845,13 +846,14 @@ char2digit (const char ch,
const int base)
{
int index;
static char * translate_table =
static const char * translate_table =
"0123456789abcdefghijklmnopqrstuvwxyz";
int c = (unsigned char)ch;
index = 0;
while ( (index < base)
&& ( translate_table[index]
!= (isalpha(ch) ? tolower(ch) : ch)))
!= (isalpha(c) ? tolower(c) : ch)))
index++;
if (index >= base)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment