[pan] and usenetutils
- From: Dominique Dumont <ddumont src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan] and usenetutils
- Date: Mon, 3 Oct 2022 16:48:33 +0000 (UTC)
commit e3d5d60db017ef92deb8d9c8d3fb2cc932e42731
Author: Thomas Tanner <thosrtanner googlemail com>
Date: Fri Sep 30 22:22:34 2022 +0100
and usenetutils
pan/usenet-utils/gnksa.cc | 12 ++++++------
pan/usenet-utils/gpg.cc | 2 +-
pan/usenet-utils/mime-utils.cc | 30 +++++++++++++++---------------
pan/usenet-utils/scorefile.cc | 40 ++++++++++++++++++++--------------------
pan/usenet-utils/url-find.cc | 2 +-
5 files changed, 43 insertions(+), 43 deletions(-)
---
diff --git a/pan/usenet-utils/gnksa.cc b/pan/usenet-utils/gnksa.cc
index 6143878..d300d45 100644
--- a/pan/usenet-utils/gnksa.cc
+++ b/pan/usenet-utils/gnksa.cc
@@ -556,7 +556,7 @@ namespace
addrtype = ADDRTYPE_OLDSTYLE;
// address part
- StringView myaddr (myfrom.substr (0, lparen));
+ StringView myaddr (myfrom.substr (nullptr, lparen));
myaddr.trim ();
addr = myaddr;
if (strict) {
@@ -566,13 +566,13 @@ namespace
}
// real name part
- StringView myname (myfrom.substr (lparen+1, 0));
+ StringView myname (myfrom.substr (lparen+1, nullptr));
myname.trim ();
if (myname.back() != ')')
return GNKSA::RPAREN_MISSING;
myname = myname.substr (NULL, myname.end()-1);
- const char * end = 0;
+ const char * end = nullptr;
if (strict && (!read_paren_phrase(myname.str,&end) || end==NULL))
return GNKSA::ILLEGAL_PAREN_PHRASE;
@@ -781,13 +781,13 @@ GNKSA :: remove_broken_message_ids_from_references (const StringView& references
break;
// find the end of the message-id
- v = v.substr (begin+1, 0);
+ v = v.substr (begin+1, nullptr);
const char * end = v.strpbrk ("<> ");
if (!end)
end = v.end();
else if (*end == '>')
++end;
- v = v.substr (end, 0);
+ v = v.substr (end, nullptr);
// check the message-id for validity
if (check_message_id (StringView(begin, end-begin)) == GNKSA::OK) {
@@ -982,6 +982,6 @@ GNKSA :: remove_signature (StringView& body)
int sig_point (-1);
const bool has_signature (find_signature_delimiter (body, sig_point) != SIG_NONE);
if (has_signature)
- body = body.substr (0, body.str+sig_point);
+ body = body.substr (nullptr, body.str+sig_point);
return has_signature;
}
diff --git a/pan/usenet-utils/gpg.cc b/pan/usenet-utils/gpg.cc
index b02b501..13c6324 100644
--- a/pan/usenet-utils/gpg.cc
+++ b/pan/usenet-utils/gpg.cc
@@ -61,7 +61,7 @@ namespace pan
int l = g_mime_signature_list_length(sig_list);
info.signers.reserve(l);
- GMimeSignature * sig(0);
+ GMimeSignature * sig(nullptr);
Signer signer;
for (int i=0;i<l;++i)
{
diff --git a/pan/usenet-utils/mime-utils.cc b/pan/usenet-utils/mime-utils.cc
index 3b4323d..3dba8cd 100644
--- a/pan/usenet-utils/mime-utils.cc
+++ b/pan/usenet-utils/mime-utils.cc
@@ -43,7 +43,7 @@ using namespace pan;
namespace pan
{
- iconv_t conv(0);
+ iconv_t conv(nullptr);
bool iconv_inited(false);
}
@@ -114,7 +114,7 @@ namespace
// part is optional
int _part = __yenc_extract_tag_val_int (b, YENC_TAG_PART);
guint _pcrc = __yenc_extract_tag_val_hex_int (b, YENC_TAG_PCRC32);
- if (part != 0)
+ if (part != nullptr)
pan_return_val_if_fail( _pcrc != 0, -1 );
guint _crc = __yenc_extract_tag_val_hex_int( b, YENC_TAG_CRC32);
@@ -291,7 +291,7 @@ namespace
bool
uu_is_ending_line (const char * line)
{
- return line!=0
+ return line!=nullptr
&& (line[0]=='e' || line[0]=='E')
&& (line[1]=='n' || line[1]=='N')
&& (line[2]=='d' || line[2]=='D')
@@ -395,8 +395,8 @@ namespace pan
guint y_pcrc;
size_t y_size;
- TempPart (EncType intype=ENC_UU, char *infilename=0): stream(0), filter(0),
- filter_stream(0), filename(infilename), valid_lines(0), type(intype),
+ TempPart (EncType intype=ENC_UU, char *infilename=nullptr): stream(nullptr), filter(nullptr),
+ filter_stream(nullptr), filename(infilename), valid_lines(0), type(intype),
y_line_len(0), y_attach_size(0), y_part(0),
y_offset_begin(0), y_offset_end(0),
y_crc(0), y_pcrc(0), y_size(0)
@@ -423,7 +423,7 @@ namespace pan
return part;
}
}
- return 0;
+ return nullptr;
}
bool append_if_not_present (temp_parts_t& parts, TempPart * part)
@@ -926,7 +926,7 @@ namespace pan
GPGDecType type;
std::string algo;
- QueryMPType() : obj(0), type(GPG_DECODE) {}
+ QueryMPType() : obj(nullptr), type(GPG_DECODE) {}
};
#else
struct QueryMPType
@@ -934,7 +934,7 @@ namespace pan
GMimeObject* obj;
std::string algo;
- QueryMPType() : obj(0) {}
+ QueryMPType() : obj(nullptr) {}
};
#endif
}
@@ -1025,7 +1025,7 @@ mime :: construct_message (GMimeStream ** istreams,
#endif
{
const char * message_id = "Foo <bar@mum>";
- GMimeMessage * retval = 0;
+ GMimeMessage * retval = nullptr;
// sanity clause
pan_return_val_if_fail (is_nonempty_string(message_id), NULL);
@@ -1066,7 +1066,7 @@ mime :: construct_message (GMimeStream ** istreams,
{
QueryMPType qtype;
g_mime_multipart_foreach (GMIME_MULTIPART(part), mixed_mp_find_gpg_params_cb, &qtype);
- GMimeObject* o(0);
+ GMimeObject* o(nullptr);
#ifdef HAVE_GMIME_CRYPTO
if (qtype.type == GPG_VERIFY)
{
@@ -1504,8 +1504,8 @@ namespace pan
if (!gpg_inited) return false;
- GMimeMultipartSigned * mps(0);
- GMimeMultipartEncrypted * mpe(0);
+ GMimeMultipartSigned * mps(nullptr);
+ GMimeMultipartEncrypted * mpe(nullptr);
switch (info.type)
{
@@ -1561,7 +1561,7 @@ namespace pan
GMimeMessage*
message_add_signed_part (const std::string& uid, const std::string& body_str, GMimeMessage* body)
{
- if (uid.empty()) return 0;
+ if (uid.empty()) return nullptr;
GMimeMultipartSigned *mps;
GError* err(NULL);
@@ -1579,7 +1579,7 @@ namespace pan
g_object_unref(gmo);
g_object_unref(mps);
g_object_unref(G_OBJECT(part));
- return 0;
+ return nullptr;
}
/* GMIME _dirty_ hack : set filename for signature attachment */
@@ -1599,7 +1599,7 @@ namespace pan
GMimeMessage* body, GPtrArray* rcp, bool sign)
{
- GError* err(0);
+ GError* err(nullptr);
GMimePart* part = g_mime_part_new_with_type("text", "plain");
mime_part_set_content (part, body_str.c_str());
diff --git a/pan/usenet-utils/scorefile.cc b/pan/usenet-utils/scorefile.cc
index 96b8734..c14e9a7 100644
--- a/pan/usenet-utils/scorefile.cc
+++ b/pan/usenet-utils/scorefile.cc
@@ -39,7 +39,7 @@ namespace
{
unsigned long get_today ()
{
- const time_t now (time (0));
+ const time_t now (time (nullptr));
struct tm t (*localtime (&now));
return (t.tm_year*10000) + (t.tm_mon*100) + t.tm_mday;
}
@@ -88,14 +88,14 @@ struct pan::Scorefile::ParseContext
std::vector<int> test_offsets;
Scorefile::Item * get_current_item () {
- Scorefile::Item * ret (0);
- if (current_section!=0 && !current_section->items.empty())
+ Scorefile::Item * ret (nullptr);
+ if (current_section!=nullptr && !current_section->items.empty())
ret = ¤t_section->items.back();
return ret;
}
FilterInfo * get_current_test () {
- FilterInfo * test (0);
+ FilterInfo * test (nullptr);
Scorefile::Item * item (get_current_item());
if (item)
test = &item->test;
@@ -113,7 +113,7 @@ struct pan::Scorefile::ParseContext
unsigned long today;
- ParseContext (): current_section(0), today(get_today()) {}
+ ParseContext (): current_section(nullptr), today(get_today()) {}
};
@@ -141,7 +141,7 @@ Scorefile :: Section*
Scorefile :: get_section (const StringView& name)
{
if (name.empty())
- return 0;
+ return nullptr;
// look for a section that already matches the name
foreach (sections_t, _sections, it)
@@ -217,7 +217,7 @@ Scorefile :: parse_file (ParseContext& context, const StringView& filename)
}
// new Item
- else if (context.current_section!=0 && !line.strncasecmp("Score:",6))
+ else if (context.current_section!=nullptr && !line.strncasecmp("Score:",6))
{
line.eat_chars (6);
const bool all_tests_must_pass (line.len>=2 && !memcmp(line.str,"::",2));
@@ -230,14 +230,14 @@ Scorefile :: parse_file (ParseContext& context, const StringView& filename)
StringView name;
const char * hash = line.strchr ('#');
if (hash)
- name = line.substr (hash+1, 0);
- name = name.substr (0, name.strchr('%')); // skip trailing comments
+ name = line.substr (hash+1, nullptr);
+ name = name.substr (nullptr, name.strchr('%')); // skip trailing comments
name.trim ();
std::deque<Item>& items (context.current_section->items);
items.resize (items.size() + 1);
Item& item (items.back());
-
+
item.name.assign (name.str, name.len);
item.filename = filename;
item.begin_line = line_number;
@@ -250,7 +250,7 @@ Scorefile :: parse_file (ParseContext& context, const StringView& filename)
}
// begin nested condition
- else if (line.len>=2 && line.str[0]=='{' && line.str[1]==':' && context.get_current_test()!=0)
+ else if (line.len>=2 && line.str[0]=='{' && line.str[1]==':' && context.get_current_test()!=nullptr)
{
context.update_item_end_line (line_number);
@@ -268,7 +268,7 @@ Scorefile :: parse_file (ParseContext& context, const StringView& filename)
}
// end nested conditions
- else if (line.len>=1 && *line.str=='}' && context.get_current_test()!=0)
+ else if (line.len>=1 && *line.str=='}' && context.get_current_test()!=nullptr)
{
context.update_item_end_line (line_number);
context.test_offsets.resize (context.test_offsets.size()-1);
@@ -290,7 +290,7 @@ Scorefile :: parse_file (ParseContext& context, const StringView& filename)
}
// include another file
- else if (!line.strncasecmp("Expires:", 6) && context.get_current_test()!=0)
+ else if (!line.strncasecmp("Expires:", 6) && context.get_current_test()!=nullptr)
{
context.update_item_end_line (line_number);
@@ -311,12 +311,12 @@ Scorefile :: parse_file (ParseContext& context, const StringView& filename)
}
// new filter
- else if (line.strpbrk (":=") && context.get_current_item()!=0)
+ else if (line.strpbrk (":=") && context.get_current_item()!=nullptr)
{
context.update_item_end_line (line_number);
-
+
// follow XNews' idiom for specifying case sensitivity:
- // '=' as the delimiter instead of ':'
+ // '=' as the delimiter instead of ':'
const char * delimiter = line.strpbrk (":=");
const bool case_sensitive (*delimiter=='=');
@@ -324,15 +324,15 @@ Scorefile :: parse_file (ParseContext& context, const StringView& filename)
bool negate (*line.str=='~');
if (negate) line.eat_chars (1);
- StringView key (line.substr (0, delimiter));
+ StringView key (line.substr (nullptr, delimiter));
key.trim ();
- StringView val (line.substr (delimiter+1, 0));
+ StringView val (line.substr (delimiter+1, nullptr));
val.trim ();
FilterInfo::aggregatesp_t& aggregates (context.get_current_test()->_aggregates);
aggregates.push_back (new FilterInfo);
FilterInfo& test (*aggregates.back());
-
+
if (!key.strncasecmp ("Lines", 5))
{
// "Lines: 5" matches articles with > 5 lines.
@@ -454,7 +454,7 @@ Scorefile :: build_score_string (const StringView & section_wildmat,
const AddItem * items,
size_t item_count)
{
- const time_t now (time (0));
+ const time_t now (time (nullptr));
std::ostringstream out;
out << "%BOS" << std::endl
<< "%Score created by Pan on " << ctime(&now)
diff --git a/pan/usenet-utils/url-find.cc b/pan/usenet-utils/url-find.cc
index a43a603..1d795c7 100644
--- a/pan/usenet-utils/url-find.cc
+++ b/pan/usenet-utils/url-find.cc
@@ -100,7 +100,7 @@ pan :: url_findx (const StringView& text, StringView& setme_url)
return false;
char bracket (0);
- const char * start (0);
+ const char * start (nullptr);
for (const char *pch (text.begin()), *end(text.end()); pch!=end; ++pch)
{
if (*pch=='h' && (end-pch>7) && !memcmp(pch,"http://",7)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]