Changeset 691
- Timestamp:
- 12/29/09 09:07:41 (2 years ago)
- Files:
-
- sweep/trunk/plugins/ladspa/ladspameta.c (modified) (2 diffs)
- sweep/trunk/src/about_dialog.c (modified) (2 diffs)
- sweep/trunk/src/channelops.c (modified) (2 diffs)
- sweep/trunk/src/db_ruler.c (modified) (2 diffs)
- sweep/trunk/src/file_dialogs.c (modified) (7 diffs)
- sweep/trunk/src/file_mad.c (modified) (4 diffs)
- sweep/trunk/src/file_sndfile1.c (modified) (6 diffs)
- sweep/trunk/src/file_speex.c (modified) (8 diffs)
- sweep/trunk/src/file_vorbis.c (modified) (10 diffs)
- sweep/trunk/src/head.c (modified) (1 diff)
- sweep/trunk/src/param.c (modified) (6 diffs)
- sweep/trunk/src/paste_dialogs.c (modified) (2 diffs)
- sweep/trunk/src/question_dialogs.c (modified) (2 diffs)
- sweep/trunk/src/samplerate.c (modified) (2 diffs)
- sweep/trunk/src/sw_chooser.c (modified) (2 diffs)
- sweep/trunk/src/sweep_sample.c (modified) (11 diffs)
- sweep/trunk/src/sweep_undo.c (modified) (6 diffs)
- sweep/trunk/src/time_ruler.c (modified) (3 diffs)
- sweep/trunk/src/view.c (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sweep/trunk/plugins/ladspa/ladspameta.c
r688 r691 653 653 ladspa_meta_add_procs (gchar * dir, gchar * name) 654 654 { 655 #define PATH_LEN 256 656 gchar path[PATH_LEN]; 655 gchar path[256]; 657 656 void * module; 658 657 LADSPA_Descriptor_Function desc_func; … … 663 662 sw_procedure * proc; 664 663 665 snprintf (path, PATH_LEN, "%s/%s", dir, name);664 snprintf (path, sizeof (path), "%s/%s", dir, name); 666 665 667 666 module = dlopen (path, RTLD_NOW); sweep/trunk/src/about_dialog.c
r688 r691 57 57 GtkWidget *vbox; 58 58 GtkWidget *label; 59 #define BUF_LEN 64 60 gchar buf[BUF_LEN]; 59 gchar buf[64]; 61 60 GtkWidget * button; 62 61 GtkWidget * about_image; … … 98 97 * gtk_widget_push_style(style); 99 98 */ 100 snprintf (buf, BUF_LEN, "%s %s", _("This is Sweep version"), VERSION);99 snprintf (buf, sizeof (buf), "%s %s", _("This is Sweep version"), VERSION); 101 100 label = gtk_label_new(buf); 102 101 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 0); sweep/trunk/src/channelops.c
r688 r691 139 139 dup_channels (sw_sample * sample, int new_channels) 140 140 { 141 #undef BUF_LEN 142 #define BUF_LEN 128 143 char buf[BUF_LEN]; 141 char buf[128]; 144 142 145 143 if (sample->sounddata->format->channels == 1) { 146 g_snprintf (buf, BUF_LEN, _("Duplicate to %d channels"), new_channels);144 g_snprintf (buf, sizeof (buf), _("Duplicate to %d channels"), new_channels); 147 145 } else { 148 g_snprintf (buf, BUF_LEN, _("Duplicate from %d to %d channels"),146 g_snprintf (buf, sizeof (buf), _("Duplicate from %d to %d channels"), 149 147 sample->sounddata->format->channels, new_channels); 150 148 } … … 629 627 change_channels (sw_sample * sample, int new_channels) 630 628 { 631 #undef BUF_LEN 632 #define BUF_LEN 128 633 char buf[BUF_LEN]; 634 635 g_snprintf (buf, BUF_LEN, _("Convert from %d to %d channels"), 629 char buf[128]; 630 631 g_snprintf (buf, sizeof (buf), _("Convert from %d to %d channels"), 636 632 sample->sounddata->format->channels, new_channels); 637 633 sweep/trunk/src/db_ruler.c
r688 r691 341 341 gfloat subd_incr; 342 342 gfloat start, end, cur; 343 #define UNIT_STR_LEN 32 344 gchar unit_str[UNIT_STR_LEN]; 343 gchar unit_str[32]; 345 344 gint digit_height; 346 345 gint digit_offset; … … 468 467 469 468 if (db_cur > -10.0) { 470 snprintf (unit_str, UNIT_STR_LEN, "%1.1f", db_cur);469 snprintf (unit_str, sizeof (unit_str), "%1.1f", db_cur); 471 470 } else { 472 snprintf (unit_str, UNIT_STR_LEN, "%2.0f", db_cur);471 snprintf (unit_str, sizeof (unit_str), "%2.0f", db_cur); 473 472 } 474 473 sweep/trunk/src/file_dialogs.c
r688 r691 143 143 { 144 144 struct stat statbuf; 145 146 #undef BUF_LEN 147 #define BUF_LEN 512 148 char buf[BUF_LEN]; 145 char buf[512]; 149 146 150 147 gchar * dirname; … … 155 152 switch (errno) { 156 153 case ENOENT: 157 snprintf (buf, BUF_LEN, _("%s does not exist."), dirname);154 snprintf (buf, sizeof (buf), _("%s does not exist."), dirname); 158 155 info_dialog_new (_("Directory does not exist"), NULL, buf); 159 156 g_free (dirname); … … 361 358 sw_view * view = (sw_view *)data; 362 359 sw_sample * sample; 363 #undef BUF_LEN 364 #define BUF_LEN 512 365 char buf[BUF_LEN]; 360 char buf[512]; 366 361 367 362 sample = view->sample; 368 363 369 snprintf (buf, BUF_LEN,364 snprintf (buf, sizeof (buf), 370 365 _("Are you sure you want to revert %s to\n%s?\n\n" 371 366 "All changes and undo information will be lost."), … … 692 687 save_as_data * sd; 693 688 694 #undef BUF_LEN 695 #define BUF_LEN 512 696 char buf[BUF_LEN]; 697 689 char buf[512]; 698 690 char * last_save; 699 691 … … 808 800 sweep_perror (errno, _("You are not allowed to write to\n%s"), filename); 809 801 } else { 810 snprintf (buf, BUF_LEN, _("%s exists. Overwrite?"), filename);802 snprintf (buf, sizeof (buf), _("%s exists. Overwrite?"), filename); 811 803 812 804 question_dialog_new (sample, _("File exists"), buf, … … 868 860 sw_view * view = (sw_view *)data; 869 861 sw_sample * sample; 870 #undef BUF_LEN 871 #define BUF_LEN 512 872 char buf[BUF_LEN]; 862 char buf[512]; 873 863 874 864 sample = view->sample; … … 878 868 sample_save_as_cb (widget, data); 879 869 } else if (sample_mtime_changed (sample)) { 880 snprintf (buf, BUF_LEN,870 snprintf (buf, sizeof (buf), 881 871 _("%s\n has changed on disk.\n\n" 882 872 "Are you sure you want to save?"), sweep/trunk/src/file_mad.c
r688 r691 87 87 * reimplement this check as a contextual verfification of 88 88 * a sequence of frames, starting from somewhere in the middle 89 * of a file. in the mean time, raise BUF_LENfrom 2048 to 819289 * of a file. in the mean time, raise size of buf from 2048 to 8192 90 90 * to mitigate the chance of a false negative. (with an increased 91 91 * change of a false positive as a result.) 92 92 */ 93 #define BUF_LEN 8192 94 unsigned char buf[BUF_LEN]; 93 unsigned char buf[8192]; 95 94 int n, i; 96 95 … … 98 97 if (fd == -1) goto out_false; 99 98 100 n = read (fd, buf, BUF_LEN);99 n = read (fd, buf, sizeof (buf)); 101 100 if (n < 4) goto out_false; 102 101 103 102 /* Check for MPEG frame marker */ 104 for (i = 0; i < BUF_LEN-1; i++) {103 for (i = 0; i < sizeof (buf)-1; i++) { 105 104 if ((buf[i] & 0xff) == 0xff && (buf[i+1] & 0xe0) == 0xe0) { 106 105 goto out_true; … … 378 377 sample_load_mad_info (sw_sample * sample, char * pathname) 379 378 { 380 #undef BUF_LEN 381 #define BUF_LEN 128 382 char buf[BUF_LEN]; 379 char buf[128]; 383 380 384 381 gboolean isnew = (sample == NULL); … … 427 424 } 428 425 429 g_snprintf (buf, BUF_LEN, _("Loading %s"), g_basename (sample->pathname));426 g_snprintf (buf, sizeof (buf), _("Loading %s"), g_basename (sample->pathname)); 430 427 431 428 schedule_operation (sample, buf, &mad_load_op, sample); sweep/trunk/src/file_sndfile1.c
r688 r691 53 53 #include "view.h" 54 54 55 #define BUF_LEN 12856 57 55 extern GtkStyle * style_wb; 58 56 … … 78 76 sweep_sndfile_perror (SNDFILE * sndfile, gchar * pathname) 79 77 { 80 #undef BUF_LEN 81 #define BUF_LEN 128 82 char buf[BUF_LEN]; 83 84 sf_error_str (sndfile, buf, BUF_LEN); 78 char buf[128]; 79 80 sf_error_str (sndfile, buf, sizeof (buf)); 85 81 86 82 sweep_perror (errno, "libsndfile: %s\n\n%s", buf, … … 623 619 { 624 620 SNDFILE * sndfile; 625 #undef BUF_LEN 626 #define BUF_LEN 128 627 char buf[BUF_LEN]; 621 char buf[128]; 628 622 gchar * message; 629 623 … … 653 647 } 654 648 655 sf_error_str (NULL, buf, BUF_LEN);656 if (!strncmp (buf, RAW_ERR_STR_1, BUF_LEN) ||657 !strncmp (buf, RAW_ERR_STR_2, BUF_LEN)) {649 sf_error_str (NULL, buf, sizeof (buf)); 650 if (!strncmp (buf, RAW_ERR_STR_1, sizeof (buf)) || 651 !strncmp (buf, RAW_ERR_STR_2, sizeof (buf))) { 658 652 659 653 so = g_malloc0 (sizeof(*so)); … … 722 716 } 723 717 724 g_snprintf (buf, BUF_LEN, _("Loading %s"), g_basename (sample->pathname));718 g_snprintf (buf, sizeof (buf), _("Loading %s"), g_basename (sample->pathname)); 725 719 726 720 sf = g_malloc0 (sizeof(sf_data)); … … 947 941 sndfile_sample_save (sw_sample * sample, gchar * pathname) 948 942 { 949 char buf[ BUF_LEN];950 951 g_snprintf (buf, BUF_LEN, _("Saving %s"), g_basename (pathname));943 char buf[128]; 944 945 g_snprintf (buf, sizeof (buf), _("Saving %s"), g_basename (pathname)); 952 946 953 947 schedule_operation (sample, buf, &sndfile_save_op, g_strdup (pathname)); sweep/trunk/src/file_speex.c
r688 r691 83 83 #endif 84 84 85 #define BUFFER_LEN 102486 87 85 #include <glib.h> 88 86 #include <gdk/gdkkeysyms.h> … … 120 118 #define HAVE_SPEEX_BETA4 121 119 #endif 122 123 #define BUF_LEN 128124 120 125 121 #define MODE_KEY "Speex_Mode" … … 527 523 sample_load_speex_info (sw_sample * sample, char * pathname) 528 524 { 529 #undef BUF_LEN 530 #define BUF_LEN 128 531 char buf[BUF_LEN]; 525 char buf[128]; 532 526 533 527 gboolean isnew = (sample == NULL); … … 575 569 } 576 570 577 g_snprintf (buf, BUF_LEN, _("Loading %s"), g_basename (sample->pathname));571 g_snprintf (buf, sizeof (buf), _("Loading %s"), g_basename (sample->pathname)); 578 572 579 573 schedule_operation (sample, buf, &speex_load_op, sample); … … 958 952 /* Report success or failure; Calculate and display statistics */ 959 953 960 #undef BUF_LEN961 #define BUF_LEN 16962 963 954 if (remaining <= 0) { 964 char time_buf[ BUF_LEN], bytes_buf[BUF_LEN];955 char time_buf[16], bytes_buf[16]; 965 956 966 957 sample_store_and_free_pathname (sample, pathname); … … 973 964 sample->modified = FALSE; 974 965 975 snprint_time (time_buf, BUF_LEN,966 snprint_time (time_buf, sizeof (time_buf), 976 967 frames_to_time (format, nr_frames - remaining)); 977 968 978 snprint_bytes (bytes_buf, BUF_LEN, bytes_written);969 snprint_bytes (bytes_buf, sizeof (bytes_buf), bytes_written); 979 970 980 971 average_bitrate = … … 989 980 average_bitrate); 990 981 } else { 991 char time_buf[ BUF_LEN], bytes_buf[BUF_LEN];992 993 snprint_time (time_buf, BUF_LEN,982 char time_buf[16], bytes_buf[16]; 983 984 snprint_time (time_buf, sizeof (time_buf), 994 985 frames_to_time (format, nr_frames - remaining)); 995 986 996 snprint_bytes (bytes_buf, BUF_LEN, bytes_written);987 snprint_bytes (bytes_buf, sizeof (bytes_buf), bytes_written); 997 988 998 989 average_bitrate = … … 1035 1026 speex_sample_save (sw_sample * sample, char * pathname) 1036 1027 { 1037 #undef BUF_LEN 1038 #define BUF_LEN 64 1039 char buf[BUF_LEN]; 1040 1041 g_snprintf (buf, BUF_LEN, _("Saving %s"), g_basename (pathname)); 1028 char buf[64]; 1029 1030 g_snprintf (buf, sizeof (buf), _("Saving %s"), g_basename (pathname)); 1042 1031 1043 1032 schedule_operation (sample, buf, &speex_save_op, pathname); sweep/trunk/src/file_vorbis.c
r688 r691 78 78 #include <vorbis/vorbisenc.h> 79 79 80 #define BUFFER_LEN 102481 82 80 #include <glib.h> 83 81 #include <gdk/gdkkeysyms.h> … … 103 101 #include "../pixmaps/vorbisword2.xpm" 104 102 #include "../pixmaps/xifish.xpm" 105 106 #define BUF_LEN 128107 103 108 104 #define QUALITY_KEY "OggVorbis_Quality" … … 251 247 int ret; 252 248 253 #undef BUF_LEN 254 #define BUF_LEN 128 255 char buf[BUF_LEN]; 249 char buf[128]; 256 250 257 251 gboolean isnew = (sample == NULL); … … 322 316 } 323 317 324 g_snprintf (buf, BUF_LEN, _("Loading %s"), g_basename (sample->pathname));318 g_snprintf (buf, sizeof (buf), _("Loading %s"), g_basename (sample->pathname)); 325 319 326 320 #ifdef DEVEL_CODE … … 331 325 sw_metadata * metadata = NULL; 332 326 333 #undef BUF_LEN 334 #define BUF_LEN 1024 335 char buf[BUF_LEN]; 327 char buf[1024]; 336 328 int n = 0; 337 329 … … 346 338 metadata_list = g_list_append (metadata_list, metadata); 347 339 348 n += snprintf (buf+n, BUF_LEN-n, "%s: %s\n",340 n += snprintf (buf+n, sizeof (buf)-n, "%s: %s\n", 349 341 metadata->name, metadata->content); 350 342 } … … 614 606 /* Report success or failure; Calculate and display statistics */ 615 607 616 #undef BUF_LEN617 #define BUF_LEN 16618 619 608 if (remaining <= 0) { 620 char time_buf[ BUF_LEN], bytes_buf[BUF_LEN];609 char time_buf[16], bytes_buf[16]; 621 610 622 611 sample_store_and_free_pathname (sample, pathname); … … 629 618 sample->modified = FALSE; 630 619 631 snprint_time (time_buf, BUF_LEN,620 snprint_time (time_buf, sizeof (time_buf), 632 621 frames_to_time (format, nr_frames - remaining)); 633 622 634 snprint_bytes (bytes_buf, BUF_LEN, bytes_written);623 snprint_bytes (bytes_buf, sizeof (bytes_buf), bytes_written); 635 624 636 625 average_bitrate = … … 645 634 average_bitrate); 646 635 } else { 647 char time_buf[ BUF_LEN], bytes_buf[BUF_LEN];648 649 snprint_time (time_buf, BUF_LEN,636 char time_buf[16], bytes_buf[16]; 637 638 snprint_time (time_buf, sizeof (time_buf), 650 639 frames_to_time (format, nr_frames - remaining)); 651 640 652 snprint_bytes (bytes_buf, BUF_LEN, bytes_written);641 snprint_bytes (bytes_buf, sizeof (bytes_buf), bytes_written); 653 642 654 643 average_bitrate = … … 692 681 vorbis_sample_save (sw_sample * sample, char * pathname) 693 682 { 694 #undef BUF_LEN 695 #define BUF_LEN 64 696 char buf[BUF_LEN]; 697 698 g_snprintf (buf, BUF_LEN, _("Saving %s"), g_basename (pathname)); 683 char buf[64]; 684 685 g_snprintf (buf, sizeof (buf), _("Saving %s"), g_basename (pathname)); 699 686 700 687 schedule_operation (sample, buf, &vorbis_save_op, pathname); sweep/trunk/src/head.c
r688 r691 234 234 sw_framecount_t offset = head->offset; 235 235 236 #define BUF_LEN 16 237 char buf[BUF_LEN]; 238 239 snprint_time (buf, BUF_LEN, 236 char buf[16]; 237 238 snprint_time (buf, sizeof (buf), 240 239 frames_to_time (sample->sounddata->format, offset)); 241 240 sweep/trunk/src/param.c
r690 r691 135 135 print_param (sw_param_type type, sw_param p) 136 136 { 137 #define BUF_LEN 64 138 gchar buf[BUF_LEN]; 139 140 snprint_param (buf, BUF_LEN, type, p); 137 gchar buf[64]; 138 139 snprint_param (buf, sizeof (buf), type, p); 141 140 printf ("%s", buf); 142 #undef BUF_LEN143 141 } 144 142 … … 363 361 int valid=0; 364 362 365 #define BUF_LEN 64 366 gchar buf[BUF_LEN]; 363 gchar buf[64]; 367 364 368 365 GtkWidget * table; … … 433 430 plsk[j].p2 = &pspec->constraint.list[j+1]; 434 431 435 snprint_param (buf, BUF_LEN, pspec->type,432 snprint_param (buf, sizeof (buf), pspec->type, 436 433 pspec->constraint.list[j+1]); 437 434 … … 527 524 528 525 return table; 529 530 #undef BUF_LEN531 526 } 532 527 … … 581 576 GtkWidget * text; 582 577 583 #define BUF_LEN 1024 584 gchar buf[BUF_LEN]; 578 gchar buf[1024]; 585 579 gint n; 586 580 … … 648 642 * gdk_font_load("-Adobe-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*"); 649 643 * 650 * n = snprintf (buf, BUF_LEN, "%s\n\n", _(proc->name));644 * n = snprintf (buf, sizeof (buf), "%s\n\n", _(proc->name)); 651 645 * gtk_text_insert (GTK_TEXT (text), font, NULL, NULL, buf, n); 652 646 */ sweep/trunk/src/paste_dialogs.c
r688 r691 168 168 169 169 sw_time_t duration; 170 171 #undef BUF_LEN 172 #define BUF_LEN 16 173 char buf[BUF_LEN]; 170 char buf[16]; 174 171 175 172 if (xfade) { … … 315 312 316 313 duration = frames_to_time (sample->sounddata->format, clipboard_width ()); 317 snprint_time (buf, BUF_LEN, duration);314 snprint_time (buf, sizeof (buf), duration); 318 315 319 316 label = gtk_label_new (buf); sweep/trunk/src/question_dialogs.c
r557 r691 216 216 info_dialog_data * id; 217 217 va_list ap; 218 #define BUF_LEN 512 219 char buf[BUF_LEN]; 218 char buf[512]; 220 219 221 220 va_start (ap, fmt); 222 vsnprintf (buf, BUF_LEN, fmt, ap);221 vsnprintf (buf, sizeof (buf), fmt, ap); 223 222 va_end (ap); 224 223 … … 266 265 sweep_perror_data * pd; 267 266 va_list ap; 268 #undef BUF_LEN 269 #define BUF_LEN 512 270 char buf[BUF_LEN]; 267 char buf[512]; 271 268 272 269 va_start (ap, fmt); 273 vsnprintf (buf, BUF_LEN, fmt, ap);270 vsnprintf (buf, sizeof (buf), fmt, ap); 274 271 va_end (ap); 275 272 sweep/trunk/src/samplerate.c
r587 r691 81 81 int channel = 0; 82 82 83 /* float input[BUFFER_LEN], output[BUFFER_LEN];*/84 83 SRC_STATE * src_state; 85 84 SRC_DATA src_data; … … 227 226 { 228 227 src_options * so; 229 230 #undef BUF_LEN 231 #define BUF_LEN 128 232 char buf[BUF_LEN]; 233 234 g_snprintf (buf, BUF_LEN, _("Resample from %d Hz to %d Hz"), 228 char buf[128]; 229 230 g_snprintf (buf, sizeof (buf), _("Resample from %d Hz to %d Hz"), 235 231 sample->sounddata->format->rate, new_rate); 236 232 sweep/trunk/src/sw_chooser.c
r271 r691 146 146 { 147 147 GtkWidget * direct_entry; 148 #define BUF_LEN 16 149 char buf[BUF_LEN]; 148 char buf[16]; 150 149 151 150 direct_entry = … … 157 156 */ 158 157 if (number > 0) { 159 snprintf (buf, BUF_LEN, "%d", number);158 snprintf (buf, sizeof (buf), "%d", number); 160 159 } else { 161 160 buf[0] = '\0'; sweep/trunk/src/sweep_sample.c
r688 r691 288 288 glong bytes; 289 289 290 #undef BUF_LEN 291 #define BUF_LEN 16 292 char buf[BUF_LEN]; 290 char buf[16]; 293 291 294 292 dialog = gtk_widget_get_toplevel (widget); … … 310 308 gtk_label_set_text (GTK_LABEL(memsize_label), _("Overflow")); 311 309 } else { 312 snprint_bytes (buf, BUF_LEN, bytes);310 snprint_bytes (buf, sizeof (buf), bytes); 313 311 gtk_label_set_text (GTK_LABEL(memsize_label), buf); 314 312 } … … 385 383 GtkTooltips * tooltips; 386 384 387 #define BUF_LEN 16 388 gchar buf[BUF_LEN]; 385 gchar buf[16]; 389 386 390 387 dialog = gtk_dialog_new (); … … 447 444 gtk_widget_show (entry); 448 445 449 snprint_time (buf, BUF_LEN, duration);446 snprint_time (buf, sizeof (buf), duration); 450 447 gtk_entry_set_text (GTK_ENTRY (entry), buf); 451 448 … … 608 605 609 606 gtk_widget_show (dialog); 610 611 #undef BUF_LEN612 607 } 613 608 … … 1218 1213 { 1219 1214 va_list ap; 1220 #undef BUF_LEN 1221 #define BUF_LEN 512 1222 char buf[BUF_LEN]; 1215 char buf[512]; 1223 1216 1224 1217 va_start (ap, fmt); 1225 vsnprintf (buf, BUF_LEN, fmt, ap);1218 vsnprintf (buf, sizeof (buf), fmt, ap); 1226 1219 va_end (ap); 1227 1220 … … 1605 1598 { 1606 1599 int n; 1607 #undef BUF_LEN 1608 #define BUF_LEN 64 1609 gchar buf[BUF_LEN]; 1600 gchar buf[64]; 1610 1601 sw_format * format = s->sounddata->format; 1611 1602 sw_sel * sel; 1612 1603 1613 n = snprintf (buf, BUF_LEN, _("Insert selection ["));1614 n += snprint_time (buf+n, BUF_LEN-n,1604 n = snprintf (buf, sizeof (buf), _("Insert selection [")); 1605 n += snprint_time (buf+n, sizeof (buf)-n, 1615 1606 frames_to_time (format, s->tmp_sel->sel_start)); 1616 n += snprintf (buf+n, BUF_LEN-n, " - ");1617 n += snprint_time (buf+n, BUF_LEN-n,1607 n += snprintf (buf+n, sizeof (buf)-n, " - "); 1608 n += snprint_time (buf+n, sizeof (buf)-n, 1618 1609 frames_to_time (format, s->tmp_sel->sel_end)); 1619 n += snprintf (buf+n, BUF_LEN-n, "]");1610 n += snprintf (buf+n, sizeof (buf)-n, "]"); 1620 1611 1621 1612 g_mutex_lock (s->sounddata->sels_mutex); … … 1629 1620 1630 1621 perform_selection_op (s, buf, ssits, NULL, sel); 1631 #undef BUF_LEN1632 1622 } 1633 1623 … … 1659 1649 { 1660 1650 int n; 1661 #define BUF_LEN 64 1662 gchar buf[BUF_LEN]; 1651 gchar buf[64]; 1663 1652 sw_format * format = s->sounddata->format; 1664 1653 sw_sel * sel; 1665 1654 1666 n = snprintf (buf, BUF_LEN, _("Subtract selection ["));1667 n += snprint_time (buf+n, BUF_LEN-n,1655 n = snprintf (buf, sizeof (buf), _("Subtract selection [")); 1656 n += snprint_time (buf+n, sizeof (buf)-n, 1668 1657 frames_to_time (format, s->tmp_sel->sel_start)); 1669 n += snprintf (buf+n, BUF_LEN-n, " - ");1670 n += snprint_time (buf+n, BUF_LEN-n,1658 n += snprintf (buf+n, sizeof (buf)-n, " - "); 1659 n += snprint_time (buf+n, sizeof (buf)-n, 1671 1660 frames_to_time (format, s->tmp_sel->sel_end)); 1672 n += snprintf (buf+n, BUF_LEN-n, "]");1661 n += snprintf (buf+n, sizeof (buf)-n, "]"); 1673 1662 1674 1663 g_mutex_lock (s->sounddata->sels_mutex); … … 1704 1693 { 1705 1694 int n; 1706 #define BUF_LEN 64 1707 gchar buf[BUF_LEN]; 1695 gchar buf[64]; 1708 1696 sw_format * format = s->sounddata->format; 1709 1697 sw_sel * sel; 1710 1698 1711 n = snprintf (buf, BUF_LEN, _("Set selection ["));1712 n += snprint_time (buf+n, BUF_LEN-n,1699 n = snprintf (buf, sizeof (buf), _("Set selection [")); 1700 n += snprint_time (buf+n, sizeof (buf)-n, 1713 1701 frames_to_time (format, s->tmp_sel->sel_start)); 1714 n += snprintf (buf+n, BUF_LEN-n, " - ");1715 n += snprint_time (buf+n, BUF_LEN-n,1702 n += snprintf (buf+n, sizeof (buf)-n, " - "); 1703 n += snprint_time (buf+n, sizeof (buf)-n, 1716 1704 frames_to_time (format, s->tmp_sel->sel_end)); 1717 n += snprintf (buf+n, BUF_LEN-n, "]");1705 n += snprintf (buf+n, sizeof (buf)-n, "]"); 1718 1706 1719 1707 g_mutex_lock (s->sounddata->sels_mutex); … … 1738 1726 GtkWidget * clist = sample->info_clist; 1739 1727 1740 #define RATE_BUF_LEN 16 1741 char rate_buf[RATE_BUF_LEN]; 1742 1743 #define CHAN_BUF_LEN 16 1744 char chan_buf[CHAN_BUF_LEN]; 1745 1746 #define BYTE_BUF_LEN 16 1747 char byte_buf[BYTE_BUF_LEN]; 1748 1749 #define TIME_BUF_LEN 16 1750 char time_buf[TIME_BUF_LEN]; 1728 char rate_buf[16]; 1729 char chan_buf[16]; 1730 char byte_buf[16]; 1731 char time_buf[16]; 1751 1732 1752 1733 if (clist == NULL) return; 1753 1734 1754 snprintf (rate_buf, RATE_BUF_LEN, "%d Hz", sounddata->format->rate);1755 1756 snprintf (chan_buf, CHAN_BUF_LEN, "%d", sounddata->format->channels);1757 1758 snprint_bytes (byte_buf, BYTE_BUF_LEN,1735 snprintf (rate_buf, sizeof (rate_buf), "%d Hz", sounddata->format->rate); 1736 1737 snprintf (chan_buf, sizeof (chan_buf), "%d", sounddata->format->channels); 1738 1739 snprint_bytes (byte_buf, sizeof (byte_buf), 1759 1740 frames_to_bytes (sounddata->format, sounddata->nr_frames)); 1760 1741 1761 snprint_time (time_buf, TIME_BUF_LEN,1742 snprint_time (time_buf, sizeof (time_buf), 1762 1743 frames_to_time (sounddata->format, sounddata->nr_frames)); 1763 1744 sweep/trunk/src/sweep_undo.c
r688 r691 152 152 sw_sample * sample = inst->sample; 153 153 154 #define BUF_LEN 128 155 gchar buf[BUF_LEN]; 156 157 g_snprintf (buf, BUF_LEN, "%s (%%p%%%%)", inst->description); 154 gchar buf[128]; 155 156 g_snprintf (buf, sizeof (buf), "%s (%%p%%%%)", inst->description); 158 157 sample_set_progress_text (sample, buf); 159 158 … … 164 163 pthread_create (&sample->ops_thread, NULL, (void *) (*op_main), sample); 165 164 } 166 #undef BUF_LEN167 165 } 168 166 … … 303 301 { 304 302 sw_op_instance * inst; 305 #undef BUF_LEN 306 #define BUF_LEN 512 307 char buf[BUF_LEN]; 303 char buf[512]; 308 304 309 305 inst = sw_op_instance_new (sample, description, operation); … … 313 309 !sample->edit_ignore_mtime && sample_mtime_changed (sample)) { 314 310 315 snprintf (buf, BUF_LEN,311 snprintf (buf, sizeof (buf), 316 312 _("%s\n has changed on disk.\n\n" 317 313 "Do you want to continue editing this buffer?"), … … 444 440 { 445 441 sw_operation * op; 446 #undef BUF_LEN 447 #define BUF_LEN 128 448 gchar buf[BUF_LEN]; 449 450 g_snprintf (buf, BUF_LEN, "Undo %s", inst->description); 442 gchar buf[128]; 443 444 g_snprintf (buf, sizeof (buf), "Undo %s", inst->description); 451 445 452 446 if (inst->op->edit_mode == SWEEP_EDIT_MODE_FILTER) … … 525 519 { 526 520 sw_operation * op; 527 528 #define BUF_LEN 128 529 gchar buf[BUF_LEN]; 530 531 g_snprintf (buf, BUF_LEN, "Redo %s", inst->description); 521 gchar buf[128]; 522 523 g_snprintf (buf, sizeof (buf), "Redo %s", inst->description); 532 524 533 525 if (inst->op->edit_mode == SWEEP_EDIT_MODE_FILTER) sweep/trunk/src/time_ruler.c
r688 r691 184 184 gdouble subd_incr; 185 185 gdouble start, end, cur; 186 #define UNIT_STR_LEN 32 187 gchar unit_str[UNIT_STR_LEN]; 186 gchar unit_str[32]; 188 187 gint digit_height; 189 188 gint digit_offset; … … 245 244 */ 246 245 scale = ceil (ruler->max_size / TIME_RULER(ruler)->samplerate); 247 snprint_time (unit_str, UNIT_STR_LEN, (sw_time_t)scale); 248 /* snprint_time_smpte (unit_str, UNIT_STR_LEN, (sw_time_t)scale, 10.0);*/ 246 snprint_time (unit_str, sizeof (unit_str), (sw_time_t)scale); 249 247 250 248 text_width = strlen (unit_str) * digit_height + 1; … … 296 294 if (i == 0) 297 295 { 298 snprint_time (unit_str, UNIT_STR_LEN, (sw_time_t)cur);296 snprint_time (unit_str, sizeof (unit_str), (sw_time_t)cur); 299 297 pango_layout_set_text (layout, unit_str, -1); 300 298 pango_layout_get_extents (layout, NULL, &logical_rect); sweep/trunk/src/view.c
r688 r691 1396 1396 view_set_pos_indicator_cb (GtkWidget * widget, gpointer data) 1397 1397 { 1398 char buf[16]; 1398 1399 SampleDisplay * sd = SAMPLE_DISPLAY(data); 1399 1400 sw_view * view = sd->view; 1400 1401 1401 #define BUF_LEN 161402 char buf[BUF_LEN];1403 1404 1402 if (sd->mouse_offset >= 0) { 1405 snprint_time (buf, BUF_LEN,1403 snprint_time (buf, sizeof (buf), 1406 1404 frames_to_time (view->sample->sounddata->format, 1407 1405 sd->mouse_offset)); … … 1410 1408 gtk_label_set_text (GTK_LABEL(view->pos), NO_TIME); 1411 1409 } 1412 1413 1414 #undef BUF_LEN1415 1410 } 1416 1411 … … 2595 2590 sw_framecount_t orig_length; 2596 2591 sw_time_t length; 2597 #define BUF_LEN 16 2598 gchar buf[BUF_LEN]; 2592 gchar buf[16]; 2599 2593 gfloat step; 2600 2594 … … 2611 2605 /* Update duration displayed in zoom combo */ 2612 2606 length = frames_to_time (view->sample->sounddata->format, end-start); 2613 snprint_time (buf, BUF_LEN, length);2607 snprint_time (buf, sizeof (buf), length); 2614 2608 2615 2609 entry = GTK_COMBO(view->zoom_combo)->entry; … … 2643 2637 view_refresh_title(view); 2644 2638 view_refresh_display(view); 2645 2646 #undef BUF_LEN2647 2639 } 2648 2640 … … 3097 3089 sw_framecount_t offset; 3098 3090 static int rate_limit = 0; 3099 3100 3101 #define BUF_LEN 16 3102 char buf[BUF_LEN]; 3091 char buf[16]; 3103 3092 3104 3093 offset = (sample->play_head->going ? … … 3106 3095 sample->user_offset); 3107 3096 3108 snprint_time (buf, BUF_LEN,3097 snprint_time (buf, sizeof (buf), 3109 3098 frames_to_time (sample->sounddata->format, offset)); 3110 3099 /* cheesy rate limiter. ugly in operation. limits pango damage */ … … 3116 3105 gtk_entry_set_text (GTK_ENTRY(view->play_pos), buf); 3117 3106 #endif 3118 3119 3107 } 3120 3108 ++rate_limit; 3121 #undef BUF_LEN3122 3109 3123 3110 sample_display_refresh_play_marker (sd); … … 3168 3155 view_set_progress_ready (sw_view * view) 3169 3156 { 3170 #define BUF_LEN 64 3171 static gchar buf[BUF_LEN]; 3157 gchar buf[64]; 3172 3158 3173 3159 if (view == NULL) return; 3174 3160 3175 snprintf (buf, BUF_LEN, "%s%s - %s",3161 snprintf (buf, sizeof (buf), "%s%s - %s", 3176 3162 view->sample->modified ? "*" : "", 3177 3163 g_basename (view->sample->pathname), … … 3180 3166 gtk_progress_set_format_string (GTK_PROGRESS(view->progress), buf); 3181 3167 gtk_progress_set_percentage (GTK_PROGRESS(view->progress), 0.0); 3182 #undef BUF_LEN3183 3168 } 3184 3169 … … 3216 3201 { 3217 3202 sw_sample * sample = view->sample; 3218 #define BUF_LEN 256 3219 char buf[BUF_LEN]; 3203 char buf[256]; 3220 3204 3221 3205 if (sample->modified && g_list_length (sample->views) == 1) { 3222 snprintf (buf, BUF_LEN, _("%s has been modified. Close anyway?"),3206 snprintf (buf, sizeof (buf), _("%s has been modified. Close anyway?"), 3223 3207 g_basename (sample->pathname)); 3224 3208 question_dialog_new (sample, _("File modified"), buf, … … 3256 3240 view_refresh_title (sw_view * view) 3257 3241 { 3242 char buf[256]; 3258 3243 sw_sample * s = (sw_sample *)view->sample; 3259 3244 3260 #define BUF_LEN 2563261 char buf[BUF_LEN];3262 3263 3245 if (s->sounddata->nr_frames > 0) { 3264 snprintf(buf, BUF_LEN,3246 snprintf(buf, sizeof (buf), 3265 3247 "%s%s %0d%% - Sweep " VERSION, 3266 3248 s->modified ? _("*") : "", … … 3269 3251 s->progress_percent); 3270 3252 } else { 3271 snprintf(buf, BUF_LEN,3253 snprintf(buf, sizeof (buf), 3272 3254 "%s%s %s - Sweep " VERSION, 3273 3255 s->modified ? _("*") : "", … … 3277 3259 3278 3260 gtk_window_set_title (GTK_WINDOW(view->window), buf); 3279 #undef BUF_LEN3280 3261 } 3281 3262 … … 3286 3267 sw_sounddata * sounddata = s->sounddata; 3287 3268 3288 #define BYTE_BUF_LEN 16 3289 char byte_buf[BYTE_BUF_LEN]; 3290 3291 #define TIME_BUF_LEN 16 3292 char time_buf[TIME_BUF_LEN]; 3293 3294 #define CHAN_BUF_LEN 16 3295 char chan_buf[CHAN_BUF_LEN]; 3296 3297 #define BUF_LEN 256 3298 char buf [BUF_LEN]; 3299 3300 snprint_bytes (byte_buf, BYTE_BUF_LEN, 3269 char byte_buf[16]; 3270 char time_buf[16]; 3271 char chan_buf[16]; 3272 char buf [256]; 3273 3274 snprint_bytes (byte_buf, sizeof (byte_buf), 3301 3275 frames_to_bytes (sounddata->format, sounddata->nr_frames)); 3302 3276 3303 snprint_time (time_buf, TIME_BUF_LEN,3277 snprint_time (time_buf, sizeof (time_buf), 3304 3278 frames_to_time (sounddata->format, sounddata->nr_frames)); 3305 3279 3306 3280 switch (s->sounddata->format->channels) { 3307 3281 case 1: 3308 snprintf (chan_buf, CHAN_BUF_LEN, _("Mono"));3282 snprintf (chan_buf, sizeof (chan_buf), _("Mono")); 3309 3283 break; 3310 3284 case 2: 3311 snprintf (chan_buf, CHAN_BUF_LEN, _("Stereo"));3285 snprintf (chan_buf, sizeof (chan_buf), _("Stereo")); 3312 3286 break; 3313 3287 default: 3314 snprintf (chan_buf, CHAN_BUF_LEN, "%d %s", s->sounddata->format->channels,3288 snprintf (chan_buf, sizeof (chan_buf), "%d %s", s->sounddata->format->channels, 3315 3289 _("channels")); 3316 3290 break; 3317 3291 } 3318 3292 3319 snprintf (buf, BUF_LEN,3293 snprintf (buf, sizeof (buf), 3320 3294 "%dHz %s [%s]", 3321 3295 s->sounddata->format->rate, … … 3323 3297 3324 3298 gtk_label_set_text (GTK_LABEL(view->status), buf); 3325 3326 #undef BUF_LEN3327 #undef BYTE_BUF_LEN3328 #undef TIME_BUF_LEN3329 3299 } 3330 3300
