Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rstudio Desktop compilation with GCC 4.7 #14

Merged
merged 1 commit into from Apr 17, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
61 changes: 31 additions & 30 deletions src/cpp/core/include/core/StringUtils.hpp
Expand Up @@ -58,36 +58,6 @@ T hashStable(const std::string& str)
return hash;
}

std::string wideToUtf8(const std::wstring& value);
std::wstring utf8ToWide(const std::string& value,
const std::string& context = std::string());

template <typename Iterator, typename InputIterator>
Error utf8Clean(Iterator begin,
InputIterator end,
unsigned char replacementChar)
{
using namespace boost::system;

if (replacementChar > 0x7F)
return systemError(errc::invalid_argument,
"Invalid UTF-8 replacement character",
ERROR_LOCATION);

Error error;

while (begin != end)
{
error = utf8Advance(begin, 1, end, &begin);
if (error)
{
*begin = replacementChar;
}
}

return Success();
}

// Moves the begin pointer the specified number of UTF8
// characters.
template <typename InputIterator>
Expand Down Expand Up @@ -139,6 +109,37 @@ Error utf8Advance(InputIterator begin,
*pResult = begin;
return Success();
}
std::string wideToUtf8(const std::wstring& value);
std::wstring utf8ToWide(const std::string& value,
const std::string& context = std::string());

template <typename Iterator, typename InputIterator>
Error utf8Clean(Iterator begin,
InputIterator end,
unsigned char replacementChar)

{
using namespace boost::system;

if (replacementChar > 0x7F)
return systemError(errc::invalid_argument,
"Invalid UTF-8 replacement character",
ERROR_LOCATION);

Error error;

while (begin != end)
{
error = utf8Advance(begin, 1, end, &begin);
if (error)
{
*begin = replacementChar;
}
}

return Success();
}


template <typename InputIterator>
Error utf8Distance(InputIterator begin,
Expand Down
1 change: 1 addition & 0 deletions src/cpp/core/include/core/system/PosixUser.hpp
Expand Up @@ -15,6 +15,7 @@
#define CORE_SYSTEM_POSIX_USER_HPP

#include <string>
#include <unistd.h>

namespace core {
class Error;
Expand Down
Expand Up @@ -48,6 +48,7 @@
#include "qtlocalpeer.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QTime>
#include <unistd.h>

#if defined(Q_OS_WIN)
#include <QtCore/QLibrary>
Expand Down