Mercurial > urweb
comparison src/c/urweb.c @ 1801:5c51ae0d643b
Fix some unportable uses of C character class functions
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Fri, 03 Aug 2012 08:32:03 -0400 |
parents | 3d922a28370b |
children | 690638bd9fef |
comparison
equal
deleted
inserted
replaced
1800:38297294cf98 | 1801:5c51ae0d643b |
---|---|
4090 uw_Basis_string uw_Basis_atom(uw_context ctx, uw_Basis_string s) { | 4090 uw_Basis_string uw_Basis_atom(uw_context ctx, uw_Basis_string s) { |
4091 char *p; | 4091 char *p; |
4092 | 4092 |
4093 for (p = s; *p; ++p) { | 4093 for (p = s; *p; ++p) { |
4094 char c = *p; | 4094 char c = *p; |
4095 if (!isalnum(c) && c != '+' && c != '-' && c != '.' && c != '%' && c != '#') | 4095 if (!isalnum((int)c) && c != '+' && c != '-' && c != '.' && c != '%' && c != '#') |
4096 uw_error(ctx, FATAL, "Disallowed character in CSS atom"); | 4096 uw_error(ctx, FATAL, "Disallowed character in CSS atom"); |
4097 } | 4097 } |
4098 | 4098 |
4099 return s; | 4099 return s; |
4100 } | 4100 } |
4102 uw_Basis_string uw_Basis_css_url(uw_context ctx, uw_Basis_string s) { | 4102 uw_Basis_string uw_Basis_css_url(uw_context ctx, uw_Basis_string s) { |
4103 char *p; | 4103 char *p; |
4104 | 4104 |
4105 for (p = s; *p; ++p) { | 4105 for (p = s; *p; ++p) { |
4106 char c = *p; | 4106 char c = *p; |
4107 if (!isalnum(c) && c != ':' && c != '/' && c != '.' && c != '_' && c != '+' | 4107 if (!isalnum((int)c) && c != ':' && c != '/' && c != '.' && c != '_' && c != '+' |
4108 && c != '-' && c != '%' && c != '?' && c != '&' && c != '=' && c != '#') | 4108 && c != '-' && c != '%' && c != '?' && c != '&' && c != '=' && c != '#') |
4109 uw_error(ctx, FATAL, "Disallowed character in CSS URL"); | 4109 uw_error(ctx, FATAL, "Disallowed character in CSS URL"); |
4110 } | 4110 } |
4111 | 4111 |
4112 return s; | 4112 return s; |
4116 char *p; | 4116 char *p; |
4117 | 4117 |
4118 if (!*s) | 4118 if (!*s) |
4119 uw_error(ctx, FATAL, "Empty CSS property"); | 4119 uw_error(ctx, FATAL, "Empty CSS property"); |
4120 | 4120 |
4121 if (!islower(s[0]) && s[0] != '_') | 4121 if (!islower((int)s[0]) && s[0] != '_') |
4122 uw_error(ctx, FATAL, "Bad initial character in CSS property"); | 4122 uw_error(ctx, FATAL, "Bad initial character in CSS property"); |
4123 | 4123 |
4124 for (p = s; *p; ++p) { | 4124 for (p = s; *p; ++p) { |
4125 char c = *p; | 4125 char c = *p; |
4126 if (!islower(c) && !isdigit(c) && c != '_' && c != '-') | 4126 if (!islower((int)c) && !isdigit((int)c) && c != '_' && c != '-') |
4127 uw_error(ctx, FATAL, "Disallowed character in CSS property"); | 4127 uw_error(ctx, FATAL, "Disallowed character in CSS property"); |
4128 } | 4128 } |
4129 | 4129 |
4130 return s; | 4130 return s; |
4131 } | 4131 } |