aboutsummaryrefslogtreecommitdiff
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
parentdab6a8b7014535e0c32d9d125569a6d2e04d056b (diff)
""
svn path=/trunk/; revision=2043
-rw-r--r--externals/grill/flext/changes.txt1
-rw-r--r--externals/grill/flext/flext.vcproj2
-rw-r--r--externals/grill/flext/source/flatom_pr.cpp27
3 files changed, 20 insertions, 10 deletions
diff --git a/externals/grill/flext/changes.txt b/externals/grill/flext/changes.txt
index 8a9b6a9b..4eb7d0d4 100644
--- a/externals/grill/flext/changes.txt
+++ b/externals/grill/flext/changes.txt
@@ -29,6 +29,7 @@ Version history:
- attribute editor: close editor window on object destruction
- fixed $0-arguments in attribute saving
- introducing ring buffer for message queue (thanks to Tom Schouten)
+- printing of atoms into buffer with better error checking
0.4.6:
- added a text edit window for list attributes
diff --git a/externals/grill/flext/flext.vcproj b/externals/grill/flext/flext.vcproj
index 1d31e557..6dba0f79 100644
--- a/externals/grill/flext/flext.vcproj
+++ b/externals/grill/flext/flext.vcproj
@@ -408,7 +408,7 @@
Name="VCLinkerTool"
AdditionalDependencies="pd.lib pthreadVC.lib stk.lib sndobj.lib"
OutputFile=".\pd-msvc\flext.dll"
- AdditionalLibraryDirectories="f:\prog\packs\pthreads;&quot;f:\prog\pd\pd-cvs\bin&quot;;F:\prog\audio\stk\lib;F:\prog\audio\sndobj\lib"
+ AdditionalLibraryDirectories="c:\data\prog\packs\pthreads;&quot;c:\data\prog\pd\pd-cvs\bin&quot;;c:\data\prog\audio\stk\lib;c:\data\prog\audio\sndobj\lib"
GenerateDebugInformation="FALSE"
OptimizeReferences="1"
ImportLibrary="./pd-msvc/flext_l.lib"
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")