From ee6334102ae0ca06143d5acc90644bef1da92acb Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Sat, 18 Sep 2004 04:00:29 +0000 Subject: "" svn path=/trunk/; revision=2043 --- externals/grill/flext/changes.txt | 1 + externals/grill/flext/flext.vcproj | 2 +- externals/grill/flext/source/flatom_pr.cpp | 27 ++++++++++++++++++--------- 3 files changed, 20 insertions(+), 10 deletions(-) (limited to 'externals') 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;"f:\prog\pd\pd-cvs\bin";F:\prog\audio\stk\lib;F:\prog\audio\sndobj\lib" + AdditionalLibraryDirectories="c:\data\prog\packs\pthreads;"c:\data\prog\pd\pd-cvs\bin";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") -- cgit v1.2.1