Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor simplification in file_seek code. #391

Merged
merged 1 commit into from
Jan 10, 2017
Merged

Conversation

iphydf
Copy link
Member

@iphydf iphydf commented Jan 5, 2017

Details in comments.


This change is Reviewable

@GrayHatter
Copy link

Reviewed 1 of 1 files at r1.
Review status: all files reviewed at latest revision, 1 unresolved discussion, some commit checks failed.


toxcore/Messenger.c, line 1331 at r1 (raw file):

    }

    uint32_t temp_filenum;

Can we simplify this and remove some duplicated variables?


Comments from Reviewable

@Diadlo
Copy link

Diadlo commented Jan 6, 2017

Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


toxcore/Messenger.c, line 1331 at r1 (raw file):

Previously, GrayHatter (Gregory Mullen) wrote…

Can we simplify this and remove some duplicated variables?

Agree. We can change current filenumber instead of copying


toxcore/Messenger.c, line 1337 at r1 (raw file):

    } else {
        // Not receiving.
        return -4;

What about early break?

if (filenumber < (1 << 16)) {
    // Not receiving
    return -4
}

/* Suggestion:   s/temp_filenum/filenumber/ */
temp_filenum = (filenumber >> 16) - 1; 

Comments from Reviewable

@iphydf iphydf force-pushed the file-xfer-seek branch 2 times, most recently from beea508 to 5bc29bd Compare January 8, 2017 15:34
@iphydf
Copy link
Member Author

iphydf commented Jan 8, 2017

Review status: all files reviewed at latest revision, 2 unresolved discussions.


toxcore/Messenger.c, line 1331 at r1 (raw file):

Previously, Diadlo (Polshakov Dmitry) wrote…

Agree. We can change current filenumber instead of copying

It's not safe to do so.


toxcore/Messenger.c, line 1337 at r1 (raw file):

Previously, Diadlo (Polshakov Dmitry) wrote…

What about early break?

if (filenumber < (1 << 16)) {
    // Not receiving
    return -4
}

/* Suggestion:   s/temp_filenum/filenumber/ */
temp_filenum = (filenumber >> 16) - 1; 

Done.


Comments from Reviewable

@GrayHatter
Copy link

:lgtm:


Reviewed 1 of 1 files at r2.
Review status: all files reviewed at latest revision, 2 unresolved discussions.


Comments from Reviewable

@Diadlo
Copy link

Diadlo commented Jan 9, 2017

:lgtm_strong:


Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@robinlinden
Copy link
Member

:lgtm_strong:


Reviewed 1 of 1 files at r2.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@iphydf iphydf merged commit 5c248e9 into TokTok:master Jan 10, 2017
@iphydf iphydf deleted the file-xfer-seek branch January 10, 2017 16:25
@nurupo
Copy link
Member

nurupo commented Jan 12, 2017

Huh, that's interesting dead code. Why did @irungentoo add the sending else branch in there if it never sends?

:lgtm_strong:


Comments from Reviewable

@iphydf iphydf added refactor Refactoring production code, eg. renaming a variable, not affecting semantics and removed code cleanup labels May 4, 2020
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Refactoring production code, eg. renaming a variable, not affecting semantics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants