Port to Visual Studio 2015
This commit is contained in:
@@ -148,7 +148,7 @@ void FileNode_GetCRC(FileNode *fileNode, char *filePath) {
|
||||
}
|
||||
|
||||
void FileNode_SaveNode(FileNode *fileNode, FILE *file) {
|
||||
short name_len;
|
||||
int name_len;
|
||||
|
||||
// Escribir nombre
|
||||
name_len = strlen(fileNode->name);
|
||||
@@ -412,7 +412,6 @@ FileNode *FileNode_Refresh(FileNode *fileNode, char *filePath) {
|
||||
// Comprobar si ha sido modificado
|
||||
FileTime fileTime;
|
||||
long long size;
|
||||
int crc;
|
||||
|
||||
// Marcar normal
|
||||
fileNode->estado = FileStatus_None;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "filenode.h"
|
||||
#include "filenodecmp.h"
|
||||
|
||||
int maxDeltaTime=4000;
|
||||
int maxDeltaTime = 4000;
|
||||
|
||||
#define QueueNode(queue,node) (queue)->next = node; (queue) = node;
|
||||
|
||||
@@ -291,7 +291,7 @@ void AccionFileNode_CheckPair(FileNode *fileNodeLeft, FileNode *fileNodeRight,
|
||||
// Directorios
|
||||
|
||||
// Preparar accion para el par de directorios
|
||||
if (abs(fileNodeLeft->fileTime - fileNodeRight->fileTime) <= maxDeltaTime) { // appoximadamente iguales
|
||||
if (abs((int)(fileNodeLeft->fileTime - fileNodeRight->fileTime)) <= maxDeltaTime) { // appoximadamente iguales
|
||||
if (fileNodeRight->estado == FileStatus_Deleted
|
||||
&& fileNodeLeft->estado == FileStatus_Deleted) {
|
||||
actionFileNodeNew->action = AccionFileCmp_Nothing;
|
||||
@@ -344,7 +344,7 @@ void AccionFileNode_CheckPair(FileNode *fileNodeLeft, FileNode *fileNodeRight,
|
||||
// Ficheros
|
||||
|
||||
// Preparar accion para el par de ficheros
|
||||
if (abs(fileNodeLeft->fileTime - fileNodeRight->fileTime) <= maxDeltaTime) { // appoximadamente iguales
|
||||
if (abs((int)(fileNodeLeft->fileTime - fileNodeRight->fileTime)) <= maxDeltaTime) { // appoximadamente iguales
|
||||
if (fileNodeRight->estado == FileStatus_Deleted
|
||||
&& fileNodeLeft->estado == FileStatus_Deleted) {
|
||||
actionFileNodeNew->action = AccionFileCmp_Nothing;
|
||||
@@ -445,7 +445,7 @@ void AccionFileNode_Copy(FileNode *fileNodeLeft, FileNode *fileNodeRight,
|
||||
if (fileNodeLeft->estado != FileStatus_Deleted) {
|
||||
AccionFileNode_CompareChilds(actionFileNodeNew,
|
||||
actionFileNodeQueue, AccionFileNode_Copy);
|
||||
if (abs(fileNodeLeft->fileTime - fileNodeRight->fileTime)
|
||||
if (abs((int)(fileNodeLeft->fileTime - fileNodeRight->fileTime))
|
||||
<= maxDeltaTime) { // appox. equal
|
||||
actionFileNodeNew->action = AccionFileCmp_Nothing;
|
||||
} else {
|
||||
@@ -460,7 +460,7 @@ void AccionFileNode_Copy(FileNode *fileNodeLeft, FileNode *fileNodeRight,
|
||||
}
|
||||
} else {
|
||||
if (fileNodeLeft->estado != FileStatus_Deleted) {
|
||||
if (abs(fileNodeLeft->fileTime - fileNodeRight->fileTime)
|
||||
if (abs((int)(fileNodeLeft->fileTime - fileNodeRight->fileTime))
|
||||
<= maxDeltaTime) { // appox. equal
|
||||
actionFileNodeNew->action = AccionFileCmp_Nothing;
|
||||
} else {
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
#include <stdio.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <utime.h>
|
||||
#include <time.h>
|
||||
#ifdef WIN32
|
||||
#define _WIN32_WINNT 0x0501
|
||||
#include <signal.h>
|
||||
#include <windows.h>
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#ifdef WIN32
|
||||
# include <direct.h>
|
||||
# define _WIN32_WINNT 0x0501
|
||||
# include <windows.h>
|
||||
# include <io.h>
|
||||
# include <stdio.h>
|
||||
# include <signal.h>
|
||||
# include <fcntl.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "util.h"
|
||||
#include "fileutil.h"
|
||||
|
||||
#ifdef WIN32
|
||||
@@ -242,7 +242,7 @@ void File_GetSizeAndTime(char *fileName, long long *size, FileTime *time) {
|
||||
|
||||
#ifdef WIN32
|
||||
int File_MakeDirectory(char *path) {
|
||||
return (_mkdir(path));
|
||||
return (CreateDirectory(path, NULL));
|
||||
}
|
||||
#else
|
||||
int File_MakeDirectory(char *path) {
|
||||
@@ -260,7 +260,6 @@ void File_IterateDir(char *path,
|
||||
int fin = 0;
|
||||
int findnext_rc;
|
||||
char path_aux[MaxPath];
|
||||
char *ptr;
|
||||
|
||||
snprintf(path_aux, MaxPath, "%s/*", path);
|
||||
handle = _findfirst(path_aux, &fileinfo);
|
||||
@@ -312,11 +311,19 @@ void File_IterateDir(char *path,
|
||||
#endif
|
||||
|
||||
void File_Delete(char *path) {
|
||||
#ifdef WIN32
|
||||
remove(path);
|
||||
#else
|
||||
unlink(path);
|
||||
#endif
|
||||
}
|
||||
|
||||
void File_DeleteDirectory(char *path) {
|
||||
rmdir(path);
|
||||
void File_DeleteDirectory(char *path) {
|
||||
#ifndef WIN32
|
||||
rmdir(path);
|
||||
#else
|
||||
_rmdir(path);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define MaxBuffer 16384
|
||||
|
||||
@@ -31,6 +31,7 @@ void Help(char *exe) {
|
||||
|
||||
FileNode *CheckDir(char *path, int recheck);
|
||||
int Sync(char *pathLeft, char *pathRight, int recheck, int dryRun);
|
||||
int Copy(char *pathLeft, char *pathRight, int reCheck, int dryRun);
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc < 2) {
|
||||
@@ -86,7 +87,6 @@ int main(int argc, char *argv[]) {
|
||||
} else if (!strcmp(argv[1], "dir") && argc == 3) {
|
||||
// Leer informacion de dir
|
||||
char *path = argv[2];
|
||||
char dirNodesFile[MaxPath];
|
||||
FileNode *fileNode;
|
||||
|
||||
fileNode = CheckDir(path, 1);
|
||||
|
||||
@@ -43,7 +43,7 @@ void Time_Pause(int pausa){
|
||||
do{
|
||||
diff=tend-t;
|
||||
if(diff>1000){
|
||||
Sleep(diff/1000);
|
||||
Sleep((int)diff/1000);
|
||||
}else{
|
||||
Sleep(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user