mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-26 12:59:23 -10:00
Bug 924839 - Remove a patch already part of ICU 52.1. See http://bugs.icu-project.org/trac/ticket/10283 but also note the relevant code was removed completely upstream. r=glandium * * * Bug 924839 - Remove another patch already part of ICU 52.1. See http://bugs.icu-project.org/trac/ticket/10290 for that. r=gaston * * * Bug 924839 - Remove another patch already in ICU 52.1. See http://bugs.icu-project.org/trac/ticket/10045 for more. r=Norbert * * * Bug 924839 - Remove another patch already applied upstream. See http://bugs.icu-project.org/trac/changeset/32937 for more. r=gaston * * * Bug 924839 - Update the ICU update script to update to 52.1, *without* applying any of our local patches. r=glandium * * * Bug 924839 - Make the ICU update script only do updating within intl/icu/source and nowhere else. r=glandium * * * Bug 924839 - Implement the changes that would be made by |cd intl/; ./update-icu.sh http://source.icu-project.org/repos/icu/icu/tags/release-52-1/;|, run with the prior changesets' changes made (thus not applying any of our local patches). These changes don't actually work without subsequent adjustments, but this provides a codebase upon which those adjustments can be made, for the purpose of generating local patches to be kept in intl/icu-patches/. rs=the-usual-suspects * * * Bug 924839 - Update the bug 899722 local patch to make runConfigureICU not override CC/CXX on BSD systems. r=gaston * * * Bug 924839 - Update the bug 724533 patch that makes ICU builds with MozillaBuild on Windows. r=glandium * * * Bug 924839 - Import an upstream patch fixing the genrb tool to properly handle the -R (--omitCollationRules) option. See http://bugs.icu-project.org/trac/ticket/10043 for the original bug report and a link to the ultimate upstream landing. r=Norbert * * * Bug 924839 - Import the upstream fix for http://bugs.icu-project.org/trac/ticket/10486 so that ICU with -DU_USING_ICU_NAMESPACE=0 will compile on Windows. r=Norbert * * * Bug 924839 - Adjust the update script to update ICU, then to apply all local patches (rather than skipping the second step). Thus if the update script is properly run, now, the final result should be no changes at all to the tree. NOT REVIEWED YET * * * Bug 924839 - Update jstests that depend on CLDR locale data to match CLDR 24. r=Norbert
135 lines
4.1 KiB
C++
135 lines
4.1 KiB
C++
/******************************************************************************
|
|
* Copyright (C) 2009-2013, International Business Machines
|
|
* Corporation and others. All Rights Reserved.
|
|
*******************************************************************************
|
|
*/
|
|
|
|
#if U_PLATFORM == U_PF_MINGW
|
|
// *cough* - for struct stat
|
|
#ifdef __STRICT_ANSI__
|
|
#undef __STRICT_ANSI__
|
|
#endif
|
|
#endif
|
|
|
|
#include "filetools.h"
|
|
#include "filestrm.h"
|
|
#include "cstring.h"
|
|
#include "unicode/putil.h"
|
|
#include "putilimp.h"
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <sys/stat.h>
|
|
#include <time.h>
|
|
#include <string.h>
|
|
|
|
#if U_HAVE_DIRENT_H
|
|
#include <dirent.h>
|
|
typedef struct dirent DIRENT;
|
|
|
|
#define MAX_PATH_SIZE 4096 /* Set the limit for the size of the path. */
|
|
|
|
#define SKIP1 "."
|
|
#define SKIP2 ".."
|
|
#endif
|
|
|
|
static int32_t whichFileModTimeIsLater(const char *file1, const char *file2);
|
|
|
|
/*
|
|
* Goes through the given directory recursive to compare each file's modification time with that of the file given.
|
|
* Also can be given just one file to check against. Default value for isDir is FALSE.
|
|
*/
|
|
U_CAPI UBool U_EXPORT2
|
|
isFileModTimeLater(const char *filePath, const char *checkAgainst, UBool isDir) {
|
|
UBool isLatest = TRUE;
|
|
|
|
if (filePath == NULL || checkAgainst == NULL) {
|
|
return FALSE;
|
|
}
|
|
|
|
if (isDir == TRUE) {
|
|
#if U_HAVE_DIRENT_H
|
|
DIR *pDir = NULL;
|
|
if ((pDir= opendir(checkAgainst)) != NULL) {
|
|
DIR *subDirp = NULL;
|
|
DIRENT *dirEntry = NULL;
|
|
|
|
while ((dirEntry = readdir(pDir)) != NULL) {
|
|
if (uprv_strcmp(dirEntry->d_name, SKIP1) != 0 && uprv_strcmp(dirEntry->d_name, SKIP2) != 0) {
|
|
char newpath[MAX_PATH_SIZE] = "";
|
|
uprv_strcpy(newpath, checkAgainst);
|
|
uprv_strcat(newpath, U_FILE_SEP_STRING);
|
|
uprv_strcat(newpath, dirEntry->d_name);
|
|
|
|
if ((subDirp = opendir(newpath)) != NULL) {
|
|
/* If this new path is a directory, make a recursive call with the newpath. */
|
|
closedir(subDirp);
|
|
isLatest = isFileModTimeLater(filePath, newpath, isDir);
|
|
if (!isLatest) {
|
|
break;
|
|
}
|
|
} else {
|
|
int32_t latest = whichFileModTimeIsLater(filePath, newpath);
|
|
if (latest < 0 || latest == 2) {
|
|
isLatest = FALSE;
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
closedir(pDir);
|
|
} else {
|
|
fprintf(stderr, "Unable to open directory: %s\n", checkAgainst);
|
|
return FALSE;
|
|
}
|
|
#endif
|
|
} else {
|
|
if (T_FileStream_file_exists(checkAgainst)) {
|
|
int32_t latest = whichFileModTimeIsLater(filePath, checkAgainst);
|
|
if (latest < 0 || latest == 2) {
|
|
isLatest = FALSE;
|
|
}
|
|
} else {
|
|
isLatest = FALSE;
|
|
}
|
|
}
|
|
|
|
return isLatest;
|
|
}
|
|
|
|
/* Compares the mod time of both files returning a number indicating which one is later. -1 if error ocurs. */
|
|
static int32_t whichFileModTimeIsLater(const char *file1, const char *file2) {
|
|
int32_t result = 0;
|
|
struct stat stbuf1, stbuf2;
|
|
|
|
if (stat(file1, &stbuf1) == 0 && stat(file2, &stbuf2) == 0) {
|
|
time_t modtime1, modtime2;
|
|
double diff;
|
|
|
|
modtime1 = stbuf1.st_mtime;
|
|
modtime2 = stbuf2.st_mtime;
|
|
|
|
diff = difftime(modtime1, modtime2);
|
|
if (diff < 0.0) {
|
|
result = 2;
|
|
} else if (diff > 0.0) {
|
|
result = 1;
|
|
}
|
|
|
|
} else {
|
|
fprintf(stderr, "Unable to get stats from file: %s or %s\n", file1, file2);
|
|
result = -1;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
/* Swap the file separater character given with the new one in the file path. */
|
|
U_CAPI void U_EXPORT2
|
|
swapFileSepChar(char *filePath, const char oldFileSepChar, const char newFileSepChar) {
|
|
for (int32_t i = 0, length = uprv_strlen(filePath); i < length; i++) {
|
|
filePath[i] = (filePath[i] == oldFileSepChar ) ? newFileSepChar : filePath[i];
|
|
}
|
|
}
|