Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/toolkit/xre/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 2 kB image not shown  

Quelle  CreateAppData.cpp   Sprache: C

 
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


#include "nsXULAppAPI.h"
#include "nsINIParser.h"
#include "nsIFile.h"
#include "mozilla/XREAppData.h"

// This include must appear early in the unified cpp file for toolkit/xre to
// make sure OSX APIs make use of the OSX TextRange before mozilla::TextRange is
// declared and made a global symbol by a "using namespace mozilla" declaration.
#ifdef XP_MACOSX
#  include <Carbon/Carbon.h>
#endif

using namespace mozilla;

static void ReadString(nsINIParser& parser, const char* section,
                       const char* key, XREAppData::CharPtr& result) {
  nsCString str;
  nsresult rv = parser.GetString(section, key, str);
  if (NS_SUCCEEDED(rv)) {
    result = str.get();
  }
}

struct ReadFlag {
  const char* section;
  const char* key;
  uint32_t flag;
};

static void ReadFlag(nsINIParser& parser, const char* section, const char* key,
                     uint32_t flag, uint32_t& result) {
  char buf[6];  // large enough to hold "false"
  nsresult rv = parser.GetString(section, key, buf, sizeof(buf));
  if (NS_SUCCEEDED(rv) || rv == NS_ERROR_LOSS_OF_SIGNIFICANT_DATA) {
    if (buf[0] == '1' || buf[0] == 't' || buf[0] == 'T') {
      result |= flag;
    }
    if (buf[0] == '0' || buf[0] == 'f' || buf[0] == 'F') {
      result &= ~flag;
    }
  }
}

nsresult XRE_ParseAppData(nsIFile* aINIFile, XREAppData& aAppData) {
  NS_ENSURE_ARG(aINIFile);

  nsresult rv;

  nsINIParser parser;
  rv = parser.Init(aINIFile);
  if (NS_FAILED(rv)) return rv;

  ReadString(parser, "App""Vendor", aAppData.vendor);
  ReadString(parser, "App""Name", aAppData.name);
  ReadString(parser, "App""RemotingName", aAppData.remotingName);
  ReadString(parser, "App""Version", aAppData.version);
  ReadString(parser, "App""BuildID", aAppData.buildID);
  ReadString(parser, "App""ID", aAppData.ID);
  ReadString(parser, "App""Copyright", aAppData.copyright);
  ReadString(parser, "App""Profile", aAppData.profile);
  ReadString(parser, "Gecko""MinVersion", aAppData.minVersion);
  ReadString(parser, "Gecko""MaxVersion", aAppData.maxVersion);
  ReadString(parser, "Crash Reporter""ServerURL", aAppData.crashReporterURL);
  ReadString(parser, "App""UAName", aAppData.UAName);
  ReadString(parser, "AppUpdate""URL", aAppData.updateURL);
  ReadFlag(parser, "XRE""EnableProfileMigrator",
           NS_XRE_ENABLE_PROFILE_MIGRATOR, aAppData.flags);
  ReadFlag(parser, "Crash Reporter""Enabled", NS_XRE_ENABLE_CRASH_REPORTER,
           aAppData.flags);

  return NS_OK;
}

Messung V0.5
C=96 H=100 G=97

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.