Kaydet (Commit) 7a8d48f5 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

loplugin:nullptr (automatic rewrite)

Change-Id: Ied61699170bd5d2c3878135b1a43b4dc1deff4d4
üst 28034eaf
...@@ -58,7 +58,7 @@ class i_xml_parser_event_handler; ...@@ -58,7 +58,7 @@ class i_xml_parser_event_handler;
class xml_parser class xml_parser
{ {
public: public:
xml_parser(const XML_Char* EncodingName = 0); xml_parser(const XML_Char* EncodingName = nullptr);
~xml_parser(); ~xml_parser();
......
...@@ -70,7 +70,7 @@ namespace /* private */ ...@@ -70,7 +70,7 @@ namespace /* private */
} }
xml_parser::xml_parser(const XML_Char* EncodingName) : xml_parser::xml_parser(const XML_Char* EncodingName) :
document_handler_(0), document_handler_(nullptr),
xml_parser_(XML_ParserCreate(EncodingName)) xml_parser_(XML_ParserCreate(EncodingName))
{ {
init(); init();
...@@ -89,7 +89,7 @@ extern "C" ...@@ -89,7 +89,7 @@ extern "C"
static void xml_start_element_handler(void* UserData, const XML_Char* name, const XML_Char** atts) static void xml_start_element_handler(void* UserData, const XML_Char* name, const XML_Char** atts)
{ {
assert(UserData != NULL); assert(UserData != nullptr);
xml_parser* pImpl = get_parser_instance(UserData); xml_parser* pImpl = get_parser_instance(UserData);
......
...@@ -228,9 +228,9 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( ...@@ -228,9 +228,9 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(
static cppu::ImplementationEntry const services[] = { static cppu::ImplementationEntry const services[] = {
{ &createInstance, &getDefaultImplementationName, { &createInstance, &getDefaultImplementationName,
&getDefaultSupportedServiceNames, &cppu::createSingleComponentFactory, 0, &getDefaultSupportedServiceNames, &cppu::createSingleComponentFactory, nullptr,
0 }, 0 },
{ 0, 0, 0, 0, 0, 0 } { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
}; };
} }
......
...@@ -146,7 +146,7 @@ Service::Service(): enabled_(false) { ...@@ -146,7 +146,7 @@ Service::Service(): enabled_(false) {
if (context.is()) { if (context.is()) {
OUString desktop; OUString desktop;
context->getValueByName("system.desktop-environment") >>= desktop; context->getValueByName("system.desktop-environment") >>= desktop;
enabled_ = desktop == "KDE4" && KApplication::kApplication() != 0; enabled_ = desktop == "KDE4" && KApplication::kApplication() != nullptr;
} }
} }
...@@ -192,9 +192,9 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( ...@@ -192,9 +192,9 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(
static cppu::ImplementationEntry const services[] = { static cppu::ImplementationEntry const services[] = {
{ &createInstance, &getServiceImplementationName, { &createInstance, &getServiceImplementationName,
&getServiceSupportedServiceNames, &cppu::createSingleComponentFactory, 0, &getServiceSupportedServiceNames, &cppu::createSingleComponentFactory, nullptr,
0 }, 0 },
{ 0, 0, 0, 0, 0, 0 } { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
}; };
} }
......
...@@ -168,12 +168,12 @@ static OUString ImplGetLocale(int category) ...@@ -168,12 +168,12 @@ static OUString ImplGetLocale(int category)
const char *locale = setlocale(category, ""); const char *locale = setlocale(category, "");
// Return "en-US" for C locales // Return "en-US" for C locales
if( (locale == NULL) || ( locale[0] == 'C' && locale[1] == '\0' ) ) if( (locale == nullptr) || ( locale[0] == 'C' && locale[1] == '\0' ) )
return OUString( "en-US" ); return OUString( "en-US" );
const char *cp; const char *cp;
const char *uscore = NULL; const char *uscore = nullptr;
// locale string have the format lang[_ctry][.encoding][@modifier] // locale string have the format lang[_ctry][.encoding][@modifier]
// we are only interested in the first two items, so we handle // we are only interested in the first two items, so we handle
...@@ -187,7 +187,7 @@ static OUString ImplGetLocale(int category) ...@@ -187,7 +187,7 @@ static OUString ImplGetLocale(int category)
} }
OUStringBuffer aLocaleBuffer; OUStringBuffer aLocaleBuffer;
if( uscore != NULL ) if( uscore != nullptr )
{ {
aLocaleBuffer.appendAscii(locale, uscore++ - locale); aLocaleBuffer.appendAscii(locale, uscore++ - locale);
aLocaleBuffer.append("-"); aLocaleBuffer.append("-");
......
...@@ -42,10 +42,10 @@ static const cppu::ImplementationEntry kImplementations_entries[] = ...@@ -42,10 +42,10 @@ static const cppu::ImplementationEntry kImplementations_entries[] =
LocaleBackend::getBackendName, LocaleBackend::getBackendName,
LocaleBackend::getBackendServiceNames, LocaleBackend::getBackendServiceNames,
cppu::createSingleComponentFactory, cppu::createSingleComponentFactory,
NULL, nullptr,
0 0
}, },
{ NULL, NULL, NULL, NULL, NULL, 0 } { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
} ; } ;
......
...@@ -296,7 +296,7 @@ void SAL_CALL CmdMailSuppl::sendSimpleMailMessage( const Reference< XSimpleMailM ...@@ -296,7 +296,7 @@ void SAL_CALL CmdMailSuppl::sendSimpleMailMessage( const Reference< XSimpleMailM
OString cmd = aBuffer.makeStringAndClear(); OString cmd = aBuffer.makeStringAndClear();
FILE * f = popen(cmd.getStr(), "w"); FILE * f = popen(cmd.getStr(), "w");
if (f == 0 || pclose(f) != 0) if (f == nullptr || pclose(f) != 0)
{ {
throw css::uno::Exception("No mail client configured", throw css::uno::Exception("No mail client configured",
static_cast < XSimpleMailClient * > (this) ); static_cast < XSimpleMailClient * > (this) );
......
...@@ -39,14 +39,14 @@ namespace ...@@ -39,14 +39,14 @@ namespace
static inline GDBusProxy* lcl_GetPackageKitProxy(const OUString& sInterface) static inline GDBusProxy* lcl_GetPackageKitProxy(const OUString& sInterface)
{ {
const OString sFullInterface = OUStringToOString("org.freedesktop.PackageKit." + sInterface, RTL_TEXTENCODING_ASCII_US); const OString sFullInterface = OUStringToOString("org.freedesktop.PackageKit." + sInterface, RTL_TEXTENCODING_ASCII_US);
GErrorWrapper error(NULL); GErrorWrapper error(nullptr);
GDBusProxy* proxy = NULL; GDBusProxy* proxy = nullptr;
proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE, NULL, G_DBUS_PROXY_FLAGS_NONE, nullptr,
"org.freedesktop.PackageKit", "org.freedesktop.PackageKit",
"/org/freedesktop/PackageKit", "/org/freedesktop/PackageKit",
reinterpret_cast<const gchar*>(sFullInterface.getStr()), reinterpret_cast<const gchar*>(sFullInterface.getStr()),
NULL, nullptr,
&error.getRef()); &error.getRef());
if(!proxy) if(!proxy)
throw RuntimeException("couldnt get a proxy!"); throw RuntimeException("couldnt get a proxy!");
...@@ -166,7 +166,7 @@ void SyncDbusSessionHelper::InstallPrinterDrivers( ...@@ -166,7 +166,7 @@ void SyncDbusSessionHelper::InstallPrinterDrivers(
const OString sPackagenameAscii = OUStringToOString(sPackagename, RTL_TEXTENCODING_ASCII_US); const OString sPackagenameAscii = OUStringToOString(sPackagename, RTL_TEXTENCODING_ASCII_US);
const OString sInteractionAscii = OUStringToOString(sInteraction, RTL_TEXTENCODING_ASCII_US); const OString sInteractionAscii = OUStringToOString(sInteraction, RTL_TEXTENCODING_ASCII_US);
std::shared_ptr<GDBusProxy> proxy(lcl_GetPackageKitProxy("Query"), GObjectDeleter<GDBusProxy>()); std::shared_ptr<GDBusProxy> proxy(lcl_GetPackageKitProxy("Query"), GObjectDeleter<GDBusProxy>());
GErrorWrapper error(NULL); GErrorWrapper error(nullptr);
std::shared_ptr<GVariant> result(g_dbus_proxy_call_sync (proxy.get(), std::shared_ptr<GVariant> result(g_dbus_proxy_call_sync (proxy.get(),
"IsInstalled", "IsInstalled",
g_variant_new ("(ss)", g_variant_new ("(ss)",
...@@ -174,7 +174,7 @@ void SyncDbusSessionHelper::InstallPrinterDrivers( ...@@ -174,7 +174,7 @@ void SyncDbusSessionHelper::InstallPrinterDrivers(
sInteractionAscii.getStr()), sInteractionAscii.getStr()),
G_DBUS_CALL_FLAGS_NONE, G_DBUS_CALL_FLAGS_NONE,
-1, /* timeout */ -1, /* timeout */
NULL, /* cancellable */ nullptr, /* cancellable */
&error.getRef()),GVariantDeleter()); &error.getRef()),GVariantDeleter());
if(result.get()) if(result.get())
o_isInstalled = bool(g_variant_get_boolean(g_variant_get_child_value(result.get(),0))); o_isInstalled = bool(g_variant_get_boolean(g_variant_get_child_value(result.get(),0)));
......
...@@ -262,7 +262,7 @@ private: ...@@ -262,7 +262,7 @@ private:
iso_lang_replacement_table_t::iterator iter = iso_lang_replacement_table_t::iterator iter =
iso_lang_replacement_table_.find(iso_lang); iso_lang_replacement_table_.find(iso_lang);
replacement_table_t* prt = NULL; replacement_table_t* prt = nullptr;
if (iso_lang_replacement_table_.end() == iter) if (iso_lang_replacement_table_.end() == iter)
{ {
...@@ -330,7 +330,7 @@ void read_ulf_file(const std::string& FileName, Substitutor& Substitutor) ...@@ -330,7 +330,7 @@ void read_ulf_file(const std::string& FileName, Substitutor& Substitutor)
// UTF8 files starting with a byte-order-mark we create a copy of the // UTF8 files starting with a byte-order-mark we create a copy of the
// original file without the byte-order-mark // original file without the byte-order-mark
OUString tmpfile_url; OUString tmpfile_url;
osl_createTempFile(NULL, NULL, &tmpfile_url.pData); osl_createTempFile(nullptr, nullptr, &tmpfile_url.pData);
OUString tmpfile_sys; OUString tmpfile_sys;
osl::FileBase::getSystemPathFromFileURL(tmpfile_url, tmpfile_sys); osl::FileBase::getSystemPathFromFileURL(tmpfile_url, tmpfile_sys);
......
...@@ -231,13 +231,13 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar ...@@ -231,13 +231,13 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar
if ( !aLaunchBuffer.isEmpty() ) if ( !aLaunchBuffer.isEmpty() )
{ {
FILE *pLaunch = popen( aLaunchBuffer.makeStringAndClear().getStr(), "w" ); FILE *pLaunch = popen( aLaunchBuffer.makeStringAndClear().getStr(), "w" );
if ( pLaunch != NULL ) if ( pLaunch != nullptr )
{ {
if ( 0 == pclose( pLaunch ) ) if ( 0 == pclose( pLaunch ) )
return; return;
} }
// Failed, do not try DESKTOP_LAUNCH any more // Failed, do not try DESKTOP_LAUNCH any more
pDesktopLaunch = NULL; pDesktopLaunch = nullptr;
} }
OString cmd = OString cmd =
...@@ -248,7 +248,7 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar ...@@ -248,7 +248,7 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar
aBuffer.makeStringAndClear(); aBuffer.makeStringAndClear();
#endif #endif
FILE *pLaunch = popen(cmd.getStr(), "w"); FILE *pLaunch = popen(cmd.getStr(), "w");
if ( pLaunch != NULL ) if ( pLaunch != nullptr )
{ {
if ( 0 == pclose( pLaunch ) ) if ( 0 == pclose( pLaunch ) )
return; return;
......
...@@ -46,7 +46,7 @@ inline void ensure_final_slash(/*inout*/ OUString& path) ...@@ -46,7 +46,7 @@ inline void ensure_final_slash(/*inout*/ OUString& path)
recently_used_file::recently_used_file() : recently_used_file::recently_used_file() :
file_(NULL) file_(nullptr)
{ {
osl::Security sec; osl::Security sec;
OUString homedir_url; OUString homedir_url;
...@@ -66,12 +66,12 @@ recently_used_file::recently_used_file() : ...@@ -66,12 +66,12 @@ recently_used_file::recently_used_file() :
int fd = open(tmp.getStr(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); int fd = open(tmp.getStr(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
if (fd != -1) { if (fd != -1) {
file_ = fdopen(fd, "w+"); file_ = fdopen(fd, "w+");
if (file_ == 0) { if (file_ == nullptr) {
close(fd); close(fd);
} }
} }
if (NULL == file_) if (nullptr == file_)
throw "I/O error opening ~/.recently-used"; throw "I/O error opening ~/.recently-used";
if (lockf(fileno(file_), F_LOCK, 0) != 0) if (lockf(fileno(file_), F_LOCK, 0) != 0)
......
...@@ -80,7 +80,7 @@ namespace /* private */ { ...@@ -80,7 +80,7 @@ namespace /* private */ {
is_private_(is_private), is_private_(is_private),
groups_(groups) groups_(groups)
{ {
timestamp_ = time(NULL); timestamp_ = time(nullptr);
} }
void set_uri(const string_t& character) void set_uri(const string_t& character)
...@@ -216,7 +216,7 @@ namespace /* private */ { ...@@ -216,7 +216,7 @@ namespace /* private */ {
{ {
public: public:
explicit recently_used_file_filter(recently_used_item_list_t& item_list) : explicit recently_used_file_filter(recently_used_item_list_t& item_list) :
item_(NULL), item_(nullptr),
item_list_(item_list) item_list_(item_list)
{ {
named_command_map_[TAG_RECENT_FILES] = &recently_used_item::set_nothing; named_command_map_[TAG_RECENT_FILES] = &recently_used_item::set_nothing;
...@@ -234,14 +234,14 @@ namespace /* private */ { ...@@ -234,14 +234,14 @@ namespace /* private */ {
const string_t& local_name, const string_t& local_name,
const xml_tag_attribute_container_t& /*attributes*/) override const xml_tag_attribute_container_t& /*attributes*/) override
{ {
if ((local_name == TAG_RECENT_ITEM) && (NULL == item_)) if ((local_name == TAG_RECENT_ITEM) && (nullptr == item_))
item_ = new recently_used_item; item_ = new recently_used_item;
} }
virtual void end_element(const string_t& /*raw_name*/, const string_t& local_name) override virtual void end_element(const string_t& /*raw_name*/, const string_t& local_name) override
{ {
// check for end tags w/o start tag // check for end tags w/o start tag
if( local_name != TAG_RECENT_FILES && NULL == item_ ) if( local_name != TAG_RECENT_FILES && nullptr == item_ )
return; // will result in an XML parser error anyway return; // will result in an XML parser error anyway
if (named_command_map_.find(local_name) != named_command_map_.end()) if (named_command_map_.find(local_name) != named_command_map_.end())
...@@ -255,7 +255,7 @@ namespace /* private */ { ...@@ -255,7 +255,7 @@ namespace /* private */ {
if (local_name == TAG_RECENT_ITEM) if (local_name == TAG_RECENT_ITEM)
{ {
item_list_.push_back(item_); item_list_.push_back(item_);
item_ = NULL; item_ = nullptr;
} }
current_element_.clear(); current_element_.clear();
} }
...@@ -406,7 +406,7 @@ namespace /* private */ { ...@@ -406,7 +406,7 @@ namespace /* private */ {
if (iter != item_list.end()) if (iter != item_list.end())
{ {
(*iter)->timestamp_ = time(NULL); (*iter)->timestamp_ = time(nullptr);
if (!(*iter)->has_group(GROUP_OOO)) if (!(*iter)->has_group(GROUP_OOO))
(*iter)->groups_.push_back(GROUP_OOO); (*iter)->groups_.push_back(GROUP_OOO);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment