Skip to content

Commit

Permalink
Remove a couple of compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Lejdborg committed Feb 17, 2012
1 parent d0740b6 commit ae45876
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions NMSSH.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ @implementation NMSSH
unsigned long hostaddr;
int sock;
struct sockaddr_in soin;
int rc;
long rc;

LIBSSH2_SESSION *session;
LIBSSH2_CHANNEL *channel;
Expand Down Expand Up @@ -131,7 +131,7 @@ - (BOOL)connect:(NSError **)error {
sock = socket(AF_INET, SOCK_STREAM, 0);
soin.sin_family = AF_INET;
soin.sin_port = htons([_port intValue]);
soin.sin_addr.s_addr = hostaddr;
soin.sin_addr.s_addr = (unsigned int)hostaddr;

// Connect to socket
if (connect(sock, (struct sockaddr*)(&soin),sizeof(struct sockaddr_in)) != 0) {
Expand Down Expand Up @@ -219,11 +219,11 @@ - (NSString *)execute:(NSString *)command error:(NSError **)error {
return nil;
}

while ( (rc = libssh2_channel_exec(channel, [command cStringUsingEncoding:NSUTF8StringEncoding])) == LIBSSH2_ERROR_EAGAIN ) {
while ((rc = libssh2_channel_exec(channel, [command cStringUsingEncoding:NSUTF8StringEncoding])) == LIBSSH2_ERROR_EAGAIN) {
waitsocket(sock, session);
}

if ( rc != 0 ) {
if (rc != 0) {
NSMutableDictionary *errorDetail = [NSMutableDictionary dictionary];
[errorDetail setValue:@"An error occured while executing command on remote server" forKey:NSLocalizedDescriptionKey];
*error = [NSError errorWithDomain:@"NMSSH" code:100 userInfo:errorDetail];
Expand All @@ -233,7 +233,7 @@ - (NSString *)execute:(NSString *)command error:(NSError **)error {

for ( ;; ) {
// Loop until we block
int rc1;
long rc1;
do {
char buffer[0x2000];
rc1 = libssh2_channel_read(channel, buffer, sizeof(buffer));
Expand Down Expand Up @@ -383,10 +383,10 @@ - (BOOL)downloadFile:(NSString *)remotePath to:(NSString *)localPath error:(NSEr
// libssh2_scp_recv() is done, now receive data
while (got < fileinfo.st_size) {
char mem[1024*24];
int rc;
long rc;

do {
int amount = sizeof(mem);
long long amount = sizeof(mem);

if ((fileinfo.st_size -got) < amount) {
amount = fileinfo.st_size - got;
Expand Down

0 comments on commit ae45876

Please sign in to comment.