aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source/flatom_pr.cpp
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2004-09-18 04:00:29 +0000
committerThomas Grill <xovo@users.sourceforge.net>2004-09-18 04:00:29 +0000
commitee6334102ae0ca06143d5acc90644bef1da92acb (patch)
treeaf4f0b3c4db4e1884233c38537584661f772b8ec /externals/grill/flext/source/flatom_pr.cpp
parentdab6a8b7014535e0c32d9d125569a6d2e04d056b (diff)
""
svn path=/trunk/; revision=2043
Diffstat (limited to 'externals/grill/flext/source/flatom_pr.cpp')
-rw-r--r--externals/grill/flext/source/flatom_pr.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/externals/grill/flext/source/flatom_pr.cpp b/externals/grill/flext/source/flatom_pr.cpp
index 43721388..5b15648a 100644
--- a/externals/grill/flext/source/flatom_pr.cpp
+++ b/externals/grill/flext/source/flatom_pr.cpp
@@ -27,29 +27,38 @@ bool flext::PrintAtom(const t_atom &a,char *buf,int bufsz)
{
bool ok = true;
if(IsFloat(a)) {
- STD::snprintf(buf,bufsz,"%g",GetFloat(a));
+ ok = STD::snprintf(buf,bufsz,"%g",GetFloat(a)) > 0;
}
else if(IsInt(a)) {
- STD::snprintf(buf,bufsz,"%i",GetInt(a));
+ ok = STD::snprintf(buf,bufsz,"%i",GetInt(a)) > 0;
}
else if(IsSymbol(a)) {
- if(!FLEXT_ASSERT(GetSymbol(a))) *buf = 0;
- else
- STD::strncpy(buf,GetString(a),bufsz);
+ if(!FLEXT_ASSERT(GetSymbol(a)))
+ *buf = 0;
+ else {
+ const char *c = GetString(a);
+ int len = strlen(c);
+ if(len < bufsz) {
+ memcpy(buf,c,len); buf[len] = 0;
+ ok = true;
+ }
+ else
+ ok = false;
+ }
}
else if(IsPointer(a)) {
- STD::snprintf(buf,bufsz,"%p",GetPointer(a));
+ ok = STD::snprintf(buf,bufsz,"%p",GetPointer(a)) > 0;
}
#if FLEXT_SYS == FLEXT_SYS_PD
else if(a.a_type == A_DOLLAR) {
- STD::snprintf(buf,bufsz,"$%d",a.a_w.w_index);
+ ok = STD::snprintf(buf,bufsz,"$%d",a.a_w.w_index) > 0;
}
else if(a.a_type == A_DOLLSYM) {
- STD::snprintf(buf,bufsz,"$%s",GetString(a));
+ ok = STD::snprintf(buf,bufsz,"$%s",GetString(a)) > 0;
}
#elif FLEXT_SYS == FLEXT_SYS_MAX
else if(a.a_type == A_DOLLAR) {
- STD::snprintf(buf,bufsz,"$%d",a.a_w.w_long);
+ ok = STD::snprintf(buf,bufsz,"$%d",a.a_w.w_long) > 0;
}
#else
//#pragma message("Not implemented")