mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 16:01:10 +02:00
more char* -> std::string conversions
Signed-off-by: Jacek Jendrzej <crashdvb@googlemail.com>
Origin commit data
------------------
Branch: ni/coolstream
Commit: 2cee6929d6
Author: martii <m4rtii@gmx.de>
Date: 2013-06-27 (Thu, 27 Jun 2013)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -42,6 +42,7 @@
|
|||||||
#include <gui/widget/stringinput.h>
|
#include <gui/widget/stringinput.h>
|
||||||
#include <gui/widget/icons.h>
|
#include <gui/widget/icons.h>
|
||||||
#include <gui/widget/buttons.h>
|
#include <gui/widget/buttons.h>
|
||||||
|
#include <system/helpers.h>
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -117,17 +118,10 @@ void CBookmarkManager::renameBookmark (unsigned int index) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#define BOOKMARKSTRINGLENGTH (10 + 1)
|
|
||||||
#define BOOKMARKSTRINGMODIFICATIONPOINT 8
|
|
||||||
const char * const BOOKMARKSTRING = "bookmark0.";
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
void CBookmarkManager::readBookmarkFile() {
|
void CBookmarkManager::readBookmarkFile() {
|
||||||
if (bookmarkfile.loadConfig(BOOKMARKFILE))
|
if (bookmarkfile.loadConfig(BOOKMARKFILE))
|
||||||
{
|
{
|
||||||
char bookmarkstring[BOOKMARKSTRINGLENGTH];
|
|
||||||
strcpy(bookmarkstring, BOOKMARKSTRING);
|
|
||||||
|
|
||||||
bookmarksmodified = false;
|
bookmarksmodified = false;
|
||||||
bookmarks.clear();
|
bookmarks.clear();
|
||||||
|
|
||||||
@@ -138,19 +132,11 @@ void CBookmarkManager::readBookmarkFile() {
|
|||||||
|
|
||||||
while (bookmarkcount-- > 0)
|
while (bookmarkcount-- > 0)
|
||||||
{
|
{
|
||||||
std::string tmp = bookmarkstring;
|
std::string bookmarkstring = "bookmark" + to_string(bookmarkcount) + ".";
|
||||||
tmp += "name";
|
std::string bookmarkname = bookmarkfile.getString(bookmarkstring + "name", "");
|
||||||
std::string bookmarkname = bookmarkfile.getString(tmp, "");
|
std::string bookmarkurl = bookmarkfile.getString(bookmarkstring + "url", "");
|
||||||
tmp = bookmarkstring;
|
std::string bookmarktime = bookmarkfile.getString(bookmarkstring + "time", "");
|
||||||
tmp += "url";
|
|
||||||
std::string bookmarkurl = bookmarkfile.getString(tmp, "");
|
|
||||||
tmp = bookmarkstring;
|
|
||||||
tmp += "time";
|
|
||||||
std::string bookmarktime = bookmarkfile.getString(tmp, "");
|
|
||||||
|
|
||||||
bookmarks.push_back(CBookmark(bookmarkname, bookmarkurl, bookmarktime));
|
bookmarks.push_back(CBookmark(bookmarkname, bookmarkurl, bookmarktime));
|
||||||
|
|
||||||
bookmarkstring[BOOKMARKSTRINGMODIFICATIONPOINT]++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -159,24 +145,16 @@ void CBookmarkManager::readBookmarkFile() {
|
|||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
void CBookmarkManager::writeBookmarkFile() {
|
void CBookmarkManager::writeBookmarkFile() {
|
||||||
char bookmarkstring[BOOKMARKSTRINGLENGTH];
|
|
||||||
strcpy(bookmarkstring, BOOKMARKSTRING);
|
|
||||||
|
|
||||||
printf("CBookmarkManager: Writing bookmark file\n");
|
printf("CBookmarkManager: Writing bookmark file\n");
|
||||||
|
|
||||||
for (std::vector<CBookmark>::const_iterator it = bookmarks.begin(); it != bookmarks.end(); ++it)
|
unsigned int bookmarkcount = 0;
|
||||||
|
for (std::vector<CBookmark>::const_iterator it = bookmarks.begin(); it != bookmarks.end(); ++it, bookmarkcount++)
|
||||||
{
|
{
|
||||||
std::string tmp = bookmarkstring;
|
std::string bookmarkstring = "bookmark" + to_string(bookmarkcount) + ".";
|
||||||
tmp += "name";
|
bookmarkfile.setString(bookmarkstring + "name", it->getName());
|
||||||
bookmarkfile.setString(tmp, it->getName());
|
bookmarkfile.setString(bookmarkstring + "url", it->getUrl());
|
||||||
tmp = bookmarkstring;
|
bookmarkfile.setString(bookmarkstring + "time", it->getTime());
|
||||||
tmp += "url";
|
|
||||||
bookmarkfile.setString(tmp, it->getUrl());
|
|
||||||
tmp = bookmarkstring;
|
|
||||||
tmp += "time";
|
|
||||||
bookmarkfile.setString(tmp, it->getTime());
|
|
||||||
|
|
||||||
bookmarkstring[BOOKMARKSTRINGMODIFICATIONPOINT]++;
|
|
||||||
}
|
}
|
||||||
bookmarkfile.setInt32("bookmarkcount", bookmarks.size());
|
bookmarkfile.setInt32("bookmarkcount", bookmarks.size());
|
||||||
bookmarkfile.saveConfig(BOOKMARKFILE);
|
bookmarkfile.saveConfig(BOOKMARKFILE);
|
||||||
|
@@ -535,14 +535,8 @@ bool CFileHelpers::createDir(const char *Dir, mode_t mode)
|
|||||||
createDir(dirPath, mode);
|
createDir(dirPath, mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
if (ret == 0)
|
return !ret || (errno == EEXIST);
|
||||||
return true;
|
|
||||||
if (errno == EEXIST)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
errno = 0;
|
errno = 0;
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user