+void prepare_name(char *buf, size_t len, const char *prefix,
+ const char *suffix, int idx) {
+ if (outputformat!=NULL) {
+ // override default file name formatting
+ // make sure single-file behavior is not used
+ numextracts = -1;
+ // Other parts of codebase use vsnprintf, so I assume snprintf
+ // is available on all platforms that swftools currently works on.
+ // We need to check for buffer overflows now that the user is
+ // supplying the format string.
+ snprintf(buf,len,outputformat,idx,suffix);
+ } else {
+ // use default file name formatting, unchanged
+ sprintf(buf,"%s%d.%s",prefix,idx,suffix);
+ }
+}
+