"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/aguix/util.cc" between
worker-4.7.0.tar.bz2 and worker-4.8.0.tar.bz2

About: Worker is a file manager for the X Window System with the classical two panel interface.

util.cc  (worker-4.7.0.tar.bz2):util.cc  (worker-4.8.0.tar.bz2)
/* util.cc /* util.cc
* This file belongs to Worker, a file manager for UN*X/X11. * This file belongs to Worker, a file manager for UN*X/X11.
* Copyright (C) 2001-2017 Ralf Hoffmann. * Copyright (C) 2001-2021 Ralf Hoffmann.
* You can contact me at: ralf@boomerangsworld.de * You can contact me at: ralf@boomerangsworld.de
* or http://www.boomerangsworld.de/worker * or http://www.boomerangsworld.de/worker
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 30 skipping to change at line 30
*/ */
#include "util.h" #include "util.h"
#include "lowlevelfunc.h" #include "lowlevelfunc.h"
#include <cctype> #include <cctype>
#include <algorithm> #include <algorithm>
#include <stdarg.h> #include <stdarg.h>
#include <functional> #include <functional>
#include <stdlib.h> #include <stdlib.h>
#include <cmath> #include <cmath>
#include "utf8.hh"
int createLines( const char *text, char ***ret_lines, const char split ) int createLines( const char *text, char ***ret_lines, const char split )
{ {
int lines; int lines;
int i, p; int i, p;
short ignorenext; short ignorenext;
lines=1; lines=1;
ignorenext = 0; ignorenext = 0;
for(i=0;i<(int)strlen(text);i++) { for(i=0;i<(int)strlen(text);i++) {
skipping to change at line 475 skipping to change at line 476
for ( pos = 0; for ( pos = 0;
pos < (int)str.length() && str[pos] == ' '; pos < (int)str.length() && str[pos] == ' ';
pos++ ); pos++ );
if ( pos > 0 ) { if ( pos > 0 ) {
std::string nv( str, pos ); std::string nv( str, pos );
str = nv; str = nv;
} }
} }
std::string remove_char( const std::string &str,
char ch )
{
std::string res;
const char *in = str.c_str();
for ( ; *in != '\0'; ) {
size_t l = UTF8::getLenOfCharacter( in );
if ( l < 1 ) {
break;
} if ( l == 1 && *in == ch ) {
// skip
in++;
} else {
for ( size_t t = 0; t < l; t++ ) {
res += *in++;
}
}
}
return res;
}
std::string timeToString( time_t t ) std::string timeToString( time_t t )
{ {
char buf[128]; char buf[128];
struct tm converted_tm = { 0 }; struct tm converted_tm = { 0 };
localtime_r( &t, &converted_tm ); localtime_r( &t, &converted_tm );
if ( strftime( buf, sizeof( buf ), if ( strftime( buf, sizeof( buf ),
"%Y-%m-%d %H:%M:%S", &converted_tm ) > 0 ) { "%Y-%m-%d %H:%M:%S", &converted_tm ) > 0 ) {
return std::string( buf ); return std::string( buf );
 End of changes. 3 change blocks. 
1 lines changed or deleted 25 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)