mirror of https://github.com/djcb/mu.git
use g_snprintf instead of snprintf
Seems the latter cannot be found on some platforms; perhaps a c++/namespace thing? Use g_snprintf instead.
This commit is contained in:
parent
38a91f3696
commit
b2014fe93e
|
@ -539,7 +539,7 @@ path_to_string (Path *p, const char* frmt)
|
|||
for (u = 0, str = NULL; p->_data[u] != 0; ++u) {
|
||||
|
||||
char segm[16];
|
||||
snprintf (segm, sizeof(segm), frmt, p->_data[u] - 1);
|
||||
g_snprintf (segm, sizeof(segm), frmt, p->_data[u] - 1);
|
||||
|
||||
if (!str)
|
||||
str = g_strdup (segm);
|
||||
|
@ -645,7 +645,7 @@ thread_segment_format_string (size_t matchnum)
|
|||
/* get the number of digits needed in a hex-representation of
|
||||
* matchnum */
|
||||
digitnum = (unsigned) (ceil (log(matchnum)/log(16)));
|
||||
snprintf (frmt, sizeof(frmt), "%%0%ux", digitnum);
|
||||
g_snprintf (frmt, sizeof(frmt), "%%0%ux", digitnum);
|
||||
|
||||
return frmt;
|
||||
}
|
||||
|
|
|
@ -306,7 +306,7 @@ Store::set_path_tstamp (const std::string& path, time_t tstamp)
|
|||
LOCKED;
|
||||
|
||||
std::array<char, 2*sizeof(tstamp)+1> data{};
|
||||
const std::size_t len = snprintf (data.data(), data.size(), "%x", tstamp);
|
||||
const std::size_t len = g_snprintf (data.data(), data.size(), "%x", tstamp);
|
||||
|
||||
priv_->writable_db()->set_metadata(path, std::string{data.data(), len});
|
||||
}
|
||||
|
@ -390,7 +390,7 @@ mutable_self (MuStore *store)
|
|||
static void
|
||||
hash_str (char *buf, size_t buf_size, const char *data)
|
||||
{
|
||||
snprintf(buf, buf_size, "016%" PRIx64, mu_util_get_hash(data));
|
||||
g_snprintf(buf, buf_size, "016%" PRIx64, mu_util_get_hash(data));
|
||||
}
|
||||
|
||||
|
||||
|
@ -954,7 +954,7 @@ each_part (MuMsg *msg, MuMsgPart *part, PartData *pdata)
|
|||
/* save the mime type of any part */
|
||||
if (part->type) {
|
||||
char ctype[MU_STORE_MAX_TERM_LENGTH + 1];
|
||||
snprintf(ctype, sizeof(ctype), "%s/%s", part->type, part->subtype);
|
||||
g_snprintf(ctype, sizeof(ctype), "%s/%s", part->type, part->subtype);
|
||||
add_term(pdata->_doc, mime + ctype);
|
||||
}
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ find_or_create (GHashTable *id_table, MuMsg *msg, guint docid)
|
|||
msgid = mu_msg_get_path (msg); /* fake it */
|
||||
if (!msgid) { /* no path either? seems to happen... */
|
||||
g_warning ("message without path");
|
||||
snprintf (fake, sizeof(fake), "fake:%p", (gpointer)msg);
|
||||
g_snprintf (fake, sizeof(fake), "fake:%p", (gpointer)msg);
|
||||
msgid = fake;
|
||||
}
|
||||
|
||||
|
|
|
@ -299,7 +299,7 @@ mu_str_fullpath_s (const char* path, const char* name)
|
|||
|
||||
g_return_val_if_fail (path, NULL);
|
||||
|
||||
snprintf (buf, sizeof(buf), "%s%c%s", path, G_DIR_SEPARATOR,
|
||||
g_snprintf (buf, sizeof(buf), "%s%c%s", path, G_DIR_SEPARATOR,
|
||||
name ? name : "");
|
||||
|
||||
return buf;
|
||||
|
|
|
@ -135,7 +135,7 @@ mu_util_cache_dir (void)
|
|||
{
|
||||
static char cachedir [PATH_MAX];
|
||||
|
||||
snprintf (cachedir, sizeof(cachedir), "%s%cmu-%u",
|
||||
g_snprintf (cachedir, sizeof(cachedir), "%s%cmu-%u",
|
||||
g_get_tmp_dir(), G_DIR_SEPARATOR,
|
||||
getuid());
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ std::string
|
|||
Mu::date_to_time_t_string (int64_t t)
|
||||
{
|
||||
char buf[sizeof(InternalDateMax)];
|
||||
snprintf (buf, sizeof(buf), InternalDateFormat, t);
|
||||
g_snprintf (buf, sizeof(buf), InternalDateFormat, t);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
@ -398,7 +398,7 @@ std::string
|
|||
Mu::size_to_string (int64_t size)
|
||||
{
|
||||
char buf[sizeof(SizeMax)];
|
||||
snprintf (buf, sizeof(buf), SizeFormat, size);
|
||||
g_snprintf (buf, sizeof(buf), SizeFormat, size);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ print_stats (MuIndexStats* stats, gboolean clear, gboolean color)
|
|||
fputs ("\r", stdout);
|
||||
|
||||
if (color)
|
||||
snprintf
|
||||
g_snprintf
|
||||
(output, sizeof(output),
|
||||
MU_COLOR_YELLOW "%c " MU_COLOR_DEFAULT
|
||||
"processing mail; "
|
||||
|
@ -149,7 +149,7 @@ print_stats (MuIndexStats* stats, gboolean clear, gboolean color)
|
|||
(unsigned)stats->_updated,
|
||||
(unsigned)stats->_cleaned_up);
|
||||
else
|
||||
snprintf
|
||||
g_snprintf
|
||||
(output, sizeof(output),
|
||||
"%c processing mail; processed: %u; "
|
||||
"updated/new: %u, cleaned-up: %u",
|
||||
|
|
Loading…
Reference in New Issue