AmendHub

Download:

jcs

/

subtext

/

amendments

/

146

util: Import bug fixes from Amend in progress and xGetStringAsChar


jcs made amendment 146 over 2 years ago
--- util.c Mon Jun 13 15:50:58 2022 +++ util.c Wed Jun 15 13:30:55 2022 @@ -433,7 +433,6 @@ progress(char *format, ...) va_list argptr; Rect bounds = { 100, 90, 160, 420 }; /* tlbr */ Rect trect; - static WindowPtr progress_win; short ttype; if (format == NULL) { @@ -442,7 +441,6 @@ progress(char *format, ...) DisposHandle(progress_ditl_h); progress_dialog = NULL; } - SetPort(progress_win); return; } @@ -452,8 +450,6 @@ progress(char *format, ...) CtoPstr(progress_s); if (progress_dialog == NULL) { - GetPort(&progress_win); - progress_ditl_h = xNewHandle(sizeof(progress_ditl)); HLock(progress_ditl_h); memcpy(*progress_ditl_h, progress_ditl, sizeof(progress_ditl)); @@ -533,18 +529,18 @@ xGetString(short id) char * xGetStringAsChar(short id) { - StringHandle h = xGetString(id); + StringHandle h; char *out; size_t l; + h = xGetString(id); HLock(h); - l = (*h)[0]; out = xmalloc(l + 1); memcpy((void *)out, (void *)(*h + 1), l); out[l] = '\0'; + ReleaseResource(h); - DisposHandle(h); return out; }