OLD | NEW |
1 /* Copyright (C) 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc. | 1 /* Copyright (C) 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc. |
2 Contributed by Paul Brook | 2 Contributed by Paul Brook |
3 | 3 |
4 This file is part of the GNU Fortran 95 runtime library (libgfortran). | 4 This file is part of the GNU Fortran 95 runtime library (libgfortran). |
5 | 5 |
6 Libgfortran is free software; you can redistribute it and/or modify | 6 Libgfortran is free software; you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
8 the Free Software Foundation; either version 3, or (at your option) | 8 the Free Software Foundation; either version 3, or (at your option) |
9 any later version. | 9 any later version. |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "libgfortran.h" | 25 #include "libgfortran.h" |
26 #include <string.h> | 26 #include <string.h> |
27 | 27 |
28 /* Compare a C-style string with a fortran style string in a case-insensitive | 28 /* Compare a C-style string with a fortran style string in a case-insensitive |
29 manner. Used for decoding string options to various statements. Returns | 29 manner. Used for decoding string options to various statements. Returns |
30 zero if not equal, nonzero if equal. */ | 30 zero if not equal, nonzero if equal. */ |
31 | 31 |
32 static int | 32 static int |
33 compare0 (const char *s1, gfc_charlen_type s1_len, const char *s2) | 33 compare0 (const char *s1, gfc_charlen_type s1_len, const char *s2) |
34 { | 34 { |
35 size_t len; | 35 gfc_charlen_type len; |
36 | 36 |
37 /* Strip trailing blanks from the Fortran string. */ | 37 /* Strip trailing blanks from the Fortran string. */ |
38 len = fstrlen (s1, s1_len); | 38 len = fstrlen (s1, s1_len); |
39 if (len != strlen(s2)) return 0; /* don't match */ | 39 |
| 40 if ((size_t) len != strlen(s2)) |
| 41 return 0; /* don't match */ |
| 42 |
40 return strncasecmp (s1, s2, len) == 0; | 43 return strncasecmp (s1, s2, len) == 0; |
41 } | 44 } |
42 | 45 |
43 | 46 |
44 /* Given a fortran string, return its length exclusive of the trailing | 47 /* Given a fortran string, return its length exclusive of the trailing |
45 spaces. */ | 48 spaces. */ |
46 | 49 |
47 gfc_charlen_type | 50 gfc_charlen_type |
48 fstrlen (const char *string, gfc_charlen_type len) | 51 fstrlen (const char *string, gfc_charlen_type len) |
49 { | 52 { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 const st_option * opts, const char *error_message) | 117 const st_option * opts, const char *error_message) |
115 { | 118 { |
116 for (; opts->name; opts++) | 119 for (; opts->name; opts++) |
117 if (compare0 (s1, s1_len, opts->name)) | 120 if (compare0 (s1, s1_len, opts->name)) |
118 return opts->value; | 121 return opts->value; |
119 | 122 |
120 generate_error (cmp, LIBERROR_BAD_OPTION, error_message); | 123 generate_error (cmp, LIBERROR_BAD_OPTION, error_message); |
121 | 124 |
122 return -1; | 125 return -1; |
123 } | 126 } |
OLD | NEW |