Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
tools: add NOLINT (readability/null_usage)
  • Loading branch information
danbev committed Nov 29, 2017
commit f249747f16e1b94a968064b970b0533173cfd6f8
19 changes: 10 additions & 9 deletions tools/icu/iculslocs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,14 @@ int dumpAllButInstalledLocales(int lev,
int list(const char* toBundle) {
UErrorCode status = U_ZERO_ERROR;

FILE* bf = NULL;
FILE* bf = NULL; // NOLINT (readability/null_usage)

if (toBundle != NULL) {
if (toBundle != NULL) { // NOLINT (readability/null_usage)
if (VERBOSE) {
printf("writing to bundle %s\n", toBundle);
}
bf = fopen(toBundle, "wb");
if (bf == NULL) {
if (bf == NULL) { // NOLINT (readability/null_usage)
printf("ERROR: Could not open '%s' for writing.\n", toBundle);
return 1;
}
Expand All @@ -258,6 +258,7 @@ int list(const char* toBundle) {
ures_openDirect(packageName.data(), locale, &status));
ASSERT_SUCCESS(&status, "while opening the bundle");
LocalUResourceBundlePointer installedLocales(
// NOLINTNEXTLINE (readability/null_usage)
ures_getByKey(bund.getAlias(), INSTALLEDLOCALES, NULL, &status));
ASSERT_SUCCESS(&status, "while fetching installed locales");

Expand All @@ -266,7 +267,7 @@ int list(const char* toBundle) {
printf("Locales: %d\n", count);
}

if (bf != NULL) {
if (bf != NULL) { // NOLINT (readability/null_usage)
// write the HEADER
fprintf(bf,
"// Warning this file is automatically generated\n"
Expand Down Expand Up @@ -310,17 +311,17 @@ int list(const char* toBundle) {

UBool exists;
if (localeExists(key, &exists)) {
if (bf != NULL) fclose(bf);
if (bf != NULL) fclose(bf); // NOLINT (readability/null_usage)
return 1; // get out.
}
if (exists) {
validCount++;
printf("%s\n", key);
if (bf != NULL) {
if (bf != NULL) { // NOLINT (readability/null_usage)
fprintf(bf, " %s {\"\"}\n", key);
}
} else {
if (bf != NULL) {
if (bf != NULL) { // NOLINT (readability/null_usage)
fprintf(bf, "// %s {\"\"}\n", key);
}
if (VERBOSE) {
Expand All @@ -329,7 +330,7 @@ int list(const char* toBundle) {
}
}

if (bf != NULL) {
if (bf != NULL) { // NOLINT (readability/null_usage)
fprintf(bf, " } // %d/%d valid\n", validCount, count);
// write the HEADER
fprintf(bf, "}\n");
Expand Down Expand Up @@ -371,7 +372,7 @@ int main(int argc, const char* argv[]) {
usage();
return 0;
} else if (!strcmp(arg, "-l")) {
if (list(NULL)) {
if (list(NULL)) { // NOLINT (readability/null_usage)
return 1;
}
} else if (!strcmp(arg, "-b") && (argsLeft >= 1)) {
Expand Down