Changeset 86

Show
Ignore:
Timestamp:
01/06/2007 19:03:56 (4 years ago)
Author:
dmik
Message:

Psi: OpenPGP: replaced printf() debug statements with qDebug() to redirect debug logs to stderr; added some minor OS/2-related corrections.

Location:
psi/trunk/src/tools/openpgp
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • psi/trunk/src/tools/openpgp/gnupg.cpp

    r2 r86  
    113113 
    114114#ifdef GPG_DEBUG 
    115         printf("gpg bin=[%s]\n", bin.latin1()); 
     115        qDebug("### gpg bin=[%s]", bin.latin1()); 
    116116#endif 
    117117        d = new Private(bin); 
     
    296296{ 
    297297#ifdef GPG_DEBUG 
    298         printf("GnuPG initialization complete\n"); 
    299         printf(" Secret Keyring: [%s]\n", d->secretWatch.fileName().latin1()); 
    300         printf(" Public Keyring: [%s]\n", d->publicWatch.fileName().latin1()); 
     298        qDebug("### GnuPG initialization complete"); 
     299        qDebug("### Secret Keyring: [%s]", d->secretWatch.fileName().latin1()); 
     300        qDebug("### Public Keyring: [%s]", d->publicWatch.fileName().latin1()); 
    301301#endif 
    302302        initFinished(b, err); 
     
    461461                d->secretDirty = true; 
    462462#ifdef GPG_DEBUG 
    463                 printf("Secret keys updated!\n"); 
     463                qDebug("### Secret keys updated!"); 
    464464#endif 
    465465        } 
     
    467467                d->publicDirty = true; 
    468468#ifdef GPG_DEBUG 
    469                 printf("Public keys updated!\n"); 
     469                qDebug("### Public keys updated!"); 
    470470#endif 
    471471        } 
  • psi/trunk/src/tools/openpgp/gpgop.cpp

    r11 r86  
    365365{ 
    366366#ifdef GPG_DEBUG 
    367         printf("{%s}\n", str.latin1()); 
     367        qDebug("### {%s}", str.latin1()); 
    368368#endif 
    369369        QString s, rest; 
     
    435435 
    436436#ifdef GPG_DEBUG 
    437         printf("GPG Finished: "); 
     437        qDebug("### GPG Finished: "); 
    438438#endif 
    439439 
     
    443443                clean = false; 
    444444#ifdef GPG_DEBUG 
    445                 printf("bad exit.. crash?\n"); 
     445                qDebug("### bad exit.. crash?"); 
    446446#endif 
    447447        } 
     
    449449                exitStatus = d->proc->exitStatus(); 
    450450#ifdef GPG_DEBUG 
    451                 printf("exitStatus=%d\n", exitStatus); 
     451                qDebug("### exitStatus=%d", exitStatus); 
    452452#endif 
    453453        } 
     
    472472 
    473473#ifdef GPG_DEBUG 
    474         printf("stdout: [%s]\n", outstr.latin1()); 
    475         printf("stderr: [%s]\n", errstr.latin1()); 
     474        qDebug("### stdout: [%s]", outstr.latin1()); 
     475        qDebug("### stderr: [%s]", errstr.latin1()); 
    476476#endif 
    477477 
  • psi/trunk/src/tools/openpgp/gpgproc/gpgproc.cpp

    r11 r86  
    106106        if(!d->pipeAux.open()) { 
    107107#ifdef GPG_DEBUG 
    108                 printf("Error creating pipeAux\n"); 
     108                qDebug("### Error creating pipeAux"); 
    109109#endif 
    110110                closePipes(); 
     
    113113        if(!d->pipeCommand.open()) { 
    114114#ifdef GPG_DEBUG 
    115                 printf("Error creating pipeCommand\n"); 
     115                qDebug("### Error creating pipeCommand"); 
    116116#endif 
    117117                closePipes(); 
     
    120120        if(!d->pipeStatus.open()) { 
    121121#ifdef GPG_DEBUG 
    122                 printf("Error creating pipeStatus\n"); 
     122                qDebug("### Error creating pipeStatus"); 
    123123#endif 
    124124                closePipes(); 
     
    130130        if(!d->pipeAux.writeEnd().winDupHandle()) { 
    131131#ifdef GPG_DEBUG 
    132                 printf("Error dup'ing pipeAux\n"); 
     132                qDebug("### Error dup'ing pipeAux"); 
    133133#endif 
    134134                closePipes(); 
     
    137137        if(!d->pipeCommand.writeEnd().winDupHandle()) { 
    138138#ifdef GPG_DEBUG 
    139                 printf("Error dup'ing pipeCommand\n"); 
     139                qDebug("### Error dup'ing pipeCommand"); 
    140140#endif 
    141141                closePipes(); 
     
    144144        if(!d->pipeStatus.readEnd().winDupHandle()) { 
    145145#ifdef GPG_DEBUG 
    146                 printf("Error dup'ing pipeStatus\n"); 
     146                qDebug("### Error dup'ing pipeStatus"); 
    147147#endif 
    148148                closePipes(); 
     
    168168                QCString cs2 = buf.data(); 
    169169                if(cs != cs2) 
    170                         printf("Pipe test failed.\n"); 
     170                        qDebug("### Pipe test failed."); 
    171171                else 
    172                         printf("Pipe test succeeded.\n"); 
     172                        qDebug("### Pipe test succeeded."); 
    173173        }*/ 
    174174 
     
    180180 
    181181#ifdef GPG_DEBUG 
    182         printf("Pipe setup complete.\n"); 
     182        qDebug("### Pipe setup complete."); 
    183183#endif 
    184184 
     
    188188 
    189189        if(useExtra) { 
    190                 fullargs += "--enable-special-filenames"; 
    191  
    192190                fullargs += "--status-fd"; 
    193191                fullargs += d->pipeStatus.writeEnd().toString(); 
     
    197195        } 
    198196 
     197        bool seen_special_filenames = false;         
    199198        for(QStringList::ConstIterator it = args.begin(); it != args.end(); ++it) { 
    200199                const QString &a = (*it); 
    201                 if(a == "-&?") 
    202                         fullargs += (QString("-&") + d->pipeAux.readEnd().toString()); 
    203                 else 
     200                if(a == "-&?") { 
     201                        seen_special_filenames = true; 
     202                        fullargs += (QString("\"-&") + d->pipeAux.readEnd().toString() + "\""); 
     203                } else { 
    204204                        fullargs += a; 
    205         } 
     205                } 
     206        } 
     207        // insert --enable-special-filenames after --no-tty 
     208        if(seen_special_filenames) 
     209                fullargs.insert(fullargs.at(2), "--enable-special-filenames"); 
    206210 
    207211        // show full command 
    208212#ifdef GPG_DEBUG 
    209         printf("GPGProc: "); 
    210         for(QStringList::ConstIterator it2 = fullargs.begin(); it2 != fullargs.end(); ++it2) { 
    211                 printf("%s ", (*it2).latin1()); 
    212         } 
    213         printf("\n"); 
     213        qDebug("### GPGProc: %s", fullargs.join(" ").latin1()); 
    214214#endif 
    215215 
     
    223223        d->proc->setClosePipeList(plist); 
    224224#endif 
    225         /// @todo (dmik) 
    226         //  On Unix, it is done when SProcess is destructed. On OS/2 as well as on 
    227         //  Win32, SProcess is not used, but we use the same QPipe implelentation 
    228         //  on OS/2 as Unix does, so we need to use the similar technuque to close 
    229         //  them... Need to investigate this file (i.e. usage) in detail. 
    230225 
    231226        connect(d->proc, SIGNAL(readyReadStdout()), SLOT(proc_readyReadStdout())); 
     
    327322#endif 
    328323        processExited(); 
     324 
     325#if defined(Q_OS_OS2) 
     326        closePipes(); 
     327#endif 
    329328} 
    330329