diff -ruN TiMidity++-1.3.9/ChangeLog TiMidity++-1.3.10/ChangeLog --- TiMidity++-1.3.9/ChangeLog Sat Apr 17 14:54:33 1999 +++ TiMidity++-1.3.10/ChangeLog Fri Jul 9 18:16:46 1999 @@ -1,3 +1,39 @@ +1999-07-09 Masanao Izumo + + * Version 1.3.10 released. + +1999-06-22 Masanao Izumo + + * libarc/arc_tar.c: Use checksum wheather the tar file is valid or not. + "ustar" magic is ignored. + +1999-06-04 Dima Simakov + + * timidity/esd_a.c: Add the code for the EsounD. + +1999-04-27 Masanao Izumo + + * configure.in(*-sgi-irix6.2): Define SGI_OLDAL. + * interface/motif_i.c: Remove c++ comment style "//" + +1999-04-24 Masanao Izumo + + * configure.in (--enable-dynamic): Bug fix. + +1999-04-21 Masanao Izumo + + * xaw_i.c: Fix bug about directory browsing. + +1999-04-18 Masanao Izumo + + * timidity/resample.c (pre_resample): Fixed interger overflow bug. + * timidity/recache.c (resamp_cache_refer_off): Fixed interger + overflow bug. + +1999-04-18 Eric A. Welsh + + * interface/ncurs_c.c (lastbends, ctl_pitch_bend): Bug fix. + 1999-04-17 Masanao Izumo * Version 1.3.9 released. diff -ruN TiMidity++-1.3.9/configure TiMidity++-1.3.10/configure --- TiMidity++-1.3.9/configure Sat Apr 17 14:54:59 1999 +++ TiMidity++-1.3.10/configure Fri Jul 9 18:06:28 1999 @@ -836,7 +836,7 @@ PACKAGE=TiMidity++ -VERSION=1.3.9 +VERSION=1.3.10 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } @@ -4901,11 +4901,11 @@ EXTRALIBS="$EXTRALIBS /usr/opt/MME220/lib/libmme.a" echo "$ac_t""yes dec" 1>&6 ;; - *-sgi-irix5*) + *-sgi-irix5*|*-sgi-irix6.2) EXTRADEFS="$EXTRADEFS -DAU_AUDRIV -DSGI_OLDAL" SYSEXTRAS="$SYSEXTRAS audriv_a.c audriv_al.c" EXTRALIBS="$EXTRALIBS -laudio" - echo "$ac_t""yes irix5" 1>&6 + echo "$ac_t""yes irix5 or irix6.2" 1>&6 ;; *-sgi-irix6*) EXTRADEFS="$EXTRADEFS -DAU_AUDRIV -DSGI_NEWAL" @@ -4957,9 +4957,9 @@ -# Check whether --with-enable-dynamic or --without-enable-dynamic was given. -if test "${with_enable_dynamic+set}" = set; then - withval="$with_enable_dynamic" +# Check whether --enable-enable-dynamic or --disable-enable-dynamic was given. +if test "${enable_enable_dynamic+set}" = set; then + enableval="$enable_enable_dynamic" test "x$enable_dynamic" = xyes && enable_dynamic=dynamic fi diff -ruN TiMidity++-1.3.9/configure.in TiMidity++-1.3.10/configure.in --- TiMidity++-1.3.9/configure.in Fri Apr 16 22:02:01 1999 +++ TiMidity++-1.3.10/configure.in Fri Jul 9 17:59:59 1999 @@ -54,7 +54,7 @@ AC_INIT(timidity/timidity.c) AC_CANONICAL_SYSTEM -AM_INIT_AUTOMAKE(TiMidity++, 1.3.9, no-define) +AM_INIT_AUTOMAKE(TiMidity++, 1.3.10, no-define) dnl To use CONTAINS() macro (See acinclude.m4) CONTAINS_INIT @@ -410,11 +410,11 @@ EXTRALIBS="$EXTRALIBS /usr/opt/MME220/lib/libmme.a" AC_MSG_RESULT(yes dec) ;; - *-sgi-irix5*) + *-sgi-irix5*|*-sgi-irix6.2) EXTRADEFS="$EXTRADEFS -DAU_AUDRIV -DSGI_OLDAL" SYSEXTRAS="$SYSEXTRAS audriv_a.c audriv_al.c" EXTRALIBS="$EXTRALIBS -laudio" - AC_MSG_RESULT(yes irix5) + AC_MSG_RESULT(yes irix5 or irix6.2) ;; *-sgi-irix6*) EXTRADEFS="$EXTRADEFS -DAU_AUDRIV -DSGI_NEWAL" @@ -467,7 +467,7 @@ dnl Dynamic link configuration -AC_ARG_WITH(enable-dynamic, +AC_ARG_ENABLE(enable-dynamic, [ --enable-dynamic Enable dynamic link interface ], [ dnl --enable-dynamic=yes to --enable-dynamic=dynamic test "x$enable_dynamic" = xyes && enable_dynamic=dynamic diff -ruN TiMidity++-1.3.9/interface/Makefile.in TiMidity++-1.3.10/interface/Makefile.in --- TiMidity++-1.3.9/interface/Makefile.in Sat Apr 17 15:54:18 1999 +++ TiMidity++-1.3.10/interface/Makefile.in Fri Jul 9 18:18:05 1999 @@ -430,10 +430,6 @@ ../timidity/output.h ../timidity/controls.h \ ../timidity/instrum.h ../timidity/playmidi.h \ ../timidity/readmidi.h -dynamic_c.o: dynamic_c.c ../config.h ../timidity/timidity.h \ - ../timidity/common.h ../libarc/url.h ../utils/mblock.h \ - ../timidity/output.h ../timidity/controls.h \ - ../timidity/dlutils.h emacs_c.o: emacs_c.c ../config.h ../timidity/timidity.h \ ../timidity/common.h ../libarc/url.h ../utils/mblock.h \ ../timidity/output.h ../timidity/controls.h \ @@ -524,7 +520,8 @@ xaw_i.o: xaw_i.c ../config.h xaw.h ../timidity/timidity.h check.xbm \ arrow.xbm on.xbm off.xbm ../timidity/common.h ../libarc/url.h \ ../utils/mblock.h ../timidity/instrum.h ../timidity/playmidi.h \ - ../timidity/readmidi.h ../timidity/controls.h ../utils/timer.h + ../timidity/readmidi.h ../timidity/controls.h ../utils/timer.h \ + ../utils/strtab.h xskin_c.o: xskin_c.c ../config.h ../timidity/timidity.h \ ../timidity/common.h ../libarc/url.h ../utils/mblock.h \ ../timidity/instrum.h ../timidity/playmidi.h \ diff -ruN TiMidity++-1.3.9/interface/motif_i.c TiMidity++-1.3.10/interface/motif_i.c --- TiMidity++-1.3.9/interface/motif_i.c Sun Feb 21 20:11:04 1999 +++ TiMidity++-1.3.10/interface/motif_i.c Tue Apr 27 04:38:52 1999 @@ -1059,7 +1059,7 @@ XtSetArg(al[ac], XmNtopOffset, 10); ac++; XtSetArg(al[ac], XmNbottomOffset, 10); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; -// XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; +/* XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; */ XtSetArg(al[ac],XmNtopAttachment,XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopWidget, locator_scale); ac++; btnForm = XmCreateForm(mainForm,"btnForm", al, ac); diff -ruN TiMidity++-1.3.9/interface/ncurs_c.c TiMidity++-1.3.10/interface/ncurs_c.c --- TiMidity++-1.3.9/interface/ncurs_c.c Wed Mar 31 14:19:10 1999 +++ TiMidity++-1.3.10/interface/ncurs_c.c Tue Apr 27 22:38:10 1999 @@ -492,7 +492,7 @@ ctl_sustain(ch, channel[ch].sustain); ctl_pitch_bend(ch, CTL_STATUS_INIT); if(channel[ch].pitchbend == 0x2000 && channel[ch].modulation_wheel > 0) - ctl_pitch_bend(ch, -1); + ctl_pitch_bend(ch, -2); else ctl_pitch_bend(ch, channel[ch].pitchbend); clear_bitset(channel_program_flags + ch, 0, 128); @@ -1350,7 +1350,8 @@ if(val == CTL_LAST_STATUS) { restore = 1; - if((val = lastbends[ch]) == 0) + val = lastbends[ch]; + if(!val || (val != '<' && val != '>')) val = ' '; } else @@ -1366,6 +1367,7 @@ { if(val != '=') lastbends[ch] = val; + else lastbends[ch] = ' '; wmove(dftwin, NOTE_LINE+ch, COLS-2); waddch(dftwin, val); scr_modified_flag = 1; diff -ruN TiMidity++-1.3.9/interface/xaw_i.c TiMidity++-1.3.10/interface/xaw_i.c --- TiMidity++-1.3.9/interface/xaw_i.c Mon Apr 5 02:22:28 1999 +++ TiMidity++-1.3.10/interface/xaw_i.c Thu Apr 22 12:56:35 1999 @@ -75,6 +75,7 @@ #include "readmidi.h" #include "controls.h" #include "timer.h" +#include "strtab.h" #ifndef S_ISDIR #define S_ISDIR(mode) (((mode)&0xF000) == 0x4000) @@ -226,6 +227,7 @@ extern int a_pipe_read(char *,int); extern int a_pipe_nread(char *buf, int n); static void initStatus(void); +static void safe_getcwd(char *cwd, int maxlen); static Widget title_mb,title_sm,time_l,popup_load,popup_load_f,load_d,load_t; static Widget load_vport,load_flist,cwd_l,load_info, lyric_t; @@ -367,19 +369,19 @@ x_hot,y_hot, root_height, root_width; static Pixmap bm_Pixmap[MAXBITMAP]; static int max_files, init_options = 0, init_chorus = 0; -char basepath[PATH_MAX]; -String *dirlist = NULL, *flist = NULL; -Dimension trace_width, trace_height, menu_width; +static char basepath[PATH_MAX]; +static String *dirlist = NULL, dirlist_top, *flist = NULL; +static Dimension trace_width, trace_height, menu_width; static int total_time = 0, curr_time; static float thumbj; static XFontStruct *labelfont,*volumefont,*tracefont; #ifdef I18N -XFontSet ttitlefont; -XFontStruct *ttitlefont0; -char **ml; -XFontStruct **fs_list; +static XFontSet ttitlefont; +static XFontStruct *ttitlefont0; +static char **ml; +static XFontStruct **fs_list; #else -XFontStruct *ttitlefont; +static XFontStruct *ttitlefont; #define ttitlefont0 ttitlefont #endif @@ -1506,6 +1508,63 @@ return(s1); } +/* Canonicalize by removing /. and /foo/.. if they appear. */ +static char *canonicalize_path(char *path) +{ + char *o, *p, *target; + int abspath; + + o = p = path; + while(*p) + { + if(p[0] == '/' && p[1] == '/') + p++; + else + *o++ = *p++; + } + while(path < o-1 && path[o - path - 1] == '/') + o--; + path[o - path] = '\0'; + + if((p = strchr(path, '/')) == NULL) + return path; + abspath = (p == path); + + o = target = p; + while(*p) + { + if(*p != '/') + *o++ = *p++; + else if(p[0] == '/' && p[1] == '.' + && (p[2]=='/' || p[2] == '\0')) + { + /* If "/." is the entire filename, keep the "/". Otherwise, + just delete the whole "/.". */ + if(o == target && p[2] == '\0') + *o++ = *p; + p += 2; + } + else if(p[0] == '/' && p[1] == '.' && p[2] == '.' + /* `/../' is the "superroot" on certain file systems. */ + && o != target + && (p[3]=='/' || p[3] == '\0')) + { + while(o != target && (--o) && *o != '/') + ; + p += 3; + if(o == target && !abspath) + o = target = p; + } + else + *o++ = *p++; + } + + target[o - target] = '\0'; + if(!*path) + strcpy(path, "/"); + return path; +} + static char *expandDir(char *path, DirPath *full) { static char tmp[PATH_MAX]; static char newfull[PATH_MAX]; @@ -1517,7 +1576,7 @@ full->dirname = tmp; full->basename = NULL; strcpy(newfull, tmp); return newfull; - } else if (NULL == (tail = strrchr(path, '/'))) { + } else if (*p != '~' && NULL == (tail = strrchr(path, '/'))) { p = tmp; strcpy(p, basepath); full->dirname = p; @@ -1552,7 +1611,7 @@ snprintf(tmp, sizeof(tmp), "%s/%s", basepath, path); } } - p = tmp; + p = canonicalize_path(tmp); tail = strrchr(p, '/'); *tail++ = '\0'; full->dirname = p; full->basename = tail; @@ -1575,7 +1634,13 @@ strcpy(basepath,p); p = strrchr(basepath, '/'); if (*(p+1) == '\0') *p = '\0'; - lrs.string = ""; dirlist[0] = (char *)NULL; + lrs.string = ""; + if(dirlist != NULL) + { + free(dirlist_top); + free(dirlist); + dirlist = NULL; + } setDirList(load_flist, cwd_l, &lrs); } } @@ -1605,36 +1670,31 @@ static void setDirList(Widget list, Widget label, XawListReturnStruct *lrs) { URL dirp; struct stat st; - char *p, currdir[PATH_MAX], filename[PATH_MAX]; + char currdir[PATH_MAX], filename[PATH_MAX]; int i, d_num, f_num; - strcpy(currdir, basepath); - - if(!strncmp("../", lrs->string, 3)) { - if(currdir != (p = strrchr(currdir, '/'))) - *p = '\0'; - else - currdir[1] = '\0'; - } else { - if(currdir[1] != '\0') strcat(currdir, "/"); - strcat(currdir, lrs->string); - if(stat(currdir, &st) == -1) return; - if(!S_ISDIR(st.st_mode)) { + snprintf(currdir, sizeof(currdir)-1, "%s/%s", basepath, lrs->string); + canonicalize_path(currdir); + if(stat(currdir, &st) == -1) return; + if(!S_ISDIR(st.st_mode)) { XtVaSetValues(load_d,XtNvalue,currdir,NULL); return; - } - currdir[strlen(currdir)-1] = '\0'; - } + } + if (NULL != (dirp=url_dir_open(currdir))) { char *fullpath; MBlockList pool; + StringTable strtab; init_mblock(&pool); - for(i= 0; dirlist[i] != NULL; i++) - XtFree(dirlist[i]); + if(dirlist != NULL) + { + free(dirlist_top); + free(dirlist); + } + init_string_table(&strtab); i = 0; d_num = 0; f_num = 0; - while (url_gets(dirp, filename, sizeof(filename)) != NULL - && i < MAX_DIRECTORY_ENTRY) { + while (url_gets(dirp, filename, sizeof(filename)) != NULL) { fullpath = (char *)new_segment(&pool,strlen(currdir) +strlen(filename) +2); sprintf(fullpath, "%s/%s", currdir, filename); if(stat(fullpath, &st) == -1) continue; @@ -1646,18 +1706,24 @@ } else { f_num++; } - dirlist[i] = XtMalloc(sizeof(char) * (strlen(filename) + 1)); - strcpy(dirlist[i++], filename); + put_string_table(&strtab, filename, strlen(filename)); + i++; } + dirlist = (String *)make_string_array(&strtab); + dirlist_top = (String)dirlist[0]; /* Marking for free() */ qsort (dirlist, i, sizeof (char *), dirlist_cmp); - dirlist[i] = NULL; snprintf(local_buf, sizeof(local_buf), "%d Directories, %d Files", d_num, f_num); XawListChange(list,dirlist,0,0,True); - XtVaSetValues(label,XtNlabel,currdir,NULL); - XtVaSetValues(load_info,XtNlabel,local_buf,NULL); - strcpy(basepath, currdir); - XtVaSetValues(load_d,XtNvalue,currdir,NULL); } + else + strcpy(local_buf, "Can't read directry"); + + XtVaSetValues(load_info,XtNlabel,local_buf,NULL); + XtVaSetValues(label,XtNlabel,currdir,NULL); + strcpy(basepath, currdir); + if(currdir[strlen(currdir) - 1] != '/') + strcat(currdir, "/"); + XtVaSetValues(load_d,XtNvalue,currdir,NULL); } static void drawBar(int ch,int len, int xofs, int column, Pixel color) { @@ -3062,12 +3128,9 @@ XReadBitmapFile(disp,RootWindow(disp,screen),cbuf,&bm_width[i],&bm_height[i], &bm_Pixmap[i],&x_hot,&y_hot); } -#ifndef STDC_HEADERS - getwd(basepath); -#else - getcwd(basepath, sizeof(basepath)); -#endif - if (!strlen(basepath)) strcat(basepath, "/"); + + safe_getcwd(basepath, sizeof(basepath)); + #ifdef OFFIX DndInitialize(toplevel); DndRegisterOtherDrop(FileDropedHandler); @@ -3284,8 +3347,7 @@ XtAddCallback(time_l,XtNcallback,(XtCallbackProc)filemenuAction,NULL); XtRealizeWidget(toplevel); - dirlist =(String *)malloc(sizeof(String)* MAX_DIRECTORY_ENTRY); - dirlist[0] = (char *)NULL; + dirlist = NULL; lrs.string = ""; setDirList(load_flist, cwd_l, &lrs); XtSetKeyboardFocus(base_f, base_f); @@ -3474,4 +3536,14 @@ stopCB(NULL,NULL,NULL); if(ctl->trace_playing) initStatus(); XtAppMainLoop(app_con); +} + +static void safe_getcwd(char *cwd, int maxlen) +{ + if(!getcwd(cwd, maxlen)) + { + ctl->cmsg(CMSG_WARNING, VERB_NORMAL, + "Warning: Can't get current working directory"); + strcpy(cwd, "."); + } } diff -ruN TiMidity++-1.3.9/libarc/arc_tar.c TiMidity++-1.3.10/libarc/arc_tar.c --- TiMidity++-1.3.9/libarc/arc_tar.c Mon Feb 22 17:42:38 1999 +++ TiMidity++-1.3.10/libarc/arc_tar.c Fri Jul 9 16:53:19 1999 @@ -17,6 +17,7 @@ #define TARHDRSIZ 512 static long octal_value(char *s, int len); +static int tar_checksum(char *hdr); ArchiveEntryNode *next_tar_entry(ArchiveHandler archiver) { @@ -51,7 +52,7 @@ { if(hdr[0] == '\0') return NULL; - if(memcmp(hdr + 257, "ustar", 5) != 0) + if(!tar_checksum(hdr)) return NULL; } size = octal_value(hdr + 124, 12); @@ -121,4 +122,33 @@ len--; } return val; +} + +static int tar_checksum(char *hdr) +{ + int i; + + long recorded_sum; + long unsigned_sum; /* the POSIX one :-) */ + long signed_sum; /* the Sun one :-( */ + + recorded_sum = octal_value(hdr + 148, 8); + unsigned_sum = 0; + signed_sum = 0; + for(i = 0; i < TARBLKSIZ; i++) + { + unsigned_sum += 0xFF & hdr[i]; + signed_sum += hdr[i]; + } + + /* Adjust checksum to count the "chksum" field as blanks. */ + for(i = 0; i < 8; i++) + { + unsigned_sum -= 0xFF & hdr[148 + i]; + signed_sum -= hdr[i]; + } + unsigned_sum += ' ' * 8; + signed_sum += ' ' * 8; + + return unsigned_sum == recorded_sum || signed_sum == recorded_sum; } diff -ruN TiMidity++-1.3.9/timidity/Makefile.in TiMidity++-1.3.10/timidity/Makefile.in --- TiMidity++-1.3.9/timidity/Makefile.in Sat Apr 17 15:54:27 1999 +++ TiMidity++-1.3.10/timidity/Makefile.in Fri Jul 9 18:18:23 1999 @@ -352,7 +352,6 @@ ../utils/mblock.h output.h controls.h ../libarc/arc.h \ ../utils/memb.h ../utils/nkflib.h wrd.h controls.o: controls.c ../config.h ../interface.h timidity.h controls.h -dl_dlopen.o: dl_dlopen.c ../config.h timidity.h dlutils.h filter.o: filter.c ../config.h timidity.h common.h ../libarc/url.h \ ../utils/mblock.h controls.h instrum.h filter.h instrum.o: instrum.c ../config.h timidity.h common.h ../libarc/url.h \ diff -ruN TiMidity++-1.3.9/timidity/recache.c TiMidity++-1.3.10/timidity/recache.c --- TiMidity++-1.3.9/timidity/recache.c Mon Nov 30 17:43:04 1998 +++ TiMidity++-1.3.10/timidity/recache.c Sun Apr 18 15:41:44 1999 @@ -173,7 +173,7 @@ a = ((double)sp->sample_rate * freq_table[note]) / ((double)sp->root_freq * play_mode->rate); - slen = (int32)(sp->data_length / a); + slen = (int32)((sp->data_length >> FRACTION_BITS) / a); if(len > slen) len = slen; } diff -ruN TiMidity++-1.3.9/timidity/resample.c TiMidity++-1.3.10/timidity/resample.c --- TiMidity++-1.3.9/timidity/resample.c Mon Nov 30 17:43:24 1998 +++ TiMidity++-1.3.10/timidity/resample.c Sun Apr 18 15:41:44 1999 @@ -867,6 +867,13 @@ a = ((double) (sp->sample_rate) * freq_table[(int) (sp->note_to_use)]) / ((double) (sp->root_freq) * play_mode->rate); + if(sp->data_length / a >= 0x7fffffffL) + { + /* Too large to compute */ + ctl->cmsg(CMSG_INFO, VERB_DEBUG, " *** Can't pre-resampling for note %d", + sp->note_to_use); + return; + } newlen = (int32)(sp->data_length / a); dest = newdata = (int16 *)safe_malloc((newlen >> (FRACTION_BITS - 1)) + 2); diff -ruN TiMidity++-1.3.9/timidity/timidity.c TiMidity++-1.3.10/timidity/timidity.c --- TiMidity++-1.3.9/timidity/timidity.c Sat Mar 20 06:17:19 1999 +++ TiMidity++-1.3.10/timidity/timidity.c Thu Apr 22 12:54:14 1999 @@ -1068,7 +1068,7 @@ i = 0; } if((cp = strchr(tmp + i, '#')) != NULL) { - if(cp == tmp + i || isspace(cp[-1]) || isspace(cp[1])) + if(cp == tmp + i || isspace((int)cp[-1]) || isspace((int)cp[1])) *cp = '\0'; }