diff options
| author | maxim nikonov <maxim.nikonov@hqo.co> | 2026-02-06 18:12:40 +0500 |
|---|---|---|
| committer | maxim nikonov <maxim.nikonov@hqo.co> | 2026-02-06 18:12:40 +0500 |
| commit | b4995f979d127cea667b4e2b71c91e9db4ab52ef (patch) | |
| tree | fbebc775e10932bace8d6a7c3481b1ba200c64db /src/Fl_Preferences.cxx | |
| parent | 9575eb0a1ffa8150f70f88b5f6b55f342c3c0088 (diff) | |
wip
Diffstat (limited to 'src/Fl_Preferences.cxx')
| -rw-r--r-- | src/Fl_Preferences.cxx | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/Fl_Preferences.cxx b/src/Fl_Preferences.cxx index ca0b17916..56ed070a1 100644 --- a/src/Fl_Preferences.cxx +++ b/src/Fl_Preferences.cxx @@ -1000,7 +1000,8 @@ static void *decodeHex( const char *src, int &size ) { size = (int) strlen( src )/2; unsigned char *data = (unsigned char*)malloc( size ), *d = data; const char *s = src; - for ( int i=size; i>0; i-- ) { + int i; + for (i =size; i>0; i-- ) { int v; char x = tolower(*s++); if ( x >= 'a' ) v = x-'a'+10; else v = x-'0'; @@ -1517,7 +1518,8 @@ Fl_Preferences::Node::Node( const char *path ) { void Fl_Preferences::Node::deleteAllChildren() { Node *next_node = NULL; - for ( Node *current_node = first_child_; current_node; current_node = next_node ) { + Node *current_node; + for (current_node = first_child_; current_node; current_node = next_node ) { next_node = current_node->next_; delete current_node; } @@ -1528,7 +1530,8 @@ void Fl_Preferences::Node::deleteAllChildren() { void Fl_Preferences::Node::deleteAllEntries() { if ( entry_ ) { - for ( int i = 0; i < nEntry_; i++ ) { + int i; + for (i = 0; i < nEntry_; i++ ) { if ( entry_[i].name ) { ::free( entry_[i].name ); entry_[i].name = NULL; @@ -1583,7 +1586,8 @@ void Fl_Preferences::Node::clearDirtyFlags() { int Fl_Preferences::Node::write( FILE *f ) { if ( next_ ) next_->write( f ); fprintf( f, "\n[%s]\n\n", path_ ); - for ( int i = 0; i < nEntry_; i++ ) { + int i; + for (i = 0; i < nEntry_; i++ ) { char *src = entry_[i].value; if ( src ) { // hack it into smaller pieces if needed fprintf( f, "%s:", entry_[i].name ); @@ -1645,7 +1649,8 @@ Fl_Preferences::Node *Fl_Preferences::Node::addChild( const char *path ) { // create and set, or change an entry within this node void Fl_Preferences::Node::set( const char *name, const char *value ) { - for ( int i=0; i<nEntry_; i++ ) { + int i; + for (i =0; i<nEntry_; i++ ) { if ( strcmp( name, entry_[i].name ) == 0 ) { if ( !value ) return; // annotation if ( strcmp( value, entry_[i].value ) != 0 ) { @@ -1710,7 +1715,8 @@ const char *Fl_Preferences::Node::get( const char *name ) { // find the index of an entry, returns -1 if no such entry int Fl_Preferences::Node::getEntry( const char *name ) { - for ( int i=0; i<nEntry_; i++ ) { + int i; + for (i =0; i<nEntry_; i++ ) { if ( strcmp( name, entry_[i].name ) == 0 ) { return i; } @@ -1784,7 +1790,8 @@ Fl_Preferences::Node *Fl_Preferences::Node::search( const char *path, int offset if ( len > 0 && path[ len ] == 0 ) return this; if ( len <= 0 || path[ len ] == '/' ) { - for ( Node *nd = first_child_; nd; nd = nd->next_ ) { + Node *nd; + for (nd = first_child_; nd; nd = nd->next_ ) { Node *nn = nd->search( path, offset ); if ( nn ) return nn; } @@ -1800,7 +1807,8 @@ int Fl_Preferences::Node::nChildren() { return nIndex_; } else { int cnt = 0; - for ( Node *nd = first_child_; nd; nd = nd->next_ ) + Node *nd; + for (nd = first_child_; nd; nd = nd->next_ ) cnt++; return cnt; } |
