Revision 64

Date:
2007/05/21 05:44:33
Author:
gdshaw@RISCPKG.ORG
Revision Log:
Disabled exceptions and enabled optimisation to reduce code size.
Files:

Legend:

 
Added
 
Removed
 
Modified
  • trunk/filer/auto_buffer.cc

     
    3 3 // Redistribution and modification are permitted under the terms of the
    4 4 // GNU General Public License (version 2 or any later version).
    5 5
    6 #include <new>
    7
    6 8 #include "auto_buffer.h"
    7 9
    8 10 auto_buffer::auto_buffer(size_type size):
    9 _buffer(new char[size])
    11 _buffer(new(std::nothrow) char[size])
    10 12 {}
    11 13
    12 14 auto_buffer& auto_buffer::operator=(auto_buffer& buffer)
  • trunk/filer/directory.cc

     
    4 4 // GNU General Public License (version 2 or any later version).
    5 5
    6 6 #include <cstring>
    7 #include <new>
    7 8
    8 9 #include "oslib/osfscontrol.h"
    9 10
     
    44 45 if (capacity>_capacity)
    45 46 {
    46 47 // Allocate new, larger array.
    47 value_type* new_values=new value_type[capacity];
    48 value_type* new_values=new(std::nothrow) value_type[capacity];
    48 49 value_type* old_values=_values;
    49 50
    50 51 // Copy values from old array to new array.
     
    218 219 {
    219 220 // If the leafname is not already present then create
    220 221 // a new entry and insert it into the directory.
    221 value_type info((osgbpb_info*)new int[info_words]);
    222 value_type info(
    223 (osgbpb_info*)new(std::nothrow) int[info_words]);
    222 224 *info=*info_src;
    223 225 strcpy(info->name,info_src->name);
    224 226 insert(info,f);
  • trunk/filer/filer_application.cc

     
    3 3 // Redistribution and modification are permitted under the terms of the
    4 4 // GNU General Public License (version 2 or any later version).
    5 5
    6 #include <new>
    7
    6 8 #include "oslib/os.h"
    7 9 #include "oslib/wimp.h"
    8 10
     
    94 96 box.y1=pos.y;
    95 97
    96 98 // Open new filer window.
    97 new filer_window(this,message.dir_name,box,get_default_options());
    99 new(std::nothrow) filer_window(
    100 this,message.dir_name,box,get_default_options());
    98 101 }
    99 102
    100 103 void filer_application::handle_mode_change()
  • trunk/filer/filer_menu.cc

     
    5 5
    6 6 #include <cstring>
    7 7 #include <cstdio>
    8 #include <new>
    8 9
    9 10 #include "oslib/fileraction.h"
    10 11 #include "oslib/osfscontrol.h"
     
    38 39 _rename_leafname(0),
    39 40 _find_pattern(0),
    40 41 _filetype_field(0),
    41 _selection_text(new char[12+max_name_length]),
    42 _selection_text(new(std::nothrow) char[12+max_name_length]),
    42 43 _layout_count(3),
    43 _layout_methods(new layout_method*[_layout_count]),
    44 _layout_methods(new(std::nothrow) layout_method*[_layout_count]),
    44 45 _sort_count(4),
    45 _sort_methods(new sort_method*[_sort_count])
    46 _sort_methods(new(std::nothrow) sort_method*[_sort_count])
    46 47 {
    47 48 _layout_methods[0]=&filer_options::layout_large();
    48 49 _layout_methods[1]=&filer_options::layout_small();
     
    63 64 _display_menu[7].text("Sort by date");
    64 65 _display_menu[3].separator(1);
    65 66
    66 _rename_leafname=new char[256];
    67 _rename_leafname=new(std::nothrow) char[256];
    67 68 _rename_leafname[0]=0;
    68 69 _rename_menu[0].text(_rename_leafname,256);
    69 70 _rename_menu[0].writable(1);
     
    77 78 _access_menu[1].separator(1);
    78 79 _access_menu[3].separator(1);
    79 80
    80 _find_pattern=new char[256];
    81 _find_pattern=new(std::nothrow) char[256];
    81 82 _find_pattern[0]=0;
    82 83 _find_menu[0].text(_find_pattern,256);
    83 84 _find_menu[0].writable(1);
    84 85
    85 _filetype_field=new char[16];
    86 _filetype_field=new(std::nothrow) char[16];
    86 87 _filetype_field[0]=0;
    87 88 _filetype_menu[0].text(_filetype_field,16);
    88 89 _filetype_menu[0].writable(1);
  • trunk/filer/filer_window.cc

     
    5 5
    6 6 #include <cstring>
    7 7 #include <cstdio>
    8 #include <new>
    8 9
    9 10 #include "oslib/osbyte.h"
    10 11 #include "oslib/osfscontrol.h"
     
    45 46 filer_window::filer_window(filer_application* app,const char* pathname,
    46 47 const os_box& box,const filer_options& options):
    47 48 window(app),
    48 _pathname(new char[std::strlen(pathname)+1]),
    49 _pathname(new(std::nothrow) char[std::strlen(pathname)+1]),
    49 50 _options(options),
    50 51 _directory(options.sort()),
    51 52 _xcsize(68),
     
    487 488 if (!_shared_menu)
    488 489 {
    489 490 wimp_open_template(template_pathname);
    490 _shared_menu=new filer_menu(parent_application());
    491 _shared_menu=new(std::nothrow) filer_menu(parent_application());
    491 492 wimp_close_template();
    492 493 }
    493 494 return *_shared_menu;
     
    803 804
    804 805 // Open new window.
    805 806 *lastdot=0;
    806 new filer_window((filer_application*)parent_application(),
    807 _pathname,box,_options);
    807 new(std::nothrow) filer_window(
    808 (filer_application*)parent_application(),_pathname,box,_options);
    808 809 *lastdot='.';
    809 810 }
    810 811 }
     
    864 865 if (std::strlen(_pathname)+std::strlen(info.name)+1<max_name_length)
    865 866 {
    866 867 std::sprintf(buffer,"%s.%s",_pathname,info.name);
    867 window* w=new filer_window(
    868 window* w=new(std::nothrow) filer_window(
    868 869 (filer_application*)parent_application(),
    869 870 buffer,box,_options);
    870 871 }
  • trunk/filer/header.cmhg

     
    3 3 ; Redistribution and modification are permitted under the terms of the
    4 4 ; GNU General Public License (version 2 or any later version).
    5 5
    6 title-string: Filer
    6 title-string: Filer2
    7 7
    8 8 help-string: Filer\t2.10 � Graham Shaw
    9 9
  • trunk/filer/main.cc

     
    3 3 // Redistribution and modification are permitted under the terms of the
    4 4 // GNU General Public License (version 2 or any later version).
    5 5
    6 #include <new>
    7
    6 8 #include "header.h"
    7 9 #include "filer_application.h"
    8 10 #include "main.h"
     
    24 26 {
    25 27 if (!app)
    26 28 {
    27 app=new filer_application;
    29 app=new(std::nothrow) filer_application;
    28 30 app->run(&pollword);
    29 31 delete app;
    30 32 app=0;
  • trunk/filer/Makefile

     
    10 10 FIXDEPS = fixdeps
    11 11
    12 12 CPPFLAGS = -IOSLib:
    13 CXXFLAGS = -mthrowback -mlibscl -mmodule \
    13 CXXFLAGS = -mthrowback -mlibscl -mmodule -fno-exceptions -Os \
    14 14 -Wall -W -Wno-unused -Wno-uninitialized -mpoke-function-name
    15 15 ASFLAGS = -throwback -objasm -module -apcs32 -apcsfpv3 -target xscale -IOSLib:
    16 16 LDFLAGS = -mlibscl -mmodule
  • trunk/filer/menu.cc

     
    4 4 // GNU General Public License (version 2 or any later version).
    5 5
    6 6 #include <cstring>
    7 #include <new>
    7 8
    8 9 #include "menu_item.h"
    9 10 #include "menu.h"
     
    14 15 _data(0)
    15 16 {
    16 17 // Allocate data block.
    17 _data=(wimp_menu*)new char[sizeof(wimp_menu)+size*sizeof(wimp_menu_entry)];
    18 _data=(wimp_menu*)new(std::nothrow)
    19 char[sizeof(wimp_menu)+size*sizeof(wimp_menu_entry)];
    18 20
    19 21 // Initialise menu header.
    20 22 std::strcpy(_data->title_data.text,title);
  • trunk/filer/new.cc

     
    7 7
    8 8 #include "oslib/osmodule.h"
    9 9
    10 void* operator new(size_t size)
    10 void* operator new(size_t size,const std::nothrow_t&)
    11 11 {
    12 12 return osmodule_alloc(size);
    13 13 }
     
    17 17 osmodule_free(block);
    18 18 }
    19 19
    20 void* operator new[](size_t size)
    20 void* operator new[](size_t size,const std::nothrow_t&)
    21 21 {
    22 22 return osmodule_alloc(size);
    23 23 }
  • trunk/filer/pathname_table.cc

     
    5 5
    6 6 #include <cstring>
    7 7 #include <cstdio>
    8 #include <new>
    8 9
    9 10 #include "oslib/os.h"
    10 11 #include "oslib/osfscontrol.h"
     
    75 76 {
    76 77 // Reallocate index data (without allowing the existing index
    77 78 // to become invalid until it is no longer needed).
    78 int* new_index_data=new int[capacity];
    79 int* new_index_data=new(std::nothrow) int[capacity];
    79 80 for (unsigned int i=0;i!=_size;++i)
    80 81 {
    81 82 new_index_data[i]=_index_data[i];
     
    87 88 // Reallocate index node pointers (again, without allowing the
    88 89 // existing node pointers to become invalid until they are no
    89 90 // longer needed).
    90 volatile node** new_index_nodes=new volatile node*[capacity];
    91 volatile node** new_index_nodes=
    92 new(std::nothrow) volatile node*[capacity];
    91 93 for (unsigned int i=0;i!=_size;++i)
    92 94 {
    93 95 new_index_nodes[i]=_index_nodes[i];
     
    99 101 // Create new nodes.
    100 102 while (_capacity<capacity)
    101 103 {
    102 node* n=new node;
    104 node* n=new(std::nothrow) node;
    103 105 n->next=_free.next;
    104 106 _free.next=n;
    105 107 ++_capacity;
  • trunk/filer/rtl.cc

     
    1 // This file is part of the free Filer module for RISC OS.
    2 // Copyright � 2007 Graham Shaw.
    3 // Redistribution and modification are permitted under the terms of the
    4 // GNU General Public License (version 2 or any later version).
    5
    6 #include <csignal>
    7
    8 /** Attempt to execute pure virtual function.
    9 * If the normal RTL is allowed to handle this then it will attempt to
    10 * throw an exception, which will pull in all the exception handling code.
    11 * Instead, throw a SIGSEGV.
    12 */
    13 extern "C"
    14 void __cxa_pure_virtual()
    15 {
    16 std::raise(SIGSEGV);
    17 }
  • trunk/filer/window_table.cc

     
    3 3 // Redistribution and modification are permitted under the terms of the
    4 4 // GNU General Public License (version 2 or any later version).
    5 5
    6 #include <new>
    7
    6 8 #include "window.h"
    7 9 #include "window_table.h"
    8 10
    9 11 window_table::window_table(size_type capacity):
    10 12 _size(0),
    11 13 _capacity(capacity),
    12 _nodes(new node[_capacity])
    14 _nodes(new(std::nothrow) node[_capacity])
    13 15 {}
    14 16
    15 17 void window_table::insert(window& w)
     
    18 20 if (_size==_capacity)
    19 21 {
    20 22 _capacity*=2;
    21 node* nodes=new node[_capacity];
    23 node* nodes=new(std::nothrow) node[_capacity];
    22 24 for (size_type i=0;i!=_size;++i)
    23 25 {
    24 26 nodes[i]=_nodes[i];