return true;
// Start a new index and add it to the hash
- if (isspace(Stop[0]) == 0)
+ if (isspace_ascii(Stop[0]) == 0)
{
// store the last found tag
if (lastTagData.EndTag != 0)
// find the end of the tag (which might or might not be the colon)
char const * EndTag = Colon;
--EndTag;
- for (; EndTag > Stop && isspace(*EndTag) != 0; --EndTag)
+ for (; EndTag > Stop && isspace_ascii(*EndTag) != 0; --EndTag)
;
++EndTag;
lastTagData.EndTag = EndTag - Section;
lastTagHash = AlphaHash(Stop, EndTag - Stop);
// find the beginning of the value
Stop = Colon + 1;
- for (; isspace(*Stop) != 0; ++Stop);
+ for (; isspace_ascii(*Stop) != 0; ++Stop)
+ if (*Stop == '\n' && Stop[1] != ' ')
+ break;
if (Stop >= End)
return false;
lastTagData.StartValue = Stop - Section;
if (unlikely(Start > End))
return _error->Error("Internal parsing error");
- for (; isspace(End[-1]) != 0 && End > Start; --End);
+ for (; isspace_ascii(End[-1]) != 0 && End > Start; --End);
return true;
}
if (unlikely(Start > End))
return "";
- for (; isspace(End[-1]) != 0 && End > Start; --End);
+ for (; isspace_ascii(End[-1]) != 0 && End > Start; --End);
return std::string(Start, End - Start);
}
errno = 0;
char *End;
signed long Result = strtol(S,&End,10);
- if (errno == ERANGE)
- _error->Errno("strtol", _("Cannot convert %s to integer"), S);
- if (Result < std::numeric_limits<int>::min() || Result > std::numeric_limits<int>::max()) {
+ if (errno == ERANGE ||
+ Result < std::numeric_limits<int>::min() || Result > std::numeric_limits<int>::max()) {
errno = ERANGE;
- _error->Errno("", _("Cannot convert %s to integer"), S);
+ _error->Error(_("Cannot convert %s to integer: out of range"), S);
}
if (S == End)
return Default;
}
static bool WriteTag(FileFd &File, std::string Tag, std::string const &Value)
{
- if (Value.empty() || isspace(Value[0]) != 0)
+ if (Value.empty() || isspace_ascii(Value[0]) != 0)
Tag.append(":");
else
Tag.append(": ");
Visited[J] |= 2;
if (Rewrite[J].Rewrite != 0 && Rewrite[J].Rewrite[0] != 0)
{
- if (isspace(Rewrite[J].Rewrite[0]))
+ if (isspace_ascii(Rewrite[J].Rewrite[0]))
fprintf(Output,"%s:%s\n",Rewrite[J].NewTag,Rewrite[J].Rewrite);
else
fprintf(Output,"%s: %s\n",Rewrite[J].NewTag,Rewrite[J].Rewrite);
Visited[J] |= 2;
if (Rewrite[J].Rewrite != 0 && Rewrite[J].Rewrite[0] != 0)
{
- if (isspace(Rewrite[J].Rewrite[0]))
+ if (isspace_ascii(Rewrite[J].Rewrite[0]))
fprintf(Output,"%s:%s\n",Rewrite[J].NewTag,Rewrite[J].Rewrite);
else
fprintf(Output,"%s: %s\n",Rewrite[J].NewTag,Rewrite[J].Rewrite);
if (Rewrite[J].Rewrite != 0 && Rewrite[J].Rewrite[0] != 0)
{
- if (isspace(Rewrite[J].Rewrite[0]))
+ if (isspace_ascii(Rewrite[J].Rewrite[0]))
fprintf(Output,"%s:%s\n",Rewrite[J].NewTag,Rewrite[J].Rewrite);
else
fprintf(Output,"%s: %s\n",Rewrite[J].NewTag,Rewrite[J].Rewrite);