rem
stringlengths
0
274k
add
stringlengths
0
169k
context
stringlengths
9
471k
qDebug( "kio_ftp : ========== DONE DIR ========= %s", _url );
kdebug( KDEBUG_INFO, 0, "========== DONE DIR ========= %s", _url );
int check( KIOConnection *_con );extern "C" { void sigalrm_handler(int);}int main( int, char ** ){ signal(SIGCHLD, KIOProtocol::sigchld_handler); signal(SIGSEGV, KIOProtocol::sigsegv_handler); // KProtocolManager manager; qDebug( "kio_ftp : Starting"); KInstance instance( "kio_ftp" ); KIOConnection parent( 0, 1 ); FtpProtocol ftp( &parent ); ftp.dispatchLoop(); qDebug( "kio_ftp : Done" );}/* * We'll use an alarm that will set this flag when transfer has timed out */char sigbreak = 0;void sigalrm_handler(int){ sigbreak = 1;} void setup_alarm(unsigned int timeout){ sigbreak = 0; alarm(timeout); signal(SIGALRM, sigalrm_handler);}FtpProtocol::FtpProtocol( KIOConnection *_conn ) : KIOProtocol( _conn ){ m_cmd = CMD_NONE; m_bIgnoreJobErrors = false; m_bCanResume = true; // most of ftp servers support resuming ?}void FtpProtocol::slotMkdir( const char *_url, int _mode ){ KURL usrc( _url ); if ( usrc.isMalformed() ) { error( ERR_MALFORMED_URL, strdup(_url) ); m_cmd = CMD_NONE; return; } if ( strcmp( usrc.protocol(), "ftp" ) != 0L ) { error( ERR_INTERNAL, "kio_ftp got non ftp file in mkdir command" ); m_cmd = CMD_NONE; return; } // Connect to the ftp server if ( !ftp.isConnected() ) if ( !ftp.ftpConnect( usrc ) ) { error( ftp.error(), ftp.errorText() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; return; } FtpEntry* e = ftp.ftpStat( usrc ); if ( !e ) { if ( !ftp.ftpMkdir( usrc.path() ) ) { error( ERR_COULD_NOT_MKDIR, strdup(_url) ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } else { // set the desired attributes for dir if ( _mode != -1 ) if ( !ftp.ftpChmod( usrc.path(), _mode ) ) { error( ERR_CANNOT_CHMOD, strdup(_url) ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } finished(); ftp.ftpDisconnect(); return; } } if ( S_ISDIR( e->type ) ) { // !!! ok ? error( ERR_DOES_ALREADY_EXIST, strdup(_url) ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } error( ERR_COULD_NOT_MKDIR, strdup(_url) ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return;}void FtpProtocol::slotCopy( QStringList& _source, const char *_dest ){ doCopy( _source, _dest, false );}void FtpProtocol::slotCopy( const char* _source, const char *_dest ){ QStringList lst; lst.append( _source ); doCopy( lst, _dest, true );}void FtpProtocol::slotMove( QStringList& _source, const char *_dest ){ doCopy( _source, _dest, false, true );}void FtpProtocol::slotMove( const char* _source, const char *_dest ){ QStringList lst; lst.append( _source ); doCopy( lst, _dest, true, true );}void FtpProtocol::doCopy( QStringList& _source, const char *_dest, bool _rename, bool _move ){ if ( _rename ) assert( _source.count() == 1 ); qDebug( "kio_ftp : Making copy to %s", _dest ); // Check whether the URLs are wellformed QStringList::Iterator soit = _source.begin(); for( ; soit != _source.end(); ++soit ) { qDebug( "kio_ftp : Checking %s", (*soit).ascii() ); KURL usrc( *soit ); if ( usrc.isMalformed() ) { error( ERR_MALFORMED_URL, (*soit) ); m_cmd = CMD_NONE; return; } if ( usrc.host().isEmpty() ) { error( ERR_MALFORMED_URL, (*soit) ); // !!! create a new error type ? m_cmd = CMD_NONE; return; } if ( strcmp( usrc.protocol(), "ftp" ) != 0L ) { error( ERR_INTERNAL, "kio_ftp got non ftp file as source in copy command" ); m_cmd = CMD_NONE; return; } } qDebug( "kio_ftp : All URLs ok %s", _dest ); // Make a copy of the parameter. if we do IPC calls from here, then we overwrite // our argument. This is tricky! ( but saves memory and speeds things up ) QString dest = _dest; // Check wellformedness of the destination KURL udest( dest ); if ( udest.isMalformed() ) { error( ERR_MALFORMED_URL, dest ); m_cmd = CMD_NONE; return; } qDebug( "kio_ftp : Dest ok %s", dest.ascii() ); // Find IO server for destination QString exec = KProtocolManager::self().executable( udest.protocol() ); if ( exec.isEmpty() ) { error( ERR_UNSUPPORTED_PROTOCOL, udest.protocol() ); m_cmd = CMD_NONE; return; } // Is the right most protocol a filesystem protocol ? if ( KProtocolManager::self().outputType( udest.protocol() ) != KProtocolManager::T_FILESYSTEM ) { error( ERR_PROTOCOL_IS_NOT_A_FILESYSTEM, udest.protocol() ); m_cmd = CMD_NONE; return; } qDebug( "kio_ftp : IO server ok %s", dest.ascii() ); // Connect to the ftp server KURL usrc( _source.first() ); if ( ! ftp.ftpConnect( usrc ) ) { error( ftp.error(), ftp.errorText() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; return; } qDebug( "kio_ftp : connected to a server" ); // Find out, whether we are logged anonymously or not // Authorization has been already checked with ftp.ftpConnect( usrc ) bool b_user = false; if ( usrc.hasUser() ) { b_user = true; } // Get a list of all source files and directories QValueList<Copy> files; QValueList<CopyDir> dirs; int size = 0; qDebug( "kio_ftp : Iterating" ); soit = _source.begin(); qDebug( "kio_ftp : Looping" ); for( ; soit != _source.end(); ++soit ) { qDebug( "kio_ftp : Executing %s", (*soit).ascii() ); KURL usrc( *soit ); qDebug( "kio_ftp : Parsed URL" ); // Did an error occur ? int s; if ( ( s = listRecursive( usrc.path(), files, dirs, _rename ) ) == -1 ) { ftp.ftpDisconnect(); // Error message is already sent m_cmd = CMD_NONE; return; } // Sum up the total amount of bytes we have to copy size += s; } qDebug( "kio_ftp : Recursive 1 %s", dest.ascii() ); /* // Check wether we do not copy a directory in itself or one of its subdirectories struct stat buff2; if ( udest.isLocalFile() && stat( udest.path(), &buff2 ) == 0 ) { bool b_error = false; for( soit = _source.begin(); soit != _source.end(); ++soit ) { KURL usrc( *soit ); struct stat buff1; // Can we stat both the source, too ? ( Should always be the case ) if ( stat( usrc.path(), &buff1 ) == 0 ) { bool b_error = false; // Are source and dest equal ? => error if ( buff1.st_ino == buff2.st_ino ) b_error = true; } } if ( !b_error ) { // Iterate over all subdirectories QValueList<CopyDir>::iterator it = dirs.begin(); for( ; it != dirs.end() && !b_error; it++ ) if ( buff2.st_ino == (*it).m_ino ) b_error = true; } // Do we have a cylic copy now ? => error if ( b_error ) { error( ERR_CYCLIC_COPY, *soit ); m_cmd = CMD_NONE; return; } } */ qDebug( "kio_ftp : Recursive ok %s", dest.ascii() ); m_cmd = CMD_GET; // Start a server for the destination protocol KIOSlave slave( exec ); if ( slave.pid() == -1 ) { error( ERR_CANNOT_LAUNCH_PROCESS, exec ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; return; } // Put a protocol on top of the job FtpIOJob job( &slave, this ); qDebug( "kio_ftp : Job started ok %s", dest.ascii() ); // Tell our client what we 'r' gonna do totalSize( size ); totalFiles( files.count() ); totalDirs( dirs.count() ); int processed_files = 0; int processed_dirs = 0; int processed_size = 0; // Replace the relative destinations with absolut destinations // by prepending the destinations path QString tmp1 = udest.path( 1 ); // Strip '/' QString tmp1_stripped = udest.path( -1 ); QValueList<CopyDir>::Iterator dit = dirs.begin(); for( ; dit != dirs.end(); dit++ ) { QString tmp2 = (*dit).m_strRelDest; if ( _rename ) (*dit).m_strRelDest = tmp1_stripped; else (*dit).m_strRelDest = tmp1; (*dit).m_strRelDest += tmp2; } QValueList<Copy>::Iterator fit = files.begin(); for( ; fit != files.end(); fit++ ) { QString tmp2 = (*fit).m_strRelDest; if ( _rename ) // !!! && (*fit).m_strRelDest == "" ) (*fit).m_strRelDest = tmp1_stripped; else (*fit).m_strRelDest = tmp1; (*fit).m_strRelDest += tmp2; } qDebug( "kio_ftp : Destinations ok %s", dest.data() ); /***** * Make directories *****/ m_bIgnoreJobErrors = true; bool overwrite_all = false; bool auto_skip = false; bool resume_all = false; QStringList skip_list, overwrite_list; // Create all directories dit = dirs.begin(); for( ; dit != dirs.end(); dit++ ) { // Repeat until we got no error do { job.clearError(); KURL ud( udest ); ud.setPath( (*dit).m_strRelDest); QString d = ud.url(); // Is this URL on the skip list ? bool skip = false; QStringList::Iterator sit = skip_list.begin(); for( ; sit != skip_list.end() && !skip; sit++ ) // Is d a subdirectory of *sit ? if ( *sit==d ) skip = true; if ( skip ) continue; // Is this URL on the overwrite list ? bool overwrite = false; QStringList::Iterator oit = overwrite_list.begin(); for( ; oit != overwrite_list.end() && !overwrite; oit++ ) if ( *oit == d ) overwrite = true; if ( overwrite ) continue; // Tell what we are doing makingDir( d.data() ); // qDebug( "kio_ftp : Making remote dir %s", d ); // Create the directory job.mkdir( d.data(), (*dit).m_access ); while( !job.hasFinished() ) job.dispatch(); // Did we have an error ? if ( job.hasError() ) { // Can we prompt the user and ask for a solution ? if ( /* m_bGUI && */ job.errorId() == ERR_DOES_ALREADY_EXIST ) { QString old_path = udest.path( 1 ); QString old_url = udest.url( 1 ); // Should we skip automatically ? if ( auto_skip ) { job.clearError(); // We dont want to copy files in this directory, so we put it on the skip list. skip_list.append( old_url ); continue; } else if ( overwrite_all ) { job.clearError(); continue; } /* RenameDlg_Mode m = (RenameDlg_Mode)( M_SINGLE | M_OVERWRITE ); if ( dirs.count() > 1 ) m = (RenameDlg_Mode)(M_MULTI | M_SKIP | M_OVERWRITE ); */ RenameDlg_Mode m = (RenameDlg_Mode)( M_MULTI | M_SKIP | M_OVERWRITE ); QString tmp2 = udest.url(), n; RenameDlg_Result r = open_RenameDlg( (*dit).m_strAbsSource, tmp2, m, n ); if ( r == R_CANCEL ) { ftp.ftpDisconnect(); error( ERR_USER_CANCELED, "" ); m_cmd = CMD_NONE; return; } else if ( r == R_RENAME ) { KURL u( n ); // The Dialog should have checked this. if ( u.isMalformed() ) assert( 0 ); // The new path with trailing '/' QString tmp3 = u.path( 1 ); /////// // Replace old path with tmp3 /////// QValueList<CopyDir>::Iterator dit2 = dit; // Change the current one and strip the trailing '/' (*dit2).m_strRelDest = u.path( -1 ); // Change the name of all subdirectories dit2++; for( ; dit2 != dirs.end(); dit2++ ) if ( strncmp((*dit2).m_strRelDest, old_path, old_path.length())==0 ) (*dit2).m_strRelDest.replace( 0, old_path.length(), tmp3 ); // Change all filenames QValueList<Copy>::Iterator fit2 = files.begin(); for( ; fit2 != files.end(); fit2++ ) if ( strncmp( (*fit2).m_strRelDest, old_path, old_path.length() ) == 0 ) (*fit2).m_strRelDest.replace( 0, old_path.length(), tmp3 ); // Dont clear error => we will repeat the current command } else if ( r == R_SKIP ) { // Skip all files and directories that start with 'old_url' skip_list.append( old_url ); // Clear the error => The current command is not repeated => skipped job.clearError(); } else if ( r == R_AUTO_SKIP ) { // Skip all files and directories that start with 'old_url' skip_list.append( old_url ); // Clear the error => The current command is not repeated => skipped job.clearError(); auto_skip = true; } else if ( r == R_OVERWRITE ) { // Dont bother for subdirectories overwrite_list.append( old_url ); // Clear the error => The current command is not repeated => we will // overwrite every file in this directory or any of its subdirectories job.clearError(); } else if ( r == R_OVERWRITE_ALL ) { job.clearError(); overwrite_all = true; } else assert( 0 ); } // No need to ask the user, so raise an error else { error( job.errorId(), job.errorText() ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } } } while( job.hasError() ); processedDirs( ++processed_dirs ); } qDebug( "kio_ftp : Created directories %s", dest.data() ); /***** * Server check - supports resuming ? *****/ if ( !ftp.ftpResume( 0 ) ) m_bCanResume = false; /***** * Copy files *****/ time_t t_start = time( 0L ); time_t t_last = t_start; fit = files.begin(); for( ; fit != files.end(); fit++ ) { bool overwrite = false; bool skip_copying = false; bool resume = false; unsigned long offset = 0; // Repeat until we got no error do { job.clearError(); KURL ud( dest ); ud.setPath( (*fit).m_strRelDest); QString d = ud.url(); // Is this URL on the skip list ? bool skip = false; QStringList::Iterator sit = skip_list.begin(); for( ; sit != skip_list.end() && !skip; sit++ ) // Is 'd' a file in directory '*sit' or one of its subdirectories ? if ( *sit==d ) skip = true; if ( skip ) continue; // emit sigCanResume( m_bCanResume ) canResume( m_bCanResume ); QString realpath = "ftp:"; realpath += (*fit).m_strAbsSource; copyingFile( realpath.ascii(), d.ascii() ); // qDebug( "kio_ftp : Writing to %s", d ); // Is this URL on the overwrite list ? QStringList::Iterator oit = overwrite_list.begin(); for( ; oit != overwrite_list.end() && !overwrite; oit++ ) if (*oit==d) overwrite = true; // implicitly set permissions rw-r--r-- for anonymous ftp int md = -1; // but when it's not anonymous ftp, set permissions as in original source if ( b_user ) md = (*fit).m_access; job.put( d, md, overwrite_all || overwrite, resume_all || resume, (*fit).m_size ); while( !job.isReady() && !job.hasFinished() ) job.dispatch(); // Did we have an error ? if ( job.hasError() ) { int currentError = job.errorId(); qDebug("################# COULD NOT PUT %d",currentError); // if ( /* m_bGUI && */ job.errorId() == ERR_WRITE_ACCESS_DENIED ) if ( /* m_bGUI && */ currentError != ERR_DOES_ALREADY_EXIST && currentError != ERR_DOES_ALREADY_EXIST_FULL ) { // Should we skip automatically ? if ( auto_skip ) { job.clearError(); skip_copying = true; continue; } QString tmp2 = ud.url(); SkipDlg_Result r; r = open_SkipDlg( tmp2, ( files.count() > 1 ) ); if ( r == S_CANCEL ) { error( ERR_USER_CANCELED, "" ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } else if ( r == S_SKIP ) { // Clear the error => The current command is not repeated => skipped job.clearError(); skip_copying = true; continue; } else if ( r == S_AUTO_SKIP ) { // Clear the error => The current command is not repeated => skipped job.clearError(); skip_copying = true; continue; } else assert( 0 ); } // Can we prompt the user and ask for a solution ? else if ( /* m_bGUI && */ currentError == ERR_DOES_ALREADY_EXIST || currentError == ERR_DOES_ALREADY_EXIST_FULL ) { // Should we skip automatically ? if ( auto_skip ) { job.clearError(); continue; } RenameDlg_Result r; QString n; if ( KProtocolManager::self().autoResume() && m_bCanResume && currentError != ERR_DOES_ALREADY_EXIST_FULL ) { r = R_RESUME_ALL; } else { RenameDlg_Mode m; // ask for resume only if transfer can be resumed and if it is not // already fully downloaded if ( files.count() > 1 ){ if ( m_bCanResume && currentError != ERR_DOES_ALREADY_EXIST_FULL ) m = (RenameDlg_Mode)(M_MULTI | M_SKIP | M_OVERWRITE | M_RESUME); else m = (RenameDlg_Mode)(M_MULTI | M_SKIP | M_OVERWRITE); } else { if ( m_bCanResume && currentError != ERR_DOES_ALREADY_EXIST_FULL ) m = (RenameDlg_Mode)( M_SINGLE | M_OVERWRITE | M_RESUME); else m = (RenameDlg_Mode)( M_SINGLE | M_OVERWRITE); } QString tmp2 = ud.url(); r = open_RenameDlg( (*fit).m_strAbsSource, tmp2, m, n ); } if ( r == R_CANCEL ) { error( ERR_USER_CANCELED, "" ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } else if ( r == R_RENAME ) { KURL u( n ); // The Dialog should have checked this. if ( u.isMalformed() ) assert( 0 ); renamed( u.path( -1 ) ); // emit signal // Change the destination name of the current file (*fit).m_strRelDest = u.path( -1 ); // Dont clear error => we will repeat the current command } else if ( r == R_SKIP ) { // Clear the error => The current command is not repeated => skipped job.clearError(); } else if ( r == R_AUTO_SKIP ) { // Clear the error => The current command is not repeated => skipped job.clearError(); auto_skip = true; } else if ( r == R_OVERWRITE ) { overwrite = true; // Dont clear error => we will repeat the current command } else if ( r == R_OVERWRITE_ALL ) { overwrite_all = true; // Dont clear error => we will repeat the current command } else if ( r == R_RESUME ) { resume = true; offset = getOffset( ud.url() ); // Dont clear error => we will repeat the current command } else if ( r == R_RESUME_ALL ) { resume_all = true; offset = getOffset( ud.url() ); // Dont clear error => we will repeat the current command } else assert( 0 ); } // No need to ask the user, so raise an error else { error( currentError, job.errorText() ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } } } while( job.hasError() ); if ( skip_copying ) continue; // add the offset to processed size if ( offset > 0 ) { processed_size += offset; qDebug( "kio_ftp : Offset = %ld", offset ); } KURL tmpurl( "ftp:/" ); tmpurl.setPath( (*fit).m_strAbsSource ); qDebug( "kio_ftp : Opening %s", (*fit).m_strAbsSource.ascii() ); if ( !ftp.ftpOpen( tmpurl, Ftp::READ, offset ) ) { error( ftp.error(), ftp.errorText() ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } // we want to know the processed size even before we read something // especially in case we overwrite file => this cleans size to zero processedSize( processed_size ); char buffer[ 4096 ]; int n; int read_size = 0; do { setup_alarm( KProtocolManager::self().readTimeout() ); // start timeout n = ftp.read( buffer, 2048 ); // !!! slow down loop for local testing // for ( int tmpi = 0; tmpi < 1000000; tmpi++ ) ; job.data( buffer, n ); processed_size += n; read_size += n; time_t t = time( 0L ); if ( t - t_last >= 1 ) { processedSize( processed_size ); speed( read_size / ( t - t_start ) ); t_last = t; } // Check parent while ( check( connection() ) ) dispatch(); // Check for error messages from slave while ( check( &slave ) ) job.dispatch(); // An error ? if ( job.hasFinished() ) { ftp.ftpDisconnect(); ftp.ftpClose(); finished(); m_cmd = CMD_NONE; return; } } while ( n > 0 ); job.dataEnd(); ftp.ftpClose(); while( !job.hasFinished() ) job.dispatch(); time_t t = time( 0L ); processedSize( processed_size ); if ( t - t_start >= 1 ) { speed( read_size / ( t - t_start ) ); t_last = t; } processedFiles( ++processed_files ); } qDebug( "kio_ftp : Copied files %s", dest.data() ); // slotDel() handles disconnecting by itself if ( _move ) { slotDel( _source ); } else ftp.ftpDisconnect(); finished(); m_cmd = CMD_NONE;}void FtpProtocol::slotGet( const char *_url ){ KURL usrc( _url ); if ( usrc.isMalformed() ) { error( ERR_MALFORMED_URL, strdup(_url) ); m_cmd = CMD_NONE; return; } if ( strcmp( usrc.protocol(), "ftp" ) != 0L ) { error( ERR_INTERNAL, "kio_ftp got non ftp file in get command" ); m_cmd = CMD_NONE; return; } if ( !ftp.ftpConnect( usrc ) ) { error( ftp.error(), ftp.errorText() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; return; } FtpEntry *e = ftp.ftpStat( usrc ); if ( !e ) { error( ERR_DOES_NOT_EXIST, strdup(_url) ); m_cmd = CMD_NONE; return; } /* if ( S_ISDIR( e->type ) ) { error( ERR_IS_DIRECTORY, strdup(_url) ); m_cmd = CMD_NONE; return; }*/ m_cmd = CMD_GET; if ( !ftp.open( usrc, Ftp::READ ) ) { error( ERR_CANNOT_OPEN_FOR_READING, strdup(_url) ); m_cmd = CMD_NONE; return; } ready(); gettingFile( _url ); totalSize( e->size ); int processed_size = 0; time_t t_start = time( 0L ); time_t t_last = t_start; char buffer[ 2048 ]; while( !ftp.atEOF() ) { int n = ftp.read( buffer, 2048 ); data( buffer, n ); processed_size += n; time_t t = time( 0L ); if ( t - t_last >= 1 ) { processedSize( processed_size ); speed( processed_size / ( t - t_start ) ); t_last = t; } } dataEnd(); ftp.ftpClose(); processedSize( e->size ); time_t t = time( 0L ); if ( t - t_start >= 1 ) speed( processed_size / ( t - t_start ) ); finished(); m_cmd = CMD_NONE;}void FtpProtocol::slotGetSize( const char* _url ) { m_cmd = CMD_GET_SIZE; // Check wether URL is wellformed KURL usrc( _url ); if ( usrc.isMalformed() ) { error( ERR_MALFORMED_URL, _url ); m_cmd = CMD_NONE; return; } if ( strcmp( usrc.protocol(), "ftp" ) != 0L ) { error( ERR_INTERNAL, "kio_ftp got non ftp file in getSize command" ); m_cmd = CMD_NONE; return; } qDebug( "kio_ftp : URL is ok " ); if ( !ftp.ftpConnect( usrc ) ) { error( ftp.error(), ftp.errorText() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; return; } // Get a list of all source files and directories QValueList<Copy> files; QValueList<CopyDir> dirs; qDebug( "kio_ftp : Executing %s", _url ); // Did an error occur ? int s; if ( ( s = listRecursive( usrc.path(), files, dirs, false ) ) == -1 ) { ftp.ftpDisconnect(); // Error message is already sent m_cmd = CMD_NONE; return; } // Tell our client what we 'r' gonna do totalSize( s ); ftp.ftpDisconnect(); finished(); m_cmd = CMD_NONE;}void FtpProtocol::slotPut( const char *_url, int _mode, bool _overwrite, bool _resume, int _size ){ QString url_orig = _url; QString url_part = url_orig + ".part"; KURL udest_orig( url_orig ); KURL udest_part( url_part ); bool m_bMarkPartial = KProtocolManager::self().markPartial(); if ( udest_orig.isMalformed() ) { error( ERR_MALFORMED_URL, url_orig ); m_cmd = CMD_NONE; finished(); return; } if ( strcmp( udest_orig.protocol(), "ftp" ) != 0L ) { error(ERR_INTERNAL,"kio_ftp got non ftp file as as destination in put command" ); m_cmd = CMD_NONE; finished(); return; } // Connect to the ftp server, only if we are not connected // this prevents connecting twice in recursive copying ( mkdir connects first time ) if ( !ftp.isConnected() ) if ( !ftp.ftpConnect( udest_orig ) ) { error( ftp.error(), ftp.errorText() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; finished(); return; } m_cmd = CMD_PUT; // Find out, whether we are logged anonymously or not // Authorization has been already checked with ftp.ftpConnect( usrc ) bool b_user = false; if ( udest_orig.hasUser() ) b_user = true; FtpEntry* e; if ( ( e = ftp.ftpStat( udest_orig ) ) ) { // if original file exists, but we are using mark partial -> rename it to XXX.part if ( m_bMarkPartial ) ftp.ftpRename( udest_orig.path(), udest_part.path() ); if ( !_overwrite && !_resume ) { if ( e->size == _size ) error( ERR_DOES_ALREADY_EXIST_FULL, udest_orig.path() ); else error( ERR_DOES_ALREADY_EXIST, udest_orig.path() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; finished(); return; } } else if ( ( e = ftp.ftpStat( udest_part ) ) ) { // if file with extension .part exists but we are not using mark partial // -> rename XXX.part to original name if ( ! m_bMarkPartial ) ftp.ftpRename( udest_part.path(), udest_orig.path() ); if ( !_overwrite && !_resume ) { if ( e->size == _size ) error( ERR_DOES_ALREADY_EXIST_FULL, udest_orig.path() ); else error( ERR_DOES_ALREADY_EXIST, udest_orig.path() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; finished(); return; } } KURL udest; // if we are using marking of partial downloads -> add .part extension if ( m_bMarkPartial ) { qDebug( "kio_ftp : Adding .part extension to %s", udest_orig.path().ascii() ); udest = udest_part; } else udest = udest_orig; /* if ( access( udest.path(), W_OK ) == -1 ) { qDebug("Write Access denied for '%s' %d",udest.path(), errno ); error( ERR_WRITE_ACCESS_DENIED, url ); m_cmd = CMD_NONE; finished(); return; } */ unsigned long offset = 0; // set the mode according to offset if ( _resume ) { offset = e->size; qDebug( "kio_ftp : Offset = %ld", offset ); } if ( !ftp.ftpOpen( udest, Ftp::WRITE, offset ) ) { qDebug( "kio_ftp : ####################### COULD NOT WRITE %s", udest.path().ascii() ); error( ftp.error(), ftp.errorText() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; finished(); return; } // We are ready for receiving data ready(); // Loop until we got 'dataEnd' while ( m_cmd == CMD_PUT && dispatch() ); ftp.ftpClose(); // check order !!! ftp.ftpDisconnect( true ); if ( (e = ftp.ftpStat( udest )) ) { if ( e->size == _size ) { // after full download rename the file back to original name if ( m_bMarkPartial ) { cerr << "kio_ftp renaming\n"; if ( !ftp.ftpRename( udest.path(), udest_orig.path() ) ) { error( ERR_CANNOT_RENAME, udest_orig.path() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; finished(); return; } } // do chmod only after full download if ( _mode != -1 ) { cerr << "kio_ftp chmoding\n"; // set the desired attributes for dir !!! how ? if ( !ftp.ftpChmod( udest_orig.path(), _mode ) ) { error( ERR_CANNOT_CHMOD, udest_orig.path() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; finished(); return; } } } // if the size is less then minimum -> delete the file else if ( e->size < KProtocolManager::self().minimumKeepSize() ) { ftp.ftpDelete( udest.path() ); } } ftp.ftpDisconnect( true ); // We have done our job => finish finished(); m_cmd = CMD_NONE;}void FtpProtocol::slotDel( QStringList& _source ){ // Check wether the URLs are wellformed QStringList::Iterator soit = _source.begin(); for( ; soit != _source.end(); ++soit ) { qDebug( "kio_ftp : Checking %s", (*soit).ascii() ); KURL usrc( *soit ); if ( usrc.isMalformed() ) { error( ERR_MALFORMED_URL, *soit); m_cmd = CMD_NONE; return; } if ( strcmp( usrc.protocol(), "ftp" ) != 0L ) { error(ERR_INTERNAL,"kio_ftp got non ftp file in delete command" ); m_cmd = CMD_NONE; return; } } qDebug( "kio_ftp : All URLs ok" ); // Get a list of all source files and directories QValueList<Copy> fs; QValueList<CopyDir> ds; int size = 0; qDebug( "kio_ftp : Iterating" ); soit = _source.begin(); qDebug( "kio_ftp : Looping" ); for( ; soit != _source.end(); ++soit ) { qDebug( "kio_ftp : Executing %s", (*soit).ascii() ); KURL usrc(*soit); qDebug( "kio_ftp : Parsed URL" ); // Did an error occur ? int s; if ( ( s = listRecursive( usrc.path(), fs, ds, false ) ) == -1 ) { // Error message is already sent ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } // Sum up the total amount of bytes we have to delete size += s; } qDebug( "kio_ftp : Recursive ok" ); if ( fs.count() == 1 ) { m_cmd = CMD_DEL; } else { m_cmd = CMD_MDEL; } // Tell our client what we 'r' gonna do totalSize( size ); totalFiles( fs.count() ); totalDirs( ds.count() ); /***** * Delete files *****/ QValueList<Copy>::Iterator fit = fs.begin(); for( ; fit != fs.end(); fit++ ) { QString filename = (*fit).m_strAbsSource; qDebug( "kio_ftp : Deleting file %s", filename.ascii() ); deletingFile( filename ); if ( !ftp.ftpDelete( filename ) ) // !!! use unlink ? { error( ERR_CANNOT_DELETE, filename ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } } /***** * Delete empty directories *****/ QValueList<CopyDir>::Iterator dit = ds.begin(); for( ; dit != ds.end(); dit++ ) { QString dirname = (*dit).m_strAbsSource; qDebug( "kio_ftp : Deleting directory %s", dirname.ascii() ); deletingFile( dirname ); if ( !ftp.ftpRmdir( dirname ) ) { error( ERR_COULD_NOT_RMDIR, dirname ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } } finished(); m_cmd = CMD_NONE;}void FtpProtocol::slotData( void *_p, int _len ){ switch( m_cmd ) { case CMD_PUT: ftp.write( _p, _len ); break; }}void FtpProtocol::slotDataEnd(){ switch( m_cmd ) { case CMD_PUT: m_cmd = CMD_NONE; }}long FtpProtocol::listRecursive( const char *_path, QValueList<Copy>& _files, QValueList<CopyDir>& _dirs, bool _rename ){ m_bAutoSkip = false; // Check wether we have to copy the complete directory tree beginning by its root. int len = strlen( _path ); while( len >= 1 && _path[ len - 1 ] == '/' ) len--; if ( len == 0 ) { CopyDir c; c.m_strAbsSource = _path; if ( _rename ) c.m_strRelDest = ""; else c.m_strRelDest = ""; c.m_access = S_IRWXU | S_IRWXO | S_IRWXG; c.m_type = S_IFDIR; _dirs.append( c ); return listRecursive2( "/", c.m_strRelDest, _files, _dirs ); } QString p=_path; qDebug( "kio_ftp : ########## RECURSIVE LISTING %s", p.ascii() ); KURL tmpurl( "ftp:/" ); tmpurl.setPath( p ); FtpEntry* e = ftp.ftpStat( tmpurl ); if ( !e ) { error( ERR_DOES_NOT_EXIST, p); return -1; } KURL u( p ); // Should be checked before, but who knows if ( u.isMalformed() ) assert( 0 ); // Is the source not a directory ? => so just copy it and we are done. if ( !S_ISDIR( e->type ) ) { qDebug( "kio_ftp : not a dir" ); QString fname; if ( _rename ) fname = ""; else { fname = u.filename(); // Should be impossible, but who knows ... if ( fname.isEmpty() ) assert( 0 ); } Copy c; c.m_strAbsSource = p; c.m_strRelDest = fname; c.m_access = e->access; c.m_type = e->type; c.m_size = e->size; _files.append( c ); return e->size; } // The source is a directory. So we have to go into recursion here. QString tmp1; if ( _rename ) tmp1 = u.path( 0 ); else { tmp1 = u.directory( true ); tmp1 += "/"; } QString tmp2; if ( _rename ) tmp2 = ""; else tmp2 = u.filename(); CopyDir c; c.m_strAbsSource = p; c.m_strRelDest = tmp2; c.m_access = e->access; c.m_type = e->type; _dirs.append( c ); qDebug( "kio_ftp : ########### STARTING RECURSION with %s and %s",tmp1.ascii(), tmp2.ascii() ); return listRecursive2( tmp1, tmp2, _files, _dirs );}long FtpProtocol::listRecursive2( const char *_abs_path, const char *_rel_path, QValueList<Copy>& _files, QValueList<CopyDir>& _dirs ){ long size = 0; cerr << "listRecursive2 " << _abs_path << " " << _rel_path << endl; QString p = _abs_path; p += _rel_path; scanningDir( p ); KURL tmpurl( "ftp:/" ); tmpurl.setPath( p ); if ( !ftp.ftpOpenDir( tmpurl ) ) { if ( m_bAutoSkip ) return 0; SkipDlg_Result result = open_SkipDlg( p, true ); if ( result == S_CANCEL ) { // error( ERR_CANNOT_ENTER_DIRECTORY, p ); return -1; } else if ( result == S_AUTO_SKIP ) m_bAutoSkip = true; return 0; } QStringList recursion; qDebug( "kio_ftp : ##Listing" ); FtpEntry *e; while ( ( e = ftp.readdir() ) != 0L ) { qDebug( "kio_ftp : #%s", e->name.ascii() ); if ( e->name == "." || e->name == ".." ) continue; QString p2 = p; p2 += "/"; p2 += e->name; QString tmp = _rel_path; tmp += "/"; tmp += e->name; if ( !S_ISDIR( e->type ) ) { qDebug( "kio_ftp : Appending '%s' '%s'", p2.ascii(), tmp.ascii() ); Copy c; c.m_strAbsSource = p2; c.m_strRelDest = tmp; c.m_access = e->access; c.m_type = e->type; c.m_size = e->size; _files.append( c ); size += e->size; } else { CopyDir c; c.m_strAbsSource = p2; c.m_strRelDest = tmp; c.m_access = e->access; c.m_type = e->type; _dirs.append( c ); recursion.append( tmp ); } } if ( !ftp.ftpCloseDir() ) { // error( ERR_COULD_NOT_CLOSEDIR, p ); return -1; } QStringList::Iterator it = recursion.begin(); for( ; it != recursion.end(); ++it ) { long s; if ( ( s = listRecursive2( _abs_path, (*it).ascii(), _files, _dirs ) ) == -1 ) return -1; size += s; } return size;}void FtpProtocol::slotListDir( const char *_url ){ qDebug( "kio_ftp : =============== LIST %s ===============", _url ); KURL usrc( _url ); if ( usrc.isMalformed() ) { error( ERR_MALFORMED_URL, strdup(_url) ); m_cmd = CMD_NONE; return; } if ( strcmp( usrc.protocol(), "ftp" ) != 0L ) { error( ERR_INTERNAL, "kio_ftp got non ftp file in list command" ); m_cmd = CMD_NONE; return; } /* struct stat buff; if ( stat( usrc.path(), &buff ) == -1 ) { error( ERR_DOES_NOT_EXIST, url); m_cmd = CMD_NONE; return; } if ( !S_ISDIR( buff.st_mode ) ) { error( ERR_IS_FILE, url ); m_cmd = CMD_NONE; return; } */ m_cmd = CMD_LIST; if ( !ftp.opendir( usrc ) ) { error( ERR_CANNOT_ENTER_DIRECTORY, strdup(_url) ); m_cmd = CMD_NONE; return; } FtpEntry* e; while ( ( e = ftp.readdir() ) ) { if ( e->name == "." || e->name == ".." ) continue; qDebug( "kio_ftp : Listing %s", e->name.ascii() ); KUDSEntry entry; KUDSAtom atom; atom.m_uds = UDS_NAME; atom.m_str = e->name; entry.append( atom ); atom.m_uds = UDS_FILE_TYPE; atom.m_long = e->type; entry.append( atom ); atom.m_uds = UDS_SIZE; atom.m_long = e->size; entry.append( atom ); /* atom.m_uds = UDS_MODIFICATION_TIME; atom.m_long = buff.st_mtime; entry.append( atom ); */ atom.m_uds = UDS_ACCESS; atom.m_long = e->access; entry.append( atom ); atom.m_uds = UDS_USER; atom.m_str = e->owner; entry.append( atom ); atom.m_uds = UDS_GROUP; atom.m_str = e->group; entry.append( atom ); atom.m_uds = UDS_LINK_DEST; atom.m_str = e->link; entry.append( atom ); /* atom.m_uds = UDS_ACCESS_TIME; atom.m_long = buff.st_atime; entry.append( atom ); atom.m_uds = UDS_CREATION_TIME; atom.m_long = buff.st_ctime; entry.append( atom ); */ listEntry( entry ); } qDebug( "kio_ftp : ============= COMPLETED LIST ============" ); ftp.closedir(); qDebug( "kio_ftp : ============= COMPLETED LIST 2 ============" ); m_cmd = CMD_NONE; finished(); qDebug( "kio_ftp : =============== BYE ===========" );}void FtpProtocol::slotTestDir( const char *_url ){ KURL usrc( _url ); if ( usrc.isMalformed() ) { error( ERR_MALFORMED_URL, strdup(_url) ); m_cmd = CMD_NONE; return; } if ( strcmp( usrc.protocol(), "ftp" ) != 0L ) { error( ERR_INTERNAL, "kio_ftp got non ftp file as source in copy command" ); m_cmd = CMD_NONE; return; } qDebug( "kio_ftp : =============== slotTestDir ==============" ); FtpEntry* e; if ( !( e = ftp.stat( usrc ) ) ) { qDebug( "kio_ftp : =========== ERROR ========" ); error( ERR_DOES_NOT_EXIST, strdup(_url) ); m_cmd = CMD_NONE; return; } if ( S_ISDIR( e->type ) ) { qDebug( "kio_ftp : ========== DONE DIR ========= %s", _url ); isDirectory(); } else { qDebug( "kio_ftp : ========== DONE FILE ========= %s", _url ); isFile(); } finished();}void FtpProtocol::jobError( int _errid, const char *_txt ){ if ( !m_bIgnoreJobErrors ) error( _errid, _txt );}/************************************* * * FtpIOJob * *************************************/FtpIOJob::FtpIOJob( KIOConnection *_conn, FtpProtocol *_Ftp ) : KIOJobBase( _conn ){ m_pFtp = _Ftp;} void FtpIOJob::slotError( int _errid, const char *_txt ){ KIOJobBase::slotError( _errid, _txt ); m_pFtp->jobError( _errid, _txt );}/************************************* * * Utilities * *************************************/int check( KIOConnection *_con ){ int err; struct timeval tv; tv.tv_sec = 0; tv.tv_usec = 0; fd_set rfds; FD_ZERO( &rfds ); FD_SET( _con->inFD(), &rfds ); again: if ( ( err = select( _con->inFD(), &rfds, 0L, 0L, &tv ) ) == -1 && errno == EINTR ) goto again; // No error and something to read ? if ( err != -1 && err != 0 ) return 1; return 0;}
qDebug( "kio_ftp : ========== DONE FILE ========= %s", _url );
kdebug( KDEBUG_INFO, 0, "========== DONE FILE ========= %s", _url );
int check( KIOConnection *_con );extern "C" { void sigalrm_handler(int);}int main( int, char ** ){ signal(SIGCHLD, KIOProtocol::sigchld_handler); signal(SIGSEGV, KIOProtocol::sigsegv_handler); // KProtocolManager manager; qDebug( "kio_ftp : Starting"); KInstance instance( "kio_ftp" ); KIOConnection parent( 0, 1 ); FtpProtocol ftp( &parent ); ftp.dispatchLoop(); qDebug( "kio_ftp : Done" );}/* * We'll use an alarm that will set this flag when transfer has timed out */char sigbreak = 0;void sigalrm_handler(int){ sigbreak = 1;} void setup_alarm(unsigned int timeout){ sigbreak = 0; alarm(timeout); signal(SIGALRM, sigalrm_handler);}FtpProtocol::FtpProtocol( KIOConnection *_conn ) : KIOProtocol( _conn ){ m_cmd = CMD_NONE; m_bIgnoreJobErrors = false; m_bCanResume = true; // most of ftp servers support resuming ?}void FtpProtocol::slotMkdir( const char *_url, int _mode ){ KURL usrc( _url ); if ( usrc.isMalformed() ) { error( ERR_MALFORMED_URL, strdup(_url) ); m_cmd = CMD_NONE; return; } if ( strcmp( usrc.protocol(), "ftp" ) != 0L ) { error( ERR_INTERNAL, "kio_ftp got non ftp file in mkdir command" ); m_cmd = CMD_NONE; return; } // Connect to the ftp server if ( !ftp.isConnected() ) if ( !ftp.ftpConnect( usrc ) ) { error( ftp.error(), ftp.errorText() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; return; } FtpEntry* e = ftp.ftpStat( usrc ); if ( !e ) { if ( !ftp.ftpMkdir( usrc.path() ) ) { error( ERR_COULD_NOT_MKDIR, strdup(_url) ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } else { // set the desired attributes for dir if ( _mode != -1 ) if ( !ftp.ftpChmod( usrc.path(), _mode ) ) { error( ERR_CANNOT_CHMOD, strdup(_url) ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } finished(); ftp.ftpDisconnect(); return; } } if ( S_ISDIR( e->type ) ) { // !!! ok ? error( ERR_DOES_ALREADY_EXIST, strdup(_url) ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } error( ERR_COULD_NOT_MKDIR, strdup(_url) ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return;}void FtpProtocol::slotCopy( QStringList& _source, const char *_dest ){ doCopy( _source, _dest, false );}void FtpProtocol::slotCopy( const char* _source, const char *_dest ){ QStringList lst; lst.append( _source ); doCopy( lst, _dest, true );}void FtpProtocol::slotMove( QStringList& _source, const char *_dest ){ doCopy( _source, _dest, false, true );}void FtpProtocol::slotMove( const char* _source, const char *_dest ){ QStringList lst; lst.append( _source ); doCopy( lst, _dest, true, true );}void FtpProtocol::doCopy( QStringList& _source, const char *_dest, bool _rename, bool _move ){ if ( _rename ) assert( _source.count() == 1 ); qDebug( "kio_ftp : Making copy to %s", _dest ); // Check whether the URLs are wellformed QStringList::Iterator soit = _source.begin(); for( ; soit != _source.end(); ++soit ) { qDebug( "kio_ftp : Checking %s", (*soit).ascii() ); KURL usrc( *soit ); if ( usrc.isMalformed() ) { error( ERR_MALFORMED_URL, (*soit) ); m_cmd = CMD_NONE; return; } if ( usrc.host().isEmpty() ) { error( ERR_MALFORMED_URL, (*soit) ); // !!! create a new error type ? m_cmd = CMD_NONE; return; } if ( strcmp( usrc.protocol(), "ftp" ) != 0L ) { error( ERR_INTERNAL, "kio_ftp got non ftp file as source in copy command" ); m_cmd = CMD_NONE; return; } } qDebug( "kio_ftp : All URLs ok %s", _dest ); // Make a copy of the parameter. if we do IPC calls from here, then we overwrite // our argument. This is tricky! ( but saves memory and speeds things up ) QString dest = _dest; // Check wellformedness of the destination KURL udest( dest ); if ( udest.isMalformed() ) { error( ERR_MALFORMED_URL, dest ); m_cmd = CMD_NONE; return; } qDebug( "kio_ftp : Dest ok %s", dest.ascii() ); // Find IO server for destination QString exec = KProtocolManager::self().executable( udest.protocol() ); if ( exec.isEmpty() ) { error( ERR_UNSUPPORTED_PROTOCOL, udest.protocol() ); m_cmd = CMD_NONE; return; } // Is the right most protocol a filesystem protocol ? if ( KProtocolManager::self().outputType( udest.protocol() ) != KProtocolManager::T_FILESYSTEM ) { error( ERR_PROTOCOL_IS_NOT_A_FILESYSTEM, udest.protocol() ); m_cmd = CMD_NONE; return; } qDebug( "kio_ftp : IO server ok %s", dest.ascii() ); // Connect to the ftp server KURL usrc( _source.first() ); if ( ! ftp.ftpConnect( usrc ) ) { error( ftp.error(), ftp.errorText() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; return; } qDebug( "kio_ftp : connected to a server" ); // Find out, whether we are logged anonymously or not // Authorization has been already checked with ftp.ftpConnect( usrc ) bool b_user = false; if ( usrc.hasUser() ) { b_user = true; } // Get a list of all source files and directories QValueList<Copy> files; QValueList<CopyDir> dirs; int size = 0; qDebug( "kio_ftp : Iterating" ); soit = _source.begin(); qDebug( "kio_ftp : Looping" ); for( ; soit != _source.end(); ++soit ) { qDebug( "kio_ftp : Executing %s", (*soit).ascii() ); KURL usrc( *soit ); qDebug( "kio_ftp : Parsed URL" ); // Did an error occur ? int s; if ( ( s = listRecursive( usrc.path(), files, dirs, _rename ) ) == -1 ) { ftp.ftpDisconnect(); // Error message is already sent m_cmd = CMD_NONE; return; } // Sum up the total amount of bytes we have to copy size += s; } qDebug( "kio_ftp : Recursive 1 %s", dest.ascii() ); /* // Check wether we do not copy a directory in itself or one of its subdirectories struct stat buff2; if ( udest.isLocalFile() && stat( udest.path(), &buff2 ) == 0 ) { bool b_error = false; for( soit = _source.begin(); soit != _source.end(); ++soit ) { KURL usrc( *soit ); struct stat buff1; // Can we stat both the source, too ? ( Should always be the case ) if ( stat( usrc.path(), &buff1 ) == 0 ) { bool b_error = false; // Are source and dest equal ? => error if ( buff1.st_ino == buff2.st_ino ) b_error = true; } } if ( !b_error ) { // Iterate over all subdirectories QValueList<CopyDir>::iterator it = dirs.begin(); for( ; it != dirs.end() && !b_error; it++ ) if ( buff2.st_ino == (*it).m_ino ) b_error = true; } // Do we have a cylic copy now ? => error if ( b_error ) { error( ERR_CYCLIC_COPY, *soit ); m_cmd = CMD_NONE; return; } } */ qDebug( "kio_ftp : Recursive ok %s", dest.ascii() ); m_cmd = CMD_GET; // Start a server for the destination protocol KIOSlave slave( exec ); if ( slave.pid() == -1 ) { error( ERR_CANNOT_LAUNCH_PROCESS, exec ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; return; } // Put a protocol on top of the job FtpIOJob job( &slave, this ); qDebug( "kio_ftp : Job started ok %s", dest.ascii() ); // Tell our client what we 'r' gonna do totalSize( size ); totalFiles( files.count() ); totalDirs( dirs.count() ); int processed_files = 0; int processed_dirs = 0; int processed_size = 0; // Replace the relative destinations with absolut destinations // by prepending the destinations path QString tmp1 = udest.path( 1 ); // Strip '/' QString tmp1_stripped = udest.path( -1 ); QValueList<CopyDir>::Iterator dit = dirs.begin(); for( ; dit != dirs.end(); dit++ ) { QString tmp2 = (*dit).m_strRelDest; if ( _rename ) (*dit).m_strRelDest = tmp1_stripped; else (*dit).m_strRelDest = tmp1; (*dit).m_strRelDest += tmp2; } QValueList<Copy>::Iterator fit = files.begin(); for( ; fit != files.end(); fit++ ) { QString tmp2 = (*fit).m_strRelDest; if ( _rename ) // !!! && (*fit).m_strRelDest == "" ) (*fit).m_strRelDest = tmp1_stripped; else (*fit).m_strRelDest = tmp1; (*fit).m_strRelDest += tmp2; } qDebug( "kio_ftp : Destinations ok %s", dest.data() ); /***** * Make directories *****/ m_bIgnoreJobErrors = true; bool overwrite_all = false; bool auto_skip = false; bool resume_all = false; QStringList skip_list, overwrite_list; // Create all directories dit = dirs.begin(); for( ; dit != dirs.end(); dit++ ) { // Repeat until we got no error do { job.clearError(); KURL ud( udest ); ud.setPath( (*dit).m_strRelDest); QString d = ud.url(); // Is this URL on the skip list ? bool skip = false; QStringList::Iterator sit = skip_list.begin(); for( ; sit != skip_list.end() && !skip; sit++ ) // Is d a subdirectory of *sit ? if ( *sit==d ) skip = true; if ( skip ) continue; // Is this URL on the overwrite list ? bool overwrite = false; QStringList::Iterator oit = overwrite_list.begin(); for( ; oit != overwrite_list.end() && !overwrite; oit++ ) if ( *oit == d ) overwrite = true; if ( overwrite ) continue; // Tell what we are doing makingDir( d.data() ); // qDebug( "kio_ftp : Making remote dir %s", d ); // Create the directory job.mkdir( d.data(), (*dit).m_access ); while( !job.hasFinished() ) job.dispatch(); // Did we have an error ? if ( job.hasError() ) { // Can we prompt the user and ask for a solution ? if ( /* m_bGUI && */ job.errorId() == ERR_DOES_ALREADY_EXIST ) { QString old_path = udest.path( 1 ); QString old_url = udest.url( 1 ); // Should we skip automatically ? if ( auto_skip ) { job.clearError(); // We dont want to copy files in this directory, so we put it on the skip list. skip_list.append( old_url ); continue; } else if ( overwrite_all ) { job.clearError(); continue; } /* RenameDlg_Mode m = (RenameDlg_Mode)( M_SINGLE | M_OVERWRITE ); if ( dirs.count() > 1 ) m = (RenameDlg_Mode)(M_MULTI | M_SKIP | M_OVERWRITE ); */ RenameDlg_Mode m = (RenameDlg_Mode)( M_MULTI | M_SKIP | M_OVERWRITE ); QString tmp2 = udest.url(), n; RenameDlg_Result r = open_RenameDlg( (*dit).m_strAbsSource, tmp2, m, n ); if ( r == R_CANCEL ) { ftp.ftpDisconnect(); error( ERR_USER_CANCELED, "" ); m_cmd = CMD_NONE; return; } else if ( r == R_RENAME ) { KURL u( n ); // The Dialog should have checked this. if ( u.isMalformed() ) assert( 0 ); // The new path with trailing '/' QString tmp3 = u.path( 1 ); /////// // Replace old path with tmp3 /////// QValueList<CopyDir>::Iterator dit2 = dit; // Change the current one and strip the trailing '/' (*dit2).m_strRelDest = u.path( -1 ); // Change the name of all subdirectories dit2++; for( ; dit2 != dirs.end(); dit2++ ) if ( strncmp((*dit2).m_strRelDest, old_path, old_path.length())==0 ) (*dit2).m_strRelDest.replace( 0, old_path.length(), tmp3 ); // Change all filenames QValueList<Copy>::Iterator fit2 = files.begin(); for( ; fit2 != files.end(); fit2++ ) if ( strncmp( (*fit2).m_strRelDest, old_path, old_path.length() ) == 0 ) (*fit2).m_strRelDest.replace( 0, old_path.length(), tmp3 ); // Dont clear error => we will repeat the current command } else if ( r == R_SKIP ) { // Skip all files and directories that start with 'old_url' skip_list.append( old_url ); // Clear the error => The current command is not repeated => skipped job.clearError(); } else if ( r == R_AUTO_SKIP ) { // Skip all files and directories that start with 'old_url' skip_list.append( old_url ); // Clear the error => The current command is not repeated => skipped job.clearError(); auto_skip = true; } else if ( r == R_OVERWRITE ) { // Dont bother for subdirectories overwrite_list.append( old_url ); // Clear the error => The current command is not repeated => we will // overwrite every file in this directory or any of its subdirectories job.clearError(); } else if ( r == R_OVERWRITE_ALL ) { job.clearError(); overwrite_all = true; } else assert( 0 ); } // No need to ask the user, so raise an error else { error( job.errorId(), job.errorText() ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } } } while( job.hasError() ); processedDirs( ++processed_dirs ); } qDebug( "kio_ftp : Created directories %s", dest.data() ); /***** * Server check - supports resuming ? *****/ if ( !ftp.ftpResume( 0 ) ) m_bCanResume = false; /***** * Copy files *****/ time_t t_start = time( 0L ); time_t t_last = t_start; fit = files.begin(); for( ; fit != files.end(); fit++ ) { bool overwrite = false; bool skip_copying = false; bool resume = false; unsigned long offset = 0; // Repeat until we got no error do { job.clearError(); KURL ud( dest ); ud.setPath( (*fit).m_strRelDest); QString d = ud.url(); // Is this URL on the skip list ? bool skip = false; QStringList::Iterator sit = skip_list.begin(); for( ; sit != skip_list.end() && !skip; sit++ ) // Is 'd' a file in directory '*sit' or one of its subdirectories ? if ( *sit==d ) skip = true; if ( skip ) continue; // emit sigCanResume( m_bCanResume ) canResume( m_bCanResume ); QString realpath = "ftp:"; realpath += (*fit).m_strAbsSource; copyingFile( realpath.ascii(), d.ascii() ); // qDebug( "kio_ftp : Writing to %s", d ); // Is this URL on the overwrite list ? QStringList::Iterator oit = overwrite_list.begin(); for( ; oit != overwrite_list.end() && !overwrite; oit++ ) if (*oit==d) overwrite = true; // implicitly set permissions rw-r--r-- for anonymous ftp int md = -1; // but when it's not anonymous ftp, set permissions as in original source if ( b_user ) md = (*fit).m_access; job.put( d, md, overwrite_all || overwrite, resume_all || resume, (*fit).m_size ); while( !job.isReady() && !job.hasFinished() ) job.dispatch(); // Did we have an error ? if ( job.hasError() ) { int currentError = job.errorId(); qDebug("################# COULD NOT PUT %d",currentError); // if ( /* m_bGUI && */ job.errorId() == ERR_WRITE_ACCESS_DENIED ) if ( /* m_bGUI && */ currentError != ERR_DOES_ALREADY_EXIST && currentError != ERR_DOES_ALREADY_EXIST_FULL ) { // Should we skip automatically ? if ( auto_skip ) { job.clearError(); skip_copying = true; continue; } QString tmp2 = ud.url(); SkipDlg_Result r; r = open_SkipDlg( tmp2, ( files.count() > 1 ) ); if ( r == S_CANCEL ) { error( ERR_USER_CANCELED, "" ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } else if ( r == S_SKIP ) { // Clear the error => The current command is not repeated => skipped job.clearError(); skip_copying = true; continue; } else if ( r == S_AUTO_SKIP ) { // Clear the error => The current command is not repeated => skipped job.clearError(); skip_copying = true; continue; } else assert( 0 ); } // Can we prompt the user and ask for a solution ? else if ( /* m_bGUI && */ currentError == ERR_DOES_ALREADY_EXIST || currentError == ERR_DOES_ALREADY_EXIST_FULL ) { // Should we skip automatically ? if ( auto_skip ) { job.clearError(); continue; } RenameDlg_Result r; QString n; if ( KProtocolManager::self().autoResume() && m_bCanResume && currentError != ERR_DOES_ALREADY_EXIST_FULL ) { r = R_RESUME_ALL; } else { RenameDlg_Mode m; // ask for resume only if transfer can be resumed and if it is not // already fully downloaded if ( files.count() > 1 ){ if ( m_bCanResume && currentError != ERR_DOES_ALREADY_EXIST_FULL ) m = (RenameDlg_Mode)(M_MULTI | M_SKIP | M_OVERWRITE | M_RESUME); else m = (RenameDlg_Mode)(M_MULTI | M_SKIP | M_OVERWRITE); } else { if ( m_bCanResume && currentError != ERR_DOES_ALREADY_EXIST_FULL ) m = (RenameDlg_Mode)( M_SINGLE | M_OVERWRITE | M_RESUME); else m = (RenameDlg_Mode)( M_SINGLE | M_OVERWRITE); } QString tmp2 = ud.url(); r = open_RenameDlg( (*fit).m_strAbsSource, tmp2, m, n ); } if ( r == R_CANCEL ) { error( ERR_USER_CANCELED, "" ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } else if ( r == R_RENAME ) { KURL u( n ); // The Dialog should have checked this. if ( u.isMalformed() ) assert( 0 ); renamed( u.path( -1 ) ); // emit signal // Change the destination name of the current file (*fit).m_strRelDest = u.path( -1 ); // Dont clear error => we will repeat the current command } else if ( r == R_SKIP ) { // Clear the error => The current command is not repeated => skipped job.clearError(); } else if ( r == R_AUTO_SKIP ) { // Clear the error => The current command is not repeated => skipped job.clearError(); auto_skip = true; } else if ( r == R_OVERWRITE ) { overwrite = true; // Dont clear error => we will repeat the current command } else if ( r == R_OVERWRITE_ALL ) { overwrite_all = true; // Dont clear error => we will repeat the current command } else if ( r == R_RESUME ) { resume = true; offset = getOffset( ud.url() ); // Dont clear error => we will repeat the current command } else if ( r == R_RESUME_ALL ) { resume_all = true; offset = getOffset( ud.url() ); // Dont clear error => we will repeat the current command } else assert( 0 ); } // No need to ask the user, so raise an error else { error( currentError, job.errorText() ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } } } while( job.hasError() ); if ( skip_copying ) continue; // add the offset to processed size if ( offset > 0 ) { processed_size += offset; qDebug( "kio_ftp : Offset = %ld", offset ); } KURL tmpurl( "ftp:/" ); tmpurl.setPath( (*fit).m_strAbsSource ); qDebug( "kio_ftp : Opening %s", (*fit).m_strAbsSource.ascii() ); if ( !ftp.ftpOpen( tmpurl, Ftp::READ, offset ) ) { error( ftp.error(), ftp.errorText() ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } // we want to know the processed size even before we read something // especially in case we overwrite file => this cleans size to zero processedSize( processed_size ); char buffer[ 4096 ]; int n; int read_size = 0; do { setup_alarm( KProtocolManager::self().readTimeout() ); // start timeout n = ftp.read( buffer, 2048 ); // !!! slow down loop for local testing // for ( int tmpi = 0; tmpi < 1000000; tmpi++ ) ; job.data( buffer, n ); processed_size += n; read_size += n; time_t t = time( 0L ); if ( t - t_last >= 1 ) { processedSize( processed_size ); speed( read_size / ( t - t_start ) ); t_last = t; } // Check parent while ( check( connection() ) ) dispatch(); // Check for error messages from slave while ( check( &slave ) ) job.dispatch(); // An error ? if ( job.hasFinished() ) { ftp.ftpDisconnect(); ftp.ftpClose(); finished(); m_cmd = CMD_NONE; return; } } while ( n > 0 ); job.dataEnd(); ftp.ftpClose(); while( !job.hasFinished() ) job.dispatch(); time_t t = time( 0L ); processedSize( processed_size ); if ( t - t_start >= 1 ) { speed( read_size / ( t - t_start ) ); t_last = t; } processedFiles( ++processed_files ); } qDebug( "kio_ftp : Copied files %s", dest.data() ); // slotDel() handles disconnecting by itself if ( _move ) { slotDel( _source ); } else ftp.ftpDisconnect(); finished(); m_cmd = CMD_NONE;}void FtpProtocol::slotGet( const char *_url ){ KURL usrc( _url ); if ( usrc.isMalformed() ) { error( ERR_MALFORMED_URL, strdup(_url) ); m_cmd = CMD_NONE; return; } if ( strcmp( usrc.protocol(), "ftp" ) != 0L ) { error( ERR_INTERNAL, "kio_ftp got non ftp file in get command" ); m_cmd = CMD_NONE; return; } if ( !ftp.ftpConnect( usrc ) ) { error( ftp.error(), ftp.errorText() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; return; } FtpEntry *e = ftp.ftpStat( usrc ); if ( !e ) { error( ERR_DOES_NOT_EXIST, strdup(_url) ); m_cmd = CMD_NONE; return; } /* if ( S_ISDIR( e->type ) ) { error( ERR_IS_DIRECTORY, strdup(_url) ); m_cmd = CMD_NONE; return; }*/ m_cmd = CMD_GET; if ( !ftp.open( usrc, Ftp::READ ) ) { error( ERR_CANNOT_OPEN_FOR_READING, strdup(_url) ); m_cmd = CMD_NONE; return; } ready(); gettingFile( _url ); totalSize( e->size ); int processed_size = 0; time_t t_start = time( 0L ); time_t t_last = t_start; char buffer[ 2048 ]; while( !ftp.atEOF() ) { int n = ftp.read( buffer, 2048 ); data( buffer, n ); processed_size += n; time_t t = time( 0L ); if ( t - t_last >= 1 ) { processedSize( processed_size ); speed( processed_size / ( t - t_start ) ); t_last = t; } } dataEnd(); ftp.ftpClose(); processedSize( e->size ); time_t t = time( 0L ); if ( t - t_start >= 1 ) speed( processed_size / ( t - t_start ) ); finished(); m_cmd = CMD_NONE;}void FtpProtocol::slotGetSize( const char* _url ) { m_cmd = CMD_GET_SIZE; // Check wether URL is wellformed KURL usrc( _url ); if ( usrc.isMalformed() ) { error( ERR_MALFORMED_URL, _url ); m_cmd = CMD_NONE; return; } if ( strcmp( usrc.protocol(), "ftp" ) != 0L ) { error( ERR_INTERNAL, "kio_ftp got non ftp file in getSize command" ); m_cmd = CMD_NONE; return; } qDebug( "kio_ftp : URL is ok " ); if ( !ftp.ftpConnect( usrc ) ) { error( ftp.error(), ftp.errorText() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; return; } // Get a list of all source files and directories QValueList<Copy> files; QValueList<CopyDir> dirs; qDebug( "kio_ftp : Executing %s", _url ); // Did an error occur ? int s; if ( ( s = listRecursive( usrc.path(), files, dirs, false ) ) == -1 ) { ftp.ftpDisconnect(); // Error message is already sent m_cmd = CMD_NONE; return; } // Tell our client what we 'r' gonna do totalSize( s ); ftp.ftpDisconnect(); finished(); m_cmd = CMD_NONE;}void FtpProtocol::slotPut( const char *_url, int _mode, bool _overwrite, bool _resume, int _size ){ QString url_orig = _url; QString url_part = url_orig + ".part"; KURL udest_orig( url_orig ); KURL udest_part( url_part ); bool m_bMarkPartial = KProtocolManager::self().markPartial(); if ( udest_orig.isMalformed() ) { error( ERR_MALFORMED_URL, url_orig ); m_cmd = CMD_NONE; finished(); return; } if ( strcmp( udest_orig.protocol(), "ftp" ) != 0L ) { error(ERR_INTERNAL,"kio_ftp got non ftp file as as destination in put command" ); m_cmd = CMD_NONE; finished(); return; } // Connect to the ftp server, only if we are not connected // this prevents connecting twice in recursive copying ( mkdir connects first time ) if ( !ftp.isConnected() ) if ( !ftp.ftpConnect( udest_orig ) ) { error( ftp.error(), ftp.errorText() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; finished(); return; } m_cmd = CMD_PUT; // Find out, whether we are logged anonymously or not // Authorization has been already checked with ftp.ftpConnect( usrc ) bool b_user = false; if ( udest_orig.hasUser() ) b_user = true; FtpEntry* e; if ( ( e = ftp.ftpStat( udest_orig ) ) ) { // if original file exists, but we are using mark partial -> rename it to XXX.part if ( m_bMarkPartial ) ftp.ftpRename( udest_orig.path(), udest_part.path() ); if ( !_overwrite && !_resume ) { if ( e->size == _size ) error( ERR_DOES_ALREADY_EXIST_FULL, udest_orig.path() ); else error( ERR_DOES_ALREADY_EXIST, udest_orig.path() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; finished(); return; } } else if ( ( e = ftp.ftpStat( udest_part ) ) ) { // if file with extension .part exists but we are not using mark partial // -> rename XXX.part to original name if ( ! m_bMarkPartial ) ftp.ftpRename( udest_part.path(), udest_orig.path() ); if ( !_overwrite && !_resume ) { if ( e->size == _size ) error( ERR_DOES_ALREADY_EXIST_FULL, udest_orig.path() ); else error( ERR_DOES_ALREADY_EXIST, udest_orig.path() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; finished(); return; } } KURL udest; // if we are using marking of partial downloads -> add .part extension if ( m_bMarkPartial ) { qDebug( "kio_ftp : Adding .part extension to %s", udest_orig.path().ascii() ); udest = udest_part; } else udest = udest_orig; /* if ( access( udest.path(), W_OK ) == -1 ) { qDebug("Write Access denied for '%s' %d",udest.path(), errno ); error( ERR_WRITE_ACCESS_DENIED, url ); m_cmd = CMD_NONE; finished(); return; } */ unsigned long offset = 0; // set the mode according to offset if ( _resume ) { offset = e->size; qDebug( "kio_ftp : Offset = %ld", offset ); } if ( !ftp.ftpOpen( udest, Ftp::WRITE, offset ) ) { qDebug( "kio_ftp : ####################### COULD NOT WRITE %s", udest.path().ascii() ); error( ftp.error(), ftp.errorText() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; finished(); return; } // We are ready for receiving data ready(); // Loop until we got 'dataEnd' while ( m_cmd == CMD_PUT && dispatch() ); ftp.ftpClose(); // check order !!! ftp.ftpDisconnect( true ); if ( (e = ftp.ftpStat( udest )) ) { if ( e->size == _size ) { // after full download rename the file back to original name if ( m_bMarkPartial ) { cerr << "kio_ftp renaming\n"; if ( !ftp.ftpRename( udest.path(), udest_orig.path() ) ) { error( ERR_CANNOT_RENAME, udest_orig.path() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; finished(); return; } } // do chmod only after full download if ( _mode != -1 ) { cerr << "kio_ftp chmoding\n"; // set the desired attributes for dir !!! how ? if ( !ftp.ftpChmod( udest_orig.path(), _mode ) ) { error( ERR_CANNOT_CHMOD, udest_orig.path() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; finished(); return; } } } // if the size is less then minimum -> delete the file else if ( e->size < KProtocolManager::self().minimumKeepSize() ) { ftp.ftpDelete( udest.path() ); } } ftp.ftpDisconnect( true ); // We have done our job => finish finished(); m_cmd = CMD_NONE;}void FtpProtocol::slotDel( QStringList& _source ){ // Check wether the URLs are wellformed QStringList::Iterator soit = _source.begin(); for( ; soit != _source.end(); ++soit ) { qDebug( "kio_ftp : Checking %s", (*soit).ascii() ); KURL usrc( *soit ); if ( usrc.isMalformed() ) { error( ERR_MALFORMED_URL, *soit); m_cmd = CMD_NONE; return; } if ( strcmp( usrc.protocol(), "ftp" ) != 0L ) { error(ERR_INTERNAL,"kio_ftp got non ftp file in delete command" ); m_cmd = CMD_NONE; return; } } qDebug( "kio_ftp : All URLs ok" ); // Get a list of all source files and directories QValueList<Copy> fs; QValueList<CopyDir> ds; int size = 0; qDebug( "kio_ftp : Iterating" ); soit = _source.begin(); qDebug( "kio_ftp : Looping" ); for( ; soit != _source.end(); ++soit ) { qDebug( "kio_ftp : Executing %s", (*soit).ascii() ); KURL usrc(*soit); qDebug( "kio_ftp : Parsed URL" ); // Did an error occur ? int s; if ( ( s = listRecursive( usrc.path(), fs, ds, false ) ) == -1 ) { // Error message is already sent ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } // Sum up the total amount of bytes we have to delete size += s; } qDebug( "kio_ftp : Recursive ok" ); if ( fs.count() == 1 ) { m_cmd = CMD_DEL; } else { m_cmd = CMD_MDEL; } // Tell our client what we 'r' gonna do totalSize( size ); totalFiles( fs.count() ); totalDirs( ds.count() ); /***** * Delete files *****/ QValueList<Copy>::Iterator fit = fs.begin(); for( ; fit != fs.end(); fit++ ) { QString filename = (*fit).m_strAbsSource; qDebug( "kio_ftp : Deleting file %s", filename.ascii() ); deletingFile( filename ); if ( !ftp.ftpDelete( filename ) ) // !!! use unlink ? { error( ERR_CANNOT_DELETE, filename ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } } /***** * Delete empty directories *****/ QValueList<CopyDir>::Iterator dit = ds.begin(); for( ; dit != ds.end(); dit++ ) { QString dirname = (*dit).m_strAbsSource; qDebug( "kio_ftp : Deleting directory %s", dirname.ascii() ); deletingFile( dirname ); if ( !ftp.ftpRmdir( dirname ) ) { error( ERR_COULD_NOT_RMDIR, dirname ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } } finished(); m_cmd = CMD_NONE;}void FtpProtocol::slotData( void *_p, int _len ){ switch( m_cmd ) { case CMD_PUT: ftp.write( _p, _len ); break; }}void FtpProtocol::slotDataEnd(){ switch( m_cmd ) { case CMD_PUT: m_cmd = CMD_NONE; }}long FtpProtocol::listRecursive( const char *_path, QValueList<Copy>& _files, QValueList<CopyDir>& _dirs, bool _rename ){ m_bAutoSkip = false; // Check wether we have to copy the complete directory tree beginning by its root. int len = strlen( _path ); while( len >= 1 && _path[ len - 1 ] == '/' ) len--; if ( len == 0 ) { CopyDir c; c.m_strAbsSource = _path; if ( _rename ) c.m_strRelDest = ""; else c.m_strRelDest = ""; c.m_access = S_IRWXU | S_IRWXO | S_IRWXG; c.m_type = S_IFDIR; _dirs.append( c ); return listRecursive2( "/", c.m_strRelDest, _files, _dirs ); } QString p=_path; qDebug( "kio_ftp : ########## RECURSIVE LISTING %s", p.ascii() ); KURL tmpurl( "ftp:/" ); tmpurl.setPath( p ); FtpEntry* e = ftp.ftpStat( tmpurl ); if ( !e ) { error( ERR_DOES_NOT_EXIST, p); return -1; } KURL u( p ); // Should be checked before, but who knows if ( u.isMalformed() ) assert( 0 ); // Is the source not a directory ? => so just copy it and we are done. if ( !S_ISDIR( e->type ) ) { qDebug( "kio_ftp : not a dir" ); QString fname; if ( _rename ) fname = ""; else { fname = u.filename(); // Should be impossible, but who knows ... if ( fname.isEmpty() ) assert( 0 ); } Copy c; c.m_strAbsSource = p; c.m_strRelDest = fname; c.m_access = e->access; c.m_type = e->type; c.m_size = e->size; _files.append( c ); return e->size; } // The source is a directory. So we have to go into recursion here. QString tmp1; if ( _rename ) tmp1 = u.path( 0 ); else { tmp1 = u.directory( true ); tmp1 += "/"; } QString tmp2; if ( _rename ) tmp2 = ""; else tmp2 = u.filename(); CopyDir c; c.m_strAbsSource = p; c.m_strRelDest = tmp2; c.m_access = e->access; c.m_type = e->type; _dirs.append( c ); qDebug( "kio_ftp : ########### STARTING RECURSION with %s and %s",tmp1.ascii(), tmp2.ascii() ); return listRecursive2( tmp1, tmp2, _files, _dirs );}long FtpProtocol::listRecursive2( const char *_abs_path, const char *_rel_path, QValueList<Copy>& _files, QValueList<CopyDir>& _dirs ){ long size = 0; cerr << "listRecursive2 " << _abs_path << " " << _rel_path << endl; QString p = _abs_path; p += _rel_path; scanningDir( p ); KURL tmpurl( "ftp:/" ); tmpurl.setPath( p ); if ( !ftp.ftpOpenDir( tmpurl ) ) { if ( m_bAutoSkip ) return 0; SkipDlg_Result result = open_SkipDlg( p, true ); if ( result == S_CANCEL ) { // error( ERR_CANNOT_ENTER_DIRECTORY, p ); return -1; } else if ( result == S_AUTO_SKIP ) m_bAutoSkip = true; return 0; } QStringList recursion; qDebug( "kio_ftp : ##Listing" ); FtpEntry *e; while ( ( e = ftp.readdir() ) != 0L ) { qDebug( "kio_ftp : #%s", e->name.ascii() ); if ( e->name == "." || e->name == ".." ) continue; QString p2 = p; p2 += "/"; p2 += e->name; QString tmp = _rel_path; tmp += "/"; tmp += e->name; if ( !S_ISDIR( e->type ) ) { qDebug( "kio_ftp : Appending '%s' '%s'", p2.ascii(), tmp.ascii() ); Copy c; c.m_strAbsSource = p2; c.m_strRelDest = tmp; c.m_access = e->access; c.m_type = e->type; c.m_size = e->size; _files.append( c ); size += e->size; } else { CopyDir c; c.m_strAbsSource = p2; c.m_strRelDest = tmp; c.m_access = e->access; c.m_type = e->type; _dirs.append( c ); recursion.append( tmp ); } } if ( !ftp.ftpCloseDir() ) { // error( ERR_COULD_NOT_CLOSEDIR, p ); return -1; } QStringList::Iterator it = recursion.begin(); for( ; it != recursion.end(); ++it ) { long s; if ( ( s = listRecursive2( _abs_path, (*it).ascii(), _files, _dirs ) ) == -1 ) return -1; size += s; } return size;}void FtpProtocol::slotListDir( const char *_url ){ qDebug( "kio_ftp : =============== LIST %s ===============", _url ); KURL usrc( _url ); if ( usrc.isMalformed() ) { error( ERR_MALFORMED_URL, strdup(_url) ); m_cmd = CMD_NONE; return; } if ( strcmp( usrc.protocol(), "ftp" ) != 0L ) { error( ERR_INTERNAL, "kio_ftp got non ftp file in list command" ); m_cmd = CMD_NONE; return; } /* struct stat buff; if ( stat( usrc.path(), &buff ) == -1 ) { error( ERR_DOES_NOT_EXIST, url); m_cmd = CMD_NONE; return; } if ( !S_ISDIR( buff.st_mode ) ) { error( ERR_IS_FILE, url ); m_cmd = CMD_NONE; return; } */ m_cmd = CMD_LIST; if ( !ftp.opendir( usrc ) ) { error( ERR_CANNOT_ENTER_DIRECTORY, strdup(_url) ); m_cmd = CMD_NONE; return; } FtpEntry* e; while ( ( e = ftp.readdir() ) ) { if ( e->name == "." || e->name == ".." ) continue; qDebug( "kio_ftp : Listing %s", e->name.ascii() ); KUDSEntry entry; KUDSAtom atom; atom.m_uds = UDS_NAME; atom.m_str = e->name; entry.append( atom ); atom.m_uds = UDS_FILE_TYPE; atom.m_long = e->type; entry.append( atom ); atom.m_uds = UDS_SIZE; atom.m_long = e->size; entry.append( atom ); /* atom.m_uds = UDS_MODIFICATION_TIME; atom.m_long = buff.st_mtime; entry.append( atom ); */ atom.m_uds = UDS_ACCESS; atom.m_long = e->access; entry.append( atom ); atom.m_uds = UDS_USER; atom.m_str = e->owner; entry.append( atom ); atom.m_uds = UDS_GROUP; atom.m_str = e->group; entry.append( atom ); atom.m_uds = UDS_LINK_DEST; atom.m_str = e->link; entry.append( atom ); /* atom.m_uds = UDS_ACCESS_TIME; atom.m_long = buff.st_atime; entry.append( atom ); atom.m_uds = UDS_CREATION_TIME; atom.m_long = buff.st_ctime; entry.append( atom ); */ listEntry( entry ); } qDebug( "kio_ftp : ============= COMPLETED LIST ============" ); ftp.closedir(); qDebug( "kio_ftp : ============= COMPLETED LIST 2 ============" ); m_cmd = CMD_NONE; finished(); qDebug( "kio_ftp : =============== BYE ===========" );}void FtpProtocol::slotTestDir( const char *_url ){ KURL usrc( _url ); if ( usrc.isMalformed() ) { error( ERR_MALFORMED_URL, strdup(_url) ); m_cmd = CMD_NONE; return; } if ( strcmp( usrc.protocol(), "ftp" ) != 0L ) { error( ERR_INTERNAL, "kio_ftp got non ftp file as source in copy command" ); m_cmd = CMD_NONE; return; } qDebug( "kio_ftp : =============== slotTestDir ==============" ); FtpEntry* e; if ( !( e = ftp.stat( usrc ) ) ) { qDebug( "kio_ftp : =========== ERROR ========" ); error( ERR_DOES_NOT_EXIST, strdup(_url) ); m_cmd = CMD_NONE; return; } if ( S_ISDIR( e->type ) ) { qDebug( "kio_ftp : ========== DONE DIR ========= %s", _url ); isDirectory(); } else { qDebug( "kio_ftp : ========== DONE FILE ========= %s", _url ); isFile(); } finished();}void FtpProtocol::jobError( int _errid, const char *_txt ){ if ( !m_bIgnoreJobErrors ) error( _errid, _txt );}/************************************* * * FtpIOJob * *************************************/FtpIOJob::FtpIOJob( KIOConnection *_conn, FtpProtocol *_Ftp ) : KIOJobBase( _conn ){ m_pFtp = _Ftp;} void FtpIOJob::slotError( int _errid, const char *_txt ){ KIOJobBase::slotError( _errid, _txt ); m_pFtp->jobError( _errid, _txt );}/************************************* * * Utilities * *************************************/int check( KIOConnection *_con ){ int err; struct timeval tv; tv.tv_sec = 0; tv.tv_usec = 0; fd_set rfds; FD_ZERO( &rfds ); FD_SET( _con->inFD(), &rfds ); again: if ( ( err = select( _con->inFD(), &rfds, 0L, 0L, &tv ) ) == -1 && errno == EINTR ) goto again; // No error and something to read ? if ( err != -1 && err != 0 ) return 1; return 0;}
oldURL.path().remove(0,1), newURL.path().remove(0,1) );
oldPath, newPath );
void DevicesProtocol::rename(KURL const &oldURL, KURL const &newURL, bool) { kdDebug(7126)<<"DevicesProtocol::rename(): old="<<oldURL<<" new="<<newURL<<endl; DCOPRef mountwatcher("kded", "mountwatcher"); DCOPReply reply = mountwatcher.call( "setDisplayName", oldURL.path().remove(0,1), newURL.path().remove(0,1) ); bool ok = false; if ( reply.isValid() ) { ok = reply; } if(ok) { finished(); } else { error(KIO::ERR_DIR_ALREADY_EXIST, i18n("This device name already exists")); }}
QString path = url.encodedPathAndQuery();
QString path = url.path();
void DevicesProtocol::mountAndRedirect(const KURL& url){ QString device; QString path = url.encodedPathAndQuery(); int i = path.find('/', 1); if (i > 0) { device = path.mid(1, i-1); path = path.mid(i+1); } else { device = path.mid(1); path = QString::null; } QStringList info = deviceInfo(KURL::decode_string(device)); if (info.empty()) { error(KIO::ERR_SLAVE_DEFINED,i18n("Unknown device %1").arg(url.fileName())); return; } QStringList::Iterator it=info.begin(); if (it!=info.end()) { QString device=*it; ++it; if (it!=info.end()) { ++it; ++it; if (it!=info.end()) { QString mp=*it; ++it;++it; if (it!=info.end()) { bool mounted=((*it)=="true"); if (!mounted) { if (!mp.startsWith("file:/")) { error(KIO::ERR_SLAVE_DEFINED,i18n("Device not accessible") +mp); return; } KProcess *proc = new KProcess; *proc << "kio_devices_mounthelper"; *proc << "-m" << url.url(); proc->start(KProcess::Block); int ec = 0; if (proc->normalExit()) ec = proc->exitStatus(); delete proc; if (ec) { error(KIO::ERR_SLAVE_DEFINED,i18n("Device not mounted")); return; } } KURL newUrl(mp); if (!path.isEmpty()) newUrl.cd(path); redirection(newUrl); finished(); return; } } } } error(KIO::ERR_SLAVE_DEFINED,i18n("Illegal data received")); return;}
int kdemain( int, char **argv )
int kdemain( int argc, char **argv )
int kdemain( int, char **argv ) { kdDebug(7126)<<"kdemain for devices"<<endl; KInstance instance( "kio_devices" ); DevicesProtocol slave(argv[1],argv[2], argv[3]); slave.dispatchLoop(); return 0; }
KInstance instance( "kio_devices" );
KApplication::disableAutoDcopRegistration(); KApplication app(argc, argv, "kio_devices", false, true);
int kdemain( int, char **argv ) { kdDebug(7126)<<"kdemain for devices"<<endl; KInstance instance( "kio_devices" ); DevicesProtocol slave(argv[1],argv[2], argv[3]); slave.dispatchLoop(); return 0; }
QGISEXTERN QgsGPXProvider * classFactory(const char *uri) { return new QgsGPXProvider(uri);
QGISEXTERN QgsGPXProvider * classFactory(const QString *uri) { return new QgsGPXProvider(*uri);
QGISEXTERN QgsGPXProvider * classFactory(const char *uri) { return new QgsGPXProvider(uri);}
kdDebug( 1440 ) << "Created info node item: " << text << endl;
InfoNodeItem::InfoNodeItem( InfoCategoryItem *parent, const QString &text ) : NavigatorItem( parent, text ){// kdDebug( 1440 ) << "Created info node item: " << text << endl;}
if (argc != 4) { fprintf(stderr, "Usage: kio_pop3 protocol domain-socket1 domain-socket2\n");
if (argc != 4) { kdDebug() << "Usage: kio_pop3 protocol domain-socket1 domain-socket2" << endl;
int kdemain( int argc, char **argv ){ KInstance instance( "kio_pop3" ); if (argc != 4) { fprintf(stderr, "Usage: kio_pop3 protocol domain-socket1 domain-socket2\n"); exit(-1); } POP3Protocol *slave; // Are we looking to use SSL? if (strcasecmp(argv[1], "pop3s") == 0) slave = new POP3Protocol(argv[2], argv[3], true); else slave = new POP3Protocol(argv[2], argv[3], false); slave->dispatchLoop(); delete slave; return 0;}
ThumbCreator *new_creator()
KDE_EXPORT ThumbCreator *new_creator()
ThumbCreator *new_creator() { return new TextCreator; }
lpStruct->iImage = (*env)->GetIntField(env, lpObject, LVCOLUMNFc.iImage); lpStruct->iSubItem = (*env)->GetIntField(env, lpObject, LVCOLUMNFc.iSubItem); lpStruct->cchTextMax = (*env)->GetIntField(env, lpObject, LVCOLUMNFc.cchTextMax); lpStruct->pszText = (LPTSTR)(*env)->GetIntField(env, lpObject, LVCOLUMNFc.pszText); lpStruct->cx = (*env)->GetIntField(env, lpObject, LVCOLUMNFc.cx); lpStruct->fmt = (*env)->GetIntField(env, lpObject, LVCOLUMNFc.fmt); lpStruct->mask = (*env)->GetIntField(env, lpObject, LVCOLUMNFc.mask);
LVCOLUMN *getLVCOLUMNFields(JNIEnv *env, jobject lpObject, LVCOLUMN *lpStruct){ if (!LVCOLUMNFc.cached) cacheLVCOLUMNFields(env, lpObject); lpStruct->iOrder = (*env)->GetIntField(env, lpObject, LVCOLUMNFc.iOrder); lpStruct->iImage = (*env)->GetIntField(env, lpObject, LVCOLUMNFc.iImage); lpStruct->iSubItem = (*env)->GetIntField(env, lpObject, LVCOLUMNFc.iSubItem); lpStruct->cchTextMax = (*env)->GetIntField(env, lpObject, LVCOLUMNFc.cchTextMax); lpStruct->pszText = (LPTSTR)(*env)->GetIntField(env, lpObject, LVCOLUMNFc.pszText); lpStruct->cx = (*env)->GetIntField(env, lpObject, LVCOLUMNFc.cx); lpStruct->fmt = (*env)->GetIntField(env, lpObject, LVCOLUMNFc.fmt); lpStruct->mask = (*env)->GetIntField(env, lpObject, LVCOLUMNFc.mask); return lpStruct;}
int kdemain( int argc, char **argv )
KDE_EXPORT int kdemain( int argc, char **argv )
int kdemain( int argc, char **argv ) { KInstance instance( "kio_finger" ); //kdDebug() << "*** Starting kio_finger " << getpid() << endl; if (argc != 4) { fprintf(stderr, "Usage: kio_finger protocol domain-socket1 domain-socket2\n"); exit(-1); } FingerProtocol slave(argv[2], argv[3]); slave.dispatchLoop(); //kdDebug() << "*** kio_finger Done" << endl; return 0; }
kndbgstream& operator<< (kndbgstream& s, sftpFileAttr& a) {
QDataStream& operator<< (QDataStream& s, const sftpFileAttr& fa) { s << (Q_UINT32)fa.mFlags; if( fa.mFlags & SSH2_FILEXFER_ATTR_SIZE ) { s << (Q_UINT32)0 << (Q_UINT32)fa.mSize; } if( fa.mFlags & SSH2_FILEXFER_ATTR_UIDGID ) { s << (Q_UINT32)fa.mUid << (Q_UINT32)fa.mGid; } if( fa.mFlags & SSH2_FILEXFER_ATTR_PERMISSIONS ) { s << (Q_UINT32)fa.mPermissions; } if( fa.mFlags & SSH2_FILEXFER_ATTR_ACMODTIME ) { s << (Q_UINT32)fa.mAtime << (Q_UINT32)fa.mMtime; } if( fa.mFlags & SSH2_FILEXFER_ATTR_EXTENDED ) { s << (Q_UINT32)fa.mExtendedCount; }
kndbgstream& operator<< (kndbgstream& s, sftpFileAttr& a) { return s;}
(*env)->SetIntField(env, lpObject, OPENFILENAMEFc.lpfnHook, (jint)lpStruct->lpfnHook); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.lCustData, (jint)lpStruct->lCustData); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.lpstrDefExt, (jint)lpStruct->lpstrDefExt); (*env)->SetShortField(env, lpObject, OPENFILENAMEFc.nFileExtension, (jshort)lpStruct->nFileExtension); (*env)->SetShortField(env, lpObject, OPENFILENAMEFc.nFileOffset, (jshort)lpStruct->nFileOffset); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.Flags, (jint)lpStruct->Flags); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.lpstrTitle, (jint)lpStruct->lpstrTitle); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.lpstrInitialDir, (jint)lpStruct->lpstrInitialDir); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.nMaxFileTitle, (jint)lpStruct->nMaxFileTitle); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.lpstrFileTitle, (jint)lpStruct->lpstrFileTitle); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.nMaxFile, (jint)lpStruct->nMaxFile); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.lpstrFile, (jint)lpStruct->lpstrFile); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.nFilterIndex, (jint)lpStruct->nFilterIndex); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.nMaxCustFilter, (jint)lpStruct->nMaxCustFilter); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.lpstrCustomFilter, (jint)lpStruct->lpstrCustomFilter); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.lpstrFilter, (jint)lpStruct->lpstrFilter); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.hInstance, (jint)lpStruct->hInstance); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.hwndOwner, (jint)lpStruct->hwndOwner); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.lStructSize, (jint)lpStruct->lStructSize);
void setOPENFILENAMEFields(JNIEnv *env, jobject lpObject, OPENFILENAME *lpStruct){ if (!OPENFILENAMEFc.cached) cacheOPENFILENAMEFields(env, lpObject); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.lpTemplateName, (jint)lpStruct->lpTemplateName); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.lpfnHook, (jint)lpStruct->lpfnHook); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.lCustData, (jint)lpStruct->lCustData); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.lpstrDefExt, (jint)lpStruct->lpstrDefExt); (*env)->SetShortField(env, lpObject, OPENFILENAMEFc.nFileExtension, (jshort)lpStruct->nFileExtension); (*env)->SetShortField(env, lpObject, OPENFILENAMEFc.nFileOffset, (jshort)lpStruct->nFileOffset); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.Flags, (jint)lpStruct->Flags); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.lpstrTitle, (jint)lpStruct->lpstrTitle); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.lpstrInitialDir, (jint)lpStruct->lpstrInitialDir); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.nMaxFileTitle, (jint)lpStruct->nMaxFileTitle); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.lpstrFileTitle, (jint)lpStruct->lpstrFileTitle); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.nMaxFile, (jint)lpStruct->nMaxFile); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.lpstrFile, (jint)lpStruct->lpstrFile); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.nFilterIndex, (jint)lpStruct->nFilterIndex); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.nMaxCustFilter, (jint)lpStruct->nMaxCustFilter); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.lpstrCustomFilter, (jint)lpStruct->lpstrCustomFilter); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.lpstrFilter, (jint)lpStruct->lpstrFilter); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.hInstance, (jint)lpStruct->hInstance); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.hwndOwner, (jint)lpStruct->hwndOwner); (*env)->SetIntField(env, lpObject, OPENFILENAMEFc.lStructSize, (jint)lpStruct->lStructSize);}
ftp.close();
ftp.ftpClose();
int check( Connection *_con );extern "C" { void sigalrm_handler(int);}int main( int, char ** ){ signal(SIGCHLD, IOProtocol::sigchld_handler); signal(SIGSEGV, IOProtocol::sigsegv_handler); // KProtocolManager manager; debug( "kio_ftp : Starting"); Connection parent( 0, 1 ); FtpProtocol ftp( &parent ); ftp.dispatchLoop(); debug( "kio_ftp : Done" );}/* * We'll use an alarm that will set this flag when transfer has timed out */char sigbreak = 0;void sigalrm_handler(int){ sigbreak = 1;} void setup_alarm(unsigned int timeout){ sigbreak = 0; alarm(timeout); signal(SIGALRM, sigalrm_handler);}FtpProtocol::FtpProtocol( Connection *_conn ) : IOProtocol( _conn ){ m_cmd = CMD_NONE; m_bIgnoreJobErrors = false; m_bCanResume = true; // most of ftp servers support resuming ?}void FtpProtocol::slotMkdir( const char *_url, int _mode ){ KURL usrc( _url ); if ( usrc.isMalformed() ) { error( ERR_MALFORMED_URL, strdup(_url) ); m_cmd = CMD_NONE; return; } if ( strcmp( usrc.protocol(), "ftp" ) != 0L ) { error( ERR_INTERNAL, "kio_ftp got non ftp file in mkdir command" ); m_cmd = CMD_NONE; return; } // Connect to the ftp server if ( !ftp.isConnected() ) if ( !ftp.ftpConnect( usrc ) ) { error( ftp.error(), ftp.errorText() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; return; } FtpEntry* e = ftp.ftpStat( usrc ); if ( !e ) { if ( !ftp.ftpMkdir( usrc.path() ) ) { error( ERR_COULD_NOT_MKDIR, strdup(_url) ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } else { // set the desired attributes for dir if ( _mode != -1 ) if ( !ftp.ftpChmod( usrc.path(), _mode ) ) { error( ERR_CANNOT_CHMOD, strdup(_url) ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } finished(); ftp.ftpDisconnect(); return; } } if ( S_ISDIR( e->type ) ) { // !!! ok ? error( ERR_DOES_ALREADY_EXIST, strdup(_url) ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } error( ERR_COULD_NOT_MKDIR, strdup(_url) ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return;}void FtpProtocol::slotCopy( QStringList& _source, const char *_dest ){ doCopy( _source, _dest, false );}void FtpProtocol::slotCopy( const char* _source, const char *_dest ){ QStringList lst; lst.append( _source ); doCopy( lst, _dest, true );}void FtpProtocol::slotMove( QStringList& _source, const char *_dest ){ doCopy( _source, _dest, false, true );}void FtpProtocol::slotMove( const char* _source, const char *_dest ){ QStringList lst; lst.append( _source ); doCopy( lst, _dest, true, true );}void FtpProtocol::doCopy( QStringList& _source, const char *_dest, bool _rename, bool _move ){ if ( _rename ) assert( _source.count() == 1 ); debug( "kio_ftp : Making copy to %s", _dest ); // Check whether the URLs are wellformed QStringList::Iterator soit = _source.begin(); for( ; soit != _source.end(); ++soit ) { qDebug( "kio_ftp : Checking %s", (*soit).ascii() ); KURL usrc( *soit ); if ( usrc.isMalformed() ) { error( ERR_MALFORMED_URL, (*soit) ); m_cmd = CMD_NONE; return; } if ( strcmp( usrc.protocol(), "ftp" ) != 0L ) { error( ERR_INTERNAL, "kio_ftp got non ftp file as source in copy command" ); m_cmd = CMD_NONE; return; } } qDebug( "kio_ftp : All URLs ok %s", _dest ); // Make a copy of the parameter. if we do IPC calls from here, then we overwrite // our argument. This is tricky! ( but saves memory and speeds things up ) QString dest = _dest; // Check wellformedness of the destination KURL udest( dest ); if ( udest.isMalformed() ) { error( ERR_MALFORMED_URL, dest ); m_cmd = CMD_NONE; return; } debug( "kio_ftp : Dest ok %s", dest.ascii() ); // Find IO server for destination QString exec = KProtocolManager::self().executable( udest.protocol() ); if ( exec.isEmpty() ) { error( ERR_UNSUPPORTED_PROTOCOL, udest.protocol() ); m_cmd = CMD_NONE; return; } // Is the right most protocol a filesystem protocol ? if ( KProtocolManager::self().outputType( udest.protocol() ) != KProtocolManager::T_FILESYSTEM ) { error( ERR_PROTOCOL_IS_NOT_A_FILESYSTEM, udest.protocol() ); m_cmd = CMD_NONE; return; } debug( "kio_ftp : IO server ok %s", dest.ascii() ); // Connect to the ftp server KURL usrc( _source.first() ); if ( !ftp.ftpConnect( usrc ) ) { error( ftp.error(), ftp.errorText() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; return; } // Find out, whether we are logged anonymously or not // Authorization has been already checked with ftp.ftpConnect( usrc ) bool b_user = false; if ( usrc.hasUser() ) b_user = true; // Get a list of all source files and directories QValueList<Copy> files; QValueList<CopyDir> dirs; int size = 0; debug( "kio_ftp : Iterating" ); soit = _source.begin(); debug( "kio_ftp : Looping" ); for( ; soit != _source.end(); ++soit ) { qDebug( "kio_ftp : Executing %s", (*soit).ascii() ); KURL usrc( *soit ); qDebug( "kio_ftp : Parsed URL" ); // Did an error occur ? int s; if ( ( s = listRecursive( usrc.path(), files, dirs, _rename ) ) == -1 ) { ftp.ftpDisconnect(); // Error message is already sent m_cmd = CMD_NONE; return; } // Sum up the total amount of bytes we have to copy size += s; } debug( "kio_ftp : Recursive 1 %s", dest.ascii() ); /* // Check wether we do not copy a directory in itself or one of its subdirectories struct stat buff2; if ( udest.isLocalFile() && stat( udest.path(), &buff2 ) == 0 ) { bool b_error = false; for( soit = _source.begin(); soit != _source.end(); ++soit ) { KURL usrc( *soit ); struct stat buff1; // Can we stat both the source, too ? ( Should always be the case ) if ( stat( usrc.path(), &buff1 ) == 0 ) { bool b_error = false; // Are source and dest equal ? => error if ( buff1.st_ino == buff2.st_ino ) b_error = true; } } if ( !b_error ) { // Iterate over all subdirectories QValueList<CopyDir>::iterator it = dirs.begin(); for( ; it != dirs.end() && !b_error; it++ ) if ( buff2.st_ino == (*it).m_ino ) b_error = true; } // Do we have a cylic copy now ? => error if ( b_error ) { error( ERR_CYCLIC_COPY, *soit ); m_cmd = CMD_NONE; return; } } */ qDebug( "kio_ftp : Recursive ok %s", dest.ascii() ); m_cmd = CMD_GET; // Start a server for the destination protocol Slave slave( exec ); if ( slave.pid() == -1 ) { error( ERR_CANNOT_LAUNCH_PROCESS, exec ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; return; } // Put a protocol on top of the job FtpIOJob job( &slave, this ); qDebug( "kio_ftp : Job started ok %s", dest.ascii() ); // Tell our client what we 'r' gonna do totalSize( size ); totalFiles( files.count() ); totalDirs( dirs.count() ); int processed_files = 0; int processed_dirs = 0; int processed_size = 0; // Replace the relative destinations with absolut destinations // by prepending the destinations path QString tmp1 = udest.path( 1 ); // Strip '/' QString tmp1_stripped = udest.path( -1 ); QValueList<CopyDir>::Iterator dit = dirs.begin(); for( ; dit != dirs.end(); dit++ ) { QString tmp2 = (*dit).m_strRelDest; if ( _rename ) (*dit).m_strRelDest = tmp1_stripped; else (*dit).m_strRelDest = tmp1; (*dit).m_strRelDest += tmp2; } QValueList<Copy>::Iterator fit = files.begin(); for( ; fit != files.end(); fit++ ) { QString tmp2 = (*fit).m_strRelDest; if ( _rename ) // !!! && (*fit).m_strRelDest == "" ) (*fit).m_strRelDest = tmp1_stripped; else (*fit).m_strRelDest = tmp1; (*fit).m_strRelDest += tmp2; } qDebug( "kio_ftp : Destinations ok %s", dest.data() ); /***** * Make directories *****/ m_bIgnoreJobErrors = true; bool overwrite_all = false; bool auto_skip = false; bool resume_all = false; QStringList skip_list, overwrite_list; // Create all directories dit = dirs.begin(); for( ; dit != dirs.end(); dit++ ) { // Repeat until we got no error do { job.clearError(); KURL ud( udest ); ud.setPath( (*dit).m_strRelDest); QString d = ud.url(); // Is this URL on the skip list ? bool skip = false; QStringList::Iterator sit = skip_list.begin(); for( ; sit != skip_list.end() && !skip; sit++ ) // Is d a subdirectory of *sit ? if ( *sit==d ) skip = true; if ( skip ) continue; // Is this URL on the overwrite list ? bool overwrite = false; QStringList::Iterator oit = overwrite_list.begin(); for( ; oit != overwrite_list.end() && !overwrite; oit++ ) if ( *oit == d ) overwrite = true; if ( overwrite ) continue; // Tell what we are doing makingDir( d.data() ); // debug( "kio_ftp : Making remote dir %s", d ); // Create the directory job.mkdir( d.data(), (*dit).m_access ); while( !job.hasFinished() ) job.dispatch(); // Did we have an error ? if ( job.hasError() ) { // Can we prompt the user and ask for a solution ? if ( /* m_bGUI && */ job.errorId() == ERR_DOES_ALREADY_EXIST ) { QString old_path = udest.path( 1 ); QString old_url = udest.url( 1 ); // Should we skip automatically ? if ( auto_skip ) { job.clearError(); // We dont want to copy files in this directory, so we put it on the skip list. skip_list.append( old_url ); continue; } else if ( overwrite_all ) { job.clearError(); continue; } /* RenameDlg_Mode m = (RenameDlg_Mode)( M_SINGLE | M_OVERWRITE ); if ( dirs.count() > 1 ) m = (RenameDlg_Mode)(M_MULTI | M_SKIP | M_OVERWRITE ); */ RenameDlg_Mode m = (RenameDlg_Mode)( M_MULTI | M_SKIP | M_OVERWRITE ); QString tmp2 = udest.url(), n; RenameDlg_Result r = open_RenameDlg( (*dit).m_strAbsSource, tmp2, m, n ); if ( r == R_CANCEL ) { ftp.ftpDisconnect(); error( ERR_USER_CANCELED, "" ); m_cmd = CMD_NONE; return; } else if ( r == R_RENAME ) { KURL u( n ); // The Dialog should have checked this. if ( u.isMalformed() ) assert( 0 ); // The new path with trailing '/' QString tmp3 = u.path( 1 ); /////// // Replace old path with tmp3 /////// QValueList<CopyDir>::Iterator dit2 = dit; // Change the current one and strip the trailing '/' (*dit2).m_strRelDest = u.path( -1 ); // Change the name of all subdirectories dit2++; for( ; dit2 != dirs.end(); dit2++ ) if ( strncmp((*dit2).m_strRelDest, old_path, old_path.length())==0 ) (*dit2).m_strRelDest.replace( 0, old_path.length(), tmp3 ); // Change all filenames QValueList<Copy>::Iterator fit2 = files.begin(); for( ; fit2 != files.end(); fit2++ ) if ( strncmp( (*fit2).m_strRelDest, old_path, old_path.length() ) == 0 ) (*fit2).m_strRelDest.replace( 0, old_path.length(), tmp3 ); // Dont clear error => we will repeat the current command } else if ( r == R_SKIP ) { // Skip all files and directories that start with 'old_url' skip_list.append( old_url ); // Clear the error => The current command is not repeated => skipped job.clearError(); } else if ( r == R_AUTO_SKIP ) { // Skip all files and directories that start with 'old_url' skip_list.append( old_url ); // Clear the error => The current command is not repeated => skipped job.clearError(); auto_skip = true; } else if ( r == R_OVERWRITE ) { // Dont bother for subdirectories overwrite_list.append( old_url ); // Clear the error => The current command is not repeated => we will // overwrite every file in this directory or any of its subdirectories job.clearError(); } else if ( r == R_OVERWRITE_ALL ) { job.clearError(); overwrite_all = true; } else assert( 0 ); } // No need to ask the user, so raise an error else { error( job.errorId(), job.errorText() ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } } } while( job.hasError() ); processedDirs( ++processed_dirs ); } debug( "kio_ftp : Created directories %s", dest.data() ); /***** * Server check - supports resuming ? *****/ if ( !ftp.ftpResume( 0 ) ) m_bCanResume = false; /***** * Copy files *****/ time_t t_start = time( 0L ); time_t t_last = t_start; fit = files.begin(); for( ; fit != files.end(); fit++ ) { bool overwrite = false; bool skip_copying = false; bool resume = false; unsigned long offset = 0; // Repeat until we got no error do { job.clearError(); KURL ud( dest ); ud.setPath( (*fit).m_strRelDest); QString d = ud.url(); // Is this URL on the skip list ? bool skip = false; QStringList::Iterator sit = skip_list.begin(); for( ; sit != skip_list.end() && !skip; sit++ ) // Is 'd' a file in directory '*sit' or one of its subdirectories ? if ( *sit==d ) skip = true; if ( skip ) continue; // emit sigCanResume( m_bCanResume ) canResume( m_bCanResume ); QString realpath = "ftp:"; realpath += (*fit).m_strAbsSource; copyingFile( realpath.ascii(), d.ascii() ); // debug( "kio_ftp : Writing to %s", d ); // Is this URL on the overwrite list ? QStringList::Iterator oit = overwrite_list.begin(); for( ; oit != overwrite_list.end() && !overwrite; oit++ ) if (*oit==d) overwrite = true; // implicitly set permissions rw-r--r-- for anonymous ftp int md = -1; // but when it's not anonymous ftp, set permissions as in original source if ( b_user ) md = (*fit).m_access; job.put( d, md, overwrite_all || overwrite, resume_all || resume, (*fit).m_size ); while( !job.isReady() && !job.hasFinished() ) job.dispatch(); // Did we have an error ? if ( job.hasError() ) { int currentError = job.errorId(); qDebug("################# COULD NOT PUT %d",currentError); // if ( /* m_bGUI && */ job.errorId() == ERR_WRITE_ACCESS_DENIED ) if ( /* m_bGUI && */ currentError != ERR_DOES_ALREADY_EXIST && currentError != ERR_DOES_ALREADY_EXIST_FULL ) { // Should we skip automatically ? if ( auto_skip ) { job.clearError(); skip_copying = true; continue; } QString tmp2 = ud.url(); SkipDlg_Result r; r = open_SkipDlg( tmp2, ( files.count() > 1 ) ); if ( r == S_CANCEL ) { error( ERR_USER_CANCELED, "" ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } else if ( r == S_SKIP ) { // Clear the error => The current command is not repeated => skipped job.clearError(); skip_copying = true; continue; } else if ( r == S_AUTO_SKIP ) { // Clear the error => The current command is not repeated => skipped job.clearError(); skip_copying = true; continue; } else assert( 0 ); } // Can we prompt the user and ask for a solution ? else if ( /* m_bGUI && */ currentError == ERR_DOES_ALREADY_EXIST || currentError == ERR_DOES_ALREADY_EXIST_FULL ) { // Should we skip automatically ? if ( auto_skip ) { job.clearError(); continue; } RenameDlg_Result r; QString n; if ( KProtocolManager::self().autoResume() && m_bCanResume && currentError != ERR_DOES_ALREADY_EXIST_FULL ) { r = R_RESUME_ALL; } else { RenameDlg_Mode m; // ask for resume only if transfer can be resumed and if it is not // already fully downloaded if ( files.count() > 1 ){ if ( m_bCanResume && currentError != ERR_DOES_ALREADY_EXIST_FULL ) m = (RenameDlg_Mode)(M_MULTI | M_SKIP | M_OVERWRITE | M_RESUME); else m = (RenameDlg_Mode)(M_MULTI | M_SKIP | M_OVERWRITE); } else { if ( m_bCanResume && currentError != ERR_DOES_ALREADY_EXIST_FULL ) m = (RenameDlg_Mode)( M_SINGLE | M_OVERWRITE | M_RESUME); else m = (RenameDlg_Mode)( M_SINGLE | M_OVERWRITE); } QString tmp2 = ud.url(); r = open_RenameDlg( (*fit).m_strAbsSource, tmp2, m, n ); } if ( r == R_CANCEL ) { error( ERR_USER_CANCELED, "" ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } else if ( r == R_RENAME ) { KURL u( n ); // The Dialog should have checked this. if ( u.isMalformed() ) assert( 0 ); // Change the destination name of the current file (*fit).m_strRelDest = u.path( -1 ); // Dont clear error => we will repeat the current command } else if ( r == R_SKIP ) { // Clear the error => The current command is not repeated => skipped job.clearError(); } else if ( r == R_AUTO_SKIP ) { // Clear the error => The current command is not repeated => skipped job.clearError(); auto_skip = true; } else if ( r == R_OVERWRITE ) { overwrite = true; // Dont clear error => we will repeat the current command } else if ( r == R_OVERWRITE_ALL ) { overwrite_all = true; // Dont clear error => we will repeat the current command } else if ( r == R_RESUME ) { resume = true; offset = getOffset( ud.url() ); // Dont clear error => we will repeat the current command } else if ( r == R_RESUME_ALL ) { resume_all = true; offset = getOffset( ud.url() ); // Dont clear error => we will repeat the current command } else assert( 0 ); } // No need to ask the user, so raise an error else { error( currentError, job.errorText() ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } } } while( job.hasError() ); if ( skip_copying ) continue; // add the offset to processed size if ( offset > 0 ) { processed_size += offset; debug( "kio_ftp : Offset = %ld", offset ); } KURL tmpurl( "ftp:/" ); tmpurl.setPath( (*fit).m_strAbsSource ); qDebug( "kio_ftp : Opening %s", (*fit).m_strAbsSource.ascii() ); if ( !ftp.ftpOpen( tmpurl, Ftp::READ, offset ) ) { error( ftp.error(), ftp.errorText() ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } // we want to know the processed size even before we read something // especially in case we overwrite file => this cleans size to zero processedSize( processed_size ); char buffer[ 4096 ]; int n; int read_size = 0; do { setup_alarm( KProtocolManager::self().readTimeout() ); // start timeout n = ftp.read( buffer, 2048 ); // !!! slow down loop for local testing // for ( int tmpi = 0; tmpi < 1000000; tmpi++ ) ; job.data( buffer, n ); processed_size += n; read_size += n; time_t t = time( 0L ); if ( t - t_last >= 1 ) { processedSize( processed_size ); speed( read_size / ( t - t_start ) ); t_last = t; } // Check parent while ( check( connection() ) ) dispatch(); // Check for error messages from slave while ( check( &slave ) ) job.dispatch(); // An error ? if ( job.hasFinished() ) { ftp.ftpDisconnect(); ftp.ftpClose(); finished(); m_cmd = CMD_NONE; return; } } while ( n > 0 ); job.dataEnd(); ftp.ftpClose(); while( !job.hasFinished() ) job.dispatch(); time_t t = time( 0L ); processedSize( processed_size ); if ( t - t_start >= 1 ) { speed( read_size / ( t - t_start ) ); t_last = t; } processedFiles( ++processed_files ); } debug( "kio_ftp : Copied files %s", dest.data() ); // slotDel() handles disconnecting by itself if ( _move ) { slotDel( _source ); } else ftp.ftpDisconnect(); finished(); m_cmd = CMD_NONE;}void FtpProtocol::slotGet( const char *_url ){ KURL usrc( _url ); if ( usrc.isMalformed() ) { error( ERR_MALFORMED_URL, strdup(_url) ); m_cmd = CMD_NONE; return; } if ( strcmp( usrc.protocol(), "ftp" ) != 0L ) { error( ERR_INTERNAL, "kio_ftp got non ftp file in get command" ); m_cmd = CMD_NONE; return; } if ( !ftp.ftpConnect( usrc ) ) { error( ftp.error(), ftp.errorText() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; return; } FtpEntry *e = ftp.ftpStat( usrc ); if ( !e ) { error( ERR_DOES_NOT_EXIST, strdup(_url) ); m_cmd = CMD_NONE; return; } /* if ( S_ISDIR( e->type ) ) { error( ERR_IS_DIRECTORY, strdup(_url) ); m_cmd = CMD_NONE; return; }*/ m_cmd = CMD_GET; if ( !ftp.open( usrc, Ftp::READ ) ) { error( ERR_CANNOT_OPEN_FOR_READING, strdup(_url) ); m_cmd = CMD_NONE; return; } ready(); gettingFile( _url ); totalSize( e->size ); int processed_size = 0; time_t t_start = time( 0L ); time_t t_last = t_start; char buffer[ 2048 ]; while( !ftp.atEOF() ) { int n = ftp.read( buffer, 2048 ); data( buffer, n ); processed_size += n; time_t t = time( 0L ); if ( t - t_last >= 1 ) { processedSize( processed_size ); speed( processed_size / ( t - t_start ) ); t_last = t; } } dataEnd(); ftp.close(); processedSize( e->size ); time_t t = time( 0L ); if ( t - t_start >= 1 ) speed( processed_size / ( t - t_start ) ); finished(); m_cmd = CMD_NONE;}void FtpProtocol::slotGetSize( const char* _url ) { m_cmd = CMD_GET_SIZE; // Check wether URL is wellformed KURL usrc( _url ); if ( usrc.isMalformed() ) { error( ERR_MALFORMED_URL, _url ); m_cmd = CMD_NONE; return; } if ( strcmp( usrc.protocol(), "ftp" ) != 0L ) { error( ERR_INTERNAL, "kio_ftp got non ftp file as source in copy command" ); m_cmd = CMD_NONE; return; } debug( "kio_ftp : URL is ok " ); if ( !ftp.ftpConnect( usrc ) ) { error( ftp.error(), ftp.errorText() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; return; } // Get a list of all source files and directories QValueList<Copy> files; QValueList<CopyDir> dirs; debug( "kio_ftp : Executing %s", _url ); // Did an error occur ? int s; if ( ( s = listRecursive( usrc.path(), files, dirs, false ) ) == -1 ) { ftp.ftpDisconnect(); // Error message is already sent m_cmd = CMD_NONE; return; } // Tell our client what we 'r' gonna do totalSize( s ); ftp.ftpDisconnect(); finished(); m_cmd = CMD_NONE;}void FtpProtocol::slotPut( const char *_url, int _mode, bool _overwrite, bool _resume, int _size ){ QString url_orig = _url; QString url_part = url_orig + ".part"; KURL udest_orig( url_orig ); KURL udest_part( url_part ); bool m_bMarkPartial = KProtocolManager::self().markPartial(); if ( udest_orig.isMalformed() ) { error( ERR_MALFORMED_URL, url_orig ); m_cmd = CMD_NONE; finished(); return; } if ( strcmp( udest_orig.protocol(), "ftp" ) != 0L ) { error(ERR_INTERNAL,"kio_ftp got non ftp file as as destination in put command" ); m_cmd = CMD_NONE; finished(); return; } // Connect to the ftp server, only if we are not connected // this prevents connecting twice in recursive copying ( mkdir connects first time ) if ( !ftp.isConnected() ) if ( !ftp.ftpConnect( udest_orig ) ) { error( ftp.error(), ftp.errorText() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; finished(); return; } m_cmd = CMD_PUT; // Find out, whether we are logged anonymously or not // Authorization has been already checked with ftp.ftpConnect( usrc ) bool b_user = false; if ( udest_orig.hasUser() ) b_user = true; FtpEntry* e; if ( ( e = ftp.ftpStat( udest_orig ) ) ) { // if original file exists, but we are using mark partial -> rename it to XXX.part if ( m_bMarkPartial ) ftp.ftpRename( udest_orig.path(), udest_part.path() ); if ( !_overwrite && !_resume ) { if ( e->size == _size ) error( ERR_DOES_ALREADY_EXIST_FULL, udest_orig.path() ); else error( ERR_DOES_ALREADY_EXIST, udest_orig.path() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; finished(); return; } } else if ( ( e = ftp.ftpStat( udest_part ) ) ) { // if file with extension .part exists but we are not using mark partial // -> rename XXX.part to original name if ( ! m_bMarkPartial ) ftp.ftpRename( udest_part.path(), udest_orig.path() ); if ( !_overwrite && !_resume ) { if ( e->size == _size ) error( ERR_DOES_ALREADY_EXIST_FULL, udest_orig.path() ); else error( ERR_DOES_ALREADY_EXIST, udest_orig.path() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; finished(); return; } } KURL udest; // if we are using marking of partial downloads -> add .part extension if ( m_bMarkPartial ) { debug( "kio_ftp : Adding .part extension to %s", udest_orig.path().ascii() ); udest = udest_part; } else udest = udest_orig; /* if ( access( udest.path(), W_OK ) == -1 ) { debug("Write Access denied for '%s' %d",udest.path(), errno ); error( ERR_WRITE_ACCESS_DENIED, url ); m_cmd = CMD_NONE; finished(); return; } */ unsigned long offset = 0; // set the mode according to offset if ( _resume ) { offset = e->size; debug( "kio_ftp : Offset = %ld", offset ); } if ( !ftp.ftpOpen( udest, Ftp::WRITE, offset ) ) { debug( "kio_ftp : ####################### COULD NOT WRITE %s", udest.path().ascii() ); error( ftp.error(), ftp.errorText() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; finished(); return; } // We are ready for receiving data ready(); // Loop until we got 'dataEnd' while ( m_cmd == CMD_PUT && dispatch() ); ftp.ftpClose(); ftp.ftpDisconnect( true ); if ( (e = ftp.ftpStat( udest )) ) { if ( e->size == _size ) { // after full download rename the file back to original name if ( m_bMarkPartial ) { cerr << "kio_ftp renaming\n"; if ( !ftp.ftpRename( udest.path(), udest_orig.path() ) ) { error( ERR_CANNOT_RENAME, udest_orig.path() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; finished(); return; } } // do chmod only after full download if ( _mode != -1 ) { cerr << "kio_ftp chmoding\n"; // set the desired attributes for dir !!! how ? if ( !ftp.ftpChmod( udest_orig.path(), _mode ) ) { error( ERR_CANNOT_CHMOD, udest_orig.path() ); ftp.ftpDisconnect( true ); m_cmd = CMD_NONE; finished(); return; } } } // if the size is less then minimum -> delete the file else if ( e->size < KProtocolManager::self().minimumKeepSize() ) { ftp.ftpDelete( udest.path() ); } } ftp.ftpDisconnect( true ); // We have done our job => finish finished(); m_cmd = CMD_NONE;}void FtpProtocol::slotDel( QStringList& _source ){ // Check wether the URLs are wellformed QStringList::Iterator soit = _source.begin(); for( ; soit != _source.end(); ++soit ) { debug( "kio_ftp : Checking %s", (*soit).ascii() ); KURL usrc( *soit ); if ( usrc.isMalformed() ) { error( ERR_MALFORMED_URL, *soit); m_cmd = CMD_NONE; return; } if ( strcmp( usrc.protocol(), "ftp" ) != 0L ) { error(ERR_INTERNAL,"kio_ftp got non ftp file for delete command" ); m_cmd = CMD_NONE; return; } } qDebug( "kio_ftp : All URLs ok" ); // Get a list of all source files and directories QValueList<Copy> fs; QValueList<CopyDir> ds; int size = 0; qDebug( "kio_ftp : Iterating" ); soit = _source.begin(); qDebug( "kio_ftp : Looping" ); for( ; soit != _source.end(); ++soit ) { qDebug( "kio_ftp : Executing %s", (*soit).ascii() ); KURL usrc(*soit); qDebug( "kio_ftp : Parsed URL" ); // Did an error occur ?// int s;// if ( ( s = listRecursive( usrc.path(), fs, ds, false ) ) == -1 )// {// // Error message is already sent// ftp.ftpDisconnect();// m_cmd = CMD_NONE;// return;// } // Sum up the total amount of bytes we have to copy// size += s; } qDebug( "kio_ftp : Recursive ok" ); if ( fs.count() == 1 ) m_cmd = CMD_DEL; else m_cmd = CMD_MDEL; // Tell our client what we 'r' gonna do totalSize( size ); totalFiles( fs.count() ); totalDirs( ds.count() ); /***** * Delete files *****/ QValueList<Copy>::Iterator fit = fs.begin(); for( ; fit != fs.end(); fit++ ) { QString filename = (*fit).m_strAbsSource; qDebug( "kio_ftp : Deleting file %s", filename.ascii() ); deletingFile( filename ); if ( !ftp.ftpDelete( filename ) ) // !!! use unlink ? { error( ERR_CANNOT_DELETE, filename ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } } /***** * Delete empty directories *****/ QValueList<CopyDir>::Iterator dit = ds.begin(); for( ; dit != ds.end(); dit++ ) { QString dirname = (*dit).m_strAbsSource; qDebug( "kio_ftp : Deleting directory %s", dirname.ascii() ); deletingFile( dirname ); if ( !ftp.ftpRmdir( dirname ) ) { error( ERR_COULD_NOT_RMDIR, dirname ); ftp.ftpDisconnect(); m_cmd = CMD_NONE; return; } } finished(); m_cmd = CMD_NONE;}void FtpProtocol::slotData( void *_p, int _len ){ switch( m_cmd ) { case CMD_PUT: ftp.write( _p, _len ); break; }}void FtpProtocol::slotDataEnd(){ switch( m_cmd ) { case CMD_PUT: m_cmd = CMD_NONE; }}long FtpProtocol::listRecursive( const char *_path, QValueList<Copy>& _files, QValueList<CopyDir>& _dirs, bool _rename ){ m_bAutoSkip = false; // Check wether we have to copy the complete directory tree beginning by its root. int len = strlen( _path ); while( len >= 1 && _path[ len - 1 ] == '/' ) len--; if ( len == 0 ) { CopyDir c; c.m_strAbsSource = _path; if ( _rename ) c.m_strRelDest = ""; else c.m_strRelDest = ""; c.m_access = S_IRWXU | S_IRWXO | S_IRWXG; c.m_type = S_IFDIR; _dirs.append( c ); return listRecursive2( "/", c.m_strRelDest, _files, _dirs ); } QString p=_path; qDebug( "kio_ftp : ########## RECURSIVE LISTING %s", p.ascii() ); KURL tmpurl( "ftp:/" ); tmpurl.setPath( p ); FtpEntry* e = ftp.ftpStat( tmpurl ); if ( !e ) { error( ERR_DOES_NOT_EXIST, p); return -1; } KURL u( p ); // Should be checked before, but who knows if ( u.isMalformed() ) assert( 0 ); // Is the source not a directory ? => so just copy it and we are done. if ( !S_ISDIR( e->type ) ) { qDebug( "kio_ftp : not a dir" ); QString fname; if ( _rename ) fname = ""; else { fname = u.filename(); // Should be impossible, but who knows ... if ( fname.isEmpty() ) assert( 0 ); } Copy c; c.m_strAbsSource = p; c.m_strRelDest = fname; c.m_access = e->access; c.m_type = e->type; c.m_size = e->size; _files.append( c ); return e->size; } // The source is a directory. So we have to go into recursion here. QString tmp1; if ( _rename ) tmp1 = u.path( 0 ); else { tmp1 = u.directory( true ); tmp1 += "/"; } QString tmp2; if ( _rename ) tmp2 = ""; else tmp2 = u.filename(); CopyDir c; c.m_strAbsSource = p; c.m_strRelDest = tmp2; c.m_access = e->access; c.m_type = e->type; _dirs.append( c ); qDebug( "kio_ftp : ########### STARTING RECURSION with %s and %s",tmp1.ascii(), tmp2.ascii() ); return listRecursive2( tmp1, tmp2, _files, _dirs );}long FtpProtocol::listRecursive2( const char *_abs_path, const char *_rel_path, QValueList<Copy>& _files, QValueList<CopyDir>& _dirs ){ long size = 0; cerr << "listRecursive2 " << _abs_path << " " << _rel_path << endl; QString p = _abs_path; p += _rel_path; scanningDir( p ); KURL tmpurl( "ftp:/" ); tmpurl.setPath( p ); if ( !ftp.ftpOpenDir( tmpurl ) ) { if ( m_bAutoSkip ) return 0; SkipDlg_Result result = open_SkipDlg( p, true ); if ( result == S_CANCEL ) { // error( ERR_CANNOT_ENTER_DIRECTORY, p ); return -1; } else if ( result == S_AUTO_SKIP ) m_bAutoSkip = true; return 0; } QStringList recursion; qDebug( "kio_ftp : ##Listing" ); FtpEntry *e; while ( ( e = ftp.readdir() ) != 0L ) { qDebug( "kio_ftp : #%s", e->name.ascii() ); if ( e->name == "." || e->name == ".." ) continue; QString p2 = p; p2 += "/"; p2 += e->name; QString tmp = _rel_path; tmp += "/"; tmp += e->name; if ( !S_ISDIR( e->type ) ) { qDebug( "kio_ftp : Appending '%s' '%s'", p2.ascii(), tmp.ascii() ); Copy c; c.m_strAbsSource = p2; c.m_strRelDest = tmp; c.m_access = e->access; c.m_type = e->type; c.m_size = e->size; _files.append( c ); size += e->size; } else { CopyDir c; c.m_strAbsSource = p2; c.m_strRelDest = tmp; c.m_access = e->access; c.m_type = e->type; _dirs.append( c ); recursion.append( tmp ); } } if ( !ftp.ftpCloseDir() ) { // error( ERR_COULD_NOT_CLOSEDIR, p ); return -1; } QStringList::Iterator it = recursion.begin(); for( ; it != recursion.end(); ++it ) { long s; if ( ( s = listRecursive2( _abs_path, (*it).ascii(), _files, _dirs ) ) == -1 ) return -1; size += s; } return size;}void FtpProtocol::slotListDir( const char *_url ){ qDebug( "kio_ftp : =============== LIST %s ===============", _url ); KURL usrc( _url ); if ( usrc.isMalformed() ) { error( ERR_MALFORMED_URL, strdup(_url) ); m_cmd = CMD_NONE; return; } if ( strcmp( usrc.protocol(), "ftp" ) != 0L ) { error( ERR_INTERNAL, "kio_ftp got non ftp file as source in copy command" ); m_cmd = CMD_NONE; return; } /* struct stat buff; if ( stat( usrc.path(), &buff ) == -1 ) { error( ERR_DOES_NOT_EXIST, url); m_cmd = CMD_NONE; return; } if ( !S_ISDIR( buff.st_mode ) ) { error( ERR_IS_FILE, url ); m_cmd = CMD_NONE; return; } */ m_cmd = CMD_LIST; if ( !ftp.opendir( usrc ) ) { error( ERR_CANNOT_ENTER_DIRECTORY, strdup(_url) ); m_cmd = CMD_NONE; return; } FtpEntry* e; while ( ( e = ftp.readdir() ) ) { if ( e->name == "." || e->name == ".." ) continue; debug( "kio_ftp : Listing %s", e->name.ascii() ); UDSEntry entry; UDSAtom atom; atom.m_uds = UDS_NAME; atom.m_str = e->name; entry.append( atom ); atom.m_uds = UDS_FILE_TYPE; atom.m_long = e->type; entry.append( atom ); atom.m_uds = UDS_SIZE; atom.m_long = e->size; entry.append( atom ); /* atom.m_uds = UDS_MODIFICATION_TIME; atom.m_long = buff.st_mtime; entry.append( atom ); */ atom.m_uds = UDS_ACCESS; atom.m_long = e->access; entry.append( atom ); atom.m_uds = UDS_USER; atom.m_str = e->owner; entry.append( atom ); atom.m_uds = UDS_GROUP; atom.m_str = e->group; entry.append( atom ); atom.m_uds = UDS_LINK_DEST; atom.m_str = e->link; entry.append( atom ); /* atom.m_uds = UDS_ACCESS_TIME; atom.m_long = buff.st_atime; entry.append( atom ); atom.m_uds = UDS_CREATION_TIME; atom.m_long = buff.st_ctime; entry.append( atom ); */ listEntry( entry ); } debug( "kio_ftp : ============= COMPLETED LIST ============" ); ftp.closedir(); debug( "kio_ftp : ============= COMPLETED LIST 2 ============" ); m_cmd = CMD_NONE; finished(); debug( "kio_ftp : =============== BYE ===========" );}void FtpProtocol::slotTestDir( const char *_url ){ KURL usrc( _url ); if ( usrc.isMalformed() ) { error( ERR_MALFORMED_URL, strdup(_url) ); m_cmd = CMD_NONE; return; } if ( strcmp( usrc.protocol(), "ftp" ) != 0L ) { error( ERR_INTERNAL, "kio_ftp got non ftp file as source in copy command" ); m_cmd = CMD_NONE; return; } qDebug( "kio_ftp : =============== slotTestDir ==============" ); FtpEntry* e; if ( !( e = ftp.stat( usrc ) ) ) { debug( "kio_ftp : =========== ERROR ========" ); error( ERR_DOES_NOT_EXIST, strdup(_url) ); m_cmd = CMD_NONE; return; } if ( S_ISDIR( e->type ) ) { qDebug( "kio_ftp : ========== DONE DIR ========= %s", _url ); isDirectory(); } else { qDebug( "kio_ftp : ========== DONE FILE ========= %s", _url ); isFile(); } finished();}void FtpProtocol::jobError( int _errid, const char *_txt ){ if ( !m_bIgnoreJobErrors ) error( _errid, _txt );}/************************************* * * FtpIOJob * *************************************/FtpIOJob::FtpIOJob( Connection *_conn, FtpProtocol *_Ftp ) : IOJob( _conn ){ m_pFtp = _Ftp;} void FtpIOJob::slotError( int _errid, const char *_txt ){ IOJob::slotError( _errid, _txt ); m_pFtp->jobError( _errid, _txt );}/************************************* * * Utilities * *************************************/int check( Connection *_con ){ int err; struct timeval tv; tv.tv_sec = 0; tv.tv_usec = 0; fd_set rfds; FD_ZERO( &rfds ); FD_SET( _con->inFD(), &rfds ); again: if ( ( err = select( _con->inFD(), &rfds, 0L, 0L, &tv ) ) == -1 && errno == EINTR ) goto again; // No error and something to read ? if ( err != -1 && err != 0 ) return 1; return 0;}
if (0)
if (1)
static UWord* allocstack(ThreadId tid){ ThreadState *tst = VG_(get_ThreadState)(tid); UWord *esp; if (tst->os_state.valgrind_stack_base == 0) { void *stk = VG_(mmap)(0, STACK_SIZE_W * sizeof(UWord) + VKI_PAGE_SIZE, VKI_PROT_READ|VKI_PROT_WRITE, VKI_MAP_PRIVATE|VKI_MAP_ANONYMOUS, SF_VALGRIND, -1, 0); if (stk != (void *)-1) { VG_(mprotect)(stk, VKI_PAGE_SIZE, VKI_PROT_NONE); /* guard page */ tst->os_state.valgrind_stack_base = ((Addr)stk) + VKI_PAGE_SIZE; tst->os_state.valgrind_stack_szB = STACK_SIZE_W * sizeof(UWord); } else return (UWord*)-1; } for (esp = (UWord*) tst->os_state.valgrind_stack_base; esp < (UWord*)(tst->os_state.valgrind_stack_base + tst->os_state.valgrind_stack_szB); esp++) *esp = FILL; /* esp is left at top of stack */ if (0) VG_(printf)("stack for tid %d at %p (%x); esp=%p\n", tid, tst->os_state.valgrind_stack_base, *(UWord*)(tst->os_state.valgrind_stack_base), esp); return esp;}
assert( info.exists() );
static void checkInfoFile( const QString& infoPath, const QString& origFilePath ){ kdDebug() << k_funcinfo << infoPath << endl; QFileInfo info( infoPath ); assert( info.isFile() ); assert( info.exists() ); KSimpleConfig infoFile( info.absFilePath(), true ); if ( !infoFile.hasGroup( "Trash Info" ) ) kdFatal() << "no Trash Info group in " << info.absFilePath() << endl; infoFile.setGroup( "Trash Info" ); const QString origPath = infoFile.readEntry( "Path" ); assert( !origPath.isEmpty() ); assert( origPath == KURL::encode_string( origFilePath, KGlobal::locale()->fileEncodingMib() ) ); const QString date = infoFile.readEntry( "DeletionDate" ); assert( !date.isEmpty() ); assert( date.contains( "T" ) );}
(*env)->SetShortField(env, lpObject, BITMAPFc.bmBitsPixel, (jshort)lpStruct->bmBitsPixel); (*env)->SetShortField(env, lpObject, BITMAPFc.bmPlanes, (jshort)lpStruct->bmPlanes); (*env)->SetIntField(env, lpObject, BITMAPFc.bmWidthBytes, (jint)lpStruct->bmWidthBytes); (*env)->SetIntField(env, lpObject, BITMAPFc.bmHeight, (jint)lpStruct->bmHeight); (*env)->SetIntField(env, lpObject, BITMAPFc.bmWidth, (jint)lpStruct->bmWidth); (*env)->SetIntField(env, lpObject, BITMAPFc.bmType, (jint)lpStruct->bmType);
void setBITMAPFields(JNIEnv *env, jobject lpObject, BITMAP *lpStruct){ if (!BITMAPFc.cached) cacheBITMAPFields(env, lpObject); (*env)->SetIntField(env, lpObject, BITMAPFc.bmBits, (jint)lpStruct->bmBits); (*env)->SetShortField(env, lpObject, BITMAPFc.bmBitsPixel, (jshort)lpStruct->bmBitsPixel); (*env)->SetShortField(env, lpObject, BITMAPFc.bmPlanes, (jshort)lpStruct->bmPlanes); (*env)->SetIntField(env, lpObject, BITMAPFc.bmWidthBytes, (jint)lpStruct->bmWidthBytes); (*env)->SetIntField(env, lpObject, BITMAPFc.bmHeight, (jint)lpStruct->bmHeight); (*env)->SetIntField(env, lpObject, BITMAPFc.bmWidth, (jint)lpStruct->bmWidth); (*env)->SetIntField(env, lpObject, BITMAPFc.bmType, (jint)lpStruct->bmType);}
lpStruct->biClrUsed = (*env)->GetIntField(env, lpObject, BITMAPINFOHEADERFc.biClrUsed); lpStruct->biYPelsPerMeter = (*env)->GetIntField(env, lpObject, BITMAPINFOHEADERFc.biYPelsPerMeter); lpStruct->biXPelsPerMeter = (*env)->GetIntField(env, lpObject, BITMAPINFOHEADERFc.biXPelsPerMeter); lpStruct->biSizeImage = (*env)->GetIntField(env, lpObject, BITMAPINFOHEADERFc.biSizeImage); lpStruct->biCompression = (*env)->GetIntField(env, lpObject, BITMAPINFOHEADERFc.biCompression); lpStruct->biBitCount = (*env)->GetShortField(env, lpObject, BITMAPINFOHEADERFc.biBitCount); lpStruct->biPlanes = (*env)->GetShortField(env, lpObject, BITMAPINFOHEADERFc.biPlanes); lpStruct->biHeight = (*env)->GetIntField(env, lpObject, BITMAPINFOHEADERFc.biHeight); lpStruct->biWidth = (*env)->GetIntField(env, lpObject, BITMAPINFOHEADERFc.biWidth); lpStruct->biSize = (*env)->GetIntField(env, lpObject, BITMAPINFOHEADERFc.biSize);
BITMAPINFOHEADER *getBITMAPINFOHEADERFields(JNIEnv *env, jobject lpObject, BITMAPINFOHEADER *lpStruct){ if (!BITMAPINFOHEADERFc.cached) cacheBITMAPINFOHEADERFields(env, lpObject); lpStruct->biClrImportant = (*env)->GetIntField(env, lpObject, BITMAPINFOHEADERFc.biClrImportant); lpStruct->biClrUsed = (*env)->GetIntField(env, lpObject, BITMAPINFOHEADERFc.biClrUsed); lpStruct->biYPelsPerMeter = (*env)->GetIntField(env, lpObject, BITMAPINFOHEADERFc.biYPelsPerMeter); lpStruct->biXPelsPerMeter = (*env)->GetIntField(env, lpObject, BITMAPINFOHEADERFc.biXPelsPerMeter); lpStruct->biSizeImage = (*env)->GetIntField(env, lpObject, BITMAPINFOHEADERFc.biSizeImage); lpStruct->biCompression = (*env)->GetIntField(env, lpObject, BITMAPINFOHEADERFc.biCompression); lpStruct->biBitCount = (*env)->GetShortField(env, lpObject, BITMAPINFOHEADERFc.biBitCount); lpStruct->biPlanes = (*env)->GetShortField(env, lpObject, BITMAPINFOHEADERFc.biPlanes); lpStruct->biHeight = (*env)->GetIntField(env, lpObject, BITMAPINFOHEADERFc.biHeight); lpStruct->biWidth = (*env)->GetIntField(env, lpObject, BITMAPINFOHEADERFc.biWidth); lpStruct->biSize = (*env)->GetIntField(env, lpObject, BITMAPINFOHEADERFc.biSize); return lpStruct;}
(*env)->SetIntField(env, lpObject, BITMAPINFOHEADERFc.biClrUsed, (jint)lpStruct->biClrUsed); (*env)->SetIntField(env, lpObject, BITMAPINFOHEADERFc.biYPelsPerMeter, (jint)lpStruct->biYPelsPerMeter); (*env)->SetIntField(env, lpObject, BITMAPINFOHEADERFc.biXPelsPerMeter, (jint)lpStruct->biXPelsPerMeter); (*env)->SetIntField(env, lpObject, BITMAPINFOHEADERFc.biSizeImage, (jint)lpStruct->biSizeImage); (*env)->SetIntField(env, lpObject, BITMAPINFOHEADERFc.biCompression, (jint)lpStruct->biCompression); (*env)->SetShortField(env, lpObject, BITMAPINFOHEADERFc.biBitCount, (jshort)lpStruct->biBitCount); (*env)->SetShortField(env, lpObject, BITMAPINFOHEADERFc.biPlanes, (jshort)lpStruct->biPlanes); (*env)->SetIntField(env, lpObject, BITMAPINFOHEADERFc.biHeight, (jint)lpStruct->biHeight); (*env)->SetIntField(env, lpObject, BITMAPINFOHEADERFc.biWidth, (jint)lpStruct->biWidth); (*env)->SetIntField(env, lpObject, BITMAPINFOHEADERFc.biSize, (jint)lpStruct->biSize);
void setBITMAPINFOHEADERFields(JNIEnv *env, jobject lpObject, BITMAPINFOHEADER *lpStruct){ if (!BITMAPINFOHEADERFc.cached) cacheBITMAPINFOHEADERFields(env, lpObject); (*env)->SetIntField(env, lpObject, BITMAPINFOHEADERFc.biClrImportant, (jint)lpStruct->biClrImportant); (*env)->SetIntField(env, lpObject, BITMAPINFOHEADERFc.biClrUsed, (jint)lpStruct->biClrUsed); (*env)->SetIntField(env, lpObject, BITMAPINFOHEADERFc.biYPelsPerMeter, (jint)lpStruct->biYPelsPerMeter); (*env)->SetIntField(env, lpObject, BITMAPINFOHEADERFc.biXPelsPerMeter, (jint)lpStruct->biXPelsPerMeter); (*env)->SetIntField(env, lpObject, BITMAPINFOHEADERFc.biSizeImage, (jint)lpStruct->biSizeImage); (*env)->SetIntField(env, lpObject, BITMAPINFOHEADERFc.biCompression, (jint)lpStruct->biCompression); (*env)->SetShortField(env, lpObject, BITMAPINFOHEADERFc.biBitCount, (jshort)lpStruct->biBitCount); (*env)->SetShortField(env, lpObject, BITMAPINFOHEADERFc.biPlanes, (jshort)lpStruct->biPlanes); (*env)->SetIntField(env, lpObject, BITMAPINFOHEADERFc.biHeight, (jint)lpStruct->biHeight); (*env)->SetIntField(env, lpObject, BITMAPINFOHEADERFc.biWidth, (jint)lpStruct->biWidth); (*env)->SetIntField(env, lpObject, BITMAPINFOHEADERFc.biSize, (jint)lpStruct->biSize);}
lpStruct->lpfnHook = (LPCCHOOKPROC)(*env)->GetIntField(env, lpObject, CHOOSECOLORFc.lpfnHook); lpStruct->lCustData = (*env)->GetIntField(env, lpObject, CHOOSECOLORFc.lCustData); lpStruct->Flags = (*env)->GetIntField(env, lpObject, CHOOSECOLORFc.Flags); lpStruct->lpCustColors = (COLORREF *)(*env)->GetIntField(env, lpObject, CHOOSECOLORFc.lpCustColors); lpStruct->rgbResult = (*env)->GetIntField(env, lpObject, CHOOSECOLORFc.rgbResult); lpStruct->hInstance = (HANDLE)(*env)->GetIntField(env, lpObject, CHOOSECOLORFc.hInstance); lpStruct->hwndOwner = (HWND)(*env)->GetIntField(env, lpObject, CHOOSECOLORFc.hwndOwner); lpStruct->lStructSize = (*env)->GetIntField(env, lpObject, CHOOSECOLORFc.lStructSize);
CHOOSECOLOR *getCHOOSECOLORFields(JNIEnv *env, jobject lpObject, CHOOSECOLOR *lpStruct){ if (!CHOOSECOLORFc.cached) cacheCHOOSECOLORFields(env, lpObject); lpStruct->lpTemplateName = (LPCTSTR)(*env)->GetIntField(env, lpObject, CHOOSECOLORFc.lpTemplateName); lpStruct->lpfnHook = (LPCCHOOKPROC)(*env)->GetIntField(env, lpObject, CHOOSECOLORFc.lpfnHook); lpStruct->lCustData = (*env)->GetIntField(env, lpObject, CHOOSECOLORFc.lCustData); lpStruct->Flags = (*env)->GetIntField(env, lpObject, CHOOSECOLORFc.Flags); lpStruct->lpCustColors = (COLORREF *)(*env)->GetIntField(env, lpObject, CHOOSECOLORFc.lpCustColors); lpStruct->rgbResult = (*env)->GetIntField(env, lpObject, CHOOSECOLORFc.rgbResult); lpStruct->hInstance = (HANDLE)(*env)->GetIntField(env, lpObject, CHOOSECOLORFc.hInstance); lpStruct->hwndOwner = (HWND)(*env)->GetIntField(env, lpObject, CHOOSECOLORFc.hwndOwner); lpStruct->lStructSize = (*env)->GetIntField(env, lpObject, CHOOSECOLORFc.lStructSize); return lpStruct;}
(*env)->SetIntField(env, lpObject, CHOOSECOLORFc.lpfnHook, (jint)lpStruct->lpfnHook); (*env)->SetIntField(env, lpObject, CHOOSECOLORFc.lCustData, (jint)lpStruct->lCustData); (*env)->SetIntField(env, lpObject, CHOOSECOLORFc.Flags, (jint)lpStruct->Flags); (*env)->SetIntField(env, lpObject, CHOOSECOLORFc.lpCustColors, (jint)lpStruct->lpCustColors); (*env)->SetIntField(env, lpObject, CHOOSECOLORFc.rgbResult, (jint)lpStruct->rgbResult); (*env)->SetIntField(env, lpObject, CHOOSECOLORFc.hInstance, (jint)lpStruct->hInstance); (*env)->SetIntField(env, lpObject, CHOOSECOLORFc.hwndOwner, (jint)lpStruct->hwndOwner); (*env)->SetIntField(env, lpObject, CHOOSECOLORFc.lStructSize, (jint)lpStruct->lStructSize);
void setCHOOSECOLORFields(JNIEnv *env, jobject lpObject, CHOOSECOLOR *lpStruct){ if (!CHOOSECOLORFc.cached) cacheCHOOSECOLORFields(env, lpObject); (*env)->SetIntField(env, lpObject, CHOOSECOLORFc.lpTemplateName, (jint)lpStruct->lpTemplateName); (*env)->SetIntField(env, lpObject, CHOOSECOLORFc.lpfnHook, (jint)lpStruct->lpfnHook); (*env)->SetIntField(env, lpObject, CHOOSECOLORFc.lCustData, (jint)lpStruct->lCustData); (*env)->SetIntField(env, lpObject, CHOOSECOLORFc.Flags, (jint)lpStruct->Flags); (*env)->SetIntField(env, lpObject, CHOOSECOLORFc.lpCustColors, (jint)lpStruct->lpCustColors); (*env)->SetIntField(env, lpObject, CHOOSECOLORFc.rgbResult, (jint)lpStruct->rgbResult); (*env)->SetIntField(env, lpObject, CHOOSECOLORFc.hInstance, (jint)lpStruct->hInstance); (*env)->SetIntField(env, lpObject, CHOOSECOLORFc.hwndOwner, (jint)lpStruct->hwndOwner); (*env)->SetIntField(env, lpObject, CHOOSECOLORFc.lStructSize, (jint)lpStruct->lStructSize);}
CHOOSEFONTFc.nSizeMin = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "nSizeMin", "I"); CHOOSEFONTFc.nFontType = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "nFontType", "S"); CHOOSEFONTFc.lpszStyle = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "lpszStyle", "I"); CHOOSEFONTFc.hInstance = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "hInstance", "I"); CHOOSEFONTFc.lpTemplateName = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "lpTemplateName", "I"); CHOOSEFONTFc.lpfnHook = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "lpfnHook", "I"); CHOOSEFONTFc.lCustData = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "lCustData", "I"); CHOOSEFONTFc.rgbColors = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "rgbColors", "I"); CHOOSEFONTFc.Flags = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "Flags", "I"); CHOOSEFONTFc.iPointSize = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "iPointSize", "I"); CHOOSEFONTFc.lpLogFont = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "lpLogFont", "I"); CHOOSEFONTFc.hDC = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "hDC", "I"); CHOOSEFONTFc.hwndOwner = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "hwndOwner", "I"); CHOOSEFONTFc.lStructSize = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "lStructSize", "I");
void cacheCHOOSEFONTFields(JNIEnv *env, jobject lpObject){ if (CHOOSEFONTFc.cached) return; CHOOSEFONTFc.clazz = (*env)->GetObjectClass(env, lpObject); CHOOSEFONTFc.nSizeMax = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "nSizeMax", "I"); CHOOSEFONTFc.nSizeMin = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "nSizeMin", "I"); CHOOSEFONTFc.nFontType = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "nFontType", "S"); CHOOSEFONTFc.lpszStyle = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "lpszStyle", "I"); CHOOSEFONTFc.hInstance = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "hInstance", "I"); CHOOSEFONTFc.lpTemplateName = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "lpTemplateName", "I"); CHOOSEFONTFc.lpfnHook = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "lpfnHook", "I"); CHOOSEFONTFc.lCustData = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "lCustData", "I"); CHOOSEFONTFc.rgbColors = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "rgbColors", "I"); CHOOSEFONTFc.Flags = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "Flags", "I"); CHOOSEFONTFc.iPointSize = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "iPointSize", "I"); CHOOSEFONTFc.lpLogFont = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "lpLogFont", "I"); CHOOSEFONTFc.hDC = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "hDC", "I"); CHOOSEFONTFc.hwndOwner = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "hwndOwner", "I"); CHOOSEFONTFc.lStructSize = (*env)->GetFieldID(env, CHOOSEFONTFc.clazz, "lStructSize", "I"); CHOOSEFONTFc.cached = 1;}
lpStruct->rcArea.right = (*env)->GetIntField(env, lpObject, COMPOSITIONFORMFc.right); lpStruct->rcArea.top = (*env)->GetIntField(env, lpObject, COMPOSITIONFORMFc.top); lpStruct->rcArea.left = (*env)->GetIntField(env, lpObject, COMPOSITIONFORMFc.left); lpStruct->ptCurrentPos.x = (*env)->GetIntField(env, lpObject, COMPOSITIONFORMFc.y); lpStruct->ptCurrentPos.y = (*env)->GetIntField(env, lpObject, COMPOSITIONFORMFc.x); lpStruct->dwStyle = (*env)->GetIntField(env, lpObject, COMPOSITIONFORMFc.dwStyle);
COMPOSITIONFORM *getCOMPOSITIONFORMFields(JNIEnv *env, jobject lpObject, COMPOSITIONFORM *lpStruct){ if (!COMPOSITIONFORMFc.cached) cacheCOMPOSITIONFORMFields(env, lpObject); lpStruct->rcArea.bottom = (*env)->GetIntField(env, lpObject, COMPOSITIONFORMFc.bottom); lpStruct->rcArea.right = (*env)->GetIntField(env, lpObject, COMPOSITIONFORMFc.right); lpStruct->rcArea.top = (*env)->GetIntField(env, lpObject, COMPOSITIONFORMFc.top); lpStruct->rcArea.left = (*env)->GetIntField(env, lpObject, COMPOSITIONFORMFc.left); lpStruct->ptCurrentPos.x = (*env)->GetIntField(env, lpObject, COMPOSITIONFORMFc.y); lpStruct->ptCurrentPos.y = (*env)->GetIntField(env, lpObject, COMPOSITIONFORMFc.x); lpStruct->dwStyle = (*env)->GetIntField(env, lpObject, COMPOSITIONFORMFc.dwStyle); return lpStruct;}
(*env)->SetIntField(env, lpObject, COMPOSITIONFORMFc.right, (jint)lpStruct->rcArea.right); (*env)->SetIntField(env, lpObject, COMPOSITIONFORMFc.top, (jint)lpStruct->rcArea.top); (*env)->SetIntField(env, lpObject, COMPOSITIONFORMFc.left, (jint)lpStruct->rcArea.left); (*env)->SetIntField(env, lpObject, COMPOSITIONFORMFc.y, (jint)lpStruct->ptCurrentPos.x); (*env)->SetIntField(env, lpObject, COMPOSITIONFORMFc.x, (jint)lpStruct->ptCurrentPos.y); (*env)->SetIntField(env, lpObject, COMPOSITIONFORMFc.dwStyle, (jint)lpStruct->dwStyle);
void setCOMPOSITIONFORMFields(JNIEnv *env, jobject lpObject, COMPOSITIONFORM *lpStruct){ if (!COMPOSITIONFORMFc.cached) cacheCOMPOSITIONFORMFields(env, lpObject); (*env)->SetIntField(env, lpObject, COMPOSITIONFORMFc.bottom, (jint)lpStruct->rcArea.bottom); (*env)->SetIntField(env, lpObject, COMPOSITIONFORMFc.right, (jint)lpStruct->rcArea.right); (*env)->SetIntField(env, lpObject, COMPOSITIONFORMFc.top, (jint)lpStruct->rcArea.top); (*env)->SetIntField(env, lpObject, COMPOSITIONFORMFc.left, (jint)lpStruct->rcArea.left); (*env)->SetIntField(env, lpObject, COMPOSITIONFORMFc.y, (jint)lpStruct->ptCurrentPos.x); (*env)->SetIntField(env, lpObject, COMPOSITIONFORMFc.x, (jint)lpStruct->ptCurrentPos.y); (*env)->SetIntField(env, lpObject, COMPOSITIONFORMFc.dwStyle, (jint)lpStruct->dwStyle);}
lpStruct->dshSection = (HANDLE)(*env)->GetIntField(env, lpObject, DIBSECTIONFc.dshSection); lpStruct->dsBitfields[2] = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.dsBitfields2); lpStruct->dsBitfields[1] = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.dsBitfields1); lpStruct->dsBitfields[0] = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.dsBitfields0); lpStruct->dsBmih.biClrImportant = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.biClrImportant); lpStruct->dsBmih.biClrUsed = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.biClrUsed); lpStruct->dsBmih.biYPelsPerMeter = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.biYPelsPerMeter); lpStruct->dsBmih.biXPelsPerMeter = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.biXPelsPerMeter); lpStruct->dsBmih.biSizeImage = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.biSizeImage); lpStruct->dsBmih.biCompression = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.biCompression); lpStruct->dsBmih.biBitCount = (*env)->GetShortField(env, lpObject, DIBSECTIONFc.biBitCount); lpStruct->dsBmih.biPlanes = (*env)->GetShortField(env, lpObject, DIBSECTIONFc.biPlanes); lpStruct->dsBmih.biHeight = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.biHeight); lpStruct->dsBmih.biWidth = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.biWidth); lpStruct->dsBmih.biSize = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.biSize);
DIBSECTION *getDIBSECTIONFields(JNIEnv *env, jobject lpObject, DIBSECTION *lpStruct){ if (!DIBSECTIONFc.cached) cacheDIBSECTIONFields(env, lpObject); getBITMAPFields(env, lpObject, (BITMAP *)lpStruct); lpStruct->dsOffset = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.dsOffset); lpStruct->dshSection = (HANDLE)(*env)->GetIntField(env, lpObject, DIBSECTIONFc.dshSection); lpStruct->dsBitfields[2] = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.dsBitfields2); lpStruct->dsBitfields[1] = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.dsBitfields1); lpStruct->dsBitfields[0] = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.dsBitfields0); lpStruct->dsBmih.biClrImportant = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.biClrImportant); lpStruct->dsBmih.biClrUsed = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.biClrUsed); lpStruct->dsBmih.biYPelsPerMeter = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.biYPelsPerMeter); lpStruct->dsBmih.biXPelsPerMeter = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.biXPelsPerMeter); lpStruct->dsBmih.biSizeImage = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.biSizeImage); lpStruct->dsBmih.biCompression = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.biCompression); lpStruct->dsBmih.biBitCount = (*env)->GetShortField(env, lpObject, DIBSECTIONFc.biBitCount); lpStruct->dsBmih.biPlanes = (*env)->GetShortField(env, lpObject, DIBSECTIONFc.biPlanes); lpStruct->dsBmih.biHeight = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.biHeight); lpStruct->dsBmih.biWidth = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.biWidth); lpStruct->dsBmih.biSize = (*env)->GetIntField(env, lpObject, DIBSECTIONFc.biSize); return lpStruct;}
(*env)->SetIntField(env, lpObject, DIBSECTIONFc.dshSection, (jint)lpStruct->dshSection); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.dsBitfields2, (jint)lpStruct->dsBitfields[2]); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.dsBitfields1, (jint)lpStruct->dsBitfields[1]); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.dsBitfields0, (jint)lpStruct->dsBitfields[0]); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.biClrImportant, (jint)lpStruct->dsBmih.biClrImportant); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.biClrUsed, (jint)lpStruct->dsBmih.biClrUsed); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.biYPelsPerMeter, (jint)lpStruct->dsBmih.biYPelsPerMeter); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.biXPelsPerMeter, (jint)lpStruct->dsBmih.biXPelsPerMeter); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.biSizeImage, (jint)lpStruct->dsBmih.biSizeImage); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.biCompression, (jint)lpStruct->dsBmih.biCompression); (*env)->SetShortField(env, lpObject, DIBSECTIONFc.biBitCount, (jshort)lpStruct->dsBmih.biBitCount); (*env)->SetShortField(env, lpObject, DIBSECTIONFc.biPlanes, (jshort)lpStruct->dsBmih.biPlanes); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.biHeight, (jint)lpStruct->dsBmih.biHeight); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.biWidth, (jint)lpStruct->dsBmih.biWidth); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.biSize, (jint)lpStruct->dsBmih.biSize);
void setDIBSECTIONFields(JNIEnv *env, jobject lpObject, DIBSECTION *lpStruct){ if (!DIBSECTIONFc.cached) cacheDIBSECTIONFields(env, lpObject); setBITMAPFields(env, lpObject, (BITMAP *)lpStruct); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.dsOffset, (jint)lpStruct->dsOffset); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.dshSection, (jint)lpStruct->dshSection); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.dsBitfields2, (jint)lpStruct->dsBitfields[2]); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.dsBitfields1, (jint)lpStruct->dsBitfields[1]); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.dsBitfields0, (jint)lpStruct->dsBitfields[0]); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.biClrImportant, (jint)lpStruct->dsBmih.biClrImportant); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.biClrUsed, (jint)lpStruct->dsBmih.biClrUsed); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.biYPelsPerMeter, (jint)lpStruct->dsBmih.biYPelsPerMeter); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.biXPelsPerMeter, (jint)lpStruct->dsBmih.biXPelsPerMeter); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.biSizeImage, (jint)lpStruct->dsBmih.biSizeImage); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.biCompression, (jint)lpStruct->dsBmih.biCompression); (*env)->SetShortField(env, lpObject, DIBSECTIONFc.biBitCount, (jshort)lpStruct->dsBmih.biBitCount); (*env)->SetShortField(env, lpObject, DIBSECTIONFc.biPlanes, (jshort)lpStruct->dsBmih.biPlanes); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.biHeight, (jint)lpStruct->dsBmih.biHeight); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.biWidth, (jint)lpStruct->dsBmih.biWidth); (*env)->SetIntField(env, lpObject, DIBSECTIONFc.biSize, (jint)lpStruct->dsBmih.biSize);}
lpStruct->dwBuildNumber = (*env)->GetIntField(env, lpObject, DLLVERSIONINFOFc.dwBuildNumber); lpStruct->dwMinorVersion = (*env)->GetIntField(env, lpObject, DLLVERSIONINFOFc.dwMinorVersion); lpStruct->dwMajorVersion = (*env)->GetIntField(env, lpObject, DLLVERSIONINFOFc.dwMajorVersion); lpStruct->cbSize = (*env)->GetIntField(env, lpObject, DLLVERSIONINFOFc.cbSize);
DLLVERSIONINFO *getDLLVERSIONINFOFields(JNIEnv *env, jobject lpObject, DLLVERSIONINFO *lpStruct){ if (!DLLVERSIONINFOFc.cached) cacheDLLVERSIONINFOFields(env, lpObject); lpStruct->dwPlatformID = (*env)->GetIntField(env, lpObject, DLLVERSIONINFOFc.dwPlatformID); lpStruct->dwBuildNumber = (*env)->GetIntField(env, lpObject, DLLVERSIONINFOFc.dwBuildNumber); lpStruct->dwMinorVersion = (*env)->GetIntField(env, lpObject, DLLVERSIONINFOFc.dwMinorVersion); lpStruct->dwMajorVersion = (*env)->GetIntField(env, lpObject, DLLVERSIONINFOFc.dwMajorVersion); lpStruct->cbSize = (*env)->GetIntField(env, lpObject, DLLVERSIONINFOFc.cbSize); return lpStruct;}
(*env)->SetIntField(env, lpObject, DLLVERSIONINFOFc.dwBuildNumber, (jint)lpStruct->dwBuildNumber); (*env)->SetIntField(env, lpObject, DLLVERSIONINFOFc.dwMinorVersion, (jint)lpStruct->dwMinorVersion); (*env)->SetIntField(env, lpObject, DLLVERSIONINFOFc.dwMajorVersion, (jint)lpStruct->dwMajorVersion); (*env)->SetIntField(env, lpObject, DLLVERSIONINFOFc.cbSize, (jint)lpStruct->cbSize);
void setDLLVERSIONINFOFields(JNIEnv *env, jobject lpObject, DLLVERSIONINFO *lpStruct){ if (!DLLVERSIONINFOFc.cached) cacheDLLVERSIONINFOFields(env, lpObject); (*env)->SetIntField(env, lpObject, DLLVERSIONINFOFc.dwPlatformID, (jint)lpStruct->dwPlatformID); (*env)->SetIntField(env, lpObject, DLLVERSIONINFOFc.dwBuildNumber, (jint)lpStruct->dwBuildNumber); (*env)->SetIntField(env, lpObject, DLLVERSIONINFOFc.dwMinorVersion, (jint)lpStruct->dwMinorVersion); (*env)->SetIntField(env, lpObject, DLLVERSIONINFOFc.dwMajorVersion, (jint)lpStruct->dwMajorVersion); (*env)->SetIntField(env, lpObject, DLLVERSIONINFOFc.cbSize, (jint)lpStruct->cbSize);}
lpStruct->lpszDatatype = (LPCTSTR)(*env)->GetIntField(env, lpObject, DOCINFOFc.lpszDatatype); lpStruct->lpszOutput = (LPCTSTR)(*env)->GetIntField(env, lpObject, DOCINFOFc.lpszOutput); lpStruct->lpszDocName = (LPCTSTR)(*env)->GetIntField(env, lpObject, DOCINFOFc.lpszDocName); lpStruct->cbSize = (*env)->GetIntField(env, lpObject, DOCINFOFc.cbSize);
DOCINFO *getDOCINFOFields(JNIEnv *env, jobject lpObject, DOCINFO *lpStruct){ if (!DOCINFOFc.cached) cacheDOCINFOFields(env, lpObject); lpStruct->fwType = (*env)->GetIntField(env, lpObject, DOCINFOFc.fwType); lpStruct->lpszDatatype = (LPCTSTR)(*env)->GetIntField(env, lpObject, DOCINFOFc.lpszDatatype); lpStruct->lpszOutput = (LPCTSTR)(*env)->GetIntField(env, lpObject, DOCINFOFc.lpszOutput); lpStruct->lpszDocName = (LPCTSTR)(*env)->GetIntField(env, lpObject, DOCINFOFc.lpszDocName); lpStruct->cbSize = (*env)->GetIntField(env, lpObject, DOCINFOFc.cbSize); return lpStruct;}
(*env)->SetIntField(env, lpObject, DOCINFOFc.lpszDatatype, (jint)lpStruct->lpszDatatype); (*env)->SetIntField(env, lpObject, DOCINFOFc.lpszOutput, (jint)lpStruct->lpszOutput); (*env)->SetIntField(env, lpObject, DOCINFOFc.lpszDocName, (jint)lpStruct->lpszDocName); (*env)->SetIntField(env, lpObject, DOCINFOFc.cbSize, (jint)lpStruct->cbSize);
void setDOCINFOFields(JNIEnv *env, jobject lpObject, DOCINFO *lpStruct){ if (!DOCINFOFc.cached) cacheDOCINFOFields(env, lpObject); (*env)->SetIntField(env, lpObject, DOCINFOFc.fwType, (jint)lpStruct->fwType); (*env)->SetIntField(env, lpObject, DOCINFOFc.lpszDatatype, (jint)lpStruct->lpszDatatype); (*env)->SetIntField(env, lpObject, DOCINFOFc.lpszOutput, (jint)lpStruct->lpszOutput); (*env)->SetIntField(env, lpObject, DOCINFOFc.lpszDocName, (jint)lpStruct->lpszDocName); (*env)->SetIntField(env, lpObject, DOCINFOFc.cbSize, (jint)lpStruct->cbSize);}
(*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.right, (jint)lpStruct->rcItem.right); (*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.bottom, (jint)lpStruct->rcItem.bottom); (*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.top, (jint)lpStruct->rcItem.top); (*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.left, (jint)lpStruct->rcItem.left); (*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.hDC, (jint)lpStruct->hDC); (*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.hwndItem, (jint)lpStruct->hwndItem); (*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.itemState, (jint)lpStruct->itemState); (*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.itemAction, (jint)lpStruct->itemAction); (*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.itemID, (jint)lpStruct->itemID); (*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.CtlID, (jint)lpStruct->CtlID); (*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.CtlType, (jint)lpStruct->CtlType);
void setDRAWITEMSTRUCTFields(JNIEnv *env, jobject lpObject, DRAWITEMSTRUCT *lpStruct){ if (!DRAWITEMSTRUCTFc.cached) cacheDRAWITEMSTRUCTFields(env, lpObject); (*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.itemData, (jint)lpStruct->itemData); (*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.right, (jint)lpStruct->rcItem.right); (*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.bottom, (jint)lpStruct->rcItem.bottom); (*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.top, (jint)lpStruct->rcItem.top); (*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.left, (jint)lpStruct->rcItem.left); (*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.hDC, (jint)lpStruct->hDC); (*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.hwndItem, (jint)lpStruct->hwndItem); (*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.itemState, (jint)lpStruct->itemState); (*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.itemAction, (jint)lpStruct->itemAction); (*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.itemID, (jint)lpStruct->itemID); (*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.CtlID, (jint)lpStruct->CtlID); (*env)->SetIntField(env, lpObject, DRAWITEMSTRUCTFc.CtlType, (jint)lpStruct->CtlType);}
(*env)->SetIntField(env, lpObject, FILETIMEFc.dwLowDateTime, (jint)lpStruct->dwLowDateTime);
void setFILETIMEFields(JNIEnv *env, jobject lpObject, FILETIME *lpStruct){ if (!FILETIMEFc.cached) cacheFILETIMEFields(env, lpObject); (*env)->SetIntField(env, lpObject, FILETIMEFc.dwHighDateTime, (jint)lpStruct->dwHighDateTime); (*env)->SetIntField(env, lpObject, FILETIMEFc.dwLowDateTime, (jint)lpStruct->dwLowDateTime);}
(*env)->SetIntField(env, lpObject, GCP_RESULTSFc.nGlyphs, (jint)lpStruct->nGlyphs); (*env)->SetIntField(env, lpObject, GCP_RESULTSFc.lpGlyphs, (jint)lpStruct->lpGlyphs); (*env)->SetIntField(env, lpObject, GCP_RESULTSFc.lpClass, (jint)lpStruct->lpClass); (*env)->SetIntField(env, lpObject, GCP_RESULTSFc.lpCaretPos, (jint)lpStruct->lpCaretPos); (*env)->SetIntField(env, lpObject, GCP_RESULTSFc.lpDx, (jint)lpStruct->lpDx); (*env)->SetIntField(env, lpObject, GCP_RESULTSFc.lpOrder, (jint)lpStruct->lpOrder); (*env)->SetIntField(env, lpObject, GCP_RESULTSFc.lpOutString, (jint)lpStruct->lpOutString); (*env)->SetIntField(env, lpObject, GCP_RESULTSFc.lStructSize, (jint)lpStruct->lStructSize);
void setGCP_RESULTSFields(JNIEnv *env, jobject lpObject, GCP_RESULTS *lpStruct){ if (!GCP_RESULTSFc.cached) cacheGCP_RESULTSFields(env, lpObject); (*env)->SetIntField(env, lpObject, GCP_RESULTSFc.nMaxFit, (jint)lpStruct->nMaxFit); (*env)->SetIntField(env, lpObject, GCP_RESULTSFc.nGlyphs, (jint)lpStruct->nGlyphs); (*env)->SetIntField(env, lpObject, GCP_RESULTSFc.lpGlyphs, (jint)lpStruct->lpGlyphs); (*env)->SetIntField(env, lpObject, GCP_RESULTSFc.lpClass, (jint)lpStruct->lpClass); (*env)->SetIntField(env, lpObject, GCP_RESULTSFc.lpCaretPos, (jint)lpStruct->lpCaretPos); (*env)->SetIntField(env, lpObject, GCP_RESULTSFc.lpDx, (jint)lpStruct->lpDx); (*env)->SetIntField(env, lpObject, GCP_RESULTSFc.lpOrder, (jint)lpStruct->lpOrder); (*env)->SetIntField(env, lpObject, GCP_RESULTSFc.lpOutString, (jint)lpStruct->lpOutString); (*env)->SetIntField(env, lpObject, GCP_RESULTSFc.lStructSize, (jint)lpStruct->lStructSize);}
HELPINFOFc.x = (*env)->GetFieldID(env, HELPINFOFc.clazz, "x", "I"); HELPINFOFc.dwContextId = (*env)->GetFieldID(env, HELPINFOFc.clazz, "dwContextId", "I"); HELPINFOFc.hItemHandle = (*env)->GetFieldID(env, HELPINFOFc.clazz, "hItemHandle", "I"); HELPINFOFc.iCtrlId = (*env)->GetFieldID(env, HELPINFOFc.clazz, "iCtrlId", "I"); HELPINFOFc.iContextType = (*env)->GetFieldID(env, HELPINFOFc.clazz, "iContextType", "I"); HELPINFOFc.cbSize = (*env)->GetFieldID(env, HELPINFOFc.clazz, "cbSize", "I");
void cacheHELPINFOFields(JNIEnv *env, jobject lpObject){ if (HELPINFOFc.cached) return; HELPINFOFc.clazz = (*env)->GetObjectClass(env, lpObject); HELPINFOFc.y = (*env)->GetFieldID(env, HELPINFOFc.clazz, "y", "I"); HELPINFOFc.x = (*env)->GetFieldID(env, HELPINFOFc.clazz, "x", "I"); HELPINFOFc.dwContextId = (*env)->GetFieldID(env, HELPINFOFc.clazz, "dwContextId", "I"); HELPINFOFc.hItemHandle = (*env)->GetFieldID(env, HELPINFOFc.clazz, "hItemHandle", "I"); HELPINFOFc.iCtrlId = (*env)->GetFieldID(env, HELPINFOFc.clazz, "iCtrlId", "I"); HELPINFOFc.iContextType = (*env)->GetFieldID(env, HELPINFOFc.clazz, "iContextType", "I"); HELPINFOFc.cbSize = (*env)->GetFieldID(env, HELPINFOFc.clazz, "cbSize", "I"); HELPINFOFc.cached = 1;}
lpStruct->MousePos.x = (*env)->GetIntField(env, lpObject, HELPINFOFc.x); lpStruct->dwContextId = (*env)->GetIntField(env, lpObject, HELPINFOFc.dwContextId); lpStruct->hItemHandle = (HANDLE)(*env)->GetIntField(env, lpObject, HELPINFOFc.hItemHandle); lpStruct->iCtrlId = (*env)->GetIntField(env, lpObject, HELPINFOFc.iCtrlId); lpStruct->iContextType = (*env)->GetIntField(env, lpObject, HELPINFOFc.iContextType); lpStruct->cbSize = (*env)->GetIntField(env, lpObject, HELPINFOFc.cbSize);
HELPINFO *getHELPINFOFields(JNIEnv *env, jobject lpObject, HELPINFO *lpStruct){ if (!HELPINFOFc.cached) cacheHELPINFOFields(env, lpObject); lpStruct->MousePos.y = (*env)->GetIntField(env, lpObject, HELPINFOFc.y); lpStruct->MousePos.x = (*env)->GetIntField(env, lpObject, HELPINFOFc.x); lpStruct->dwContextId = (*env)->GetIntField(env, lpObject, HELPINFOFc.dwContextId); lpStruct->hItemHandle = (HANDLE)(*env)->GetIntField(env, lpObject, HELPINFOFc.hItemHandle); lpStruct->iCtrlId = (*env)->GetIntField(env, lpObject, HELPINFOFc.iCtrlId); lpStruct->iContextType = (*env)->GetIntField(env, lpObject, HELPINFOFc.iContextType); lpStruct->cbSize = (*env)->GetIntField(env, lpObject, HELPINFOFc.cbSize); return lpStruct;}
lpStruct->hbmMask = (HBITMAP)(*env)->GetIntField(env, lpObject, ICONINFOFc.hbmMask); lpStruct->yHotspot = (*env)->GetIntField(env, lpObject, ICONINFOFc.yHotspot); lpStruct->xHotspot = (*env)->GetIntField(env, lpObject, ICONINFOFc.xHotspot); lpStruct->fIcon = (*env)->GetBooleanField(env, lpObject, ICONINFOFc.fIcon);
ICONINFO *getICONINFOFields(JNIEnv *env, jobject lpObject, ICONINFO *lpStruct){ if (!ICONINFOFc.cached) cacheICONINFOFields(env, lpObject); lpStruct->hbmColor = (HBITMAP)(*env)->GetIntField(env, lpObject, ICONINFOFc.hbmColor); lpStruct->hbmMask = (HBITMAP)(*env)->GetIntField(env, lpObject, ICONINFOFc.hbmMask); lpStruct->yHotspot = (*env)->GetIntField(env, lpObject, ICONINFOFc.yHotspot); lpStruct->xHotspot = (*env)->GetIntField(env, lpObject, ICONINFOFc.xHotspot); lpStruct->fIcon = (*env)->GetBooleanField(env, lpObject, ICONINFOFc.fIcon); return lpStruct;}
(*env)->SetIntField(env, lpObject, ICONINFOFc.hbmMask, (jint)lpStruct->hbmMask); (*env)->SetIntField(env, lpObject, ICONINFOFc.yHotspot, (jint)lpStruct->yHotspot); (*env)->SetIntField(env, lpObject, ICONINFOFc.xHotspot, (jint)lpStruct->xHotspot); (*env)->SetBooleanField(env, lpObject, ICONINFOFc.fIcon, (jboolean)lpStruct->fIcon);
void setICONINFOFields(JNIEnv *env, jobject lpObject, ICONINFO *lpStruct){ if (!ICONINFOFc.cached) cacheICONINFOFields(env, lpObject); (*env)->SetIntField(env, lpObject, ICONINFOFc.hbmColor, (jint)lpStruct->hbmColor); (*env)->SetIntField(env, lpObject, ICONINFOFc.hbmMask, (jint)lpStruct->hbmMask); (*env)->SetIntField(env, lpObject, ICONINFOFc.yHotspot, (jint)lpStruct->yHotspot); (*env)->SetIntField(env, lpObject, ICONINFOFc.xHotspot, (jint)lpStruct->xHotspot); (*env)->SetBooleanField(env, lpObject, ICONINFOFc.fIcon, (jboolean)lpStruct->fIcon);}
INITCOMMONCONTROLSEXFc.dwSize = (*env)->GetFieldID(env, INITCOMMONCONTROLSEXFc.clazz, "dwSize", "I");
void cacheINITCOMMONCONTROLSEXFields(JNIEnv *env, jobject lpObject){ if (INITCOMMONCONTROLSEXFc.cached) return; INITCOMMONCONTROLSEXFc.clazz = (*env)->GetObjectClass(env, lpObject); INITCOMMONCONTROLSEXFc.dwICC = (*env)->GetFieldID(env, INITCOMMONCONTROLSEXFc.clazz, "dwICC", "I"); INITCOMMONCONTROLSEXFc.dwSize = (*env)->GetFieldID(env, INITCOMMONCONTROLSEXFc.clazz, "dwSize", "I"); INITCOMMONCONTROLSEXFc.cached = 1;}
lpStruct->lbColor = (*env)->GetIntField(env, lpObject, LOGBRUSHFc.lbColor); lpStruct->lbStyle = (*env)->GetIntField(env, lpObject, LOGBRUSHFc.lbStyle);
LOGBRUSH *getLOGBRUSHFields(JNIEnv *env, jobject lpObject, LOGBRUSH *lpStruct){ if (!LOGBRUSHFc.cached) cacheLOGBRUSHFields(env, lpObject); lpStruct->lbHatch = (*env)->GetIntField(env, lpObject, LOGBRUSHFc.lbHatch); lpStruct->lbColor = (*env)->GetIntField(env, lpObject, LOGBRUSHFc.lbColor); lpStruct->lbStyle = (*env)->GetIntField(env, lpObject, LOGBRUSHFc.lbStyle); return lpStruct;}
(*env)->SetIntField(env, lpObject, LOGBRUSHFc.lbColor, (jint)lpStruct->lbColor); (*env)->SetIntField(env, lpObject, LOGBRUSHFc.lbStyle, (jint)lpStruct->lbStyle);
void setLOGBRUSHFields(JNIEnv *env, jobject lpObject, LOGBRUSH *lpStruct){ if (!LOGBRUSHFc.cached) cacheLOGBRUSHFields(env, lpObject); (*env)->SetIntField(env, lpObject, LOGBRUSHFc.lbHatch, (jint)lpStruct->lbHatch); (*env)->SetIntField(env, lpObject, LOGBRUSHFc.lbColor, (jint)lpStruct->lbColor); (*env)->SetIntField(env, lpObject, LOGBRUSHFc.lbStyle, (jint)lpStruct->lbStyle);}
lpStruct->lopnWidth.y = (*env)->GetIntField(env, lpObject, LOGPENFc.y); lpStruct->lopnWidth.x = (*env)->GetIntField(env, lpObject, LOGPENFc.x); lpStruct->lopnStyle = (*env)->GetIntField(env, lpObject, LOGPENFc.lopnStyle);
LOGPEN *getLOGPENFields(JNIEnv *env, jobject lpObject, LOGPEN *lpStruct){ if (!LOGPENFc.cached) cacheLOGPENFields(env, lpObject); lpStruct->lopnColor = (*env)->GetIntField(env, lpObject, LOGPENFc.lopnColor); lpStruct->lopnWidth.y = (*env)->GetIntField(env, lpObject, LOGPENFc.y); lpStruct->lopnWidth.x = (*env)->GetIntField(env, lpObject, LOGPENFc.x); lpStruct->lopnStyle = (*env)->GetIntField(env, lpObject, LOGPENFc.lopnStyle); return lpStruct;}
(*env)->SetIntField(env, lpObject, LOGPENFc.y, (jint)lpStruct->lopnWidth.y); (*env)->SetIntField(env, lpObject, LOGPENFc.x, (jint)lpStruct->lopnWidth.x); (*env)->SetIntField(env, lpObject, LOGPENFc.lopnStyle, (jint)lpStruct->lopnStyle);
void setLOGPENFields(JNIEnv *env, jobject lpObject, LOGPEN *lpStruct){ if (!LOGPENFc.cached) cacheLOGPENFields(env, lpObject); (*env)->SetIntField(env, lpObject, LOGPENFc.lopnColor, (jint)lpStruct->lopnColor); (*env)->SetIntField(env, lpObject, LOGPENFc.y, (jint)lpStruct->lopnWidth.y); (*env)->SetIntField(env, lpObject, LOGPENFc.x, (jint)lpStruct->lopnWidth.x); (*env)->SetIntField(env, lpObject, LOGPENFc.lopnStyle, (jint)lpStruct->lopnStyle);}
(*env)->SetIntField(env, lpObject, LVCOLUMNFc.iImage, (jint)lpStruct->iImage); (*env)->SetIntField(env, lpObject, LVCOLUMNFc.iSubItem, (jint)lpStruct->iSubItem); (*env)->SetIntField(env, lpObject, LVCOLUMNFc.cchTextMax, (jint)lpStruct->cchTextMax); (*env)->SetIntField(env, lpObject, LVCOLUMNFc.pszText, (jint)lpStruct->pszText); (*env)->SetIntField(env, lpObject, LVCOLUMNFc.cx, (jint)lpStruct->cx); (*env)->SetIntField(env, lpObject, LVCOLUMNFc.fmt, (jint)lpStruct->fmt); (*env)->SetIntField(env, lpObject, LVCOLUMNFc.mask, (jint)lpStruct->mask);
void setLVCOLUMNFields(JNIEnv *env, jobject lpObject, LVCOLUMN *lpStruct){ if (!LVCOLUMNFc.cached) cacheLVCOLUMNFields(env, lpObject); (*env)->SetIntField(env, lpObject, LVCOLUMNFc.iOrder, (jint)lpStruct->iOrder); (*env)->SetIntField(env, lpObject, LVCOLUMNFc.iImage, (jint)lpStruct->iImage); (*env)->SetIntField(env, lpObject, LVCOLUMNFc.iSubItem, (jint)lpStruct->iSubItem); (*env)->SetIntField(env, lpObject, LVCOLUMNFc.cchTextMax, (jint)lpStruct->cchTextMax); (*env)->SetIntField(env, lpObject, LVCOLUMNFc.pszText, (jint)lpStruct->pszText); (*env)->SetIntField(env, lpObject, LVCOLUMNFc.cx, (jint)lpStruct->cx); (*env)->SetIntField(env, lpObject, LVCOLUMNFc.fmt, (jint)lpStruct->fmt); (*env)->SetIntField(env, lpObject, LVCOLUMNFc.mask, (jint)lpStruct->mask);}
(*env)->SetIntField(env, lpObject, LVHITTESTINFOFc.iItem, (jint)lpStruct->iItem); (*env)->SetIntField(env, lpObject, LVHITTESTINFOFc.flags, (jint)lpStruct->flags); (*env)->SetIntField(env, lpObject, LVHITTESTINFOFc.y, (jint)lpStruct->pt.y); (*env)->SetIntField(env, lpObject, LVHITTESTINFOFc.x, (jint)lpStruct->pt.x);
void setLVHITTESTINFOFields(JNIEnv *env, jobject lpObject, LVHITTESTINFO *lpStruct){ if (!LVHITTESTINFOFc.cached) cacheLVHITTESTINFOFields(env, lpObject); (*env)->SetIntField(env, lpObject, LVHITTESTINFOFc.iSubItem, (jint)lpStruct->iSubItem); (*env)->SetIntField(env, lpObject, LVHITTESTINFOFc.iItem, (jint)lpStruct->iItem); (*env)->SetIntField(env, lpObject, LVHITTESTINFOFc.flags, (jint)lpStruct->flags); (*env)->SetIntField(env, lpObject, LVHITTESTINFOFc.y, (jint)lpStruct->pt.y); (*env)->SetIntField(env, lpObject, LVHITTESTINFOFc.x, (jint)lpStruct->pt.x);}
LVITEMFc.lParam = (*env)->GetFieldID(env, LVITEMFc.clazz, "lParam", "I"); LVITEMFc.iImage = (*env)->GetFieldID(env, LVITEMFc.clazz, "iImage", "I"); LVITEMFc.cchTextMax = (*env)->GetFieldID(env, LVITEMFc.clazz, "cchTextMax", "I"); LVITEMFc.pszText = (*env)->GetFieldID(env, LVITEMFc.clazz, "pszText", "I"); LVITEMFc.stateMask = (*env)->GetFieldID(env, LVITEMFc.clazz, "stateMask", "I"); LVITEMFc.state = (*env)->GetFieldID(env, LVITEMFc.clazz, "state", "I"); LVITEMFc.iSubItem = (*env)->GetFieldID(env, LVITEMFc.clazz, "iSubItem", "I"); LVITEMFc.iItem = (*env)->GetFieldID(env, LVITEMFc.clazz, "iItem", "I"); LVITEMFc.mask = (*env)->GetFieldID(env, LVITEMFc.clazz, "mask", "I");
void cacheLVITEMFields(JNIEnv *env, jobject lpObject){ if (LVITEMFc.cached) return; LVITEMFc.clazz = (*env)->GetObjectClass(env, lpObject); LVITEMFc.iIndent = (*env)->GetFieldID(env, LVITEMFc.clazz, "iIndent", "I"); LVITEMFc.lParam = (*env)->GetFieldID(env, LVITEMFc.clazz, "lParam", "I"); LVITEMFc.iImage = (*env)->GetFieldID(env, LVITEMFc.clazz, "iImage", "I"); LVITEMFc.cchTextMax = (*env)->GetFieldID(env, LVITEMFc.clazz, "cchTextMax", "I"); LVITEMFc.pszText = (*env)->GetFieldID(env, LVITEMFc.clazz, "pszText", "I"); LVITEMFc.stateMask = (*env)->GetFieldID(env, LVITEMFc.clazz, "stateMask", "I"); LVITEMFc.state = (*env)->GetFieldID(env, LVITEMFc.clazz, "state", "I"); LVITEMFc.iSubItem = (*env)->GetFieldID(env, LVITEMFc.clazz, "iSubItem", "I"); LVITEMFc.iItem = (*env)->GetFieldID(env, LVITEMFc.clazz, "iItem", "I"); LVITEMFc.mask = (*env)->GetFieldID(env, LVITEMFc.clazz, "mask", "I"); LVITEMFc.cached = 1;}
MEASUREITEMSTRUCTFc.itemHeight = (*env)->GetFieldID(env, MEASUREITEMSTRUCTFc.clazz, "itemHeight", "I"); MEASUREITEMSTRUCTFc.itemWidth = (*env)->GetFieldID(env, MEASUREITEMSTRUCTFc.clazz, "itemWidth", "I"); MEASUREITEMSTRUCTFc.itemID = (*env)->GetFieldID(env, MEASUREITEMSTRUCTFc.clazz, "itemID", "I"); MEASUREITEMSTRUCTFc.CtlID = (*env)->GetFieldID(env, MEASUREITEMSTRUCTFc.clazz, "CtlID", "I"); MEASUREITEMSTRUCTFc.CtlType = (*env)->GetFieldID(env, MEASUREITEMSTRUCTFc.clazz, "CtlType", "I");
void cacheMEASUREITEMSTRUCTFields(JNIEnv *env, jobject lpObject){ if (MEASUREITEMSTRUCTFc.cached) return; MEASUREITEMSTRUCTFc.clazz = (*env)->GetObjectClass(env, lpObject); MEASUREITEMSTRUCTFc.itemData = (*env)->GetFieldID(env, MEASUREITEMSTRUCTFc.clazz, "itemData", "I"); MEASUREITEMSTRUCTFc.itemHeight = (*env)->GetFieldID(env, MEASUREITEMSTRUCTFc.clazz, "itemHeight", "I"); MEASUREITEMSTRUCTFc.itemWidth = (*env)->GetFieldID(env, MEASUREITEMSTRUCTFc.clazz, "itemWidth", "I"); MEASUREITEMSTRUCTFc.itemID = (*env)->GetFieldID(env, MEASUREITEMSTRUCTFc.clazz, "itemID", "I"); MEASUREITEMSTRUCTFc.CtlID = (*env)->GetFieldID(env, MEASUREITEMSTRUCTFc.clazz, "CtlID", "I"); MEASUREITEMSTRUCTFc.CtlType = (*env)->GetFieldID(env, MEASUREITEMSTRUCTFc.clazz, "CtlType", "I"); MEASUREITEMSTRUCTFc.cached = 1;}
(*env)->SetIntField(env, lpObject, MENUINFOFc.dwContextHelpID, (jint)lpStruct->dwContextHelpID); (*env)->SetIntField(env, lpObject, MENUINFOFc.hbrBack, (jint)lpStruct->hbrBack); (*env)->SetIntField(env, lpObject, MENUINFOFc.cyMax, (jint)lpStruct->cyMax); (*env)->SetIntField(env, lpObject, MENUINFOFc.dwStyle, (jint)lpStruct->dwStyle); (*env)->SetIntField(env, lpObject, MENUINFOFc.fMask, (jint)lpStruct->fMask); (*env)->SetIntField(env, lpObject, MENUINFOFc.cbSize, (jint)lpStruct->cbSize);
void setMENUINFOFields(JNIEnv *env, jobject lpObject, MENUINFO *lpStruct){ if (!MENUINFOFc.cached) cacheMENUINFOFields(env, lpObject); (*env)->SetIntField(env, lpObject, MENUINFOFc.dwMenuData, (jint)lpStruct->dwMenuData); (*env)->SetIntField(env, lpObject, MENUINFOFc.dwContextHelpID, (jint)lpStruct->dwContextHelpID); (*env)->SetIntField(env, lpObject, MENUINFOFc.hbrBack, (jint)lpStruct->hbrBack); (*env)->SetIntField(env, lpObject, MENUINFOFc.cyMax, (jint)lpStruct->cyMax); (*env)->SetIntField(env, lpObject, MENUINFOFc.dwStyle, (jint)lpStruct->dwStyle); (*env)->SetIntField(env, lpObject, MENUINFOFc.fMask, (jint)lpStruct->fMask); (*env)->SetIntField(env, lpObject, MENUINFOFc.cbSize, (jint)lpStruct->cbSize);}
MENUITEMINFOFc.cch = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "cch", "I"); MENUITEMINFOFc.dwTypeData = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "dwTypeData", "I"); MENUITEMINFOFc.dwItemData = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "dwItemData", "I"); MENUITEMINFOFc.hbmpUnchecked = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "hbmpUnchecked", "I"); MENUITEMINFOFc.hbmpChecked = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "hbmpChecked", "I"); MENUITEMINFOFc.hSubMenu = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "hSubMenu", "I"); MENUITEMINFOFc.wID = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "wID", "I"); MENUITEMINFOFc.fState = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "fState", "I"); MENUITEMINFOFc.fType = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "fType", "I"); MENUITEMINFOFc.fMask = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "fMask", "I"); MENUITEMINFOFc.cbSize = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "cbSize", "I");
void cacheMENUITEMINFOFields(JNIEnv *env, jobject lpObject){ if (MENUITEMINFOFc.cached) return; MENUITEMINFOFc.clazz = (*env)->GetObjectClass(env, lpObject); MENUITEMINFOFc.hbmpItem = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "hbmpItem", "I"); MENUITEMINFOFc.cch = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "cch", "I"); MENUITEMINFOFc.dwTypeData = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "dwTypeData", "I"); MENUITEMINFOFc.dwItemData = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "dwItemData", "I"); MENUITEMINFOFc.hbmpUnchecked = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "hbmpUnchecked", "I"); MENUITEMINFOFc.hbmpChecked = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "hbmpChecked", "I"); MENUITEMINFOFc.hSubMenu = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "hSubMenu", "I"); MENUITEMINFOFc.wID = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "wID", "I"); MENUITEMINFOFc.fState = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "fState", "I"); MENUITEMINFOFc.fType = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "fType", "I"); MENUITEMINFOFc.fMask = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "fMask", "I"); MENUITEMINFOFc.cbSize = (*env)->GetFieldID(env, MENUITEMINFOFc.clazz, "cbSize", "I"); MENUITEMINFOFc.cached = 1;}
MONITORINFOFc.rcWork_bottom = (*env)->GetFieldID(env, MONITORINFOFc.clazz, "rcWork_bottom", "I"); MONITORINFOFc.rcWork_right = (*env)->GetFieldID(env, MONITORINFOFc.clazz, "rcWork_right", "I"); MONITORINFOFc.rcWork_top = (*env)->GetFieldID(env, MONITORINFOFc.clazz, "rcWork_top", "I"); MONITORINFOFc.rcWork_left = (*env)->GetFieldID(env, MONITORINFOFc.clazz, "rcWork_left", "I"); MONITORINFOFc.rcMonitor_bottom = (*env)->GetFieldID(env, MONITORINFOFc.clazz, "rcMonitor_bottom", "I"); MONITORINFOFc.rcMonitor_right = (*env)->GetFieldID(env, MONITORINFOFc.clazz, "rcMonitor_right", "I"); MONITORINFOFc.rcMonitor_top = (*env)->GetFieldID(env, MONITORINFOFc.clazz, "rcMonitor_top", "I"); MONITORINFOFc.rcMonitor_left = (*env)->GetFieldID(env, MONITORINFOFc.clazz, "rcMonitor_left", "I"); MONITORINFOFc.cbSize = (*env)->GetFieldID(env, MONITORINFOFc.clazz, "cbSize", "I");
void cacheMONITORINFOFields(JNIEnv *env, jobject lpObject){ if (MONITORINFOFc.cached) return; MONITORINFOFc.clazz = (*env)->GetObjectClass(env, lpObject); MONITORINFOFc.dwFlags = (*env)->GetFieldID(env, MONITORINFOFc.clazz, "dwFlags", "I"); MONITORINFOFc.rcWork_bottom = (*env)->GetFieldID(env, MONITORINFOFc.clazz, "rcWork_bottom", "I"); MONITORINFOFc.rcWork_right = (*env)->GetFieldID(env, MONITORINFOFc.clazz, "rcWork_right", "I"); MONITORINFOFc.rcWork_top = (*env)->GetFieldID(env, MONITORINFOFc.clazz, "rcWork_top", "I"); MONITORINFOFc.rcWork_left = (*env)->GetFieldID(env, MONITORINFOFc.clazz, "rcWork_left", "I"); MONITORINFOFc.rcMonitor_bottom = (*env)->GetFieldID(env, MONITORINFOFc.clazz, "rcMonitor_bottom", "I"); MONITORINFOFc.rcMonitor_right = (*env)->GetFieldID(env, MONITORINFOFc.clazz, "rcMonitor_right", "I"); MONITORINFOFc.rcMonitor_top = (*env)->GetFieldID(env, MONITORINFOFc.clazz, "rcMonitor_top", "I"); MONITORINFOFc.rcMonitor_left = (*env)->GetFieldID(env, MONITORINFOFc.clazz, "rcMonitor_left", "I"); MONITORINFOFc.cbSize = (*env)->GetFieldID(env, MONITORINFOFc.clazz, "cbSize", "I"); MONITORINFOFc.cached = 1;}
(*env)->SetIntField(env, lpObject, MSGFc.x, (jint)lpStruct->pt.x); (*env)->SetIntField(env, lpObject, MSGFc.time, (jint)lpStruct->time); (*env)->SetIntField(env, lpObject, MSGFc.lParam, (jint)lpStruct->lParam); (*env)->SetIntField(env, lpObject, MSGFc.wParam, (jint)lpStruct->wParam); (*env)->SetIntField(env, lpObject, MSGFc.message, (jint)lpStruct->message); (*env)->SetIntField(env, lpObject, MSGFc.hwnd, (jint)lpStruct->hwnd);
void setMSGFields(JNIEnv *env, jobject lpObject, MSG *lpStruct){ if (!MSGFc.cached) cacheMSGFields(env, lpObject); (*env)->SetIntField(env, lpObject, MSGFc.y, (jint)lpStruct->pt.y); (*env)->SetIntField(env, lpObject, MSGFc.x, (jint)lpStruct->pt.x); (*env)->SetIntField(env, lpObject, MSGFc.time, (jint)lpStruct->time); (*env)->SetIntField(env, lpObject, MSGFc.lParam, (jint)lpStruct->lParam); (*env)->SetIntField(env, lpObject, MSGFc.wParam, (jint)lpStruct->wParam); (*env)->SetIntField(env, lpObject, MSGFc.message, (jint)lpStruct->message); (*env)->SetIntField(env, lpObject, MSGFc.hwnd, (jint)lpStruct->hwnd);}
(*env)->SetIntField(env, lpObject, NMCUSTOMDRAWFc.uItemState, (jint)lpStruct->uItemState); (*env)->SetIntField(env, lpObject, NMCUSTOMDRAWFc.dwItemSpec, (jint)lpStruct->dwItemSpec); (*env)->SetIntField(env, lpObject, NMCUSTOMDRAWFc.bottom, (jint)lpStruct->rc.bottom); (*env)->SetIntField(env, lpObject, NMCUSTOMDRAWFc.right, (jint)lpStruct->rc.right); (*env)->SetIntField(env, lpObject, NMCUSTOMDRAWFc.top, (jint)lpStruct->rc.top); (*env)->SetIntField(env, lpObject, NMCUSTOMDRAWFc.left, (jint)lpStruct->rc.left); (*env)->SetIntField(env, lpObject, NMCUSTOMDRAWFc.hdc, (jint)lpStruct->hdc); (*env)->SetIntField(env, lpObject, NMCUSTOMDRAWFc.dwDrawStage, (jint)lpStruct->dwDrawStage);
void setNMCUSTOMDRAWFields(JNIEnv *env, jobject lpObject, NMCUSTOMDRAW *lpStruct){ if (!NMCUSTOMDRAWFc.cached) cacheNMCUSTOMDRAWFields(env, lpObject); setNMHDRFields(env, lpObject, (NMHDR *)lpStruct); (*env)->SetIntField(env, lpObject, NMCUSTOMDRAWFc.lItemlParam, (jint)lpStruct->lItemlParam); (*env)->SetIntField(env, lpObject, NMCUSTOMDRAWFc.uItemState, (jint)lpStruct->uItemState); (*env)->SetIntField(env, lpObject, NMCUSTOMDRAWFc.dwItemSpec, (jint)lpStruct->dwItemSpec); (*env)->SetIntField(env, lpObject, NMCUSTOMDRAWFc.bottom, (jint)lpStruct->rc.bottom); (*env)->SetIntField(env, lpObject, NMCUSTOMDRAWFc.right, (jint)lpStruct->rc.right); (*env)->SetIntField(env, lpObject, NMCUSTOMDRAWFc.top, (jint)lpStruct->rc.top); (*env)->SetIntField(env, lpObject, NMCUSTOMDRAWFc.left, (jint)lpStruct->rc.left); (*env)->SetIntField(env, lpObject, NMCUSTOMDRAWFc.hdc, (jint)lpStruct->hdc); (*env)->SetIntField(env, lpObject, NMCUSTOMDRAWFc.dwDrawStage, (jint)lpStruct->dwDrawStage);}
NMHDRFc.idFrom = (*env)->GetFieldID(env, NMHDRFc.clazz, "idFrom", "I"); NMHDRFc.hwndFrom = (*env)->GetFieldID(env, NMHDRFc.clazz, "hwndFrom", "I");
void cacheNMHDRFields(JNIEnv *env, jobject lpObject){ if (NMHDRFc.cached) return; NMHDRFc.clazz = (*env)->GetObjectClass(env, lpObject); NMHDRFc.code = (*env)->GetFieldID(env, NMHDRFc.clazz, "code", "I"); NMHDRFc.idFrom = (*env)->GetFieldID(env, NMHDRFc.clazz, "idFrom", "I"); NMHDRFc.hwndFrom = (*env)->GetFieldID(env, NMHDRFc.clazz, "hwndFrom", "I"); NMHDRFc.cached = 1;}
(*env)->SetIntField(env, lpObject, NMHDRFc.idFrom, (jint)lpStruct->idFrom); (*env)->SetIntField(env, lpObject, NMHDRFc.hwndFrom, (jint)lpStruct->hwndFrom);
void setNMHDRFields(JNIEnv *env, jobject lpObject, NMHDR *lpStruct){ if (!NMHDRFc.cached) cacheNMHDRFields(env, lpObject); (*env)->SetIntField(env, lpObject, NMHDRFc.code, (jint)lpStruct->code); (*env)->SetIntField(env, lpObject, NMHDRFc.idFrom, (jint)lpStruct->idFrom); (*env)->SetIntField(env, lpObject, NMHDRFc.hwndFrom, (jint)lpStruct->hwndFrom);}
(*env)->SetIntField(env, lpObject, NMHEADERFc.iButton, (jint)lpStruct->iButton); (*env)->SetIntField(env, lpObject, NMHEADERFc.iItem, (jint)lpStruct->iItem);
void setNMHEADERFields(JNIEnv *env, jobject lpObject, NMHEADER *lpStruct){ if (!NMHEADERFc.cached) cacheNMHEADERFields(env, lpObject); setNMHDRFields(env, lpObject, (NMHDR *)lpStruct); (*env)->SetIntField(env, lpObject, NMHEADERFc.pitem, (jint)lpStruct->pitem); (*env)->SetIntField(env, lpObject, NMHEADERFc.iButton, (jint)lpStruct->iButton); (*env)->SetIntField(env, lpObject, NMHEADERFc.iItem, (jint)lpStruct->iItem);}
(*env)->SetIntField(env, lpObject, NMLISTVIEWFc.y, (jint)lpStruct->ptAction.y); (*env)->SetIntField(env, lpObject, NMLISTVIEWFc.x, (jint)lpStruct->ptAction.x); (*env)->SetIntField(env, lpObject, NMLISTVIEWFc.uChanged, (jint)lpStruct->uChanged); (*env)->SetIntField(env, lpObject, NMLISTVIEWFc.uOldState, (jint)lpStruct->uOldState); (*env)->SetIntField(env, lpObject, NMLISTVIEWFc.uNewState, (jint)lpStruct->uNewState); (*env)->SetIntField(env, lpObject, NMLISTVIEWFc.iSubItem, (jint)lpStruct->iSubItem); (*env)->SetIntField(env, lpObject, NMLISTVIEWFc.iItem, (jint)lpStruct->iItem);
void setNMLISTVIEWFields(JNIEnv *env, jobject lpObject, NMLISTVIEW *lpStruct){ if (!NMLISTVIEWFc.cached) cacheNMLISTVIEWFields(env, lpObject); setNMHDRFields(env, lpObject, (NMHDR *)lpStruct); (*env)->SetIntField(env, lpObject, NMLISTVIEWFc.lParam, (jint)lpStruct->lParam); (*env)->SetIntField(env, lpObject, NMLISTVIEWFc.y, (jint)lpStruct->ptAction.y); (*env)->SetIntField(env, lpObject, NMLISTVIEWFc.x, (jint)lpStruct->ptAction.x); (*env)->SetIntField(env, lpObject, NMLISTVIEWFc.uChanged, (jint)lpStruct->uChanged); (*env)->SetIntField(env, lpObject, NMLISTVIEWFc.uOldState, (jint)lpStruct->uOldState); (*env)->SetIntField(env, lpObject, NMLISTVIEWFc.uNewState, (jint)lpStruct->uNewState); (*env)->SetIntField(env, lpObject, NMLISTVIEWFc.iSubItem, (jint)lpStruct->iSubItem); (*env)->SetIntField(env, lpObject, NMLISTVIEWFc.iItem, (jint)lpStruct->iItem);}
NMLVCUSTOMDRAWFc.clrTextBk = (*env)->GetFieldID(env, NMLVCUSTOMDRAWFc.clazz, "clrTextBk", "I"); NMLVCUSTOMDRAWFc.clrText = (*env)->GetFieldID(env, NMLVCUSTOMDRAWFc.clazz, "clrText", "I");
void cacheNMLVCUSTOMDRAWFields(JNIEnv *env, jobject lpObject){ if (NMLVCUSTOMDRAWFc.cached) return; cacheNMCUSTOMDRAWFields(env, lpObject); NMLVCUSTOMDRAWFc.clazz = (*env)->GetObjectClass(env, lpObject); NMLVCUSTOMDRAWFc.iSubItem = (*env)->GetFieldID(env, NMLVCUSTOMDRAWFc.clazz, "iSubItem", "I"); NMLVCUSTOMDRAWFc.clrTextBk = (*env)->GetFieldID(env, NMLVCUSTOMDRAWFc.clazz, "clrTextBk", "I"); NMLVCUSTOMDRAWFc.clrText = (*env)->GetFieldID(env, NMLVCUSTOMDRAWFc.clazz, "clrText", "I"); NMLVCUSTOMDRAWFc.cached = 1;}
(*env)->SetIntField(env, lpObject, NMTOOLBARFc.bottom, (jint)lpStruct->rcButton.bottom);
(*env)->SetIntField(env, lpObject, NMTOOLBARFc.left, (jint)lpStruct->rcButton.left); #endif #ifndef _WIN32_WCE (*env)->SetIntField(env, lpObject, NMTOOLBARFc.top, (jint)lpStruct->rcButton.top);
void setNMTOOLBARFields(JNIEnv *env, jobject lpObject, NMTOOLBAR *lpStruct){ if (!NMTOOLBARFc.cached) cacheNMTOOLBARFields(env, lpObject); setNMHDRFields(env, lpObject, (NMHDR *)lpStruct);#ifndef _WIN32_WCE (*env)->SetIntField(env, lpObject, NMTOOLBARFc.bottom, (jint)lpStruct->rcButton.bottom);#endif#ifndef _WIN32_WCE (*env)->SetIntField(env, lpObject, NMTOOLBARFc.right, (jint)lpStruct->rcButton.right);#endif#ifndef _WIN32_WCE (*env)->SetIntField(env, lpObject, NMTOOLBARFc.top, (jint)lpStruct->rcButton.top);#endif#ifndef _WIN32_WCE (*env)->SetIntField(env, lpObject, NMTOOLBARFc.left, (jint)lpStruct->rcButton.left);#endif (*env)->SetIntField(env, lpObject, NMTOOLBARFc.pszText, (jint)lpStruct->pszText); (*env)->SetIntField(env, lpObject, NMTOOLBARFc.cchText, (jint)lpStruct->cchText); (*env)->SetIntField(env, lpObject, NMTOOLBARFc.iString, (jint)lpStruct->tbButton.iString); (*env)->SetIntField(env, lpObject, NMTOOLBARFc.dwData, (jint)lpStruct->tbButton.dwData); (*env)->SetByteField(env, lpObject, NMTOOLBARFc.fsStyle, (jbyte)lpStruct->tbButton.fsStyle); (*env)->SetByteField(env, lpObject, NMTOOLBARFc.fsState, (jbyte)lpStruct->tbButton.fsState); (*env)->SetIntField(env, lpObject, NMTOOLBARFc.idCommand, (jint)lpStruct->tbButton.idCommand); (*env)->SetIntField(env, lpObject, NMTOOLBARFc.iBitmap, (jint)lpStruct->tbButton.iBitmap); (*env)->SetIntField(env, lpObject, NMTOOLBARFc.iItem, (jint)lpStruct->iItem);}
(*env)->SetIntField(env, lpObject, NMTOOLBARFc.top, (jint)lpStruct->rcButton.top);
(*env)->SetIntField(env, lpObject, NMTOOLBARFc.bottom, (jint)lpStruct->rcButton.bottom);
void setNMTOOLBARFields(JNIEnv *env, jobject lpObject, NMTOOLBAR *lpStruct){ if (!NMTOOLBARFc.cached) cacheNMTOOLBARFields(env, lpObject); setNMHDRFields(env, lpObject, (NMHDR *)lpStruct);#ifndef _WIN32_WCE (*env)->SetIntField(env, lpObject, NMTOOLBARFc.bottom, (jint)lpStruct->rcButton.bottom);#endif#ifndef _WIN32_WCE (*env)->SetIntField(env, lpObject, NMTOOLBARFc.right, (jint)lpStruct->rcButton.right);#endif#ifndef _WIN32_WCE (*env)->SetIntField(env, lpObject, NMTOOLBARFc.top, (jint)lpStruct->rcButton.top);#endif#ifndef _WIN32_WCE (*env)->SetIntField(env, lpObject, NMTOOLBARFc.left, (jint)lpStruct->rcButton.left);#endif (*env)->SetIntField(env, lpObject, NMTOOLBARFc.pszText, (jint)lpStruct->pszText); (*env)->SetIntField(env, lpObject, NMTOOLBARFc.cchText, (jint)lpStruct->cchText); (*env)->SetIntField(env, lpObject, NMTOOLBARFc.iString, (jint)lpStruct->tbButton.iString); (*env)->SetIntField(env, lpObject, NMTOOLBARFc.dwData, (jint)lpStruct->tbButton.dwData); (*env)->SetByteField(env, lpObject, NMTOOLBARFc.fsStyle, (jbyte)lpStruct->tbButton.fsStyle); (*env)->SetByteField(env, lpObject, NMTOOLBARFc.fsState, (jbyte)lpStruct->tbButton.fsState); (*env)->SetIntField(env, lpObject, NMTOOLBARFc.idCommand, (jint)lpStruct->tbButton.idCommand); (*env)->SetIntField(env, lpObject, NMTOOLBARFc.iBitmap, (jint)lpStruct->tbButton.iBitmap); (*env)->SetIntField(env, lpObject, NMTOOLBARFc.iItem, (jint)lpStruct->iItem);}
jobject lpObject1 = (*env)->GetObjectField(env, lpObject, NONCLIENTMETRICSAFc.lfMessageFont); setLOGFONTAFields(env, lpObject1, &lpStruct->lfMessageFont);
jobject lpObject1 = (*env)->GetObjectField(env, lpObject, NONCLIENTMETRICSAFc.lfCaptionFont); setLOGFONTAFields(env, lpObject1, &lpStruct->lfCaptionFont); } { jobject lpObject1 = (*env)->GetObjectField(env, lpObject, NONCLIENTMETRICSAFc.lfSmCaptionFont); setLOGFONTAFields(env, lpObject1, &lpStruct->lfSmCaptionFont); } { jobject lpObject1 = (*env)->GetObjectField(env, lpObject, NONCLIENTMETRICSAFc.lfMenuFont); setLOGFONTAFields(env, lpObject1, &lpStruct->lfMenuFont);
void setNONCLIENTMETRICSAFields(JNIEnv *env, jobject lpObject, NONCLIENTMETRICSA *lpStruct){ if (!NONCLIENTMETRICSAFc.cached) cacheNONCLIENTMETRICSAFields(env, lpObject); setNONCLIENTMETRICSFields(env, lpObject, (NONCLIENTMETRICS *)lpStruct); { jobject lpObject1 = (*env)->GetObjectField(env, lpObject, NONCLIENTMETRICSAFc.lfMessageFont); setLOGFONTAFields(env, lpObject1, &lpStruct->lfMessageFont); } { jobject lpObject1 = (*env)->GetObjectField(env, lpObject, NONCLIENTMETRICSAFc.lfStatusFont); setLOGFONTAFields(env, lpObject1, &lpStruct->lfStatusFont); } { jobject lpObject1 = (*env)->GetObjectField(env, lpObject, NONCLIENTMETRICSAFc.lfMenuFont); setLOGFONTAFields(env, lpObject1, &lpStruct->lfMenuFont); } { jobject lpObject1 = (*env)->GetObjectField(env, lpObject, NONCLIENTMETRICSAFc.lfSmCaptionFont); setLOGFONTAFields(env, lpObject1, &lpStruct->lfSmCaptionFont); } { jobject lpObject1 = (*env)->GetObjectField(env, lpObject, NONCLIENTMETRICSAFc.lfCaptionFont); setLOGFONTAFields(env, lpObject1, &lpStruct->lfCaptionFont); }}
jobject lpObject1 = (*env)->GetObjectField(env, lpObject, NONCLIENTMETRICSAFc.lfMenuFont); setLOGFONTAFields(env, lpObject1, &lpStruct->lfMenuFont); } { jobject lpObject1 = (*env)->GetObjectField(env, lpObject, NONCLIENTMETRICSAFc.lfSmCaptionFont); setLOGFONTAFields(env, lpObject1, &lpStruct->lfSmCaptionFont); } { jobject lpObject1 = (*env)->GetObjectField(env, lpObject, NONCLIENTMETRICSAFc.lfCaptionFont); setLOGFONTAFields(env, lpObject1, &lpStruct->lfCaptionFont);
jobject lpObject1 = (*env)->GetObjectField(env, lpObject, NONCLIENTMETRICSAFc.lfMessageFont); setLOGFONTAFields(env, lpObject1, &lpStruct->lfMessageFont);
void setNONCLIENTMETRICSAFields(JNIEnv *env, jobject lpObject, NONCLIENTMETRICSA *lpStruct){ if (!NONCLIENTMETRICSAFc.cached) cacheNONCLIENTMETRICSAFields(env, lpObject); setNONCLIENTMETRICSFields(env, lpObject, (NONCLIENTMETRICS *)lpStruct); { jobject lpObject1 = (*env)->GetObjectField(env, lpObject, NONCLIENTMETRICSAFc.lfMessageFont); setLOGFONTAFields(env, lpObject1, &lpStruct->lfMessageFont); } { jobject lpObject1 = (*env)->GetObjectField(env, lpObject, NONCLIENTMETRICSAFc.lfStatusFont); setLOGFONTAFields(env, lpObject1, &lpStruct->lfStatusFont); } { jobject lpObject1 = (*env)->GetObjectField(env, lpObject, NONCLIENTMETRICSAFc.lfMenuFont); setLOGFONTAFields(env, lpObject1, &lpStruct->lfMenuFont); } { jobject lpObject1 = (*env)->GetObjectField(env, lpObject, NONCLIENTMETRICSAFc.lfSmCaptionFont); setLOGFONTAFields(env, lpObject1, &lpStruct->lfSmCaptionFont); } { jobject lpObject1 = (*env)->GetObjectField(env, lpObject, NONCLIENTMETRICSAFc.lfCaptionFont); setLOGFONTAFields(env, lpObject1, &lpStruct->lfCaptionFont); }}
NONCLIENTMETRICSWFc.lfStatusFont = (*env)->GetFieldID(env, NONCLIENTMETRICSWFc.clazz, "lfStatusFont", "Lorg/eclipse/swt/internal/win32/LOGFONTW;"); NONCLIENTMETRICSWFc.lfMenuFont = (*env)->GetFieldID(env, NONCLIENTMETRICSWFc.clazz, "lfMenuFont", "Lorg/eclipse/swt/internal/win32/LOGFONTW;"); NONCLIENTMETRICSWFc.lfSmCaptionFont = (*env)->GetFieldID(env, NONCLIENTMETRICSWFc.clazz, "lfSmCaptionFont", "Lorg/eclipse/swt/internal/win32/LOGFONTW;"); NONCLIENTMETRICSWFc.lfCaptionFont = (*env)->GetFieldID(env, NONCLIENTMETRICSWFc.clazz, "lfCaptionFont", "Lorg/eclipse/swt/internal/win32/LOGFONTW;");
void cacheNONCLIENTMETRICSWFields(JNIEnv *env, jobject lpObject){ if (NONCLIENTMETRICSWFc.cached) return; cacheNONCLIENTMETRICSFields(env, lpObject); NONCLIENTMETRICSWFc.clazz = (*env)->GetObjectClass(env, lpObject); NONCLIENTMETRICSWFc.lfMessageFont = (*env)->GetFieldID(env, NONCLIENTMETRICSWFc.clazz, "lfMessageFont", "Lorg/eclipse/swt/internal/win32/LOGFONTW;"); NONCLIENTMETRICSWFc.lfStatusFont = (*env)->GetFieldID(env, NONCLIENTMETRICSWFc.clazz, "lfStatusFont", "Lorg/eclipse/swt/internal/win32/LOGFONTW;"); NONCLIENTMETRICSWFc.lfMenuFont = (*env)->GetFieldID(env, NONCLIENTMETRICSWFc.clazz, "lfMenuFont", "Lorg/eclipse/swt/internal/win32/LOGFONTW;"); NONCLIENTMETRICSWFc.lfSmCaptionFont = (*env)->GetFieldID(env, NONCLIENTMETRICSWFc.clazz, "lfSmCaptionFont", "Lorg/eclipse/swt/internal/win32/LOGFONTW;"); NONCLIENTMETRICSWFc.lfCaptionFont = (*env)->GetFieldID(env, NONCLIENTMETRICSWFc.clazz, "lfCaptionFont", "Lorg/eclipse/swt/internal/win32/LOGFONTW;"); NONCLIENTMETRICSWFc.cached = 1;}
lpStruct->fIncUpdate = (*env)->GetBooleanField(env, lpObject, PAINTSTRUCTFc.fIncUpdate); lpStruct->fRestore = (*env)->GetBooleanField(env, lpObject, PAINTSTRUCTFc.fRestore); lpStruct->rcPaint.bottom = (*env)->GetIntField(env, lpObject, PAINTSTRUCTFc.bottom); lpStruct->rcPaint.right = (*env)->GetIntField(env, lpObject, PAINTSTRUCTFc.right); lpStruct->rcPaint.top = (*env)->GetIntField(env, lpObject, PAINTSTRUCTFc.top); lpStruct->rcPaint.left = (*env)->GetIntField(env, lpObject, PAINTSTRUCTFc.left); lpStruct->fErase = (*env)->GetBooleanField(env, lpObject, PAINTSTRUCTFc.fErase); lpStruct->hdc = (HDC)(*env)->GetIntField(env, lpObject, PAINTSTRUCTFc.hdc);
PAINTSTRUCT *getPAINTSTRUCTFields(JNIEnv *env, jobject lpObject, PAINTSTRUCT *lpStruct){ if (!PAINTSTRUCTFc.cached) cachePAINTSTRUCTFields(env, lpObject); { jbyteArray lpObject1 = (*env)->GetObjectField(env, lpObject, PAINTSTRUCTFc.rgbReserved); (*env)->GetByteArrayRegion(env, lpObject1, 0, sizeof(lpStruct->rgbReserved), (void *)lpStruct->rgbReserved); } lpStruct->fIncUpdate = (*env)->GetBooleanField(env, lpObject, PAINTSTRUCTFc.fIncUpdate); lpStruct->fRestore = (*env)->GetBooleanField(env, lpObject, PAINTSTRUCTFc.fRestore); lpStruct->rcPaint.bottom = (*env)->GetIntField(env, lpObject, PAINTSTRUCTFc.bottom); lpStruct->rcPaint.right = (*env)->GetIntField(env, lpObject, PAINTSTRUCTFc.right); lpStruct->rcPaint.top = (*env)->GetIntField(env, lpObject, PAINTSTRUCTFc.top); lpStruct->rcPaint.left = (*env)->GetIntField(env, lpObject, PAINTSTRUCTFc.left); lpStruct->fErase = (*env)->GetBooleanField(env, lpObject, PAINTSTRUCTFc.fErase); lpStruct->hdc = (HDC)(*env)->GetIntField(env, lpObject, PAINTSTRUCTFc.hdc); return lpStruct;}
lpStruct->x = (*env)->GetIntField(env, lpObject, POINTFc.x);
POINT *getPOINTFields(JNIEnv *env, jobject lpObject, POINT *lpStruct){ if (!POINTFc.cached) cachePOINTFields(env, lpObject); lpStruct->y = (*env)->GetIntField(env, lpObject, POINTFc.y); lpStruct->x = (*env)->GetIntField(env, lpObject, POINTFc.x); return lpStruct;}
lpStruct->lParam = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.lParam); lpStruct->cxIdeal = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.cxIdeal); lpStruct->cyIntegral = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.cyIntegral); lpStruct->cyMaxChild = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.cyMaxChild); lpStruct->cyChild = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.cyChild); lpStruct->wID = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.wID); lpStruct->hbmBack = (HBITMAP)(*env)->GetIntField(env, lpObject, REBARBANDINFOFc.hbmBack); lpStruct->cx = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.cx); lpStruct->cyMinChild = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.cyMinChild); lpStruct->cxMinChild = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.cxMinChild); lpStruct->hwndChild = (HWND)(*env)->GetIntField(env, lpObject, REBARBANDINFOFc.hwndChild); lpStruct->iImage = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.iImage); lpStruct->cch = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.cch); lpStruct->lpText = (LPTSTR)(*env)->GetIntField(env, lpObject, REBARBANDINFOFc.lpText); lpStruct->clrBack = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.clrBack); lpStruct->clrFore = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.clrFore); lpStruct->fStyle = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.fStyle); lpStruct->fMask = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.fMask); lpStruct->cbSize = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.cbSize);
REBARBANDINFO *getREBARBANDINFOFields(JNIEnv *env, jobject lpObject, REBARBANDINFO *lpStruct){ if (!REBARBANDINFOFc.cached) cacheREBARBANDINFOFields(env, lpObject);#ifndef _WIN32_WCE lpStruct->cxHeader = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.cxHeader);#endif lpStruct->lParam = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.lParam); lpStruct->cxIdeal = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.cxIdeal); lpStruct->cyIntegral = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.cyIntegral); lpStruct->cyMaxChild = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.cyMaxChild); lpStruct->cyChild = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.cyChild); lpStruct->wID = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.wID); lpStruct->hbmBack = (HBITMAP)(*env)->GetIntField(env, lpObject, REBARBANDINFOFc.hbmBack); lpStruct->cx = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.cx); lpStruct->cyMinChild = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.cyMinChild); lpStruct->cxMinChild = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.cxMinChild); lpStruct->hwndChild = (HWND)(*env)->GetIntField(env, lpObject, REBARBANDINFOFc.hwndChild); lpStruct->iImage = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.iImage); lpStruct->cch = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.cch); lpStruct->lpText = (LPTSTR)(*env)->GetIntField(env, lpObject, REBARBANDINFOFc.lpText); lpStruct->clrBack = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.clrBack); lpStruct->clrFore = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.clrFore); lpStruct->fStyle = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.fStyle); lpStruct->fMask = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.fMask); lpStruct->cbSize = (*env)->GetIntField(env, lpObject, REBARBANDINFOFc.cbSize); return lpStruct;}
RECTFc.right = (*env)->GetFieldID(env, RECTFc.clazz, "right", "I"); RECTFc.top = (*env)->GetFieldID(env, RECTFc.clazz, "top", "I"); RECTFc.left = (*env)->GetFieldID(env, RECTFc.clazz, "left", "I");
void cacheRECTFields(JNIEnv *env, jobject lpObject){ if (RECTFc.cached) return; RECTFc.clazz = (*env)->GetObjectClass(env, lpObject); RECTFc.bottom = (*env)->GetFieldID(env, RECTFc.clazz, "bottom", "I"); RECTFc.right = (*env)->GetFieldID(env, RECTFc.clazz, "right", "I"); RECTFc.top = (*env)->GetFieldID(env, RECTFc.clazz, "top", "I"); RECTFc.left = (*env)->GetFieldID(env, RECTFc.clazz, "left", "I"); RECTFc.cached = 1;}
(*env)->SetIntField(env, lpObject, SCROLLINFOFc.nPos, (jint)lpStruct->nPos); (*env)->SetIntField(env, lpObject, SCROLLINFOFc.nPage, (jint)lpStruct->nPage); (*env)->SetIntField(env, lpObject, SCROLLINFOFc.nMax, (jint)lpStruct->nMax); (*env)->SetIntField(env, lpObject, SCROLLINFOFc.nMin, (jint)lpStruct->nMin); (*env)->SetIntField(env, lpObject, SCROLLINFOFc.fMask, (jint)lpStruct->fMask); (*env)->SetIntField(env, lpObject, SCROLLINFOFc.cbSize, (jint)lpStruct->cbSize);
void setSCROLLINFOFields(JNIEnv *env, jobject lpObject, SCROLLINFO *lpStruct){ if (!SCROLLINFOFc.cached) cacheSCROLLINFOFields(env, lpObject); (*env)->SetIntField(env, lpObject, SCROLLINFOFc.nTrackPos, (jint)lpStruct->nTrackPos); (*env)->SetIntField(env, lpObject, SCROLLINFOFc.nPos, (jint)lpStruct->nPos); (*env)->SetIntField(env, lpObject, SCROLLINFOFc.nPage, (jint)lpStruct->nPage); (*env)->SetIntField(env, lpObject, SCROLLINFOFc.nMax, (jint)lpStruct->nMax); (*env)->SetIntField(env, lpObject, SCROLLINFOFc.nMin, (jint)lpStruct->nMin); (*env)->SetIntField(env, lpObject, SCROLLINFOFc.fMask, (jint)lpStruct->fMask); (*env)->SetIntField(env, lpObject, SCROLLINFOFc.cbSize, (jint)lpStruct->cbSize);}
(*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.hIcon, (jint)lpStruct->hIcon); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.dwHotKey, (jint)lpStruct->dwHotKey); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.hkeyClass, (jint)lpStruct->hkeyClass); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.lpClass, (jint)lpStruct->lpClass); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.lpIDList, (jint)lpStruct->lpIDList); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.hInstApp, (jint)lpStruct->hInstApp); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.nShow, (jint)lpStruct->nShow); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.lpDirectory, (jint)lpStruct->lpDirectory); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.lpParameters, (jint)lpStruct->lpParameters); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.lpFile, (jint)lpStruct->lpFile); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.lpVerb, (jint)lpStruct->lpVerb); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.hwnd, (jint)lpStruct->hwnd); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.fMask, (jint)lpStruct->fMask); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.cbSize, (jint)lpStruct->cbSize);
void setSHELLEXECUTEINFOFields(JNIEnv *env, jobject lpObject, SHELLEXECUTEINFO *lpStruct){ if (!SHELLEXECUTEINFOFc.cached) cacheSHELLEXECUTEINFOFields(env, lpObject); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.hProcess, (jint)lpStruct->hProcess); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.hIcon, (jint)lpStruct->hIcon); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.dwHotKey, (jint)lpStruct->dwHotKey); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.hkeyClass, (jint)lpStruct->hkeyClass); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.lpClass, (jint)lpStruct->lpClass); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.lpIDList, (jint)lpStruct->lpIDList); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.hInstApp, (jint)lpStruct->hInstApp); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.nShow, (jint)lpStruct->nShow); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.lpDirectory, (jint)lpStruct->lpDirectory); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.lpParameters, (jint)lpStruct->lpParameters); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.lpFile, (jint)lpStruct->lpFile); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.lpVerb, (jint)lpStruct->lpVerb); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.hwnd, (jint)lpStruct->hwnd); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.fMask, (jint)lpStruct->fMask); (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOFc.cbSize, (jint)lpStruct->cbSize);}
lpStruct->dwData = (*env)->GetIntField(env, lpObject, TBBUTTONFc.dwData); lpStruct->fsStyle = (*env)->GetByteField(env, lpObject, TBBUTTONFc.fsStyle); lpStruct->fsState = (*env)->GetByteField(env, lpObject, TBBUTTONFc.fsState); lpStruct->idCommand = (*env)->GetIntField(env, lpObject, TBBUTTONFc.idCommand); lpStruct->iBitmap = (*env)->GetIntField(env, lpObject, TBBUTTONFc.iBitmap);
TBBUTTON *getTBBUTTONFields(JNIEnv *env, jobject lpObject, TBBUTTON *lpStruct){ if (!TBBUTTONFc.cached) cacheTBBUTTONFields(env, lpObject); lpStruct->iString = (*env)->GetIntField(env, lpObject, TBBUTTONFc.iString); lpStruct->dwData = (*env)->GetIntField(env, lpObject, TBBUTTONFc.dwData); lpStruct->fsStyle = (*env)->GetByteField(env, lpObject, TBBUTTONFc.fsStyle); lpStruct->fsState = (*env)->GetByteField(env, lpObject, TBBUTTONFc.fsState); lpStruct->idCommand = (*env)->GetIntField(env, lpObject, TBBUTTONFc.idCommand); lpStruct->iBitmap = (*env)->GetIntField(env, lpObject, TBBUTTONFc.iBitmap); return lpStruct;}
(*env)->SetIntField(env, lpObject, TBBUTTONFc.dwData, (jint)lpStruct->dwData); (*env)->SetByteField(env, lpObject, TBBUTTONFc.fsStyle, (jbyte)lpStruct->fsStyle); (*env)->SetByteField(env, lpObject, TBBUTTONFc.fsState, (jbyte)lpStruct->fsState); (*env)->SetIntField(env, lpObject, TBBUTTONFc.idCommand, (jint)lpStruct->idCommand); (*env)->SetIntField(env, lpObject, TBBUTTONFc.iBitmap, (jint)lpStruct->iBitmap);
void setTBBUTTONFields(JNIEnv *env, jobject lpObject, TBBUTTON *lpStruct){ if (!TBBUTTONFc.cached) cacheTBBUTTONFields(env, lpObject); (*env)->SetIntField(env, lpObject, TBBUTTONFc.iString, (jint)lpStruct->iString); (*env)->SetIntField(env, lpObject, TBBUTTONFc.dwData, (jint)lpStruct->dwData); (*env)->SetByteField(env, lpObject, TBBUTTONFc.fsStyle, (jbyte)lpStruct->fsStyle); (*env)->SetByteField(env, lpObject, TBBUTTONFc.fsState, (jbyte)lpStruct->fsState); (*env)->SetIntField(env, lpObject, TBBUTTONFc.idCommand, (jint)lpStruct->idCommand); (*env)->SetIntField(env, lpObject, TBBUTTONFc.iBitmap, (jint)lpStruct->iBitmap);}
lpStruct->pszText = (LPTSTR)(*env)->GetIntField(env, lpObject, TBBUTTONINFOFc.pszText); lpStruct->lParam = (*env)->GetIntField(env, lpObject, TBBUTTONINFOFc.lParam); lpStruct->cx = (*env)->GetShortField(env, lpObject, TBBUTTONINFOFc.cx); lpStruct->fsStyle = (*env)->GetByteField(env, lpObject, TBBUTTONINFOFc.fsStyle); lpStruct->fsState = (*env)->GetByteField(env, lpObject, TBBUTTONINFOFc.fsState); lpStruct->iImage = (*env)->GetIntField(env, lpObject, TBBUTTONINFOFc.iImage); lpStruct->idCommand = (*env)->GetIntField(env, lpObject, TBBUTTONINFOFc.idCommand); lpStruct->dwMask = (*env)->GetIntField(env, lpObject, TBBUTTONINFOFc.dwMask); lpStruct->cbSize = (*env)->GetIntField(env, lpObject, TBBUTTONINFOFc.cbSize);
TBBUTTONINFO *getTBBUTTONINFOFields(JNIEnv *env, jobject lpObject, TBBUTTONINFO *lpStruct){ if (!TBBUTTONINFOFc.cached) cacheTBBUTTONINFOFields(env, lpObject); lpStruct->cchText = (*env)->GetIntField(env, lpObject, TBBUTTONINFOFc.cchText); lpStruct->pszText = (LPTSTR)(*env)->GetIntField(env, lpObject, TBBUTTONINFOFc.pszText); lpStruct->lParam = (*env)->GetIntField(env, lpObject, TBBUTTONINFOFc.lParam); lpStruct->cx = (*env)->GetShortField(env, lpObject, TBBUTTONINFOFc.cx); lpStruct->fsStyle = (*env)->GetByteField(env, lpObject, TBBUTTONINFOFc.fsStyle); lpStruct->fsState = (*env)->GetByteField(env, lpObject, TBBUTTONINFOFc.fsState); lpStruct->iImage = (*env)->GetIntField(env, lpObject, TBBUTTONINFOFc.iImage); lpStruct->idCommand = (*env)->GetIntField(env, lpObject, TBBUTTONINFOFc.idCommand); lpStruct->dwMask = (*env)->GetIntField(env, lpObject, TBBUTTONINFOFc.dwMask); lpStruct->cbSize = (*env)->GetIntField(env, lpObject, TBBUTTONINFOFc.cbSize); return lpStruct;}
(*env)->SetIntField(env, lpObject, TBBUTTONINFOFc.pszText, (jint)lpStruct->pszText); (*env)->SetIntField(env, lpObject, TBBUTTONINFOFc.lParam, (jint)lpStruct->lParam); (*env)->SetShortField(env, lpObject, TBBUTTONINFOFc.cx, (jshort)lpStruct->cx); (*env)->SetByteField(env, lpObject, TBBUTTONINFOFc.fsStyle, (jbyte)lpStruct->fsStyle); (*env)->SetByteField(env, lpObject, TBBUTTONINFOFc.fsState, (jbyte)lpStruct->fsState); (*env)->SetIntField(env, lpObject, TBBUTTONINFOFc.iImage, (jint)lpStruct->iImage); (*env)->SetIntField(env, lpObject, TBBUTTONINFOFc.idCommand, (jint)lpStruct->idCommand); (*env)->SetIntField(env, lpObject, TBBUTTONINFOFc.dwMask, (jint)lpStruct->dwMask); (*env)->SetIntField(env, lpObject, TBBUTTONINFOFc.cbSize, (jint)lpStruct->cbSize);
void setTBBUTTONINFOFields(JNIEnv *env, jobject lpObject, TBBUTTONINFO *lpStruct){ if (!TBBUTTONINFOFc.cached) cacheTBBUTTONINFOFields(env, lpObject); (*env)->SetIntField(env, lpObject, TBBUTTONINFOFc.cchText, (jint)lpStruct->cchText); (*env)->SetIntField(env, lpObject, TBBUTTONINFOFc.pszText, (jint)lpStruct->pszText); (*env)->SetIntField(env, lpObject, TBBUTTONINFOFc.lParam, (jint)lpStruct->lParam); (*env)->SetShortField(env, lpObject, TBBUTTONINFOFc.cx, (jshort)lpStruct->cx); (*env)->SetByteField(env, lpObject, TBBUTTONINFOFc.fsStyle, (jbyte)lpStruct->fsStyle); (*env)->SetByteField(env, lpObject, TBBUTTONINFOFc.fsState, (jbyte)lpStruct->fsState); (*env)->SetIntField(env, lpObject, TBBUTTONINFOFc.iImage, (jint)lpStruct->iImage); (*env)->SetIntField(env, lpObject, TBBUTTONINFOFc.idCommand, (jint)lpStruct->idCommand); (*env)->SetIntField(env, lpObject, TBBUTTONINFOFc.dwMask, (jint)lpStruct->dwMask); (*env)->SetIntField(env, lpObject, TBBUTTONINFOFc.cbSize, (jint)lpStruct->cbSize);}
(*env)->SetByteField(env, lpObject, TEXTMETRICAFc.tmDefaultChar, (jbyte)lpStruct->tmDefaultChar); (*env)->SetByteField(env, lpObject, TEXTMETRICAFc.tmLastChar, (jbyte)lpStruct->tmLastChar); (*env)->SetByteField(env, lpObject, TEXTMETRICAFc.tmFirstChar, (jbyte)lpStruct->tmFirstChar);
void setTEXTMETRICAFields(JNIEnv *env, jobject lpObject, TEXTMETRICA *lpStruct){ if (!TEXTMETRICAFc.cached) cacheTEXTMETRICAFields(env, lpObject); setTEXTMETRICFields(env, lpObject, (TEXTMETRIC *)lpStruct); (*env)->SetByteField(env, lpObject, TEXTMETRICAFc.tmBreakChar, (jbyte)lpStruct->tmBreakChar); (*env)->SetByteField(env, lpObject, TEXTMETRICAFc.tmDefaultChar, (jbyte)lpStruct->tmDefaultChar); (*env)->SetByteField(env, lpObject, TEXTMETRICAFc.tmLastChar, (jbyte)lpStruct->tmLastChar); (*env)->SetByteField(env, lpObject, TEXTMETRICAFc.tmFirstChar, (jbyte)lpStruct->tmFirstChar);}
lpStruct->iImage = (*env)->GetIntField(env, lpObject, TCITEMFc.iImage); lpStruct->cchTextMax = (*env)->GetIntField(env, lpObject, TCITEMFc.cchTextMax); lpStruct->pszText = (LPTSTR)(*env)->GetIntField(env, lpObject, TCITEMFc.pszText); lpStruct->dwStateMask = (*env)->GetIntField(env, lpObject, TCITEMFc.dwStateMask); lpStruct->dwState = (*env)->GetIntField(env, lpObject, TCITEMFc.dwState); lpStruct->mask = (*env)->GetIntField(env, lpObject, TCITEMFc.mask);
TCITEM *getTCITEMFields(JNIEnv *env, jobject lpObject, TCITEM *lpStruct){ if (!TCITEMFc.cached) cacheTCITEMFields(env, lpObject); lpStruct->lParam = (*env)->GetIntField(env, lpObject, TCITEMFc.lParam); lpStruct->iImage = (*env)->GetIntField(env, lpObject, TCITEMFc.iImage); lpStruct->cchTextMax = (*env)->GetIntField(env, lpObject, TCITEMFc.cchTextMax); lpStruct->pszText = (LPTSTR)(*env)->GetIntField(env, lpObject, TCITEMFc.pszText); lpStruct->dwStateMask = (*env)->GetIntField(env, lpObject, TCITEMFc.dwStateMask); lpStruct->dwState = (*env)->GetIntField(env, lpObject, TCITEMFc.dwState); lpStruct->mask = (*env)->GetIntField(env, lpObject, TCITEMFc.mask); return lpStruct;}
(*env)->SetIntField(env, lpObject, TCITEMFc.iImage, (jint)lpStruct->iImage); (*env)->SetIntField(env, lpObject, TCITEMFc.cchTextMax, (jint)lpStruct->cchTextMax); (*env)->SetIntField(env, lpObject, TCITEMFc.pszText, (jint)lpStruct->pszText); (*env)->SetIntField(env, lpObject, TCITEMFc.dwStateMask, (jint)lpStruct->dwStateMask); (*env)->SetIntField(env, lpObject, TCITEMFc.dwState, (jint)lpStruct->dwState); (*env)->SetIntField(env, lpObject, TCITEMFc.mask, (jint)lpStruct->mask);
void setTCITEMFields(JNIEnv *env, jobject lpObject, TCITEM *lpStruct){ if (!TCITEMFc.cached) cacheTCITEMFields(env, lpObject); (*env)->SetIntField(env, lpObject, TCITEMFc.lParam, (jint)lpStruct->lParam); (*env)->SetIntField(env, lpObject, TCITEMFc.iImage, (jint)lpStruct->iImage); (*env)->SetIntField(env, lpObject, TCITEMFc.cchTextMax, (jint)lpStruct->cchTextMax); (*env)->SetIntField(env, lpObject, TCITEMFc.pszText, (jint)lpStruct->pszText); (*env)->SetIntField(env, lpObject, TCITEMFc.dwStateMask, (jint)lpStruct->dwStateMask); (*env)->SetIntField(env, lpObject, TCITEMFc.dwState, (jint)lpStruct->dwState); (*env)->SetIntField(env, lpObject, TCITEMFc.mask, (jint)lpStruct->mask);}
(*env)->SetCharField(env, lpObject, TEXTMETRICWFc.tmDefaultChar, (jchar)lpStruct->tmDefaultChar); (*env)->SetCharField(env, lpObject, TEXTMETRICWFc.tmLastChar, (jchar)lpStruct->tmLastChar); (*env)->SetCharField(env, lpObject, TEXTMETRICWFc.tmFirstChar, (jchar)lpStruct->tmFirstChar);
void setTEXTMETRICWFields(JNIEnv *env, jobject lpObject, TEXTMETRICW *lpStruct){ if (!TEXTMETRICWFc.cached) cacheTEXTMETRICWFields(env, lpObject); setTEXTMETRICFields(env, lpObject, (TEXTMETRIC *)lpStruct); (*env)->SetCharField(env, lpObject, TEXTMETRICWFc.tmBreakChar, (jchar)lpStruct->tmBreakChar); (*env)->SetCharField(env, lpObject, TEXTMETRICWFc.tmDefaultChar, (jchar)lpStruct->tmDefaultChar); (*env)->SetCharField(env, lpObject, TEXTMETRICWFc.tmLastChar, (jchar)lpStruct->tmLastChar); (*env)->SetCharField(env, lpObject, TEXTMETRICWFc.tmFirstChar, (jchar)lpStruct->tmFirstChar);}
lpStruct->lpszText = (LPTSTR)(*env)->GetIntField(env, lpObject, TOOLINFOFc.lpszText); lpStruct->hinst = (HINSTANCE)(*env)->GetIntField(env, lpObject, TOOLINFOFc.hinst); lpStruct->rect.bottom = (*env)->GetIntField(env, lpObject, TOOLINFOFc.bottom); lpStruct->rect.right = (*env)->GetIntField(env, lpObject, TOOLINFOFc.right); lpStruct->rect.top = (*env)->GetIntField(env, lpObject, TOOLINFOFc.top); lpStruct->rect.left = (*env)->GetIntField(env, lpObject, TOOLINFOFc.left); lpStruct->uId = (*env)->GetIntField(env, lpObject, TOOLINFOFc.uId); lpStruct->hwnd = (HWND)(*env)->GetIntField(env, lpObject, TOOLINFOFc.hwnd); lpStruct->uFlags = (*env)->GetIntField(env, lpObject, TOOLINFOFc.uFlags); lpStruct->cbSize = (*env)->GetIntField(env, lpObject, TOOLINFOFc.cbSize);
TOOLINFO *getTOOLINFOFields(JNIEnv *env, jobject lpObject, TOOLINFO *lpStruct){ if (!TOOLINFOFc.cached) cacheTOOLINFOFields(env, lpObject); lpStruct->lParam = (*env)->GetIntField(env, lpObject, TOOLINFOFc.lParam); lpStruct->lpszText = (LPTSTR)(*env)->GetIntField(env, lpObject, TOOLINFOFc.lpszText); lpStruct->hinst = (HINSTANCE)(*env)->GetIntField(env, lpObject, TOOLINFOFc.hinst); lpStruct->rect.bottom = (*env)->GetIntField(env, lpObject, TOOLINFOFc.bottom); lpStruct->rect.right = (*env)->GetIntField(env, lpObject, TOOLINFOFc.right); lpStruct->rect.top = (*env)->GetIntField(env, lpObject, TOOLINFOFc.top); lpStruct->rect.left = (*env)->GetIntField(env, lpObject, TOOLINFOFc.left); lpStruct->uId = (*env)->GetIntField(env, lpObject, TOOLINFOFc.uId); lpStruct->hwnd = (HWND)(*env)->GetIntField(env, lpObject, TOOLINFOFc.hwnd); lpStruct->uFlags = (*env)->GetIntField(env, lpObject, TOOLINFOFc.uFlags); lpStruct->cbSize = (*env)->GetIntField(env, lpObject, TOOLINFOFc.cbSize); return lpStruct;}
(*env)->SetIntField(env, lpObject, TOOLINFOFc.lpszText, (jint)lpStruct->lpszText); (*env)->SetIntField(env, lpObject, TOOLINFOFc.hinst, (jint)lpStruct->hinst); (*env)->SetIntField(env, lpObject, TOOLINFOFc.bottom, (jint)lpStruct->rect.bottom); (*env)->SetIntField(env, lpObject, TOOLINFOFc.right, (jint)lpStruct->rect.right); (*env)->SetIntField(env, lpObject, TOOLINFOFc.top, (jint)lpStruct->rect.top); (*env)->SetIntField(env, lpObject, TOOLINFOFc.left, (jint)lpStruct->rect.left); (*env)->SetIntField(env, lpObject, TOOLINFOFc.uId, (jint)lpStruct->uId); (*env)->SetIntField(env, lpObject, TOOLINFOFc.hwnd, (jint)lpStruct->hwnd); (*env)->SetIntField(env, lpObject, TOOLINFOFc.uFlags, (jint)lpStruct->uFlags); (*env)->SetIntField(env, lpObject, TOOLINFOFc.cbSize, (jint)lpStruct->cbSize);
void setTOOLINFOFields(JNIEnv *env, jobject lpObject, TOOLINFO *lpStruct){ if (!TOOLINFOFc.cached) cacheTOOLINFOFields(env, lpObject); (*env)->SetIntField(env, lpObject, TOOLINFOFc.lParam, (jint)lpStruct->lParam); (*env)->SetIntField(env, lpObject, TOOLINFOFc.lpszText, (jint)lpStruct->lpszText); (*env)->SetIntField(env, lpObject, TOOLINFOFc.hinst, (jint)lpStruct->hinst); (*env)->SetIntField(env, lpObject, TOOLINFOFc.bottom, (jint)lpStruct->rect.bottom); (*env)->SetIntField(env, lpObject, TOOLINFOFc.right, (jint)lpStruct->rect.right); (*env)->SetIntField(env, lpObject, TOOLINFOFc.top, (jint)lpStruct->rect.top); (*env)->SetIntField(env, lpObject, TOOLINFOFc.left, (jint)lpStruct->rect.left); (*env)->SetIntField(env, lpObject, TOOLINFOFc.uId, (jint)lpStruct->uId); (*env)->SetIntField(env, lpObject, TOOLINFOFc.hwnd, (jint)lpStruct->hwnd); (*env)->SetIntField(env, lpObject, TOOLINFOFc.uFlags, (jint)lpStruct->uFlags); (*env)->SetIntField(env, lpObject, TOOLINFOFc.cbSize, (jint)lpStruct->cbSize);}
(*env)->SetIntField(env, lpObject, TRACKMOUSEEVENTFc.hwndTrack, (jint)lpStruct->hwndTrack); (*env)->SetIntField(env, lpObject, TRACKMOUSEEVENTFc.dwFlags, (jint)lpStruct->dwFlags); (*env)->SetIntField(env, lpObject, TRACKMOUSEEVENTFc.cbSize, (jint)lpStruct->cbSize);
void setTRACKMOUSEEVENTFields(JNIEnv *env, jobject lpObject, TRACKMOUSEEVENT *lpStruct){ if (!TRACKMOUSEEVENTFc.cached) cacheTRACKMOUSEEVENTFields(env, lpObject); (*env)->SetIntField(env, lpObject, TRACKMOUSEEVENTFc.dwHoverTime, (jint)lpStruct->dwHoverTime); (*env)->SetIntField(env, lpObject, TRACKMOUSEEVENTFc.hwndTrack, (jint)lpStruct->hwndTrack); (*env)->SetIntField(env, lpObject, TRACKMOUSEEVENTFc.dwFlags, (jint)lpStruct->dwFlags); (*env)->SetIntField(env, lpObject, TRACKMOUSEEVENTFc.cbSize, (jint)lpStruct->cbSize);}
(*env)->SetIntField(env, lpObject, TVHITTESTINFOFc.flags, (jint)lpStruct->flags); (*env)->SetIntField(env, lpObject, TVHITTESTINFOFc.y, (jint)lpStruct->pt.y); (*env)->SetIntField(env, lpObject, TVHITTESTINFOFc.x, (jint)lpStruct->pt.x);
void setTVHITTESTINFOFields(JNIEnv *env, jobject lpObject, TVHITTESTINFO *lpStruct){ if (!TVHITTESTINFOFc.cached) cacheTVHITTESTINFOFields(env, lpObject); (*env)->SetIntField(env, lpObject, TVHITTESTINFOFc.hItem, (jint)lpStruct->hItem); (*env)->SetIntField(env, lpObject, TVHITTESTINFOFc.flags, (jint)lpStruct->flags); (*env)->SetIntField(env, lpObject, TVHITTESTINFOFc.y, (jint)lpStruct->pt.y); (*env)->SetIntField(env, lpObject, TVHITTESTINFOFc.x, (jint)lpStruct->pt.x);}
KApplication app( false, false );
KApplication app( false );
int KDE_EXPORT kdemain( int argc, char **argv ) { // KApplication is necessary to use other ioslaves putenv(strdup("SESSION_MANAGER=")); KCmdLineArgs::init(argc, argv, "kio_remote", 0L, 0L, false); KCmdLineArgs::addCmdLineOptions( options ); KApplication app( false, false ); // We want to be anonymous even if we use DCOP app.dcopClient()->attach(); DCOPRef ref( "kded", "kded" ); ref.call( "loadModule", "remotedirnotify" ); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); RemoteProtocol slave( args->arg(0), args->arg(1), args->arg(2) ); slave.dispatchLoop(); return 0; }
if (arg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0); if (arg3) (*env)->ReleaseByteArrayElements(env, arg3, lparg3, 0); if (arg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0);
JNIEXPORT jint JNICALL OS_NATIVE(select) (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1, jbyteArray arg2, jbyteArray arg3, jintArray arg4){ jbyte *lparg1=NULL; jbyte *lparg2=NULL; jbyte *lparg3=NULL; jint *lparg4=NULL; jint rc; NATIVE_ENTER(env, that, "select\n") if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL); if (arg2) lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL); if (arg3) lparg3 = (*env)->GetByteArrayElements(env, arg3, NULL); if (arg4) lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL); rc = (jint)select(arg0, (fd_set *)lparg1, (fd_set *)lparg2, (fd_set *)lparg3, (struct timeval *)lparg4); if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); if (arg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0); if (arg3) (*env)->ReleaseByteArrayElements(env, arg3, lparg3, 0); if (arg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0); NATIVE_EXIT(env, that, "select\n") return rc;}
if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); if (arg3) (*env)->ReleaseByteArrayElements(env, arg3, lparg3, 0);
JNIEXPORT jint JNICALL OS_NATIVE(XmStringGenerate) (JNIEnv *env, jclass that, jbyteArray arg0, jbyteArray arg1, jint arg2, jbyteArray arg3){ jbyte *lparg0=NULL; jbyte *lparg1=NULL; jbyte *lparg3=NULL; jint rc; NATIVE_ENTER(env, that, "XmStringGenerate\n") if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL); if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL); if (arg3) lparg3 = (*env)->GetByteArrayElements(env, arg3, NULL); rc = (jint)XmStringGenerate((XtPointer)lparg0, (XmStringTag)lparg1, arg2, (XmStringTag)lparg3); if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); if (arg3) (*env)->ReleaseByteArrayElements(env, arg3, lparg3, 0); NATIVE_EXIT(env, that, "XmStringGenerate\n") return rc;}
if (arg3) (*env)->ReleaseShortArrayElements(env, arg3, lparg3, 0);
JNIEXPORT jboolean JNICALL OS_NATIVE(XmTextPosToXY) (JNIEnv *env, jclass that, jint arg0, jint arg1, jshortArray arg2, jshortArray arg3){ jshort *lparg2=NULL; jshort *lparg3=NULL; jboolean rc; NATIVE_ENTER(env, that, "XmTextPosToXY\n") if (arg2) lparg2 = (*env)->GetShortArrayElements(env, arg2, NULL); if (arg3) lparg3 = (*env)->GetShortArrayElements(env, arg3, NULL); rc = (jboolean)XmTextPosToXY((Widget)arg0, (XmTextPosition)arg1, (Position *)lparg2, (Position *)lparg3); if (arg2) (*env)->ReleaseShortArrayElements(env, arg2, lparg2, 0); if (arg3) (*env)->ReleaseShortArrayElements(env, arg3, lparg3, 0); NATIVE_EXIT(env, that, "XmTextPosToXY\n") return rc;}
printf(" --param name value\n");
printf(" --param name value : pass a (parameter,value) pair\n");
static void usage(const char *name) { printf("Usage: %s [options] stylesheet file [file ...]\n", name); printf(" Options:\n"); printf(" --verbose or -v: show logs of what's happening\n"); printf(" --timing: display the time used\n"); printf(" --repeat: run the transformation 20 times\n"); printf(" --debug: dump the tree of the result instead\n"); printf(" --novalid: skip the Dtd loading phase\n"); printf(" --noout: do not dump the result\n"); printf(" --maxdepth val : increase the maximum depth\n");#ifdef LIBXML_HTML_ENABLED printf(" --html: the input document is(are) an HTML file(s)\n");#endif#ifdef LIBXML_DOCB_ENABLED printf(" --docbook: the input document is SGML docbook\n");#endif printf(" --param name value\n"); printf(" --nonet refuse to fetch DTDs or entities over network\n"); printf(" --warnnet warn against fetching over the network\n");}
if ( driverDescription.startsWith("USGSDEM", false) )
if ( driverDescription.startsWith("USGSDEM") )
static void buildSupportedRasterFileFilter_(QString & fileFilters){ // first get the GDAL driver manager GDALDriverManager *driverManager = GetGDALDriverManager(); if (!driverManager) { std::cerr << "unable to get GDALDriverManager\n"; return; // XXX good place to throw exception if we } // XXX decide to do exceptions // then iterate through all of the supported drivers, adding the // corresponding file filter GDALDriver *driver; // current driver char **driverMetadata; // driver metadata strings QString driverLongName(""); // long name for the given driver QString driverExtension(""); // file name extension for given driver QString driverDescription; // QString wrapper of GDAL driver description QStringList metadataTokens; // essentially the metadata string delimited by '=' QString catchallFilter; // for Any file(*.*), but also for those // drivers with no specific file // filter // Grind through all the drivers and their respective metadata. // We'll add a file filter for those drivers that have a file // extension defined for them; the others, welll, even though // theoreticaly we can open those files because there exists a // driver for them, the user will have to use the "All Files" to // open datasets with no explicitly defined file name extension. // Note that file name extension strings are of the form // "DMD_EXTENSION=.*". We'll also store the long name of the // driver, which will be found in DMD_LONGNAME, which will have the // same form. for (int i = 0; i < driverManager->GetDriverCount(); ++i) { driver = driverManager->GetDriver(i); Q_CHECK_PTR(driver); if (!driver) { qWarning("unable to get driver %d", i); continue; } // now we need to see if the driver is for something currently // supported; if not, we give it a miss for the next driver driverDescription = driver->GetDescription(); if (!isSupportedRasterDriver_(driverDescription)) { // not supported, therefore skip#ifdef DEBUG qWarning("skipping unsupported driver %s", driver->GetDescription());#endif continue; } // std::cerr << "got driver string " << driver->GetDescription() << "\n"; driverMetadata = driver->GetMetadata(); // presumably we know we've run out of metadta if either the // address is 0, or the first character is null while (driverMetadata && '\0' != driverMetadata[0]) { metadataTokens = QStringList::split("=", *driverMetadata); // std::cerr << "\t" << *driverMetadata << "\n"; // XXX add check for malformed metadataTokens // Note that it's oddly possible for there to be a // DMD_EXTENSION with no corresponding defined extension // string; so we check that there're more than two tokens. if (metadataTokens.count() > 1) { if ("DMD_EXTENSION" == metadataTokens[0]) { driverExtension = metadataTokens[1]; } else if ("DMD_LONGNAME" == metadataTokens[0]) { driverLongName = metadataTokens[1]; // remove any superfluous (.*) strings at the end as // they'll confuse QFileDialog::getOpenFileNames() driverLongName.remove(QRegExp("\\(.*\\)$")); } } // if we have both the file name extension and the long name, // then we've all the information we need for the current // driver; therefore emit a file filter string and move to // the next driver if (!(driverExtension.isEmpty() || driverLongName.isEmpty())) { // XXX add check for SDTS; in that case we want (*CATD.DDF) fileFilters += createFileFilter_(driverLongName, "*." + driverExtension); break; // ... to next driver, if any. } ++driverMetadata; } // each metadata item if ( driverExtension.isEmpty() && ! driverLongName.isEmpty() ) { // Then what we have here is a driver with no corresponding // file extension; e.g., GRASS. In which case we append the // string to the "catch-all" which will match all file types. // (I.e., "*.*") We use the driver description intead of the // long time to prevent the catch-all line from getting too // large. // ... OTOH, there are some drivers with missing // DMD_EXTENSION; so let's check for them here and handle // them appropriately // USGS DEMs use "*.dem" if ( driverDescription.startsWith("USGSDEM", false) ) { fileFilters += createFileFilter_(driverLongName, "*.dem"); } else { catchallFilter += QString(driver->GetDescription()) + " "; } } driverExtension = driverLongName = ""; // reset for next driver } // each loaded GDAL driver // can't forget the default case fileFilters += catchallFilter + "All other files (*.*)";} // buildSupportedRasterFileFilter_()
bcache_map[ino] = new Filecache(this);
bcache_map[ino] = new Filecache(this, ino);
Filecache *get_fc(inodeno_t ino) { if (!bcache_map.count(ino)) { bcache_map[ino] = new Filecache(this); } return bcache_map[ino]; }
if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL);
if (arg0) lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL);
JNIEXPORT jint JNICALL OS_NATIVE(gdk_1atom_1intern) (JNIEnv *env, jclass that, jbyteArray arg0, jboolean arg1){ jbyte *lparg0=NULL; jint rc; NATIVE_ENTER(env, that, "gdk_1atom_1intern\n") if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL); rc = (jint)gdk_atom_intern((const gchar *)lparg0, arg1); if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, JNI_ABORT); NATIVE_EXIT(env, that, "gdk_1atom_1intern\n") return rc;}
if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, JNI_ABORT);
if (arg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, JNI_ABORT);
JNIEXPORT jint JNICALL OS_NATIVE(gdk_1atom_1intern) (JNIEnv *env, jclass that, jbyteArray arg0, jboolean arg1){ jbyte *lparg0=NULL; jint rc; NATIVE_ENTER(env, that, "gdk_1atom_1intern\n") if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL); rc = (jint)gdk_atom_intern((const gchar *)lparg0, arg1); if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, JNI_ABORT); NATIVE_EXIT(env, that, "gdk_1atom_1intern\n") return rc;}
if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL);
if (arg1) lparg1 = (*env)->GetPrimitiveArrayCritical(env, arg1, NULL);
JNIEXPORT jint JNICALL OS_NATIVE(gdk_1bitmap_1create_1from_1data) (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1, jint arg2, jint arg3){ jbyte *lparg1=NULL; jint rc; NATIVE_ENTER(env, that, "gdk_1bitmap_1create_1from_1data\n") if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL); rc = (jint)gdk_bitmap_create_from_data((GdkWindow *)arg0, (const gchar *)lparg1, (gint)arg2, (gint)arg3); if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, JNI_ABORT); NATIVE_EXIT(env, that, "gdk_1bitmap_1create_1from_1data\n") return rc;}
if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, JNI_ABORT);
if (arg1) (*env)->ReleasePrimitiveArrayCritical(env, arg1, lparg1, JNI_ABORT);
JNIEXPORT jint JNICALL OS_NATIVE(gdk_1bitmap_1create_1from_1data) (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1, jint arg2, jint arg3){ jbyte *lparg1=NULL; jint rc; NATIVE_ENTER(env, that, "gdk_1bitmap_1create_1from_1data\n") if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL); rc = (jint)gdk_bitmap_create_from_data((GdkWindow *)arg0, (const gchar *)lparg1, (gint)arg2, (gint)arg3); if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, JNI_ABORT); NATIVE_EXIT(env, that, "gdk_1bitmap_1create_1from_1data\n") return rc;}
if (arg3) setGdkColorFields(env, arg3, lparg3);
JNIEXPORT jint JNICALL OS_NATIVE(gdk_1cursor_1new_1from_1pixmap) (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2, jobject arg3, jint arg4, jint arg5){ GdkColor _arg2, *lparg2=NULL; GdkColor _arg3, *lparg3=NULL; jint rc; NATIVE_ENTER(env, that, "gdk_1cursor_1new_1from_1pixmap\n") if (arg2) lparg2 = getGdkColorFields(env, arg2, &_arg2); if (arg3) lparg3 = getGdkColorFields(env, arg3, &_arg3); rc = (jint)gdk_cursor_new_from_pixmap((GdkPixmap *)arg0, (GdkPixmap *)arg1, (GdkColor *)lparg2, (GdkColor *)lparg3, (gint)arg4, (gint)arg5); if (arg2) setGdkColorFields(env, arg2, lparg2); if (arg3) setGdkColorFields(env, arg3, lparg3); NATIVE_EXIT(env, that, "gdk_1cursor_1new_1from_1pixmap\n") return rc;}
if (arg2) lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL);
if (arg2) lparg2 = (*env)->GetPrimitiveArrayCritical(env, arg2, NULL);
JNIEXPORT void JNICALL OS_NATIVE(gdk_1draw_1lines) (JNIEnv *env, jclass that, jint arg0, jint arg1, jintArray arg2, jint arg3){ jint *lparg2=NULL; NATIVE_ENTER(env, that, "gdk_1draw_1lines\n") if (arg2) lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL); gdk_draw_lines((GdkDrawable *)arg0, (GdkGC *)arg1, (GdkPoint *)lparg2, (gint)arg3); if (arg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, JNI_ABORT); NATIVE_EXIT(env, that, "gdk_1draw_1lines\n")}
if (arg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, JNI_ABORT);
if (arg2) (*env)->ReleasePrimitiveArrayCritical(env, arg2, lparg2, JNI_ABORT);
JNIEXPORT void JNICALL OS_NATIVE(gdk_1draw_1lines) (JNIEnv *env, jclass that, jint arg0, jint arg1, jintArray arg2, jint arg3){ jint *lparg2=NULL; NATIVE_ENTER(env, that, "gdk_1draw_1lines\n") if (arg2) lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL); gdk_draw_lines((GdkDrawable *)arg0, (GdkGC *)arg1, (GdkPoint *)lparg2, (gint)arg3); if (arg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, JNI_ABORT); NATIVE_EXIT(env, that, "gdk_1draw_1lines\n")}
if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL);
if (arg3) lparg3 = (*env)->GetPrimitiveArrayCritical(env, arg3, NULL);
JNIEXPORT void JNICALL OS_NATIVE(gdk_1draw_1polygon) (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jintArray arg3, jint arg4){ jint *lparg3=NULL; NATIVE_ENTER(env, that, "gdk_1draw_1polygon\n") if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL); gdk_draw_polygon((GdkDrawable *)arg0, (GdkGC *)arg1, (gint)arg2, (GdkPoint *)lparg3, (gint)arg4); if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, JNI_ABORT); NATIVE_EXIT(env, that, "gdk_1draw_1polygon\n")}
if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, JNI_ABORT);
if (arg3) (*env)->ReleasePrimitiveArrayCritical(env, arg3, lparg3, JNI_ABORT);
JNIEXPORT void JNICALL OS_NATIVE(gdk_1draw_1polygon) (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jintArray arg3, jint arg4){ jint *lparg3=NULL; NATIVE_ENTER(env, that, "gdk_1draw_1polygon\n") if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL); gdk_draw_polygon((GdkDrawable *)arg0, (GdkGC *)arg1, (gint)arg2, (GdkPoint *)lparg3, (gint)arg4); if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, JNI_ABORT); NATIVE_EXIT(env, that, "gdk_1draw_1polygon\n")}
if (arg2) lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL);
if (arg2) lparg2 = (*env)->GetPrimitiveArrayCritical(env, arg2, NULL);
JNIEXPORT void JNICALL OS_NATIVE(gdk_1gc_1set_1dashes) (JNIEnv *env, jclass that, jint arg0, jint arg1, jbyteArray arg2, jint arg3){ jbyte *lparg2=NULL; NATIVE_ENTER(env, that, "gdk_1gc_1set_1dashes\n") if (arg2) lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL); gdk_gc_set_dashes((GdkGC *)arg0, (gint)arg1, (gint8 *)lparg2, (gint)arg3); if (arg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, JNI_ABORT); NATIVE_EXIT(env, that, "gdk_1gc_1set_1dashes\n")}
if (arg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, JNI_ABORT);
if (arg2) (*env)->ReleasePrimitiveArrayCritical(env, arg2, lparg2, JNI_ABORT);
JNIEXPORT void JNICALL OS_NATIVE(gdk_1gc_1set_1dashes) (JNIEnv *env, jclass that, jint arg0, jint arg1, jbyteArray arg2, jint arg3){ jbyte *lparg2=NULL; NATIVE_ENTER(env, that, "gdk_1gc_1set_1dashes\n") if (arg2) lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL); gdk_gc_set_dashes((GdkGC *)arg0, (gint)arg1, (gint8 *)lparg2, (gint)arg3); if (arg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, JNI_ABORT); NATIVE_EXIT(env, that, "gdk_1gc_1set_1dashes\n")}
if (arg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
JNIEXPORT jint JNICALL OS_NATIVE(gdk_1window_1get_1origin) (JNIEnv *env, jclass that, jint arg0, jintArray arg1, jintArray arg2){ jint *lparg1=NULL; jint *lparg2=NULL; jint rc; NATIVE_ENTER(env, that, "gdk_1window_1get_1origin\n") if (arg1) lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL); if (arg2) lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL); rc = (jint)gdk_window_get_origin((GdkWindow *)arg0, (gint *)lparg1, (gint *)lparg2); if (arg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); if (arg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); NATIVE_EXIT(env, that, "gdk_1window_1get_1origin\n") return rc;}
if (arg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
JNIEXPORT jint JNICALL OS_NATIVE(gdk_1window_1get_1pointer) (JNIEnv *env, jclass that, jint arg0, jintArray arg1, jintArray arg2, jintArray arg3){ jint *lparg1=NULL; jint *lparg2=NULL; jint *lparg3=NULL; jint rc; NATIVE_ENTER(env, that, "gdk_1window_1get_1pointer\n") if (arg1) lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL); if (arg2) lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL); if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL); rc = (jint)gdk_window_get_pointer((GdkWindow *)arg0, (gint *)lparg1, (gint *)lparg2, (GdkModifierType *)lparg3); if (arg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); if (arg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0); NATIVE_EXIT(env, that, "gdk_1window_1get_1pointer\n") return rc;}