diff --git a/jni/NativeFormats/fbreader/src/formats/css/StyleSheetParser.cpp b/jni/NativeFormats/fbreader/src/formats/css/StyleSheetParser.cpp index 718c948a8..a57ce3c35 100644 --- a/jni/NativeFormats/fbreader/src/formats/css/StyleSheetParser.cpp +++ b/jni/NativeFormats/fbreader/src/formats/css/StyleSheetParser.cpp @@ -65,7 +65,7 @@ void StyleSheetTableParser::processAtRule(const std::string &name, const StyleSh shared_ptr StyleSheetSingleStyleParser::parseString(const char *text) { myReadState = WAITING_FOR_ATTRIBUTE; - parse(text, strlen(text), true); + parse(text, std::strlen(text), true); shared_ptr control = StyleSheetTable::createControl(myMap); reset(); return control; @@ -106,7 +106,7 @@ void StyleSheetParser::parse(const char *text, int len, bool final) { const char *start = text; const char *end = text + len; for (const char *ptr = start; ptr != end; ++ptr) { - if (isspace(*ptr)) { + if (std::isspace(*ptr)) { if (start != ptr) { myWord.append(start, ptr - start); } @@ -212,8 +212,8 @@ void StyleSheetParser::processWord(std::string &word) { word.erase(0, index + 2); } } - -void StyleSheetParser::processWordWithoutComments(const std::string &word) { + +void StyleSheetParser::processWordWithoutComments(const std::string &word) { switch (myReadState) { case WAITING_FOR_SELECTOR: myReadState = SELECTOR; diff --git a/jni/NativeFormats/fbreader/src/formats/css/StyleSheetTable.cpp b/jni/NativeFormats/fbreader/src/formats/css/StyleSheetTable.cpp index 7ab7b0da9..1d6e11cea 100644 --- a/jni/NativeFormats/fbreader/src/formats/css/StyleSheetTable.cpp +++ b/jni/NativeFormats/fbreader/src/formats/css/StyleSheetTable.cpp @@ -57,7 +57,7 @@ void StyleSheetTable::addMap(const std::string &tag, const std::string &aClass, static bool parseLength(const std::string &toParse, short &size, ZLTextStyleEntry::SizeUnit &unit) { if (ZLStringUtil::stringEndsWith(toParse, "%")) { unit = ZLTextStyleEntry::SIZE_UNIT_PERCENT; - size = atoi(toParse.c_str()); + size = std::atoi(toParse.c_str()); return true; } else if (ZLStringUtil::stringEndsWith(toParse, "em")) { unit = ZLTextStyleEntry::SIZE_UNIT_EM_100; @@ -69,11 +69,11 @@ static bool parseLength(const std::string &toParse, short &size, ZLTextStyleEntr return true; } else if (ZLStringUtil::stringEndsWith(toParse, "px")) { unit = ZLTextStyleEntry::SIZE_UNIT_PIXEL; - size = atoi(toParse.c_str()); + size = std::atoi(toParse.c_str()); return true; } else if (ZLStringUtil::stringEndsWith(toParse, "pt")) { unit = ZLTextStyleEntry::SIZE_UNIT_POINT; - size = atoi(toParse.c_str()); + size = std::atoi(toParse.c_str()); return true; } return false; diff --git a/jni/NativeFormats/fbreader/src/formats/html/HtmlBookReader.cpp b/jni/NativeFormats/fbreader/src/formats/html/HtmlBookReader.cpp index 17cd70fe0..009591af7 100644 --- a/jni/NativeFormats/fbreader/src/formats/html/HtmlBookReader.cpp +++ b/jni/NativeFormats/fbreader/src/formats/html/HtmlBookReader.cpp @@ -404,7 +404,7 @@ HtmlBookReader::~HtmlBookReader() { void HtmlBookReader::addConvertedDataToBuffer(const char *text, std::size_t len, bool convert) { if (len > 0) { if (myDontBreakParagraph) { - while ((len > 0) && isspace(*text)) { + while (len > 0 && std::isspace(*text)) { --len; ++text; } @@ -433,7 +433,7 @@ bool HtmlBookReader::tagHandler(const HtmlTag &tag) { if (tag.Attributes[i].Name == "ID") { myBookReader.addHyperlinkLabel(tag.Attributes[i].Value); break; - } + } } shared_ptr action = myActionMap[tag.Name]; if (action.isNull()) { @@ -464,7 +464,7 @@ void HtmlBookReader::preformattedCharacterDataHandler(const char *text, std::siz myBookReader.beginParagraph(); start = ptr + 1; } else if (mySpaceCounter >= 0) { - if (isspace((unsigned char)*ptr)) { + if (std::isspace((unsigned char)*ptr)) { ++mySpaceCounter; } else { myBookReader.addFixedHSpace(mySpaceCounter); @@ -475,7 +475,7 @@ void HtmlBookReader::preformattedCharacterDataHandler(const char *text, std::siz addConvertedDataToBuffer(start, end - start, convert); } else if (breakType & PlainTextFormat::BREAK_PARAGRAPH_AT_LINE_WITH_INDENT) { for (const char *ptr = text; ptr != end; ++ptr) { - if (isspace((unsigned char)*ptr)) { + if (std::isspace((unsigned char)*ptr)) { if (*ptr == '\n') { mySpaceCounter = 0; } else if (mySpaceCounter >= 0) { @@ -499,7 +499,7 @@ void HtmlBookReader::preformattedCharacterDataHandler(const char *text, std::siz } } else if (breakType & PlainTextFormat::BREAK_PARAGRAPH_AT_EMPTY_LINE) { for (const char *ptr = start; ptr != end; ++ptr) { - if (isspace((unsigned char)*ptr)) { + if (std::isspace((unsigned char)*ptr)) { if (*ptr == '\n') { ++myBreakCounter; } @@ -536,7 +536,7 @@ bool HtmlBookReader::characterDataHandler(const char *text, std::size_t len, boo const char *end = text + len; if (!myIsStarted) { for (; ptr != end; ++ptr) { - if (!isspace((unsigned char)*ptr)) { + if (!std::isspace((unsigned char)*ptr)) { myIsStarted = true; break; } diff --git a/jni/NativeFormats/fbreader/src/formats/html/HtmlEntityCollection.cpp b/jni/NativeFormats/fbreader/src/formats/html/HtmlEntityCollection.cpp index e042b9a1c..b27ba9a6a 100644 --- a/jni/NativeFormats/fbreader/src/formats/html/HtmlEntityCollection.cpp +++ b/jni/NativeFormats/fbreader/src/formats/html/HtmlEntityCollection.cpp @@ -64,8 +64,8 @@ void CollectionReader::startElementHandler(const char *tag, const char **attribu } static const std::string _name = "name"; static const std::string _number = "number"; - if ((_name == attributes[0]) && (_number == attributes[2])) { - myCollection[attributes[1]] = atoi(attributes[3]); + if (_name == attributes[0] && _number == attributes[2]) { + myCollection[attributes[1]] = std::atoi(attributes[3]); } } } diff --git a/jni/NativeFormats/fbreader/src/formats/html/HtmlReader.cpp b/jni/NativeFormats/fbreader/src/formats/html/HtmlReader.cpp index 3abdc0a06..4ac415bc8 100644 --- a/jni/NativeFormats/fbreader/src/formats/html/HtmlReader.cpp +++ b/jni/NativeFormats/fbreader/src/formats/html/HtmlReader.cpp @@ -52,7 +52,7 @@ void HtmlReader::setTag(HtmlTag &tag, const std::string &name) { const std::size_t len = tag.Name.length(); for (std::size_t i = 0; i < len; ++i) { - tag.Name[i] = toupper(tag.Name[i]); + tag.Name[i] = std::toupper(tag.Name[i]); } } @@ -79,9 +79,9 @@ enum SpecialType { static bool allowSymbol(SpecialType type, char ch) { return - ((type == ST_NAME) && isalpha(ch)) || - ((type == ST_DEC) && isdigit(ch)) || - ((type == ST_HEX) && isxdigit(ch)); + (type == ST_NAME && std::isalpha(ch)) || + (type == ST_DEC && std::isdigit(ch)) || + (type == ST_HEX && std::isxdigit(ch)); } static int specialSymbolNumber(SpecialType type, const std::string &txt) { @@ -90,9 +90,9 @@ static int specialSymbolNumber(SpecialType type, const std::string &txt) { case ST_NAME: return HtmlEntityCollection::symbolNumber(txt); case ST_DEC: - return strtol(txt.c_str() + 1, &end, 10); + return std::strtol(txt.c_str() + 1, &end, 10); case ST_HEX: - return strtol(txt.c_str() + 2, &end, 16); + return std::strtol(txt.c_str() + 2, &end, 16); default: return 0; } @@ -157,7 +157,7 @@ void HtmlReader::readDocument(ZLInputStream &stream) { if (state_special == ST_UNKNOWN) { if (*ptr == '#') { state_special = ST_NUM; - } else if (isalpha(*ptr)) { + } else if (std::isalpha(*ptr)) { state_special = ST_NAME; } else { start = ptr; @@ -166,7 +166,7 @@ void HtmlReader::readDocument(ZLInputStream &stream) { } else if (state_special == ST_NUM) { if (*ptr == 'x') { state_special = ST_HEX; - } else if (isdigit(*ptr)) { + } else if (std::isdigit(*ptr)) { state_special = ST_DEC; } else { start = ptr; @@ -231,13 +231,13 @@ void HtmlReader::readDocument(ZLInputStream &stream) { } break; case PS_TAGNAME: - if ((*ptr == '>') || (*ptr == '/') || isspace((unsigned char)*ptr)) { + if (*ptr == '>' || *ptr == '/' || std::isspace((unsigned char)*ptr)) { currentString.append(start, ptr - start); start = ptr + 1; setTag(currentTag, currentString); currentString.erase(); if (currentTag.Name == "") { - state = (*ptr == '>') ? PS_TEXT : PS_SKIPTAG; + state = *ptr == '>' ? PS_TEXT : PS_SKIPTAG; } else { if (*ptr == '>') { if (!tagHandler(currentTag)) { @@ -260,11 +260,11 @@ void HtmlReader::readDocument(ZLInputStream &stream) { } break; case PS_ATTRIBUTENAME: - if ((*ptr == '>') || (*ptr == '/') || (*ptr == '=') || isspace((unsigned char)*ptr)) { - if ((ptr != start) || !currentString.empty()) { + if (*ptr == '>' || *ptr == '/' || *ptr == '=' || std::isspace((unsigned char)*ptr)) { + if (ptr != start || !currentString.empty()) { currentString.append(start, ptr - start); for (unsigned int i = 0; i < currentString.length(); ++i) { - currentString[i] = toupper(currentString[i]); + currentString[i] = std::toupper(currentString[i]); } currentTag.addAttribute(currentString); currentString.erase(); @@ -300,8 +300,8 @@ void HtmlReader::readDocument(ZLInputStream &stream) { appendString(attributeValueString, currentString); state = PS_SPECIAL_IN_ATTRIBUTEVALUE; state_special = ST_UNKNOWN; - } else if ((quotationCounter != 1) && ((*ptr == '>') || (*ptr == '/') || isspace((unsigned char)*ptr))) { - if ((ptr != start) || !currentString.empty()) { + } else if (quotationCounter != 1 && (*ptr == '>' || *ptr == '/' || std::isspace((unsigned char)*ptr))) { + if (ptr != start || !currentString.empty()) { currentString.append(start, ptr - start); appendString(attributeValueString, currentString); if (attributeValueString[0] == '"') { diff --git a/jni/NativeFormats/fbreader/src/formats/oeb/NCXReader.cpp b/jni/NativeFormats/fbreader/src/formats/oeb/NCXReader.cpp index a49a4f7bd..c0b78dc8a 100644 --- a/jni/NativeFormats/fbreader/src/formats/oeb/NCXReader.cpp +++ b/jni/NativeFormats/fbreader/src/formats/oeb/NCXReader.cpp @@ -47,14 +47,14 @@ void NCXReader::startElementHandler(const char *fullTag, const char **attributes case READ_MAP: if (TAG_NAVPOINT == tag) { const char *order = attributeValue(attributes, "playOrder"); - myPointStack.push_back(NavPoint((order != 0) ? atoi(order) : myPlayIndex++, myPointStack.size())); + myPointStack.push_back(NavPoint(order != 0 ? std::atoi(order) : myPlayIndex++, myPointStack.size())); myReadState = READ_POINT; } break; case READ_POINT: if (TAG_NAVPOINT == tag) { const char *order = attributeValue(attributes, "playOrder"); - myPointStack.push_back(NavPoint((order != 0) ? atoi(order) : myPlayIndex++, myPointStack.size())); + myPointStack.push_back(NavPoint(order != 0 ? std::atoi(order) : myPlayIndex++, myPointStack.size())); } else if (TAG_NAVLABEL == tag) { myReadState = READ_LABEL; } else if (TAG_CONTENT == tag) { diff --git a/jni/NativeFormats/fbreader/src/formats/rtf/RtfReader.cpp b/jni/NativeFormats/fbreader/src/formats/rtf/RtfReader.cpp index 71229fb1f..4bca4eb6f 100644 --- a/jni/NativeFormats/fbreader/src/formats/rtf/RtfReader.cpp +++ b/jni/NativeFormats/fbreader/src/formats/rtf/RtfReader.cpp @@ -108,7 +108,7 @@ void RtfDestinationCommand::run(RtfReader &reader, int*) const { void RtfStyleCommand::run(RtfReader &reader, int*) const { if (reader.myState.Destination == RtfReader::DESTINATION_STYLESHEET) { //std::cerr << "Add style index: " << val << "\n"; - + //sprintf(style_attributes[0], "%i", val); } else /*if (myState.Destination == rdsContent)*/ { //std::cerr << "Set style index: " << val << "\n"; @@ -236,7 +236,7 @@ bool RtfReader::parseDocument() { while (ptr != end) { switch (parserState) { case READ_END_OF_FILE: - if (*ptr != '}' && !isspace(*ptr)) { + if (*ptr != '}' && !std::isspace(*ptr)) { return false; } break; @@ -277,19 +277,19 @@ bool RtfReader::parseDocument() { parserState = READ_END_OF_FILE; break; } - + if (myState.Destination != myStateStack.top().Destination) { switchDestination(myState.Destination, false); switchDestination(myStateStack.top().Destination, true); } - + bool oldItalic = myState.Italic; bool oldBold = myState.Bold; bool oldUnderlined = myState.Underlined; ZLTextAlignmentType oldAlignment = myState.Alignment; myState = myStateStack.top(); myStateStack.pop(); - + if (myState.Italic != oldItalic) { setFontProperty(RtfReader::FONT_ITALIC); } @@ -302,7 +302,7 @@ bool RtfReader::parseDocument() { if (myState.Alignment != oldAlignment) { setAlignment(); } - + break; } case '\\': @@ -332,7 +332,7 @@ bool RtfReader::parseDocument() { case READ_HEX_SYMBOL: hexString += *ptr; if (hexString.size() == 2) { - char ch = strtol(hexString.c_str(), 0, 16); + char ch = std::strtol(hexString.c_str(), 0, 16); hexString.erase(); processCharData(&ch, 1); parserState = READ_NORMAL_DATA; @@ -340,7 +340,7 @@ bool RtfReader::parseDocument() { } break; case READ_KEYWORD: - if (!isalpha(*ptr)) { + if (!std::isalpha(*ptr)) { if (ptr == dataStart && keyword.empty()) { if (*ptr == '\'') { parserState = READ_HEX_SYMBOL; @@ -352,7 +352,7 @@ bool RtfReader::parseDocument() { dataStart = ptr + 1; } else { keyword.append(dataStart, ptr - dataStart); - if (*ptr == '-' || isdigit(*ptr)) { + if (*ptr == '-' || std::isdigit(*ptr)) { dataStart = ptr; parserState = READ_KEYWORD_PARAMETER; } else { @@ -365,9 +365,9 @@ bool RtfReader::parseDocument() { } break; case READ_KEYWORD_PARAMETER: - if (!isdigit(*ptr)) { + if (!std::isdigit(*ptr)) { parameterString.append(dataStart, ptr - dataStart); - int parameter = atoi(parameterString.c_str()); + int parameter = std::atoi(parameterString.c_str()); parameterString.erase(); readNextChar = *ptr == ' '; if (keyword == "bin" && parameter > 0) { @@ -407,7 +407,7 @@ bool RtfReader::parseDocument() { } } } - + return myIsInterrupted || myStateStack.empty(); } @@ -419,7 +419,7 @@ void RtfReader::processKeyword(const std::string &keyword, int *parameter) { } std::map::const_iterator it = ourKeywordMap.find(keyword); - + if (it == ourKeywordMap.end()) { if (wasSpecialMode) { myState.Destination = RtfReader::DESTINATION_SKIP; @@ -456,7 +456,7 @@ bool RtfReader::readDocument(const ZLFile &file) { fillKeywordMap(); myStreamBuffer = new char[rtfStreamBufferSize]; - + myIsInterrupted = false; mySpecialMode = false; @@ -473,9 +473,9 @@ bool RtfReader::readDocument(const ZLFile &file) { while (!myStateStack.empty()) { myStateStack.pop(); } - + delete[] myStreamBuffer; myStream->close(); - + return code; } diff --git a/jni/NativeFormats/fbreader/src/formats/txt/PlainTextFormat.cpp b/jni/NativeFormats/fbreader/src/formats/txt/PlainTextFormat.cpp index d00a522f6..9b392f217 100644 --- a/jni/NativeFormats/fbreader/src/formats/txt/PlainTextFormat.cpp +++ b/jni/NativeFormats/fbreader/src/formats/txt/PlainTextFormat.cpp @@ -133,7 +133,7 @@ void PlainTextFormatDetector::detect(ZLInputStream &stream, PlainTextFormat &for currentLineIndent = 0; } else if (*ptr == '\r') { continue; - } else if (isspace((unsigned char)*ptr)) { + } else if (std::isspace((unsigned char)*ptr)) { if (currentLineIsEmpty) { ++currentLineIndent; } diff --git a/jni/NativeFormats/fbreader/src/formats/txt/TxtBookReader.cpp b/jni/NativeFormats/fbreader/src/formats/txt/TxtBookReader.cpp index fd205982e..42ca06b95 100644 --- a/jni/NativeFormats/fbreader/src/formats/txt/TxtBookReader.cpp +++ b/jni/NativeFormats/fbreader/src/formats/txt/TxtBookReader.cpp @@ -39,7 +39,7 @@ bool TxtBookReader::characterDataHandler(std::string &str) { const char *ptr = str.data(); const char *end = ptr + str.length(); for (; ptr != end; ++ptr) { - if (isspace((unsigned char)*ptr)) { + if (std::isspace((unsigned char)*ptr)) { if (*ptr != '\t') { ++mySpaceCounter; } else { diff --git a/jni/NativeFormats/fbreader/src/formats/util/MiscUtil.cpp b/jni/NativeFormats/fbreader/src/formats/util/MiscUtil.cpp index c6e9b1079..a9f61fcf8 100644 --- a/jni/NativeFormats/fbreader/src/formats/util/MiscUtil.cpp +++ b/jni/NativeFormats/fbreader/src/formats/util/MiscUtil.cpp @@ -81,7 +81,7 @@ std::string MiscUtil::decodeHtmlURL(const std::string &encoded) { if ((encoded[i] == '%') && (i < len - 2)) { buffer[0] = *(encoded.data() + i + 1); buffer[1] = *(encoded.data() + i + 2); - decoded += (char)strtol(buffer, 0, 16); + decoded += (char)std::strtol(buffer, 0, 16); i += 2; } else { decoded += encoded[i];