diff --git a/code/nel/include/nel/misc/diff_tool.h b/code/nel/include/nel/misc/diff_tool.h index 75a3f181b..e122137cf 100644 --- a/code/nel/include/nel/misc/diff_tool.h +++ b/code/nel/include/nel/misc/diff_tool.h @@ -21,7 +21,7 @@ namespace STRING_MANAGER { - const ucstring nl("\r\n"); + const ucstring nl("\n"); struct TStringInfo diff --git a/code/nel/include/nel/misc/i18n.h b/code/nel/include/nel/misc/i18n.h index 5f270a490..a24596911 100644 --- a/code/nel/include/nel/misc/i18n.h +++ b/code/nel/include/nel/misc/i18n.h @@ -162,11 +162,8 @@ public: * EF,BB, BF. * 16 bits encoding can be recognized by the official header : * FF, FE, witch can be reversed if the data are MSB first. - * - * Optionally, you can force the reader to consider the file as - * UTF-8 encoded. */ - static void readTextBuffer(uint8 *buffer, uint size, ucstring &result, bool forceUtf8 = false); + static void readTextBuffer(uint8 *buffer, uint size, ucstring &result); /** Remove any C style comment from the passed string. */ diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp b/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp index e4a531b9b..f33667082 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp @@ -153,9 +153,9 @@ bool CCocoaEventEmitter::pasteTextFromClipboard(ucstring &text) NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; NSArray *classArray = [NSArray arrayWithObject:[NSString class]]; NSDictionary *options = [NSDictionary dictionary]; - + BOOL ok = [pasteboard canReadObjectForClasses:classArray options:options]; - if (ok) + if (ok) { NSArray *objectsToPaste = [pasteboard readObjectsForClasses:classArray options:options]; NSString *nstext = [objectsToPaste objectAtIndex:0]; @@ -264,8 +264,8 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server) mousePos.y /= (float)viewRect.size.height; // if the mouse event was placed outside the view, don't tell NeL :) - if((mousePos.x < 0.0 || mousePos.x > 1.0 || - mousePos.y < 0.0 || mousePos.y > 1.0) && + if((mousePos.x < 0.0 || mousePos.x > 1.0 || + mousePos.y < 0.0 || mousePos.y > 1.0) && event.type != NSKeyDown && event.type != NSKeyUp) { return false; @@ -415,7 +415,7 @@ typedef bool (*cocoaProc)(NL3D::IDriver*, const void* e); void CCocoaEventEmitter::submitEvents(CEventServer& server, bool /* allWins */) { - // break if there was no event to handle + // break if there was no event to handle // if running embedded in e.g. qt, _eventLoop will be false while(_eventLoop) { @@ -442,8 +442,15 @@ void CCocoaEventEmitter::submitEvents(CEventServer& server, bool /* allWins */) processMessage(event, &server); } - // forward the event to the cocoa application - [NSApp sendEvent:event]; + @try + { + // forward the event to the cocoa application + [NSApp sendEvent:event]; + } + @catch(NSException *e) + { + nlwarning("Exception when sending event: %s", [[e reason] UTF8String]); + } } _server = &server; diff --git a/code/nel/src/3d/font_generator.cpp b/code/nel/src/3d/font_generator.cpp index cdbaf8834..ce8048f15 100644 --- a/code/nel/src/3d/font_generator.cpp +++ b/code/nel/src/3d/font_generator.cpp @@ -457,7 +457,7 @@ CFontGenerator::CFontGenerator (const std::string &fontFileName, const std::stri nlerror ("FT_New_Face() failed with file '%s': %s", fontFileName.c_str(), getFT2Error(error)); } - if (fontExFileName != "") + if (!fontExFileName.empty()) { error = FT_Attach_File (_Face, fontExFileName.c_str ()); if (error) diff --git a/code/nel/src/3d/landscape_user.cpp b/code/nel/src/3d/landscape_user.cpp index d6de7df9e..c2c3a4b27 100644 --- a/code/nel/src/3d/landscape_user.cpp +++ b/code/nel/src/3d/landscape_user.cpp @@ -213,9 +213,9 @@ void CLandscapeUser::refreshAllZonesAround(const CVector &pos, float radius, std refreshZonesAround (pos, radius, za, zr); // some zone added or removed?? - if(za != "") + if(!za.empty()) zonesAdded.push_back(za); - if(zr != "") + if(!zr.empty()) zonesRemoved.push_back(zr); _ZoneManager.checkZonesAround ((uint)pos.x, (uint)(-pos.y), (uint)radius); diff --git a/code/nel/src/3d/scene_group.cpp b/code/nel/src/3d/scene_group.cpp index 5b29709cc..c5f6f24dc 100644 --- a/code/nel/src/3d/scene_group.cpp +++ b/code/nel/src/3d/scene_group.cpp @@ -1121,7 +1121,7 @@ void CInstanceGroup::setClusterSystemForInstances(CInstanceGroup *pIG) void CInstanceGroup::getDynamicPortals (std::vector &names) { for (uint32 i = 0; i < _Portals.size(); ++i) - if (_Portals[i].getName() != "") + if (!_Portals[i].getName().empty()) names.push_back (_Portals[i].getName()); } diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index fa8265876..3ea18a717 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -572,7 +572,7 @@ namespace NLGUI curl_easy_cleanup(it->curl); string tmpfile = it->dest + ".tmp"; - if(res != CURLE_OK || r < 200 || r >= 300 || ((it->md5sum != "") && (it->md5sum != getMD5(tmpfile).toString()))) + if(res != CURLE_OK || r < 200 || r >= 300 || (!it->md5sum.empty() && (it->md5sum != getMD5(tmpfile).toString()))) { NLMISC::CFile::deleteFile(tmpfile.c_str()); } diff --git a/code/nel/src/gui/view_text.cpp b/code/nel/src/gui/view_text.cpp index c88dd8173..a2975fc1a 100644 --- a/code/nel/src/gui/view_text.cpp +++ b/code/nel/src/gui/view_text.cpp @@ -1430,7 +1430,7 @@ namespace NLGUI // Append to the last line _Lines.back()->addWord(ucCurrentWord, 0, wordFormat, _FontWidth, *TextContext); // reset the word - ucCurrentWord = ucstring(""); + ucCurrentWord.clear(); } diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp index bd8dfb5fe..d3888b68c 100644 --- a/code/nel/src/gui/widget_manager.cpp +++ b/code/nel/src/gui/widget_manager.cpp @@ -442,7 +442,7 @@ namespace NLGUI if (sZeStart[sZeStart.size()-1] == ':') sZeStart = sZeStart.substr(0, sZeStart.size()-1); - while (sZeStart != "") + while (!sZeStart.empty()) { if (sEltId[0] == ':') sTmp = sZeStart + sEltId; diff --git a/code/nel/src/misc/diff_tool.cpp b/code/nel/src/misc/diff_tool.cpp index f57746b1a..6c453d14e 100644 --- a/code/nel/src/misc/diff_tool.cpp +++ b/code/nel/src/misc/diff_tool.cpp @@ -117,7 +117,7 @@ bool loadStringFile(const std::string filename, vector &stringInfos */ ucstring text; - CI18N::readTextFile(filename, text, false, false, true, CI18N::LINE_FMT_CRLF); + CI18N::readTextFile(filename, text, false, false, true, CI18N::LINE_FMT_LF); // CI18N::readTextBuffer(buffer, size, text); // delete [] buffer; @@ -154,7 +154,7 @@ bool loadStringFile(const std::string filename, vector &stringInfos if (!CI18N::parseLabel(first, last, si.Identifier)) { uint32 line = countLine(text, first); - nlwarning("DT: Fatal : In '%s', line %u: Invalid label after '%s'\n", + nlwarning("DT: Fatal : In '%s', line %u: Invalid label after '%s'", filename.c_str(), line, lastLabel.c_str()); @@ -167,7 +167,7 @@ bool loadStringFile(const std::string filename, vector &stringInfos if (!CI18N::parseMarkedString(openMark, closeMark, first, last, si.Text)) { uint32 line = countLine(text, first); - nlwarning("DT: Fatal : In '%s', line %u: Invalid text value for label %s\n", + nlwarning("DT: Fatal : In '%s', line %u: Invalid text value for label %s", filename.c_str(), line, lastLabel.c_str()); @@ -181,7 +181,7 @@ bool loadStringFile(const std::string filename, vector &stringInfos if (!CI18N::parseMarkedString(openMark, closeMark, first, last, si.Text2)) { uint32 line = countLine(text, first); - nlwarning("DT: Fatal: In '%s' line %u: Invalid text2 value label %s\n", + nlwarning("DT: Fatal: In '%s' line %u: Invalid text2 value label %s", filename.c_str(), line, lastLabel.c_str()); @@ -313,7 +313,7 @@ bool readPhraseFile(const std::string &filename, vector &phrases, bool { ucstring doc; - CI18N::readTextFile(filename, doc, false, false, true, CI18N::LINE_FMT_CRLF); + CI18N::readTextFile(filename, doc, false, false, true, CI18N::LINE_FMT_LF); return readPhraseFileFromString(doc, filename, phrases, forceRehash); } @@ -577,7 +577,7 @@ ucstring preparePhraseFile(const vector &phrases, bool removeDiffCommen if (!c.Comments.empty()) { ucstring comment = tabLines(1, c.Comments); - ret += comment; // + '\r'+'\n'; + ret += comment; // + '\n'; } if (!c.Conditions.empty()) { @@ -626,7 +626,7 @@ bool loadExcelSheet(const string filename, TWorksheet &worksheet, bool checkUniq fp.close(); ucstring str; - CI18N::readTextFile(filename, str, false, false, false, CI18N::LINE_FMT_CRLF); + CI18N::readTextFile(filename, str, false, false, false, CI18N::LINE_FMT_LF); if (!readExcelSheet(str, worksheet, checkUnique)) return false; @@ -646,6 +646,8 @@ bool readExcelSheet(const ucstring &str, TWorksheet &worksheet, bool checkUnique strArray[strArray.size()-1]= 0; memcpy(&strArray[0], &str[0], str.size()*sizeof(ucchar)); + // size of new line characters + size_t sizeOfNl = nl.length(); // **** Build array of lines. just point to strArray, and fill 0 where appropriated vector lines; @@ -660,10 +662,10 @@ bool readExcelSheet(const ucstring &str, TWorksheet &worksheet, bool checkUnique // nldebug("Found line : [%s]", ucstring(&strArray[lastPos]).toString().c_str()); lines.push_back(&strArray[lastPos]); } - lastPos = pos + 2; + lastPos = pos + sizeOfNl; } - // Must add last line if no \r\n ending + // Must add last line if no \n ending if (lastPos < str.size()) { pos= str.size(); diff --git a/code/nel/src/misc/i18n.cpp b/code/nel/src/misc/i18n.cpp index a170f6d20..b004ef886 100644 --- a/code/nel/src/misc/i18n.cpp +++ b/code/nel/src/misc/i18n.cpp @@ -743,7 +743,7 @@ void CI18N::_readTextFile(const string &filename, // Transform the string in ucstring according to format header if (!text.empty()) - readTextBuffer((uint8*)&text[0], (uint)text.size(), result, forceUtf8); + readTextBuffer((uint8*)&text[0], (uint)text.size(), result); if (preprocess) { @@ -1109,7 +1109,7 @@ void CI18N::_readTextFile(const string &filename, temp.append(result.begin()+lastPos, result.end()); result.swap(temp); - temp = ""; + temp.clear(); // second loop with the '\n' pos = 0; @@ -1137,28 +1137,13 @@ void CI18N::_readTextFile(const string &filename, } } -void CI18N::readTextBuffer(uint8 *buffer, uint size, ucstring &result, bool forceUtf8) +void CI18N::readTextBuffer(uint8 *buffer, uint size, ucstring &result) { static uint8 utf16Header[] = { 0xffu, 0xfeu }; static uint8 utf16RevHeader[] = { 0xfeu, 0xffu }; static uint8 utf8Header[] = { 0xefu, 0xbbu, 0xbfu }; - if (forceUtf8) - { - if (size>=3 && - buffer[0]==utf8Header[0] && - buffer[1]==utf8Header[1] && - buffer[2]==utf8Header[2] - ) - { - // remove utf8 header - buffer+= 3; - size-=3; - } - string text((char*)buffer, size); - result.fromUtf8(text); - } - else if (size>=3 && + if (size>=3 && buffer[0]==utf8Header[0] && buffer[1]==utf8Header[1] && buffer[2]==utf8Header[2] @@ -1211,10 +1196,9 @@ void CI18N::readTextBuffer(uint8 *buffer, uint size, ucstring &result, bool forc } else { - // hum.. ascii read ? - // so, just do a direct conversion + // all text files without BOM are now parsed as UTF-8 by default string text((char*)buffer, size); - result = text; + result.fromUtf8(text); } } diff --git a/code/ryzom/client/src/interface_v3/inventory_manager.cpp b/code/ryzom/client/src/interface_v3/inventory_manager.cpp index f886bc3e9..4f882fd21 100644 --- a/code/ryzom/client/src/interface_v3/inventory_manager.cpp +++ b/code/ryzom/client/src/interface_v3/inventory_manager.cpp @@ -2504,13 +2504,13 @@ class CHandlerInvCanDropTo : public IActionHandler if (pCSDst != NULL) { // If we want to drop something on a reference slot (hand or equip) - if (pInv->getDBIndexPath(pCSDst) != "") + if (!pInv->getDBIndexPath(pCSDst).empty()) { // We must drag'n'drop an item if (pCSSrc && pCSSrc->getType() == CCtrlSheetInfo::SheetType_Item) if (pCSDst && pCSDst->getType() == CCtrlSheetInfo::SheetType_Item) { - if (pInv->getDBIndexPath(pCSSrc) != "") + if (!pInv->getDBIndexPath(pCSSrc).empty()) { // The item dragged comes from a slot check if this is the good type if (pCSDst->canDropItem(pCSSrc)) diff --git a/code/ryzom/client/src/interface_v3/item_consumable_effect.cpp b/code/ryzom/client/src/interface_v3/item_consumable_effect.cpp index 6e50666b1..a91394390 100644 --- a/code/ryzom/client/src/interface_v3/item_consumable_effect.cpp +++ b/code/ryzom/client/src/interface_v3/item_consumable_effect.cpp @@ -52,7 +52,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet * // Extract parameters from sheet vector params; CSString param = eff.splitTo(':', true); - while (param != "") + while (!param.empty()) { params.push_back(param); param = eff.splitTo(':', true); diff --git a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index 714ed7029..fb0d251f5 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -346,13 +346,13 @@ static CLuaString lstr_isNil("isNil"); void CLuaIHMRyzom::createLuaEnumTable(CLuaState &ls, const std::string &str) { //H_AUTO(Lua_CLuaIHM_createLuaEnumTable) - std::string path = "", script, p; + std::string path, script, p; CSString s = str; // Create table recursively (ex: 'game.TPVPClan' will check/create the table 'game' and 'game.TPVPClan') p = s.splitTo('.', true); while (p.size() > 0) { - if (path == "") + if (path.empty()) path = p; else path += "." + p; diff --git a/code/ryzom/client/src/interface_v3/view_bitmap_faber_mp.cpp b/code/ryzom/client/src/interface_v3/view_bitmap_faber_mp.cpp index 212ceebeb..a87e807cc 100644 --- a/code/ryzom/client/src/interface_v3/view_bitmap_faber_mp.cpp +++ b/code/ryzom/client/src/interface_v3/view_bitmap_faber_mp.cpp @@ -128,7 +128,7 @@ void CViewBitmapFaberMp::draw () { CItemSheet *pIS = (CItemSheet*)pES; - if (pIS->getIconBack() != "") + if (!pIS->getIconBack().empty()) { if (_AccIconBackString != pIS->getIconBack()) { @@ -140,7 +140,7 @@ void CViewBitmapFaberMp::draw () _AccIconBackId); } - if (pIS->getIconMain() != "") + if (!pIS->getIconMain().empty()) { if (_AccIconMainString != pIS->getIconMain()) { @@ -152,7 +152,7 @@ void CViewBitmapFaberMp::draw () _AccIconMainId); } - if (pIS->getIconOver() != "") + if (!pIS->getIconOver().empty()) { if (_AccIconOverString != pIS->getIconOver()) { diff --git a/code/ryzom/client/src/net_manager.cpp b/code/ryzom/client/src/net_manager.cpp index 0e9f09747..b949263e7 100644 --- a/code/ryzom/client/src/net_manager.cpp +++ b/code/ryzom/client/src/net_manager.cpp @@ -507,7 +507,7 @@ void impulseShardId(NLMISC::CBitMemStream &impulse) string webHost; impulse.serial(webHost); - if (webHost != "") + if (!webHost.empty()) { WebServer = webHost; } diff --git a/code/ryzom/client/src/r2/dmc/property_accessor.cpp b/code/ryzom/client/src/r2/dmc/property_accessor.cpp index d8f7a1290..2db78ad14 100644 --- a/code/ryzom/client/src/r2/dmc/property_accessor.cpp +++ b/code/ryzom/client/src/r2/dmc/property_accessor.cpp @@ -125,7 +125,7 @@ const CObject *CPropertyAccessor::getPropertyValue(const CObject* componentParam std::string str = propClass->toString(); - while (!toRet && str != "") + while (!toRet && !str.empty()) { CObjectGenerator* generator = _Factory->getGenerator(str); diff --git a/code/ryzom/client/src/rosace.cpp b/code/ryzom/client/src/rosace.cpp index 6711d19ad..71e41929b 100644 --- a/code/ryzom/client/src/rosace.cpp +++ b/code/ryzom/client/src/rosace.cpp @@ -503,7 +503,7 @@ void CRosace::init() void CRosace::add(const string &name, const CRosaceContext &context) { // If the name is not empty. - if(name != "") + if(!name.empty()) _Contexts.insert(TContexts::value_type (name, context)); }// add // diff --git a/code/ryzom/common/src/game_share/object.cpp b/code/ryzom/common/src/game_share/object.cpp index 45e1a549e..dddb6b270 100644 --- a/code/ryzom/common/src/game_share/object.cpp +++ b/code/ryzom/common/src/game_share/object.cpp @@ -647,7 +647,7 @@ bool CObjectString::set(const std::string& key, const std::string & value) { //H_AUTO(R2_CObjectString_set) - BOMB_IF( key != "", "Try to set the a sub value of an object that does not allowed it", return false); + BOMB_IF(!key.empty(), "Try to set the a sub value of an object that does not allowed it", return false); _Value = value; return true; } @@ -808,7 +808,7 @@ bool CObjectNumber::set(const std::string& key, double value) { //H_AUTO(R2_CObjectNumber_set) - BOMB_IF(key != "", "Try to set an element of a table on an object that is not a table", return false); + BOMB_IF(!key.empty(), "Try to set an element of a table on an object that is not a table", return false); _Value = value; return true; @@ -819,7 +819,7 @@ bool CObjectNumber::set(const std::string& key, const std::string & value) { //H_AUTO(R2_CObjectNumber_set) //XXX - BOMB_IF(key != "", "Try to set an element of a table on an object that is not a table", return false); + BOMB_IF(!key.empty(), "Try to set an element of a table on an object that is not a table", return false); NLMISC::fromString(value, _Value); return true; } @@ -907,7 +907,7 @@ bool CObjectInteger::set(const std::string& key, sint64 value) { //H_AUTO(R2_CObjectInteger_set) - BOMB_IF(key != "", "Try to set an element of a table on an object that is not a table", return false); + BOMB_IF(!key.empty(), "Try to set an element of a table on an object that is not a table", return false); _Value = value; return true; @@ -918,7 +918,7 @@ bool CObjectInteger::set(const std::string& key, const std::string & value) { //H_AUTO(R2_CObjectInteger_set) //XXX - BOMB_IF(key != "", "Try to set an element of a table on an object that is not a table", return false); + BOMB_IF(!key.empty(), "Try to set an element of a table on an object that is not a table", return false); NLMISC::fromString(value, _Value); return true; } diff --git a/code/ryzom/common/src/game_share/server_edition_module.cpp b/code/ryzom/common/src/game_share/server_edition_module.cpp index 486391487..924f23497 100644 --- a/code/ryzom/common/src/game_share/server_edition_module.cpp +++ b/code/ryzom/common/src/game_share/server_edition_module.cpp @@ -2813,7 +2813,7 @@ void CServerEditionModule::createSession(NLNET::IModuleProxy *sender, TCharId ow else if (first->first == "Rules" ) { info.setDMLess( first->second != "Mastered"); } else if (first->first == "NevraxScenario" && first->second == "1") { nevraxScenario = true; } else if (first->first == "TrialAllowed" && first->second == "1") { trialAllowed = true; } - else if (first->first == "MissionTag" && first->second != "") { missionTag = first->second; } + else if (first->first == "MissionTag" && !first->second.empty()) { missionTag = first->second; } } // info.setMissionTag(missionTag); info.setSessionAnimatorCharId( ownerCharId); @@ -3863,7 +3863,7 @@ void CServerEditionModule::startScenario(NLNET::IModuleProxy *senderModuleProxy, else if (first->first == "Rules" ) { info.setDMLess( first->second != "Mastered"); } else if (first->first == "NevraxScenario" && first->second == "1") { nevraxScenario = true; } else if (first->first == "TrialAllowed" && first->second == "1") { trialAllowed = true; } - else if (first->first == "MissionTag" && first->second != "") { missionTag = first->second; } + else if (first->first == "MissionTag" && !first->second.empty()) { missionTag = first->second; } } info.setSessionAnimatorCharId( charId); diff --git a/code/ryzom/common/src/game_share/string_mgr_module.cpp b/code/ryzom/common/src/game_share/string_mgr_module.cpp index e28fc0c8c..df74f35d1 100644 --- a/code/ryzom/common/src/game_share/string_mgr_module.cpp +++ b/code/ryzom/common/src/game_share/string_mgr_module.cpp @@ -479,14 +479,14 @@ void CStringManagerModule::translateAndForwardWithArg(TDataSetRow senderId,CChat void CStringManagerModule::translateAndForward(TDataSetRow senderId,CChatGroup::TGroupType groupType,std::string id,TSessionId sessionId) { std::string toSend = getValue(sessionId.asInt(), id); - if(toSend != "") + if(!toSend.empty()) send(senderId,groupType,toSend); } void CStringManagerModule::send(TDataSetRow& senderId,CChatGroup::TGroupType groupType,const std::string& toSend) { - if(toSend != "") + if(!toSend.empty()) { ucstring uStr; uStr.fromUtf8(toSend); diff --git a/code/ryzom/server/src/ai_data_service/pacs_scan.cpp b/code/ryzom/server/src/ai_data_service/pacs_scan.cpp index b99009bed..796ce7b78 100644 --- a/code/ryzom/server/src/ai_data_service/pacs_scan.cpp +++ b/code/ryzom/server/src/ai_data_service/pacs_scan.cpp @@ -2071,7 +2071,7 @@ public: _WorldMap.clear(); string ext = CFile::getExtension(name); - if (ext == "") + if (ext.empty()) ext = "cwmap2"; CIFile f(OutputPath+CFile::getFilenameWithoutExtension(name)+"."+ext); f.serial(_WorldMap); @@ -2213,7 +2213,7 @@ public: _WorldMap.clear(); string ext = CFile::getExtension(name); - if (ext == "") + if (ext.empty()) ext = "cw_map2"; CIFile f(CFile::getPath(name) + CFile::getFilenameWithoutExtension(name)+"."+ext); diff --git a/code/ryzom/tools/client/client_config_qt/src/config.cpp b/code/ryzom/tools/client/client_config_qt/src/config.cpp index 15cd4fb9d..93e672845 100644 --- a/code/ryzom/tools/client/client_config_qt/src/config.cpp +++ b/code/ryzom/tools/client/client_config_qt/src/config.cpp @@ -288,6 +288,8 @@ void CConfig::setString( const char *key, const std::string &value ) } else { - nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() ); + NLMISC::CConfigFile::CVar var; + var.forceAsString(value); + cf.insertVar(key, var); } } diff --git a/code/ryzom/tools/client/client_config_qt/src/sound_settings_widget.cpp b/code/ryzom/tools/client/client_config_qt/src/sound_settings_widget.cpp index b820a696f..49348d38b 100644 --- a/code/ryzom/tools/client/client_config_qt/src/sound_settings_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/src/sound_settings_widget.cpp @@ -25,11 +25,16 @@ CSoundSettingsWidget::CSoundSettingsWidget( QWidget *parent ) : setupUi( this ); load(); + connect(autoRadioButton, SIGNAL(clicked(bool)), this, SLOT(onSomethingChanged())); + connect(openalRadioButton, SIGNAL(clicked(bool)), this, SLOT(onSomethingChanged())); + connect(fmodRadioButton, SIGNAL(clicked(bool)), this, SLOT(onSomethingChanged())); + connect(xaudio2RadioButton, SIGNAL(clicked(bool)), this, SLOT(onSomethingChanged())); + connect(directsoundRadioButton, SIGNAL(clicked(bool)), this, SLOT(onSomethingChanged())); + connect( tracksSlider, SIGNAL( valueChanged( int ) ), this, SLOT( onTracksSliderChange() ) ); connect( soundCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); connect( eaxCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); connect( softwareCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); - connect( fmodCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); } CSoundSettingsWidget::~CSoundSettingsWidget() @@ -64,8 +69,38 @@ void CSoundSettingsWidget::load() updateTracksLabel(); - if( s.config.getString( "DriverSound" ).compare( "FMod" ) == 0 ) - fmodCheckBox->setChecked( true ); + std::string soundDriver = NLMISC::toLower(s.config.getString("DriverSound")); + +#ifdef Q_OS_WIN32 + fmodRadioButton->setEnabled(true); + xaudio2RadioButton->setEnabled(true); + directsoundRadioButton->setEnabled(true); +#else + fmodRadioButton->setEnabled(false); + xaudio2RadioButton->setEnabled(false); + directsoundRadioButton->setEnabled(false); +#endif + + if (soundDriver.compare("openal") == 0) + { + openalRadioButton->setChecked(true); + } + else if (soundDriver.compare("fmod") == 0) + { + fmodRadioButton->setChecked(true); + } + else if (soundDriver.compare("xaudio2") == 0) + { + xaudio2RadioButton->setChecked(true); + } + else if (soundDriver.compare("directsound") == 0) + { + directsoundRadioButton->setChecked(true); + } + else + { + autoRadioButton->setChecked(true); + } } void CSoundSettingsWidget::save() @@ -83,8 +118,18 @@ void CSoundSettingsWidget::save() s.config.setInt( "MaxTrack", tracksSlider->value() * 4 ); - if( fmodCheckBox->isChecked() ) - s.config.setString( "DriverSound", std::string( "FMod" ) ); + if (openalRadioButton->isChecked()) + s.config.setString("DriverSound", std::string("OpenAL")); +#ifdef Q_OS_WIN32 + else if (fmodRadioButton->isChecked()) + s.config.setString("DriverSound", std::string("FMod")); + else if (xaudio2RadioButton->isChecked()) + s.config.setString("DriverSound", std::string("XAudio2")); + else if (directsoundRadioButton->isChecked()) + s.config.setString("DriverSound", std::string("DirectSound")); +#endif + else + s.config.setString("DriverSound", std::string("Auto")); } void CSoundSettingsWidget::updateTracksLabel() diff --git a/code/ryzom/tools/client/client_config_qt/ui/display_settings_widget.ui b/code/ryzom/tools/client/client_config_qt/ui/display_settings_widget.ui index 2cf1176e8..f5b5c2e48 100644 --- a/code/ryzom/tools/client/client_config_qt/ui/display_settings_widget.ui +++ b/code/ryzom/tools/client/client_config_qt/ui/display_settings_widget.ui @@ -7,62 +7,58 @@ 0 0 391 - 429 + 388 Display - - + + Driver - - - - - - - Specify if Ryzom is to be run in OpenGL or Direct3D: - - - - - - - Auto - - - - - - - OpenGL - - - - - - - Direct3D - - - - + + + + + Specify if Ryzom is to be run in OpenGL or Direct3D: + + + + + + + Auto + + + + + + + OpenGL + + + + + + + Direct3D + + - + Parameters - + - + Specify if Ryzom is to be run in full screen or window mode: @@ -76,7 +72,7 @@ - + Specify a video mode: @@ -85,19 +81,6 @@ - - - - Qt::Vertical - - - - 20 - 34 - - - - @@ -106,54 +89,46 @@ - - - - - - - Width - - - - - - - Height - - - - - - - X position - - - - - - - Y position - - - - + + + + + Width + + - - - - - - - - - - - - - - - + + + + + + + Height + + + + + + + + + + X position + + + + + + + + + + Y position + + + + + diff --git a/code/ryzom/tools/client/client_config_qt/ui/sound_settings_widget.ui b/code/ryzom/tools/client/client_config_qt/ui/sound_settings_widget.ui index dc973292a..37a9b0b92 100644 --- a/code/ryzom/tools/client/client_config_qt/ui/sound_settings_widget.ui +++ b/code/ryzom/tools/client/client_config_qt/ui/sound_settings_widget.ui @@ -6,147 +6,140 @@ 0 0 - 391 - 429 + 294 + 317 Sound - - - - - - - - - Enable sound - - - - - - - Enable EAX - - - - - - - Enable FMod - - - - - - - Software sound buffer (may increase FPS) - - - - - - - Qt::Vertical - - - QSizePolicy::Maximum - - - - 20 - 13 - - - - - - - - Sound tracks - - - - - - - - - Qt::Vertical - - - QSizePolicy::Maximum - - - - 20 - 18 - - - - - - - - - - 1 - - - 8 - - - 1 - - - 4 - - - 1 - - - Qt::Horizontal - - - - - - - 8 tracks - - - - - - + + + + + Driver + + + + + + Auto + + + + + + + OpenAL + + + + + + + FMod + + + + + + + XAudio2 + + + + + + + DirectSound + + + + + - - - - Qt::Horizontal + + + + Parameters - - - 180 - 20 - - - - - - - - Qt::Vertical - - - - 20 - 223 - - - + + + + + Enable sound + + + + + + + Enable EAX + + + + + + + Software sound buffer (may increase FPS) + + + + + + + Sound tracks + + + + + + + + + 1 + + + 8 + + + 1 + + + 4 + + + 1 + + + Qt::Horizontal + + + + + + + 8 tracks + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + diff --git a/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp b/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp index cd0e4581c..db8481453 100644 --- a/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp +++ b/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp @@ -1158,7 +1158,7 @@ void CScreenshotIslands::loadIslands() TBuffer cleanBuffer; processProximityBuffer(zoneBuffer, zones[i].getZoneWidth(), cleanBuffer); - string fileName = string(""); + string fileName; list< string >::const_iterator itIsland(continent.Islands.begin()), lastIsland(continent.Islands.end()); for( ; itIsland != lastIsland ; ++itIsland) { @@ -1178,7 +1178,7 @@ void CScreenshotIslands::loadIslands() } // write the processed proximity map to an output file - if(fileName != "") + if(!fileName.empty()) { writeProximityBufferToTgaFile(fileName, cleanBuffer, zones[i].getZoneWidth(), zones[i].getZoneHeight()); _TempFileNames.push_back(fileName); diff --git a/code/ryzom/tools/leveldesign/csv_transform/csv_transform.cpp b/code/ryzom/tools/leveldesign/csv_transform/csv_transform.cpp index f94890f04..941db4100 100644 --- a/code/ryzom/tools/leveldesign/csv_transform/csv_transform.cpp +++ b/code/ryzom/tools/leveldesign/csv_transform/csv_transform.cpp @@ -167,7 +167,7 @@ public: //--------------------------------------------------------------------------------------------- // housekeeping - if (outputName!="") + if (!outputName.empty()) flush(outputName); } @@ -258,7 +258,7 @@ private: if (i>=cols.size() || i>=lastTblCols.size() || cols[i]!=lastTblCols[i] - || (cols[i]!="" && !headerIsOpen[tblColumnNames[i]])) + || (!cols[i].empty() && !headerIsOpen[tblColumnNames[i]])) { CSString s=headers[tblColumnNames[i]]; for (uint32 j=1;jOutIGDir == "") + if (_Options->OutIGDir.empty()) _OutIGDir = CTools::normalizePath (ContinentCFG.OutIGDir); else _OutIGDir = CTools::normalizePath (_Options->OutIGDir); - if (_Options->LandFile == "") + if (_Options->LandFile.empty()) _LandFile = ContinentCFG.LandFile; else _LandFile = _Options->LandFile; - if (_Options->DfnDir == "") + if (_Options->DfnDir.empty()) _DfnDir = ContinentCFG.DfnDir; else _DfnDir = _Options->DfnDir; - if (_Options->GameElemDir == "") + if (_Options->GameElemDir.empty()) _GameElemDir = ContinentCFG.GameElemDir; else _GameElemDir = _Options->GameElemDir; - if (_Options->InLandscapeDir == "") + if (_Options->InLandscapeDir.empty()) _InLandscapeDir = ContinentCFG.LandZoneWDir; // Directory where to get .zonew files else _InLandscapeDir = _Options->InLandscapeDir; - if (_Options->LandFarBankFile == "") + if (_Options->LandFarBankFile.empty()) _LandBankFile = ContinentCFG.LandBankFile; // The .smallbank file associated with the landscape else _LandBankFile = _Options->LandBankFile; - if (_Options->LandFarBankFile == "") + if (_Options->LandFarBankFile.empty()) _LandFarBankFile = ContinentCFG.LandFarBankFile; // The .farbank file else _LandFarBankFile = _Options->LandFarBankFile; - if (_Options->LandTileNoiseDir == "") + if (_Options->LandTileNoiseDir.empty()) _LandTileNoiseDir = ContinentCFG.LandTileNoiseDir; // Directory where to get displacement map else _LandTileNoiseDir = _Options->LandTileNoiseDir; diff --git a/code/ryzom/tools/leveldesign/export/tools.cpp b/code/ryzom/tools/leveldesign/export/tools.cpp index 742359840..5c1e1d9b3 100644 --- a/code/ryzom/tools/leveldesign/export/tools.cpp +++ b/code/ryzom/tools/leveldesign/export/tools.cpp @@ -27,7 +27,7 @@ using namespace NLMISC; // --------------------------------------------------------------------------- void CTools::mkdir (const string &dirName) { - if (dirName == "") + if (dirName.empty()) return; // Does the directory exist ? string newDir = pwd(); @@ -38,7 +38,7 @@ void CTools::mkdir (const string &dirName) } SetCurrentDirectory (newDir.c_str()); // Create upper levels - newDir = ""; + newDir.clear(); string::size_type pos = dirName.rfind('\\'); if (pos != string::npos) { diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/variables.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/variables.cpp index bf405ab5c..f27f2a974 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/variables.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/variables.cpp @@ -80,7 +80,7 @@ public: return getNpcFullName(); else if (subPart == "function") return _NpcFunction; - else if (subPart == "") + else if (subPart.empty()) return _NpcLabel; throw EParseException(NULL, toString("var_npc don't have a subpart '%s'", subPart.c_str()).c_str()); @@ -137,7 +137,7 @@ public: string evalVar(const string &subPart) { - if (subPart == "") + if (subPart.empty()) return string("\"")+_NpcLabel+"\""; throw EParseException(NULL, toString("var_npc_name don't have a subpart '%s'", subPart.c_str()).c_str()); diff --git a/code/ryzom/tools/leveldesign/mp_generator/main.cpp b/code/ryzom/tools/leveldesign/mp_generator/main.cpp index 1766a3b3b..eed001ac7 100644 --- a/code/ryzom/tools/leveldesign/mp_generator/main.cpp +++ b/code/ryzom/tools/leveldesign/mp_generator/main.cpp @@ -1069,7 +1069,7 @@ void GenerateSpecialItem( int numMP, const CSString& nomMP, const MPCraftStats& void parseSpecialAttributes(const CSString &specialAttributes, MPCraftStats &craftStats, CExtraInfo &extraInfo) { // evaluate DropOrSell according to CraftStats: can DropOrSell if it is a MP Craft - extraInfo.DropOrSell= craftStats.Craft != ""; + extraInfo.DropOrSell= !craftStats.Craft.empty(); // parse attributes vector strArray; diff --git a/code/ryzom/tools/leveldesign/named_items_2_csv/named_items_2_csv.cpp b/code/ryzom/tools/leveldesign/named_items_2_csv/named_items_2_csv.cpp index f2fa783dc..d34e30c5a 100644 --- a/code/ryzom/tools/leveldesign/named_items_2_csv/named_items_2_csv.cpp +++ b/code/ryzom/tools/leveldesign/named_items_2_csv/named_items_2_csv.cpp @@ -254,7 +254,8 @@ int importCsv(const char *filename) do { fields.push_back(s.splitTo(';', true)); - } while (s != ""); + } + while (!s.empty()); } // read values for each item @@ -278,7 +279,8 @@ int importCsv(const char *filename) { val = s.splitTo(';', true); items[n].push_back(val); - } while (s != ""); + } + while (!s.empty()); } fclose(f); @@ -376,7 +378,7 @@ void updateItemField(CVectorSString &lines, uint itemIndex, uint fieldIndex, uin if (pos == string::npos) continue; - if (val != "") + if (!val.empty()) { // check if the attribute is the right one and not included in another one // for example: Protection is in ProtectionFactor @@ -507,7 +509,7 @@ int main(int argc, char *argv[]) } // create a .csv file - if (scriptFile != "") + if (!scriptFile.empty()) { if (CFile::getFilename(scriptFile) == scriptFile) scriptFile = curDir + scriptFile; @@ -545,7 +547,7 @@ int main(int argc, char *argv[]) } // create a .txt file - if (csvFile != "") + if (!csvFile.empty()) { if (CFile::getFilename(csvFile) == csvFile) csvFile = curDir + csvFile; diff --git a/code/ryzom/tools/leveldesign/world_editor/land_export_lib/export.cpp b/code/ryzom/tools/leveldesign/world_editor/land_export_lib/export.cpp index 279578293..7b47bb88b 100644 --- a/code/ryzom/tools/leveldesign/world_editor/land_export_lib/export.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/land_export_lib/export.cpp @@ -205,7 +205,7 @@ bool CExport::export_ (SExportOptions &options, IExportCB *expCB) if (_ExportCB != NULL) _ExportCB->dispPass ("Loading height map"); _HeightMap = NULL; - if (_Options->HeightMapFile != "") + if (!_Options->HeightMapFile.empty()) { _HeightMap = new CBitmap; try @@ -236,7 +236,7 @@ bool CExport::export_ (SExportOptions &options, IExportCB *expCB) if (_ExportCB != NULL) _ExportCB->dispPass ("Loading height map"); _HeightMap2 = NULL; - if (_Options->HeightMapFile2 != "") + if (!_Options->HeightMapFile2.empty()) { _HeightMap2 = new CBitmap; try @@ -267,7 +267,7 @@ bool CExport::export_ (SExportOptions &options, IExportCB *expCB) if (_ExportCB != NULL) _ExportCB->dispPass ("Loading color map"); _ColorMap = NULL; - if (_Options->ColorMapFile != "") + if (!_Options->ColorMapFile.empty()) { _ColorMap = new CBitmap; try @@ -314,12 +314,12 @@ bool CExport::export_ (SExportOptions &options, IExportCB *expCB) try { // Add zone files - if (_Options->OutZoneDir != "") + if (!_Options->OutZoneDir.empty()) NLMISC::CPath::getPathContent(_Options->OutZoneDir, true, false, true, allFiles); // Add ig files vector allOtherFiles; - if (_Options->OutIGDir != "") + if (!_Options->OutIGDir.empty()) NLMISC::CPath::getPathContent(_Options->OutIGDir, true, false, true, allOtherFiles); allFiles.insert(allFiles.end(), allOtherFiles.begin(), allOtherFiles.end()); } @@ -386,7 +386,7 @@ bool CExport::export_ (SExportOptions &options, IExportCB *expCB) _ZoneMaxX = nMaxX; _ZoneMaxY = nMaxY; - if ((_Options->ZoneMin != "") && (_Options->ZoneMax != "")) + if (!_Options->ZoneMin.empty() && !_Options->ZoneMax.empty()) { _Options->ZoneMin = strupr (_Options->ZoneMin); _Options->ZoneMax = strupr (_Options->ZoneMax); diff --git a/code/ryzom/tools/pd_parser/main.cpp b/code/ryzom/tools/pd_parser/main.cpp index d181e0c45..bbd9cc8bc 100644 --- a/code/ryzom/tools/pd_parser/main.cpp +++ b/code/ryzom/tools/pd_parser/main.cpp @@ -51,7 +51,7 @@ int main(int argc, char **argv) } } - if (inputfile == "") + if (inputfile.empty()) { nlwarning("Error: missing input file(s)"); exit(EXIT_FAILURE); diff --git a/code/ryzom/tools/pd_parser/parse_node.h b/code/ryzom/tools/pd_parser/parse_node.h index ad2b6a8f2..9a4371234 100644 --- a/code/ryzom/tools/pd_parser/parse_node.h +++ b/code/ryzom/tools/pd_parser/parse_node.h @@ -735,7 +735,7 @@ public: return UserCodes[i].UserCode; // then look for a default code for (i=0; i &phrases, bool { ucstring doc; - CI18N::readTextFile(filename, doc, false, false, false, CI18N::LINE_FMT_CRLF); + CI18N::readTextFile(filename, doc, false, false, false, CI18N::LINE_FMT_LF); verifyVersion(doc, 1); return readPhraseFileFromString(doc, filename, phrases, forceRehash); } @@ -199,7 +199,7 @@ bool readPhraseFile2(const std::string &filename, vector &phrases, bool { ucstring doc; - CI18N::readTextFile(filename, doc, false, false, false, CI18N::LINE_FMT_CRLF); + CI18N::readTextFile(filename, doc, false, false, false, CI18N::LINE_FMT_LF); verifyVersion(doc, 2); return readPhraseFileFromString(doc, filename, phrases, forceRehash); } @@ -352,7 +352,7 @@ bool mergeStringDiff(vector &strings, const string &language, const { // Check if the diff is translated ucstring text; - CI18N::readTextFile(diffs[i], text, false, false, false, CI18N::LINE_FMT_CRLF); + CI18N::readTextFile(diffs[i], text, false, false, false, CI18N::LINE_FMT_LF); if (text.find(ucstring("DIFF NOT TRANSLATED")) != ucstring::npos) { LOG("Diff file [%s] is not translated, merging it later.\n", CFile::getFilename(diffs[i]).c_str()); @@ -679,7 +679,7 @@ void cleanComment(const std::string & filename) ucstring text; uint nbOldValue=0; - CI18N::readTextFile(filename, text, false, false, false, CI18N::LINE_FMT_CRLF); + CI18N::readTextFile(filename, text, false, false, false, CI18N::LINE_FMT_LF); ucstring newText; ucstring::size_type last = 0; @@ -703,7 +703,7 @@ void cleanComment(const std::string & filename) } } text = newText; - newText = ucstring(""); + newText.clear(); last = 0; while ( last != ucstring::npos) { @@ -800,7 +800,7 @@ int mergeStringDiff(int argc, char *argv[]) { // backup the original file ucstring old; - CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_CRLF); + CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_LF); if (old != str) CFile::moveFile(historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename), filename); } @@ -840,7 +840,7 @@ bool mergePhraseDiff(vector &phrases, const string &language, bool only { // Check if the diff is translated ucstring text; - CI18N::readTextFile(diffs[i], text, false, false, false, CI18N::LINE_FMT_CRLF); + CI18N::readTextFile(diffs[i], text, false, false, false, CI18N::LINE_FMT_LF); verifyVersion(text, 1); if (text.find(ucstring("DIFF NOT TRANSLATED")) != ucstring::npos) { @@ -1164,7 +1164,7 @@ int mergePhraseDiff(int argc, char *argv[], int version) { // backup the original file ucstring old; - CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_CRLF); + CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_LF); if (old != str) CFile::moveFile(historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename), filename); } @@ -1333,7 +1333,7 @@ int mergeClauseDiff(int argc, char *argv[]) { // backup the original file ucstring old; - CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_CRLF); + CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_LF); if (old != str) CFile::moveFile(historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename), filename); } @@ -1358,7 +1358,7 @@ bool mergeWorksheetDiff(const std::string filename, TWorksheet &sheet, bool only if (onlyTranslated) { ucstring text; - CI18N::readTextFile(fileList[i], text, false, false, false, CI18N::LINE_FMT_CRLF); + CI18N::readTextFile(fileList[i], text, false, false, false, CI18N::LINE_FMT_LF); if (text.find(ucstring("DIFF NOT TRANSLATED")) != ucstring::npos) { LOG("Diff file [%s] is not translated, merging it later.\n", CFile::getFilename(fileList[i]).c_str()); @@ -1666,7 +1666,7 @@ int makeWorksheetDiff(int argc, char *argv[], const std::string &additionFilenam string fn(CFile::getFilenameWithoutExtension(referenceFilename)), ext(CFile::getExtension(referenceFilename)); std::string diffName(diffDir+fn+"_diff_"+diffVersion+"."+ext); - CI18N::writeTextFile(diffName, str, false); + CI18N::writeTextFile(diffName, str); } @@ -1691,9 +1691,9 @@ int mergeWorksheetDiff(int argc, char *argv[], const std::string &filename, cons // there is no translated file yet, build one from the working file. ucstring str; string addfn = addDir+additionFile; - CI18N::readTextFile(addfn, str, false, false, false, CI18N::LINE_FMT_CRLF); + CI18N::readTextFile(addfn, str, false, false, false, CI18N::LINE_FMT_LF); str = str.substr(0, str.find(nl)+2); - CI18N::writeTextFile(transDir+filename, str, false); + CI18N::writeTextFile(transDir+filename, str); // reread the file. bool res = loadExcelSheet(transDir+filename, translated); nlassert(res); @@ -1711,7 +1711,7 @@ int mergeWorksheetDiff(int argc, char *argv[], const std::string &filename, cons { // backup the original file ucstring old; - CI18N::readTextFile(transDir+filename, old, false, true, false, CI18N::LINE_FMT_CRLF); + CI18N::readTextFile(transDir+filename, old, false, true, false, CI18N::LINE_FMT_LF); if (old != str) { string fn(CFile::getFilenameWithoutExtension(filename)), ext(CFile::getExtension(filename)); @@ -1720,7 +1720,7 @@ int mergeWorksheetDiff(int argc, char *argv[], const std::string &filename, cons } if (translated.size() > 0) - CI18N::writeTextFile(transDir+filename, str, false); + CI18N::writeTextFile(transDir+filename, str); return 0; } @@ -1865,7 +1865,7 @@ void cropLines(const std::string &filename, uint32 nbLines) LOG("Cropping %u lines from file '%s'\n", nbLines, filename.c_str()); - CI18N::readTextFile(filename, utext, false, false, false, CI18N::LINE_FMT_CRLF); + CI18N::readTextFile(filename, utext, false, false, false, CI18N::LINE_FMT_LF); string text = utext.toUtf8(); @@ -1881,7 +1881,7 @@ void cropLines(const std::string &filename, uint32 nbLines) utext.fromUtf8(text); - CI18N::writeTextFile(filename, utext, true); + CI18N::writeTextFile(filename, utext); } @@ -1910,7 +1910,7 @@ int makeWork() // change #include "*_en.txt" into #include "*_wk.txt" ucstring utext; - CI18N::readTextFile(filename, utext, false, false, false, CI18N::LINE_FMT_CRLF); + CI18N::readTextFile(filename, utext, false, false, false, CI18N::LINE_FMT_LF); string text = utext.toUtf8(); bool changedFile = false; @@ -1943,7 +1943,7 @@ int makeWork() if (changedFile) { utext.fromUtf8(text); - CI18N::writeTextFile(filename, utext, true); + CI18N::writeTextFile(filename, utext); } // change filename @@ -2348,7 +2348,7 @@ void patchWorkFile(vector &updatedPhrase, const std::string & filename) { ucstring text; if ( updatedPhrase.empty() ) { return; } - CI18N::readTextFile(filename, text, false, false, false, CI18N::LINE_FMT_CRLF); + CI18N::readTextFile(filename, text, false, false, false, CI18N::LINE_FMT_LF); vector::const_iterator first(updatedPhrase.begin()); vector::const_iterator last(updatedPhrase.end()); for (; first != last; ++first) @@ -2489,7 +2489,7 @@ bool mergePhraseDiff2(vector &phrases, const string &language, bool onl { // Check if the diff is translated ucstring text; - CI18N::readTextFile(diffs[i], text, false, false, false, CI18N::LINE_FMT_CRLF); + CI18N::readTextFile(diffs[i], text, false, false, false, CI18N::LINE_FMT_LF); verifyVersion(text, 2); if (text.find(ucstring("DIFF NOT TRANSLATED")) != ucstring::npos) { @@ -2947,7 +2947,7 @@ void preprocessTextFile(const std::string &filename, // Transform the string in ucstring according to format header if (!text.empty()) - CI18N::readTextBuffer((uint8*)&text[0], (uint)text.size(), result, false); + CI18N::readTextBuffer((uint8*)&text[0], (uint)text.size(), result); @@ -3029,7 +3029,7 @@ int mergePhraseDiff(int argc, char *argv[]) { // backup the original file ucstring old; - CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_CRLF); + CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_LF); if (old != str) CFile::moveFile((historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename)).c_str(), filename.c_str()); }