VirtualBox

Changeset 39905 in vbox for trunk/src/VBox/Main/src-client


Ignore:
Timestamp:
Jan 30, 2012 12:41:49 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
75975
Message:

GuestCtrl/Main: Fixed another typo (return value), fixed handling of 0-byte files from host.

Location:
trunk/src/VBox/Main/src-client
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/GuestCtrlImplDir.cpp

    r39843 r39905  
    250250                break;
    251251
    252             case VERR_FILE_NOT_FOUND:
     252            case VERR_PATH_NOT_FOUND:
    253253                *aExists = FALSE;
    254254                break;
     
    497497                const char *pszFsType = stdOut[0].GetString("ftype");
    498498                if (!pszFsType) /* Attribute missing? */
    499                      rc = VERR_NOT_FOUND;
     499                     rc = VERR_PATH_NOT_FOUND;
    500500                if (   RT_SUCCESS(rc)
    501501                    && strcmp(pszFsType, "d")) /* Directory? */
    502502                {
    503                      rc = VERR_FILE_NOT_FOUND;
     503                     rc = VERR_PATH_NOT_FOUND;
    504504                     /* This is not critical for Main, so don't set hr --
    505505                      * we will take care of rc then. */
  • trunk/src/VBox/Main/src-client/GuestCtrlImplTasks.cpp

    r39843 r39905  
    263263                        BOOL fCompleted = FALSE;
    264264                        BOOL fCanceled = FALSE;
    265 
    266                         size_t cbToRead = cbSize;
    267265                        uint64_t cbTransferedTotal = 0;
    268 
    269                         size_t cbRead;
    270266
    271267                        SafeArray<BYTE> aInputData(_64K);
     
    273269                               && !fCompleted)
    274270                        {
    275                             /** @todo Not very efficient, but works for now. */
    276                             vrc = RTFileSeek(fileSource, cbTransferedTotal,
    277                                              RTFILE_SEEK_BEGIN, NULL /* poffActual */);
    278                             if (RT_SUCCESS(vrc))
    279                             {
    280                                 vrc = RTFileRead(fileSource, (uint8_t*)aInputData.raw(),
    281                                                  RT_MIN(cbToRead, _64K), &cbRead);
    282                                 /*
    283                                  * Some other error occured? There might be a chance that RTFileRead
    284                                  * could not resolve/map the native error code to an IPRT code, so just
    285                                  * print a generic error.
    286                                  */
    287                                 if (RT_FAILURE(vrc))
     271                            size_t cbToRead = cbSize;
     272                            size_t cbRead = 0;
     273                            if (cbSize) /* If we have nothing to read, take a shortcut. */
     274                            {
     275                                /** @todo Not very efficient, but works for now. */
     276                                vrc = RTFileSeek(fileSource, cbTransferedTotal,
     277                                                 RTFILE_SEEK_BEGIN, NULL /* poffActual */);
     278                                if (RT_SUCCESS(vrc))
     279                                {
     280                                    vrc = RTFileRead(fileSource, (uint8_t*)aInputData.raw(),
     281                                                     RT_MIN(cbToRead, _64K), &cbRead);
     282                                    /*
     283                                     * Some other error occured? There might be a chance that RTFileRead
     284                                     * could not resolve/map the native error code to an IPRT code, so just
     285                                     * print a generic error.
     286                                     */
     287                                    if (RT_FAILURE(vrc))
     288                                    {
     289                                        rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress,
     290                                                                             Guest::tr("Could not read from file \"%s\" (%Rrc)"),
     291                                                                             aTask->strSource.c_str(), vrc);
     292                                        break;
     293                                    }
     294                                }
     295                                else
    288296                                {
    289297                                    rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress,
    290                                                                          Guest::tr("Could not read from file \"%s\" (%Rrc)"),
    291                                                                          aTask->strSource.c_str(), vrc);
     298                                                                         Guest::tr("Seeking file \"%s\" failed; offset = %RU64 (%Rrc)"),
     299                                                                         aTask->strSource.c_str(), cbTransferedTotal, vrc);
    292300                                    break;
    293301                                }
    294                             }
    295                             else
    296                             {
    297                                 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress,
    298                                                                      Guest::tr("Seeking file \"%s\" failed; offset = %RU64 (%Rrc)"),
    299                                                                      aTask->strSource.c_str(), cbTransferedTotal, vrc);
    300                                 break;
    301302                            }
    302303                            /* Resize buffer to reflect amount we just have read.
     
    317318                            }
    318319
    319                             ULONG uBytesWritten;
     320                            ULONG uBytesWritten = 0;
    320321                            rc = pGuest->SetProcessInput(uPID, uFlags,
    321322                                                         0 /* Infinite timeout */,
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette