summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/base64.cpp4
-rw-r--r--src/utils/copynpaste.cpp24
-rw-r--r--src/utils/dtor.h6
-rw-r--r--src/utils/paths.cpp2
-rw-r--r--src/utils/specialfolder.cpp2
-rw-r--r--src/utils/xml.cpp4
6 files changed, 22 insertions, 20 deletions
diff --git a/src/utils/base64.cpp b/src/utils/base64.cpp
index 14876d878..3906efc76 100644
--- a/src/utils/base64.cpp
+++ b/src/utils/base64.cpp
@@ -102,8 +102,8 @@ unsigned char *php3_base64_decode(const unsigned char *string,
unsigned char *result = static_cast<unsigned char *>(
calloc(length + 1, 1));
- if (result == NULL)
- return NULL;
+ if (result == nullptr)
+ return nullptr;
/* run through the whole string, converting as we go */
while ((ch = *current++) != '\0')
diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp
index ed9f0f641..7bf7e59d4 100644
--- a/src/utils/copynpaste.cpp
+++ b/src/utils/copynpaste.cpp
@@ -43,7 +43,7 @@ bool retrieveBuffer(std::string& text, std::string::size_type& pos)
{
bool ret = false;
- if (!OpenClipboard(NULL))
+ if (!OpenClipboard(nullptr))
return false;
HANDLE h = GetClipboardData(CF_UNICODETEXT);
@@ -54,13 +54,13 @@ bool retrieveBuffer(std::string& text, std::string::size_type& pos)
if (data)
{
int len = WideCharToMultiByte(CP_UTF8, 0, data, -1,
- NULL, 0, NULL, NULL);
+ nullptr, 0, nullptr, nullptr);
if (len > 0)
{
// Convert from UTF-16 to UTF-8
void *temp = calloc(len, 1);
if (WideCharToMultiByte(CP_UTF8, 0, data, -1,
- (LPSTR)temp, len, NULL, NULL))
+ (LPSTR)temp, len, nullptr, nullptr))
{
text.insert(pos, (char*)temp);
pos += len-1;
@@ -94,7 +94,7 @@ bool retrieveBuffer(std::string& text, std::string::size_type& pos)
bool sendBuffer(std::string& text)
{
- int wCharsLen = MultiByteToWideChar(CP_UTF8, 0, text.c_str(), -1, NULL, 0);
+ int wCharsLen = MultiByteToWideChar(CP_UTF8, 0, text.c_str(), -1, nullptr, 0);
if (!wCharsLen)
return false;
@@ -298,7 +298,7 @@ static char* getSelection2(Display *dpy, Window us, Atom selection,
if (owner == None)
{
//printf("No owner\n");
- return NULL;
+ return nullptr;
}
XConvertSelection(dpy, selection, request_target,
XA_PRIMARY, us, CurrentTime);
@@ -317,13 +317,13 @@ static char* getSelection2(Display *dpy, Window us, Atom selection,
if (e.xselection.property == None)
{
//printf("Couldn't convert\n");
- return NULL;
+ return nullptr;
}
long unsigned len, left, dummy;
int format;
Atom type;
- unsigned char *data = NULL;
+ unsigned char *data = nullptr;
ret = XGetWindowProperty(dpy, us, e.xselection.property, 0, 0,
False, AnyPropertyType, &type, &format, &len, &left, &data);
@@ -331,7 +331,7 @@ static char* getSelection2(Display *dpy, Window us, Atom selection,
{
if (ret == Success)
XFree(data);
- return NULL;
+ return nullptr;
}
ret = XGetWindowProperty(dpy, us, e.xselection.property, 0,
@@ -341,7 +341,7 @@ static char* getSelection2(Display *dpy, Window us, Atom selection,
if (ret != Success)
{
//printf("Failed to get property: %p on %lu\n", data, len);
- return NULL;
+ return nullptr;
}
//printf(">>> Got %s: len=%lu left=%lu (event %i)\n", data,
@@ -349,14 +349,14 @@ static char* getSelection2(Display *dpy, Window us, Atom selection,
return reinterpret_cast<char*>(data);
}
}
- return NULL;
+ return nullptr;
}
static Atom requestAtom;
static char* getSelection(Display *dpy, Window us, Atom selection)
{
- char *data = NULL;
+ char *data = nullptr;
if (requestAtom != None)
data = getSelection2(dpy, us, selection, requestAtom);
if (!data)
@@ -374,7 +374,7 @@ bool retrieveBuffer(std::string& text, std::string::size_type& pos)
{
Display *dpy = info.info.x11.display;
Window us = info.info.x11.window;
- char *data = NULL;
+ char *data = nullptr;
requestAtom = XInternAtom (dpy, "UTF8_STRING", true);
diff --git a/src/utils/dtor.h b/src/utils/dtor.h
index 11583709f..fbe903ced 100644
--- a/src/utils/dtor.h
+++ b/src/utils/dtor.h
@@ -30,14 +30,16 @@
template<typename T>
struct dtor : public std::unary_function <T, void>
{
- void operator()(T &ptr) { delete ptr; }
+ void operator()(T &ptr)
+ { delete ptr; }
};
template<typename T1, typename T2>
struct dtor<std::pair<T1, T2> > :
public std::unary_function <std::pair<T1, T2>, void>
{
- void operator()(std::pair<T1, T2> &pair) { delete pair.second; }
+ void operator()(std::pair<T1, T2> &pair)
+ { delete pair.second; }
};
template<class Cont>
diff --git a/src/utils/paths.cpp b/src/utils/paths.cpp
index b42caf9b5..3cc35cb55 100644
--- a/src/utils/paths.cpp
+++ b/src/utils/paths.cpp
@@ -41,7 +41,7 @@ std::string getRealPath(const std::string &str)
char *realPath = (char*)calloc(PATH_MAX, sizeof(char));
realpath(str.c_str(), realPath);
#else
- char *realPath = realpath(str.c_str(), NULL);
+ char *realPath = realpath(str.c_str(), nullptr);
#endif
path = realPath;
free(realPath);
diff --git a/src/utils/specialfolder.cpp b/src/utils/specialfolder.cpp
index 31eaec687..fae0fbf47 100644
--- a/src/utils/specialfolder.cpp
+++ b/src/utils/specialfolder.cpp
@@ -45,7 +45,7 @@ std::string getSpecialFolderLocation(int folderId)
char szPath[_MAX_PATH];
// get the item ID list for folderId
- HRESULT hr = SHGetSpecialFolderLocation(NULL, folderId, &pItemIdList);
+ HRESULT hr = SHGetSpecialFolderLocation(nullptr, folderId, &pItemIdList);
if (hr != S_OK)
return ret;
diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp
index 89457a4e8..56aa44ce3 100644
--- a/src/utils/xml.cpp
+++ b/src/utils/xml.cpp
@@ -38,7 +38,7 @@ namespace XML
mDoc(0)
{
int size;
- char *data = NULL;
+ char *data = nullptr;
if (useResman)
{
ResourceManager *resman = ResourceManager::getInstance();
@@ -162,7 +162,7 @@ namespace XML
return child;
}
- return NULL;
+ return nullptr;
}
} // namespace XML