Commit c4f27454 authored by Zhangyi Chen's avatar Zhangyi Chen

Remove butil/nix, butil/third_party/xdg_mime/ and related stuff

parent 1e2d716f
......@@ -34,15 +34,6 @@ BUTIL_SOURCES = \
src/butil/third_party/nspr/prtime.cc \
src/butil/third_party/symbolize/demangle.cc \
src/butil/third_party/symbolize/symbolize.cc \
src/butil/third_party/xdg_mime/xdgmime.c \
src/butil/third_party/xdg_mime/xdgmimealias.c \
src/butil/third_party/xdg_mime/xdgmimecache.c \
src/butil/third_party/xdg_mime/xdgmimeglob.c \
src/butil/third_party/xdg_mime/xdgmimeicon.c \
src/butil/third_party/xdg_mime/xdgmimeint.c \
src/butil/third_party/xdg_mime/xdgmimemagic.c \
src/butil/third_party/xdg_mime/xdgmimeparent.c \
src/butil/third_party/xdg_user_dirs/xdg_user_dir_lookup.cc \
src/butil/third_party/snappy/snappy-sinksource.cc \
src/butil/third_party/snappy/snappy-stubs-internal.cc \
src/butil/third_party/snappy/snappy.cc \
......
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "butil/nix/mime_util_xdg.h"
#include "butil/files/file_path.h"
#include "butil/lazy_instance.h"
#include "butil/synchronization/lock.h"
#include "butil/third_party/xdg_mime/xdgmime.h"
#include "butil/threading/thread_restrictions.h"
namespace butil {
namespace nix {
namespace {
// None of the XDG stuff is thread-safe, so serialize all access under
// this lock.
LazyInstance<Lock>::Leaky g_mime_util_xdg_lock = LAZY_INSTANCE_INITIALIZER;
} // namespace
std::string GetFileMimeType(const FilePath& filepath) {
if (filepath.empty())
return std::string();
ThreadRestrictions::AssertIOAllowed();
AutoLock scoped_lock(g_mime_util_xdg_lock.Get());
return xdg_mime_get_mime_type_from_file_name(filepath.value().c_str());
}
std::string GetDataMimeType(const std::string& data) {
ThreadRestrictions::AssertIOAllowed();
AutoLock scoped_lock(g_mime_util_xdg_lock.Get());
return xdg_mime_get_mime_type_for_data(data.data(), data.length(), NULL);
}
} // namespace nix
} // namespace butil
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_NIX_MIME_UTIL_XDG_H_
#define BASE_NIX_MIME_UTIL_XDG_H_
#include <string>
#include "butil/base_export.h"
#include "butil/build_config.h"
namespace butil {
class FilePath;
namespace nix {
// Gets the mime type for a file based on its filename. The file path does not
// have to exist. Please note because it doesn't touch the disk, this does not
// work for directories.
// If the mime type is unknown, this will return application/octet-stream.
BASE_EXPORT std::string GetFileMimeType(const FilePath& filepath);
// Get the mime type for a byte vector.
BASE_EXPORT std::string GetDataMimeType(const std::string& data);
} // namespace nix
} // namespace butil
#endif // BASE_NIX_MIME_UTIL_XDG_H_
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "butil/nix/xdg_util.h"
#include <string>
#include "butil/base_paths.h"
#include "butil/environment.h"
#include "butil/file_util.h"
#include "butil/files/file_path.h"
#include "butil/path_service.h"
#include "butil/third_party/xdg_user_dirs/xdg_user_dir_lookup.h"
namespace {
// The KDE session version environment variable used in KDE 4.
const char kKDE4SessionEnvVar[] = "KDE_SESSION_VERSION";
} // namespace
namespace butil {
namespace nix {
const char kDotConfigDir[] = ".config";
const char kXdgConfigHomeEnvVar[] = "XDG_CONFIG_HOME";
FilePath GetXDGDirectory(Environment* env, const char* env_name,
const char* fallback_dir) {
FilePath path;
std::string env_value;
if (env->GetVar(env_name, &env_value) && !env_value.empty()) {
path = FilePath(env_value);
} else {
PathService::Get(butil::DIR_HOME, &path);
path = path.Append(fallback_dir);
}
return path.StripTrailingSeparators();
}
FilePath GetXDGUserDirectory(const char* dir_name, const char* fallback_dir) {
FilePath path;
char* xdg_dir = xdg_user_dir_lookup(dir_name);
if (xdg_dir) {
path = FilePath(xdg_dir);
free(xdg_dir);
} else {
PathService::Get(butil::DIR_HOME, &path);
path = path.Append(fallback_dir);
}
return path.StripTrailingSeparators();
}
DesktopEnvironment GetDesktopEnvironment(Environment* env) {
// XDG_CURRENT_DESKTOP is the newest standard circa 2012.
std::string xdg_current_desktop;
if (env->GetVar("XDG_CURRENT_DESKTOP", &xdg_current_desktop)) {
// Not all desktop environments set this env var as of this writing.
if (xdg_current_desktop == "Unity")
return DESKTOP_ENVIRONMENT_UNITY;
else if (xdg_current_desktop == "GNOME")
return DESKTOP_ENVIRONMENT_GNOME;
}
// DESKTOP_SESSION was what everyone used in 2010.
std::string desktop_session;
if (env->GetVar("DESKTOP_SESSION", &desktop_session)) {
if (desktop_session == "gnome") {
return DESKTOP_ENVIRONMENT_GNOME;
} else if (desktop_session == "kde4") {
return DESKTOP_ENVIRONMENT_KDE4;
} else if (desktop_session == "kde") {
// This may mean KDE4 on newer systems, so we have to check.
if (env->HasVar(kKDE4SessionEnvVar))
return DESKTOP_ENVIRONMENT_KDE4;
return DESKTOP_ENVIRONMENT_KDE3;
} else if (desktop_session.find("xfce") != std::string::npos ||
desktop_session == "xubuntu") {
return DESKTOP_ENVIRONMENT_XFCE;
}
}
// Fall back on some older environment variables.
// Useful particularly in the DESKTOP_SESSION=default case.
if (env->HasVar("GNOME_DESKTOP_SESSION_ID")) {
return DESKTOP_ENVIRONMENT_GNOME;
} else if (env->HasVar("KDE_FULL_SESSION")) {
if (env->HasVar(kKDE4SessionEnvVar))
return DESKTOP_ENVIRONMENT_KDE4;
return DESKTOP_ENVIRONMENT_KDE3;
}
return DESKTOP_ENVIRONMENT_OTHER;
}
const char* GetDesktopEnvironmentName(DesktopEnvironment env) {
switch (env) {
case DESKTOP_ENVIRONMENT_OTHER:
return NULL;
case DESKTOP_ENVIRONMENT_GNOME:
return "GNOME";
case DESKTOP_ENVIRONMENT_KDE3:
return "KDE3";
case DESKTOP_ENVIRONMENT_KDE4:
return "KDE4";
case DESKTOP_ENVIRONMENT_UNITY:
return "UNITY";
case DESKTOP_ENVIRONMENT_XFCE:
return "XFCE";
}
return NULL;
}
const char* GetDesktopEnvironmentName(Environment* env) {
return GetDesktopEnvironmentName(GetDesktopEnvironment(env));
}
} // namespace nix
} // namespace butil
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_NIX_XDG_UTIL_H_
#define BASE_NIX_XDG_UTIL_H_
// XDG refers to http://en.wikipedia.org/wiki/Freedesktop.org .
// This file contains utilities found across free desktop environments.
//
// TODO(brettw) this file should be in app/x11, but is currently used by
// net. We should have a net API to allow the embedder to specify the behavior
// that it uses XDG for, and then move this file.
#include "butil/base_export.h"
#ifdef nix
#error asdf
#endif
namespace butil {
class Environment;
class FilePath;
namespace nix {
// The default XDG config directory name.
BASE_EXPORT extern const char kDotConfigDir[];
// The XDG config directory environment variable.
BASE_EXPORT extern const char kXdgConfigHomeEnvVar[];
// Utility function for getting XDG directories.
// |env_name| is the name of an environment variable that we want to use to get
// a directory path. |fallback_dir| is the directory relative to $HOME that we
// use if |env_name| cannot be found or is empty. |fallback_dir| may be NULL.
// Examples of |env_name| are XDG_CONFIG_HOME and XDG_DATA_HOME.
BASE_EXPORT FilePath GetXDGDirectory(Environment* env, const char* env_name,
const char* fallback_dir);
// Wrapper around xdg_user_dir_lookup() from src/butil/third_party/xdg-user-dirs
// This looks up "well known" user directories like the desktop and music
// folder. Examples of |dir_name| are DESKTOP and MUSIC.
BASE_EXPORT FilePath GetXDGUserDirectory(const char* dir_name,
const char* fallback_dir);
enum DesktopEnvironment {
DESKTOP_ENVIRONMENT_OTHER,
DESKTOP_ENVIRONMENT_GNOME,
// KDE3 and KDE4 are sufficiently different that we count
// them as two different desktop environments here.
DESKTOP_ENVIRONMENT_KDE3,
DESKTOP_ENVIRONMENT_KDE4,
DESKTOP_ENVIRONMENT_UNITY,
DESKTOP_ENVIRONMENT_XFCE,
};
// Return an entry from the DesktopEnvironment enum with a best guess
// of which desktop environment we're using. We use this to know when
// to attempt to use preferences from the desktop environment --
// proxy settings, password manager, etc.
BASE_EXPORT DesktopEnvironment GetDesktopEnvironment(Environment* env);
// Return a string representation of the given desktop environment.
// May return NULL in the case of DESKTOP_ENVIRONMENT_OTHER.
BASE_EXPORT const char* GetDesktopEnvironmentName(DesktopEnvironment env);
// Convenience wrapper that calls GetDesktopEnvironment() first.
BASE_EXPORT const char* GetDesktopEnvironmentName(Environment* env);
} // namespace nix
} // namespace butil
#endif // BASE_NIX_XDG_UTIL_H_
Licensed under the Academic Free License version 2.0 (below)
Or under the following terms:
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
--------------------------------------------------------------------------------
Academic Free License v. 2.0
--------------------------------------------------------------------------------
This Academic Free License (the "License") applies to any original work of
authorship (the "Original Work") whose owner (the "Licensor") has placed the
following notice immediately following the copyright notice for the Original
Work:
Licensed under the Academic Free License version 2.0
1) Grant of Copyright License. Licensor hereby grants You a world-wide,
royalty-free, non-exclusive, perpetual, sublicenseable license to do the
following:
a) to reproduce the Original Work in copies;
b) to prepare derivative works ("Derivative Works") based upon the Original
Work;
c) to distribute copies of the Original Work and Derivative Works to the
public;
d) to perform the Original Work publicly; and
e) to display the Original Work publicly.
2) Grant of Patent License. Licensor hereby grants You a world-wide,
royalty-free, non-exclusive, perpetual, sublicenseable license, under patent
claims owned or controlled by the Licensor that are embodied in the Original
Work as furnished by the Licensor, to make, use, sell and offer for sale the
Original Work and Derivative Works.
3) Grant of Source Code License. The term "Source Code" means the preferred
form of the Original Work for making modifications to it and all available
documentation describing how to modify the Original Work. Licensor hereby
agrees to provide a machine-readable copy of the Source Code of the Original
Work along with each copy of the Original Work that Licensor distributes.
Licensor reserves the right to satisfy this obligation by placing a
machine-readable copy of the Source Code in an information repository
reasonably calculated to permit inexpensive and convenient access by You for as
long as Licensor continues to distribute the Original Work, and by publishing
the address of that information repository in a notice immediately following
the copyright notice that applies to the Original Work.
4) Exclusions From License Grant. Neither the names of Licensor, nor the names
of any contributors to the Original Work, nor any of their trademarks or
service marks, may be used to endorse or promote products derived from this
Original Work without express prior written permission of the Licensor. Nothing
in this License shall be deemed to grant any rights to trademarks, copyrights,
patents, trade secrets or any other intellectual property of Licensor except as
expressly stated herein. No patent license is granted to make, use, sell or
offer to sell embodiments of any patent claims other than the licensed claims
defined in Section 2. No right is granted to the trademarks of Licensor even if
such marks are included in the Original Work. Nothing in this License shall be
interpreted to prohibit Licensor from licensing under different terms from this
License any Original Work that Licensor otherwise would have a right to
license.
5) This section intentionally omitted.
6) Attribution Rights. You must retain, in the Source Code of any Derivative
Works that You create, all copyright, patent or trademark notices from the
Source Code of the Original Work, as well as any notices of licensing and any
descriptive text identified therein as an "Attribution Notice." You must cause
the Source Code for any Derivative Works that You create to carry a prominent
Attribution Notice reasonably calculated to inform recipients that You have
modified the Original Work.
7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that
the copyright in and to the Original Work and the patent rights granted herein
by Licensor are owned by the Licensor or are sublicensed to You under the terms
of this License with the permission of the contributor(s) of those copyrights
and patent rights. Except as expressly stated in the immediately proceeding
sentence, the Original Work is provided under this License on an "AS IS" BASIS
and WITHOUT WARRANTY, either express or implied, including, without limitation,
the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU.
This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No
license to Original Work is granted hereunder except under this disclaimer.
8) Limitation of Liability. Under no circumstances and under no legal theory,
whether in tort (including negligence), contract, or otherwise, shall the
Licensor be liable to any person for any direct, indirect, special, incidental,
or consequential damages of any character arising as a result of this License
or the use of the Original Work including, without limitation, damages for loss
of goodwill, work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses. This limitation of liability shall not
apply to liability for death or personal injury resulting from Licensor's
negligence to the extent applicable law prohibits such limitation. Some
jurisdictions do not allow the exclusion or limitation of incidental or
consequential damages, so this exclusion and limitation may not apply to You.
9) Acceptance and Termination. If You distribute copies of the Original Work or
a Derivative Work, You must make a reasonable effort under the circumstances to
obtain the express assent of recipients to the terms of this License. Nothing
else but this License (or another written agreement between Licensor and You)
grants You permission to create Derivative Works based upon the Original Work
or to exercise any of the rights granted in Section 1 herein, and any attempt
to do so except under the terms of this License (or another written agreement
between Licensor and You) is expressly prohibited by U.S. copyright law, the
equivalent laws of other countries, and by international treaty. Therefore, by
exercising any of the rights granted to You in Section 1 herein, You indicate
Your acceptance of this License and all of its terms and conditions.
10) Termination for Patent Action. This License shall terminate automatically
and You may no longer exercise any of the rights granted to You by this License
as of the date You commence an action, including a cross-claim or counterclaim,
for patent infringement (i) against Licensor with respect to a patent
applicable to software or (ii) against any entity with respect to a patent
applicable to the Original Work (but excluding combinations of the Original
Work with other software or hardware).
11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this
License may be brought only in the courts of a jurisdiction wherein the
Licensor resides or in which Licensor conducts its primary business, and under
the laws of that jurisdiction excluding its conflict-of-law provisions. The
application of the United Nations Convention on Contracts for the International
Sale of Goods is expressly excluded. Any use of the Original Work outside the
scope of this License or after its termination shall be subject to the
requirements and penalties of the U.S. Copyright Act, 17 U.S.C. 101 et seq.,
the equivalent laws of other countries, and international treaty. This section
shall survive the termination of this License.
12) Attorneys Fees. In any action to enforce the terms of this License or
seeking damages relating thereto, the prevailing party shall be entitled to
recover its costs and expenses, including, without limitation, reasonable
attorneys' fees and costs incurred in connection with such action, including
any appeal of such action. This section shall survive the termination of this
License.
13) Miscellaneous. This License represents the complete agreement concerning
the subject matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent necessary to
make it enforceable.
14) Definition of "You" in This License. "You" throughout this License, whether
in upper or lower case, means an individual or a legal entity exercising rights
under, and complying with all of the terms of, this License. For legal
entities, "You" includes any entity that controls, is controlled by, or is
under common control with you. For purposes of this definition, "control" means
(i) the power, direct or indirect, to cause the direction or management of such
entity, whether by contract or otherwise, or (ii) ownership of fifty percent
(50%) or more of the outstanding shares, or (iii) beneficial ownership of such
entity.
15) Right to Use. You may use the Original Work in all ways not otherwise
restricted or conditioned by this License or by law, and Licensor promises not
to interfere with or be responsible for such uses by You.
This license is Copyright (C) 2003 Lawrence E. Rosen. All rights reserved.
Permission is hereby granted to copy and distribute this license without
modification. This license may not be modified without the express written
permission of its copyright owner.
This module is a simple module that parses the proposed MIME spec listed
at http://freedesktop.org/. It is currently targetted at version 0.12.
There are no formal releases planned for this module, and it is not
intended to be installed at this time. Rather, it is meant to be used
by other libraries or applications to add support for the MIME system.
It is dual-licensed under the terms of the GNU Lesser General Public
License, and the Academic Free License, version 2.0.
Name: xdg-mime
URL: http://freedesktop.org
License: Academic Free License version 2.0 or LGPL v2
The code in this directory is synced from:
git://anongit.freedesktop.org/xdg/xdgmime
@ 2cdd8d36d7930d5a594587286cb1949ff62f7027 on 2012/08/06.
In addition, we have the following patch(es):
- compile.patch: small tweaks to make the code compile.
- Added a LICENSE file.
--- a/xdgmimecache.c
+++ b/xdgmimecache.c
@@ -40,6 +40,8 @@
#include <netinet/in.h> /* for ntohl/ntohs */
+#define HAVE_MMAP 1
+
#ifdef HAVE_MMAP
#include <sys/mman.h>
#else
@@ -1000,5 +1002,3 @@
dump_glob_node (cache, offset + 20 * j, 0);
}
}
-
-
This diff is collapsed.
/* -*- mode: C; c-file-style: "gnu" -*- */
/* xdgmime.h: XDG Mime Spec mime resolver. Based on version 0.11 of the spec.
*
* More info can be found at http://www.freedesktop.org/standards/
*
* Copyright (C) 2003 Red Hat, Inc.
* Copyright (C) 2003 Jonathan Blandford <jrb@alum.mit.edu>
*
* Licensed under the Academic Free License version 2.0
* Or under the following terms:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __XDG_MIME_H__
#define __XDG_MIME_H__
#include <stdlib.h>
#include <sys/stat.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#ifdef XDG_PREFIX
#define XDG_ENTRY(func) _XDG_ENTRY2(XDG_PREFIX,func)
#define _XDG_ENTRY2(prefix,func) _XDG_ENTRY3(prefix,func)
#define _XDG_ENTRY3(prefix,func) prefix##_##func
#define XDG_RESERVED_ENTRY(func) _XDG_RESERVED_ENTRY2(XDG_PREFIX,func)
#define _XDG_RESERVED_ENTRY2(prefix,func) _XDG_RESERVED_ENTRY3(prefix,func)
#define _XDG_RESERVED_ENTRY3(prefix,func) _##prefix##_##func
#endif
typedef void (*XdgMimeCallback) (void *user_data);
typedef void (*XdgMimeDestroy) (void *user_data);
#ifdef XDG_PREFIX
#define xdg_mime_get_mime_type_for_data XDG_ENTRY(get_mime_type_for_data)
#define xdg_mime_get_mime_type_for_file XDG_ENTRY(get_mime_type_for_file)
#define xdg_mime_get_mime_type_from_file_name XDG_ENTRY(get_mime_type_from_file_name)
#define xdg_mime_get_mime_types_from_file_name XDG_ENTRY(get_mime_types_from_file_name)
#define xdg_mime_is_valid_mime_type XDG_ENTRY(is_valid_mime_type)
#define xdg_mime_mime_type_equal XDG_ENTRY(mime_type_equal)
#define xdg_mime_media_type_equal XDG_ENTRY(media_type_equal)
#define xdg_mime_mime_type_subclass XDG_ENTRY(mime_type_subclass)
#define xdg_mime_get_mime_parents XDG_ENTRY(get_mime_parents)
#define xdg_mime_list_mime_parents XDG_ENTRY(list_mime_parents)
#define xdg_mime_unalias_mime_type XDG_ENTRY(unalias_mime_type)
#define xdg_mime_get_max_buffer_extents XDG_ENTRY(get_max_buffer_extents)
#define xdg_mime_shutdown XDG_ENTRY(shutdown)
#define xdg_mime_dump XDG_ENTRY(dump)
#define xdg_mime_register_reload_callback XDG_ENTRY(register_reload_callback)
#define xdg_mime_remove_callback XDG_ENTRY(remove_callback)
#define xdg_mime_type_unknown XDG_ENTRY(type_unknown)
#define xdg_mime_type_empty XDG_ENTRY(type_empty)
#define xdg_mime_type_textplain XDG_ENTRY(type_textplain)
#define xdg_mime_get_icon XDG_ENTRY(get_icon)
#define xdg_mime_get_generic_icon XDG_ENTRY(get_generic_icon)
#define _xdg_mime_mime_type_equal XDG_RESERVED_ENTRY(mime_type_equal)
#define _xdg_mime_mime_type_subclass XDG_RESERVED_ENTRY(mime_type_subclass)
#define _xdg_mime_unalias_mime_type XDG_RESERVED_ENTRY(unalias_mime_type)
#endif
extern const char xdg_mime_type_unknown[];
extern const char xdg_mime_type_empty[];
extern const char xdg_mime_type_textplain[];
#define XDG_MIME_TYPE_UNKNOWN xdg_mime_type_unknown
#define XDG_MIME_TYPE_EMPTY xdg_mime_type_empty
#define XDG_MIME_TYPE_TEXTPLAIN xdg_mime_type_textplain
const char *xdg_mime_get_mime_type_for_data (const void *data,
size_t len,
int *result_prio);
const char *xdg_mime_get_mime_type_for_file (const char *file_name,
struct stat *statbuf);
const char *xdg_mime_get_mime_type_from_file_name (const char *file_name);
int xdg_mime_get_mime_types_from_file_name(const char *file_name,
const char *mime_types[],
int n_mime_types);
int xdg_mime_is_valid_mime_type (const char *mime_type);
int xdg_mime_mime_type_equal (const char *mime_a,
const char *mime_b);
int xdg_mime_media_type_equal (const char *mime_a,
const char *mime_b);
int xdg_mime_mime_type_subclass (const char *mime_a,
const char *mime_b);
/* xdg_mime_get_mime_parents() is deprecated since it does
* not work correctly with caches. Use xdg_mime_list_parents()
* instead, but notice that that function expects you to free
* the array it returns.
*/
const char **xdg_mime_get_mime_parents (const char *mime);
char ** xdg_mime_list_mime_parents (const char *mime);
const char *xdg_mime_unalias_mime_type (const char *mime);
const char *xdg_mime_get_icon (const char *mime);
const char *xdg_mime_get_generic_icon (const char *mime);
int xdg_mime_get_max_buffer_extents (void);
void xdg_mime_shutdown (void);
void xdg_mime_dump (void);
int xdg_mime_register_reload_callback (XdgMimeCallback callback,
void *data,
XdgMimeDestroy destroy);
void xdg_mime_remove_callback (int callback_id);
/* Private versions of functions that don't call xdg_mime_init () */
int _xdg_mime_mime_type_equal (const char *mime_a,
const char *mime_b);
int _xdg_mime_mime_type_subclass (const char *mime,
const char *base);
const char *_xdg_mime_unalias_mime_type (const char *mime);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __XDG_MIME_H__ */
/* -*- mode: C; c-file-style: "gnu" -*- */
/* xdgmimealias.c: Private file. Datastructure for storing the aliases.
*
* More info can be found at http://www.freedesktop.org/standards/
*
* Copyright (C) 2004 Red Hat, Inc.
* Copyright (C) 2004 Matthias Clasen <mclasen@redhat.com>
*
* Licensed under the Academic Free License version 2.0
* Or under the following terms:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "xdgmimealias.h"
#include "xdgmimeint.h"
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <fnmatch.h>
#ifndef FALSE
#define FALSE (0)
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif
typedef struct XdgAlias XdgAlias;
struct XdgAlias
{
char *alias;
char *mime_type;
};
struct XdgAliasList
{
struct XdgAlias *aliases;
int n_aliases;
};
XdgAliasList *
_xdg_mime_alias_list_new (void)
{
XdgAliasList *list;
list = malloc (sizeof (XdgAliasList));
list->aliases = NULL;
list->n_aliases = 0;
return list;
}
void
_xdg_mime_alias_list_free (XdgAliasList *list)
{
int i;
if (list->aliases)
{
for (i = 0; i < list->n_aliases; i++)
{
free (list->aliases[i].alias);
free (list->aliases[i].mime_type);
}
free (list->aliases);
}
free (list);
}
static int
alias_entry_cmp (const void *v1, const void *v2)
{
return strcmp (((XdgAlias *)v1)->alias, ((XdgAlias *)v2)->alias);
}
const char *
_xdg_mime_alias_list_lookup (XdgAliasList *list,
const char *alias)
{
XdgAlias *entry;
XdgAlias key;
if (list->n_aliases > 0)
{
key.alias = (char *)alias;
key.mime_type = NULL;
entry = bsearch (&key, list->aliases, list->n_aliases,
sizeof (XdgAlias), alias_entry_cmp);
if (entry)
return entry->mime_type;
}
return NULL;
}
void
_xdg_mime_alias_read_from_file (XdgAliasList *list,
const char *file_name)
{
FILE *file;
char line[255];
int alloc;
file = fopen (file_name, "r");
if (file == NULL)
return;
/* FIXME: Not UTF-8 safe. Doesn't work if lines are greater than 255 chars.
* Blah */
alloc = list->n_aliases + 16;
list->aliases = realloc (list->aliases, alloc * sizeof (XdgAlias));
while (fgets (line, 255, file) != NULL)
{
char *sep;
if (line[0] == '#')
continue;
sep = strchr (line, ' ');
if (sep == NULL)
continue;
*(sep++) = '\000';
sep[strlen (sep) -1] = '\000';
if (list->n_aliases == alloc)
{
alloc <<= 1;
list->aliases = realloc (list->aliases,
alloc * sizeof (XdgAlias));
}
list->aliases[list->n_aliases].alias = strdup (line);
list->aliases[list->n_aliases].mime_type = strdup (sep);
list->n_aliases++;
}
list->aliases = realloc (list->aliases,
list->n_aliases * sizeof (XdgAlias));
fclose (file);
if (list->n_aliases > 1)
qsort (list->aliases, list->n_aliases,
sizeof (XdgAlias), alias_entry_cmp);
}
void
_xdg_mime_alias_list_dump (XdgAliasList *list)
{
int i;
if (list->aliases)
{
for (i = 0; i < list->n_aliases; i++)
{
printf ("%s %s\n",
list->aliases[i].alias,
list->aliases[i].mime_type);
}
}
}
/* -*- mode: C; c-file-style: "gnu" -*- */
/* xdgmimealias.h: Private file. Datastructure for storing the aliases.
*
* More info can be found at http://www.freedesktop.org/standards/
*
* Copyright (C) 2004 Red Hat, Inc.
* Copyright (C) 200 Matthias Clasen <mclasen@redhat.com>
*
* Licensed under the Academic Free License version 2.0
* Or under the following terms:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __XDG_MIME_ALIAS_H__
#define __XDG_MIME_ALIAS_H__
#include "xdgmime.h"
typedef struct XdgAliasList XdgAliasList;
#ifdef XDG_PREFIX
#define _xdg_mime_alias_read_from_file XDG_RESERVED_ENTRY(alias_read_from_file)
#define _xdg_mime_alias_list_new XDG_RESERVED_ENTRY(alias_list_new)
#define _xdg_mime_alias_list_free XDG_RESERVED_ENTRY(alias_list_free)
#define _xdg_mime_alias_list_lookup XDG_RESERVED_ENTRY(alias_list_lookup)
#define _xdg_mime_alias_list_dump XDG_RESERVED_ENTRY(alias_list_dump)
#endif
void _xdg_mime_alias_read_from_file (XdgAliasList *list,
const char *file_name);
XdgAliasList *_xdg_mime_alias_list_new (void);
void _xdg_mime_alias_list_free (XdgAliasList *list);
const char *_xdg_mime_alias_list_lookup (XdgAliasList *list,
const char *alias);
void _xdg_mime_alias_list_dump (XdgAliasList *list);
#endif /* __XDG_MIME_ALIAS_H__ */
This diff is collapsed.
/* -*- mode: C; c-file-style: "gnu" -*- */
/* xdgmimecache.h: Private file. Datastructure for mmapped caches.
*
* More info can be found at http://www.freedesktop.org/standards/
*
* Copyright (C) 2005 Matthias Clasen <mclasen@redhat.com>
*
* Licensed under the Academic Free License version 2.0
* Or under the following terms:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __XDG_MIME_CACHE_H__
#define __XDG_MIME_CACHE_H__
#include "xdgmime.h"
typedef struct _XdgMimeCache XdgMimeCache;
#ifdef XDG_PREFIX
#define _xdg_mime_cache_new_from_file XDG_RESERVED_ENTRY(cache_new_from_file)
#define _xdg_mime_cache_ref XDG_RESERVED_ENTRY(cache_ref)
#define _xdg_mime_cache_unref XDG_RESERVED_ENTRY(cache_unref)
#define _xdg_mime_cache_get_max_buffer_extents XDG_RESERVED_ENTRY(cache_get_max_buffer_extents)
#define _xdg_mime_cache_get_mime_type_for_data XDG_RESERVED_ENTRY(cache_get_mime_type_for_data)
#define _xdg_mime_cache_get_mime_type_for_file XDG_RESERVED_ENTRY(cache_get_mime_type_for_file)
#define _xdg_mime_cache_get_mime_type_from_file_name XDG_RESERVED_ENTRY(cache_get_mime_type_from_file_name)
#define _xdg_mime_cache_get_mime_types_from_file_name XDG_RESERVED_ENTRY(cache_get_mime_types_from_file_name)
#define _xdg_mime_cache_list_mime_parents XDG_RESERVED_ENTRY(cache_list_mime_parents)
#define _xdg_mime_cache_mime_type_subclass XDG_RESERVED_ENTRY(cache_mime_type_subclass)
#define _xdg_mime_cache_unalias_mime_type XDG_RESERVED_ENTRY(cache_unalias_mime_type)
#define _xdg_mime_cache_get_icon XDG_RESERVED_ENTRY(cache_get_icon)
#define _xdg_mime_cache_get_generic_icon XDG_RESERVED_ENTRY(cache_get_generic_icon)
#define _xdg_mime_cache_glob_dump XDG_RESERVED_ENTRY(cache_glob_dump)
#endif
extern XdgMimeCache **_caches;
XdgMimeCache *_xdg_mime_cache_new_from_file (const char *file_name);
XdgMimeCache *_xdg_mime_cache_ref (XdgMimeCache *cache);
void _xdg_mime_cache_unref (XdgMimeCache *cache);
const char *_xdg_mime_cache_get_mime_type_for_data (const void *data,
size_t len,
int *result_prio);
const char *_xdg_mime_cache_get_mime_type_for_file (const char *file_name,
struct stat *statbuf);
int _xdg_mime_cache_get_mime_types_from_file_name (const char *file_name,
const char *mime_types[],
int n_mime_types);
const char *_xdg_mime_cache_get_mime_type_from_file_name (const char *file_name);
int _xdg_mime_cache_is_valid_mime_type (const char *mime_type);
int _xdg_mime_cache_mime_type_equal (const char *mime_a,
const char *mime_b);
int _xdg_mime_cache_media_type_equal (const char *mime_a,
const char *mime_b);
int _xdg_mime_cache_mime_type_subclass (const char *mime_a,
const char *mime_b);
char **_xdg_mime_cache_list_mime_parents (const char *mime);
const char *_xdg_mime_cache_unalias_mime_type (const char *mime);
int _xdg_mime_cache_get_max_buffer_extents (void);
const char *_xdg_mime_cache_get_icon (const char *mime);
const char *_xdg_mime_cache_get_generic_icon (const char *mime);
void _xdg_mime_cache_glob_dump (void);
#endif /* __XDG_MIME_CACHE_H__ */
This diff is collapsed.
/* -*- mode: C; c-file-style: "gnu" -*- */
/* xdgmimeglob.h: Private file. Datastructure for storing the globs.
*
* More info can be found at http://www.freedesktop.org/standards/
*
* Copyright (C) 2003 Red Hat, Inc.
* Copyright (C) 2003 Jonathan Blandford <jrb@alum.mit.edu>
*
* Licensed under the Academic Free License version 2.0
* Or under the following terms:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __XDG_MIME_GLOB_H__
#define __XDG_MIME_GLOB_H__
#include "xdgmime.h"
typedef struct XdgGlobHash XdgGlobHash;
typedef enum
{
XDG_GLOB_LITERAL, /* Makefile */
XDG_GLOB_SIMPLE, /* *.gif */
XDG_GLOB_FULL /* x*.[ch] */
} XdgGlobType;
#ifdef XDG_PREFIX
#define _xdg_mime_glob_read_from_file XDG_RESERVED_ENTRY(glob_read_from_file)
#define _xdg_glob_hash_new XDG_RESERVED_ENTRY(hash_new)
#define _xdg_glob_hash_free XDG_RESERVED_ENTRY(hash_free)
#define _xdg_glob_hash_lookup_file_name XDG_RESERVED_ENTRY(hash_lookup_file_name)
#define _xdg_glob_hash_append_glob XDG_RESERVED_ENTRY(hash_append_glob)
#define _xdg_glob_determine_type XDG_RESERVED_ENTRY(determine_type)
#define _xdg_glob_hash_dump XDG_RESERVED_ENTRY(hash_dump)
#endif
void _xdg_mime_glob_read_from_file (XdgGlobHash *glob_hash,
const char *file_name,
int version_two);
XdgGlobHash *_xdg_glob_hash_new (void);
void _xdg_glob_hash_free (XdgGlobHash *glob_hash);
int _xdg_glob_hash_lookup_file_name (XdgGlobHash *glob_hash,
const char *text,
const char *mime_types[],
int n_mime_types);
void _xdg_glob_hash_append_glob (XdgGlobHash *glob_hash,
const char *glob,
const char *mime_type,
int weight,
int case_sensitive);
XdgGlobType _xdg_glob_determine_type (const char *glob);
void _xdg_glob_hash_dump (XdgGlobHash *glob_hash);
#endif /* __XDG_MIME_GLOB_H__ */
/* -*- mode: C; c-file-style: "gnu" -*- */
/* xdgmimeicon.c: Private file. Datastructure for storing the aliases.
*
* More info can be found at http://www.freedesktop.org/standards/
*
* Copyright (C) 2008 Red Hat, Inc.
*
* Licensed under the Academic Free License version 2.0
* Or under the following terms:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "xdgmimeicon.h"
#include "xdgmimeint.h"
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <fnmatch.h>
#ifndef FALSE
#define FALSE (0)
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif
typedef struct XdgIcon XdgIcon;
struct XdgIcon
{
char *mime_type;
char *icon_name;
};
struct XdgIconList
{
struct XdgIcon *icons;
int n_icons;
};
XdgIconList *
_xdg_mime_icon_list_new (void)
{
XdgIconList *list;
list = malloc (sizeof (XdgIconList));
list->icons = NULL;
list->n_icons = 0;
return list;
}
void
_xdg_mime_icon_list_free (XdgIconList *list)
{
int i;
if (list->icons)
{
for (i = 0; i < list->n_icons; i++)
{
free (list->icons[i].mime_type);
free (list->icons[i].icon_name);
}
free (list->icons);
}
free (list);
}
static int
icon_entry_cmp (const void *v1, const void *v2)
{
return strcmp (((XdgIcon *)v1)->mime_type, ((XdgIcon *)v2)->mime_type);
}
const char *
_xdg_mime_icon_list_lookup (XdgIconList *list,
const char *mime_type)
{
XdgIcon *entry;
XdgIcon key;
if (list->n_icons > 0)
{
key.mime_type = (char *)mime_type;
key.icon_name = NULL;
entry = bsearch (&key, list->icons, list->n_icons,
sizeof (XdgIcon), icon_entry_cmp);
if (entry)
return entry->icon_name;
}
return NULL;
}
void
_xdg_mime_icon_read_from_file (XdgIconList *list,
const char *file_name)
{
FILE *file;
char line[255];
int alloc;
file = fopen (file_name, "r");
if (file == NULL)
return;
/* FIXME: Not UTF-8 safe. Doesn't work if lines are greater than 255 chars.
* Blah */
alloc = list->n_icons + 16;
list->icons = realloc (list->icons, alloc * sizeof (XdgIcon));
while (fgets (line, 255, file) != NULL)
{
char *sep;
if (line[0] == '#')
continue;
sep = strchr (line, ':');
if (sep == NULL)
continue;
*(sep++) = '\000';
sep[strlen (sep) -1] = '\000';
if (list->n_icons == alloc)
{
alloc <<= 1;
list->icons = realloc (list->icons,
alloc * sizeof (XdgIcon));
}
list->icons[list->n_icons].mime_type = strdup (line);
list->icons[list->n_icons].icon_name = strdup (sep);
list->n_icons++;
}
list->icons = realloc (list->icons,
list->n_icons * sizeof (XdgIcon));
fclose (file);
if (list->n_icons > 1)
qsort (list->icons, list->n_icons,
sizeof (XdgIcon), icon_entry_cmp);
}
void
_xdg_mime_icon_list_dump (XdgIconList *list)
{
int i;
if (list->icons)
{
for (i = 0; i < list->n_icons; i++)
{
printf ("%s %s\n",
list->icons[i].mime_type,
list->icons[i].icon_name);
}
}
}
/* -*- mode: C; c-file-style: "gnu" -*- */
/* xdgmimeicon.h: Private file. Datastructure for storing the aliases.
*
* More info can be found at http://www.freedesktop.org/standards/
*
* Copyright (C) 2008 Red Hat, Inc.
*
* Licensed under the Academic Free License version 2.0
* Or under the following terms:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __XDG_MIME_ICON_H__
#define __XDG_MIME_ICON_H__
#include "xdgmime.h"
typedef struct XdgIconList XdgIconList;
#ifdef XDG_PREFIX
#define _xdg_mime_icon_read_from_file XDG_ENTRY(icon_read_from_file)
#define _xdg_mime_icon_list_new XDG_ENTRY(icon_list_new)
#define _xdg_mime_icon_list_free XDG_ENTRY(icon_list_free)
#define _xdg_mime_icon_list_lookup XDG_ENTRY(icon_list_lookup)
#define _xdg_mime_icon_list_dump XDG_ENTRY(icon_list_dump)
#endif
void _xdg_mime_icon_read_from_file (XdgIconList *list,
const char *file_name);
XdgIconList *_xdg_mime_icon_list_new (void);
void _xdg_mime_icon_list_free (XdgIconList *list);
const char *_xdg_mime_icon_list_lookup (XdgIconList *list,
const char *mime);
void _xdg_mime_icon_list_dump (XdgIconList *list);
#endif /* __XDG_MIME_ICON_H__ */
/* -*- mode: C; c-file-style: "gnu" -*- */
/* xdgmimeint.c: Internal defines and functions.
*
* More info can be found at http://www.freedesktop.org/standards/
*
* Copyright (C) 2003 Red Hat, Inc.
* Copyright (C) 2003 Jonathan Blandford <jrb@alum.mit.edu>
*
* Licensed under the Academic Free License version 2.0
* Or under the following terms:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "xdgmimeint.h"
#include <ctype.h>
#include <string.h>
#ifndef FALSE
#define FALSE (0)
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif
static const char _xdg_utf8_skip_data[256] = {
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1
};
const char * const _xdg_utf8_skip = _xdg_utf8_skip_data;
/* Returns the number of unprocessed characters. */
xdg_unichar_t
_xdg_utf8_to_ucs4(const char *source)
{
xdg_unichar_t ucs32;
if( ! ( *source & 0x80 ) )
{
ucs32 = *source;
}
else
{
int bytelength = 0;
xdg_unichar_t result;
if ( ! (*source & 0x40) )
{
ucs32 = *source;
}
else
{
if ( ! (*source & 0x20) )
{
result = *source++ & 0x1F;
bytelength = 2;
}
else if ( ! (*source & 0x10) )
{
result = *source++ & 0x0F;
bytelength = 3;
}
else if ( ! (*source & 0x08) )
{
result = *source++ & 0x07;
bytelength = 4;
}
else if ( ! (*source & 0x04) )
{
result = *source++ & 0x03;
bytelength = 5;
}
else if ( ! (*source & 0x02) )
{
result = *source++ & 0x01;
bytelength = 6;
}
else
{
result = *source++;
bytelength = 1;
}
for ( bytelength --; bytelength > 0; bytelength -- )
{
result <<= 6;
result |= *source++ & 0x3F;
}
ucs32 = result;
}
}
return ucs32;
}
/* hullo. this is great code. don't rewrite it */
xdg_unichar_t
_xdg_ucs4_to_lower (xdg_unichar_t source)
{
/* FIXME: Do a real to_upper sometime */
/* CaseFolding-3.2.0.txt has a table of rules. */
if ((source & 0xFF) == source)
return (xdg_unichar_t) tolower ((unsigned char) source);
return source;
}
int
_xdg_utf8_validate (const char *source)
{
/* FIXME: actually write */
return TRUE;
}
const char *
_xdg_get_base_name (const char *file_name)
{
const char *base_name;
if (file_name == NULL)
return NULL;
base_name = strrchr (file_name, '/');
if (base_name == NULL)
return file_name;
else
return base_name + 1;
}
xdg_unichar_t *
_xdg_convert_to_ucs4 (const char *source, int *len)
{
xdg_unichar_t *out;
int i;
const char *p;
out = malloc (sizeof (xdg_unichar_t) * (strlen (source) + 1));
p = source;
i = 0;
while (*p)
{
out[i++] = _xdg_utf8_to_ucs4 (p);
p = _xdg_utf8_next_char (p);
}
out[i] = 0;
*len = i;
return out;
}
void
_xdg_reverse_ucs4 (xdg_unichar_t *source, int len)
{
xdg_unichar_t c;
int i;
for (i = 0; i < len - i - 1; i++)
{
c = source[i];
source[i] = source[len - i - 1];
source[len - i - 1] = c;
}
}
const char *
_xdg_binary_or_text_fallback(const void *data, size_t len)
{
unsigned char *chardata;
size_t i;
chardata = (unsigned char *) data;
for (i = 0; i < 32 && i < len; ++i)
{
if (chardata[i] < 32 && chardata[i] != 9 && chardata[i] != 10 && chardata[i] != 13)
return XDG_MIME_TYPE_UNKNOWN; /* binary data */
}
return XDG_MIME_TYPE_TEXTPLAIN;
}
/* -*- mode: C; c-file-style: "gnu" -*- */
/* xdgmimeint.h: Internal defines and functions.
*
* More info can be found at http://www.freedesktop.org/standards/
*
* Copyright (C) 2003 Red Hat, Inc.
* Copyright (C) 2003 Jonathan Blandford <jrb@alum.mit.edu>
*
* Licensed under the Academic Free License version 2.0
* Or under the following terms:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __XDG_MIME_INT_H__
#define __XDG_MIME_INT_H__
#include "xdgmime.h"
#ifndef FALSE
#define FALSE (0)
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif
/* FIXME: Needs to be configure check */
typedef unsigned int xdg_unichar_t;
typedef unsigned char xdg_uchar8_t;
typedef unsigned short xdg_uint16_t;
typedef unsigned int xdg_uint32_t;
#ifdef XDG_PREFIX
#define _xdg_utf8_skip XDG_RESERVED_ENTRY(utf8_skip)
#define _xdg_utf8_to_ucs4 XDG_RESERVED_ENTRY(utf8_to_ucs4)
#define _xdg_ucs4_to_lower XDG_RESERVED_ENTRY(ucs4_to_lower)
#define _xdg_utf8_validate XDG_RESERVED_ENTRY(utf8_validate)
#define _xdg_get_base_name XDG_RESERVED_ENTRY(get_base_name)
#define _xdg_convert_to_ucs4 XDG_RESERVED_ENTRY(convert_to_ucs4)
#define _xdg_reverse_ucs4 XDG_RESERVED_ENTRY(reverse_ucs4)
#endif
#define SWAP_BE16_TO_LE16(val) (xdg_uint16_t)(((xdg_uint16_t)(val) << 8)|((xdg_uint16_t)(val) >> 8))
#define SWAP_BE32_TO_LE32(val) (xdg_uint32_t)((((xdg_uint32_t)(val) & 0xFF000000U) >> 24) | \
(((xdg_uint32_t)(val) & 0x00FF0000U) >> 8) | \
(((xdg_uint32_t)(val) & 0x0000FF00U) << 8) | \
(((xdg_uint32_t)(val) & 0x000000FFU) << 24))
/* UTF-8 utils
*/
extern const char *const _xdg_utf8_skip;
#define _xdg_utf8_next_char(p) (char *)((p) + _xdg_utf8_skip[*(unsigned char *)(p)])
#define _xdg_utf8_char_size(p) (int) (_xdg_utf8_skip[*(unsigned char *)(p)])
xdg_unichar_t _xdg_utf8_to_ucs4 (const char *source);
xdg_unichar_t _xdg_ucs4_to_lower (xdg_unichar_t source);
int _xdg_utf8_validate (const char *source);
xdg_unichar_t *_xdg_convert_to_ucs4 (const char *source, int *len);
void _xdg_reverse_ucs4 (xdg_unichar_t *source, int len);
const char *_xdg_get_base_name (const char *file_name);
const char *_xdg_binary_or_text_fallback(const void *data, size_t len);
#endif /* __XDG_MIME_INT_H__ */
This diff is collapsed.
/* -*- mode: C; c-file-style: "gnu" -*- */
/* xdgmimemagic.h: Private file. Datastructure for storing the magic files.
*
* More info can be found at http://www.freedesktop.org/standards/
*
* Copyright (C) 2003 Red Hat, Inc.
* Copyright (C) 2003 Jonathan Blandford <jrb@alum.mit.edu>
*
* Licensed under the Academic Free License version 2.0
* Or under the following terms:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __XDG_MIME_MAGIC_H__
#define __XDG_MIME_MAGIC_H__
#include <unistd.h>
#include "xdgmime.h"
typedef struct XdgMimeMagic XdgMimeMagic;
#ifdef XDG_PREFIX
#define _xdg_mime_glob_read_from_file XDG_RESERVED_ENTRY(glob_read_from_file)
#define _xdg_mime_magic_new XDG_RESERVED_ENTRY(magic_new)
#define _xdg_mime_magic_read_from_file XDG_RESERVED_ENTRY(magic_read_from_file)
#define _xdg_mime_magic_free XDG_RESERVED_ENTRY(magic_free)
#define _xdg_mime_magic_get_buffer_extents XDG_RESERVED_ENTRY(magic_get_buffer_extents)
#define _xdg_mime_magic_lookup_data XDG_RESERVED_ENTRY(magic_lookup_data)
#endif
XdgMimeMagic *_xdg_mime_magic_new (void);
void _xdg_mime_magic_read_from_file (XdgMimeMagic *mime_magic,
const char *file_name);
void _xdg_mime_magic_free (XdgMimeMagic *mime_magic);
int _xdg_mime_magic_get_buffer_extents (XdgMimeMagic *mime_magic);
const char *_xdg_mime_magic_lookup_data (XdgMimeMagic *mime_magic,
const void *data,
size_t len,
int *result_prio,
const char *mime_types[],
int n_mime_types);
#endif /* __XDG_MIME_MAGIC_H__ */
/* -*- mode: C; c-file-style: "gnu" -*- */
/* xdgmimealias.c: Private file. Datastructure for storing the hierarchy.
*
* More info can be found at http://www.freedesktop.org/standards/
*
* Copyright (C) 2004 Red Hat, Inc.
* Copyright (C) 2004 Matthias Clasen <mclasen@redhat.com>
*
* Licensed under the Academic Free License version 2.0
* Or under the following terms:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "xdgmimeparent.h"
#include "xdgmimeint.h"
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <fnmatch.h>
#ifndef FALSE
#define FALSE (0)
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif
typedef struct XdgMimeParents XdgMimeParents;
struct XdgMimeParents
{
char *mime;
char **parents;
int n_parents;
};
struct XdgParentList
{
struct XdgMimeParents *parents;
int n_mimes;
};
XdgParentList *
_xdg_mime_parent_list_new (void)
{
XdgParentList *list;
list = malloc (sizeof (XdgParentList));
list->parents = NULL;
list->n_mimes = 0;
return list;
}
void
_xdg_mime_parent_list_free (XdgParentList *list)
{
int i;
char **p;
if (list->parents)
{
for (i = 0; i < list->n_mimes; i++)
{
for (p = list->parents[i].parents; *p; p++)
free (*p);
free (list->parents[i].parents);
free (list->parents[i].mime);
}
free (list->parents);
}
free (list);
}
static int
parent_entry_cmp (const void *v1, const void *v2)
{
return strcmp (((XdgMimeParents *)v1)->mime, ((XdgMimeParents *)v2)->mime);
}
const char **
_xdg_mime_parent_list_lookup (XdgParentList *list,
const char *mime)
{
XdgMimeParents *entry;
XdgMimeParents key;
if (list->n_mimes > 0)
{
key.mime = (char *)mime;
key.parents = NULL;
entry = bsearch (&key, list->parents, list->n_mimes,
sizeof (XdgMimeParents), &parent_entry_cmp);
if (entry)
return (const char **)entry->parents;
}
return NULL;
}
void
_xdg_mime_parent_read_from_file (XdgParentList *list,
const char *file_name)
{
FILE *file;
char line[255];
int i, alloc;
XdgMimeParents *entry;
file = fopen (file_name, "r");
if (file == NULL)
return;
/* FIXME: Not UTF-8 safe. Doesn't work if lines are greater than 255 chars.
* Blah */
alloc = list->n_mimes + 16;
list->parents = realloc (list->parents, alloc * sizeof (XdgMimeParents));
while (fgets (line, 255, file) != NULL)
{
char *sep;
if (line[0] == '#')
continue;
sep = strchr (line, ' ');
if (sep == NULL)
continue;
*(sep++) = '\000';
sep[strlen (sep) -1] = '\000';
entry = NULL;
for (i = 0; i < list->n_mimes; i++)
{
if (strcmp (list->parents[i].mime, line) == 0)
{
entry = &(list->parents[i]);
break;
}
}
if (!entry)
{
if (list->n_mimes == alloc)
{
alloc <<= 1;
list->parents = realloc (list->parents,
alloc * sizeof (XdgMimeParents));
}
list->parents[list->n_mimes].mime = strdup (line);
list->parents[list->n_mimes].parents = NULL;
entry = &(list->parents[list->n_mimes]);
list->n_mimes++;
}
if (!entry->parents)
{
entry->n_parents = 1;
entry->parents = malloc ((entry->n_parents + 1) * sizeof (char *));
}
else
{
entry->n_parents += 1;
entry->parents = realloc (entry->parents,
(entry->n_parents + 2) * sizeof (char *));
}
entry->parents[entry->n_parents - 1] = strdup (sep);
entry->parents[entry->n_parents] = NULL;
}
list->parents = realloc (list->parents,
list->n_mimes * sizeof (XdgMimeParents));
fclose (file);
if (list->n_mimes > 1)
qsort (list->parents, list->n_mimes,
sizeof (XdgMimeParents), &parent_entry_cmp);
}
void
_xdg_mime_parent_list_dump (XdgParentList *list)
{
int i;
char **p;
if (list->parents)
{
for (i = 0; i < list->n_mimes; i++)
{
for (p = list->parents[i].parents; *p; p++)
printf ("%s %s\n", list->parents[i].mime, *p);
}
}
}
/* -*- mode: C; c-file-style: "gnu" -*- */
/* xdgmimeparent.h: Private file. Datastructure for storing the hierarchy.
*
* More info can be found at http://www.freedesktop.org/standards/
*
* Copyright (C) 2004 Red Hat, Inc.
* Copyright (C) 200 Matthias Clasen <mclasen@redhat.com>
*
* Licensed under the Academic Free License version 2.0
* Or under the following terms:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __XDG_MIME_PARENT_H__
#define __XDG_MIME_PARENT_H__
#include "xdgmime.h"
typedef struct XdgParentList XdgParentList;
#ifdef XDG_PREFIX
#define _xdg_mime_parent_read_from_file XDG_RESERVED_ENTRY(parent_read_from_file)
#define _xdg_mime_parent_list_new XDG_RESERVED_ENTRY(parent_list_new)
#define _xdg_mime_parent_list_free XDG_RESERVED_ENTRY(parent_list_free)
#define _xdg_mime_parent_list_lookup XDG_RESERVED_ENTRY(parent_list_lookup)
#define _xdg_mime_parent_list_dump XDG_RESERVED_ENTRY(parent_list_dump)
#endif
void _xdg_mime_parent_read_from_file (XdgParentList *list,
const char *file_name);
XdgParentList *_xdg_mime_parent_list_new (void);
void _xdg_mime_parent_list_free (XdgParentList *list);
const char **_xdg_mime_parent_list_lookup (XdgParentList *list,
const char *mime);
void _xdg_mime_parent_list_dump (XdgParentList *list);
#endif /* __XDG_MIME_PARENT_H__ */
Copyright (c) 2007 Red Hat, inc
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Name: xdg-user-dirs
URL: http://www.freedesktop.org/wiki/Software/xdg-user-dirs
License: MIT
This directory include xdg-user-dir-lookup.c renamed as xdg_user_dir_lookup.cc
from xdg-user-dirs 0.10. We made xdg_user_dir_lookup() non-static and added a
xdg_user_dir_lookup.h.
/*
This file is not licenced under the GPL like the rest of the code.
Its is under the MIT license, to encourage reuse by cut-and-paste.
Copyright (c) 2007 Red Hat, inc
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/**
* xdg_user_dir_lookup_with_fallback:
* @type: a string specifying the type of directory
* @fallback: value to use if the directory isn't specified by the user
* @returns: a newly allocated absolute pathname
*
* Looks up a XDG user directory of the specified type.
* Example of types are "DESKTOP" and "DOWNLOAD".
*
* In case the user hasn't specified any directory for the specified
* type the value returned is @fallback.
*
* The return value is newly allocated and must be freed with
* free(). The return value is never NULL if @fallback != NULL, unless
* out of memory.
**/
static char *
xdg_user_dir_lookup_with_fallback (const char *type, const char *fallback)
{
FILE *file;
char *home_dir, *config_home, *config_file;
char buffer[512];
char *user_dir;
char *p, *d;
int len;
int relative;
home_dir = getenv ("HOME");
if (home_dir == NULL)
goto error;
config_home = getenv ("XDG_CONFIG_HOME");
if (config_home == NULL || config_home[0] == 0)
{
config_file = (char*) malloc (strlen (home_dir) + strlen ("/.config/user-dirs.dirs") + 1);
if (config_file == NULL)
goto error;
strcpy (config_file, home_dir);
strcat (config_file, "/.config/user-dirs.dirs");
}
else
{
config_file = (char*) malloc (strlen (config_home) + strlen ("/user-dirs.dirs") + 1);
if (config_file == NULL)
goto error;
strcpy (config_file, config_home);
strcat (config_file, "/user-dirs.dirs");
}
file = fopen (config_file, "r");
free (config_file);
if (file == NULL)
goto error;
user_dir = NULL;
while (fgets (buffer, sizeof (buffer), file))
{
/* Remove newline at end */
len = strlen (buffer);
if (len > 0 && buffer[len-1] == '\n')
buffer[len-1] = 0;
p = buffer;
while (*p == ' ' || *p == '\t')
p++;
if (strncmp (p, "XDG_", 4) != 0)
continue;
p += 4;
if (strncmp (p, type, strlen (type)) != 0)
continue;
p += strlen (type);
if (strncmp (p, "_DIR", 4) != 0)
continue;
p += 4;
while (*p == ' ' || *p == '\t')
p++;
if (*p != '=')
continue;
p++;
while (*p == ' ' || *p == '\t')
p++;
if (*p != '"')
continue;
p++;
relative = 0;
if (strncmp (p, "$HOME/", 6) == 0)
{
p += 6;
relative = 1;
}
else if (*p != '/')
continue;
if (relative)
{
user_dir = (char*) malloc (strlen (home_dir) + 1 + strlen (p) + 1);
if (user_dir == NULL)
goto error2;
strcpy (user_dir, home_dir);
strcat (user_dir, "/");
}
else
{
user_dir = (char*) malloc (strlen (p) + 1);
if (user_dir == NULL)
goto error2;
*user_dir = 0;
}
d = user_dir + strlen (user_dir);
while (*p && *p != '"')
{
if ((*p == '\\') && (*(p+1) != 0))
p++;
*d++ = *p++;
}
*d = 0;
}
error2:
fclose (file);
if (user_dir)
return user_dir;
error:
if (fallback)
return strdup (fallback);
return NULL;
}
/**
* xdg_user_dir_lookup:
* @type: a string specifying the type of directory
* @returns: a newly allocated absolute pathname
*
* Looks up a XDG user directory of the specified type.
* Example of types are "DESKTOP" and "DOWNLOAD".
*
* The return value is always != NULL (unless out of memory),
* and if a directory
* for the type is not specified by the user the default
* is the home directory. Except for DESKTOP which defaults
* to ~/Desktop.
*
* The return value is newly allocated and must be freed with
* free().
**/
char *
xdg_user_dir_lookup (const char *type)
{
char *dir, *home_dir, *user_dir;
dir = xdg_user_dir_lookup_with_fallback (type, NULL);
if (dir != NULL)
return dir;
home_dir = getenv ("HOME");
if (home_dir == NULL)
return strdup ("/tmp");
/* Special case desktop for historical compatibility */
if (strcmp (type, "DESKTOP") == 0)
{
user_dir = (char*) malloc (strlen (home_dir) + strlen ("/Desktop") + 1);
if (user_dir == NULL)
return NULL;
strcpy (user_dir, home_dir);
strcat (user_dir, "/Desktop");
return user_dir;
}
return strdup (home_dir);
}
#ifdef STANDALONE_XDG_USER_DIR_LOOKUP
int
main (int argc, char *argv[])
{
if (argc != 2)
{
fprintf (stderr, "Usage %s <dir-type>\n", argv[0]);
exit (1);
}
printf ("%s\n", xdg_user_dir_lookup (argv[1]));
return 0;
}
#endif
/*
This file is not licenced under the GPL like the rest of the code.
Its is under the MIT license, to encourage reuse by cut-and-paste.
Copyright (c) 2007 Red Hat, inc
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef CHROME_THIRD_PARTY_XDG_USER_DIRS_XDG_USER_DIR_LOOKUP_H_
#define CHROME_THIRD_PARTY_XDG_USER_DIRS_XDG_USER_DIR_LOOKUP_H_
char* xdg_user_dir_lookup(const char *type);
#endif // CHROME_THIRD_PARTY_XDG_USER_DIRS_XDG_USER_DIR_LOOKUP_H_
......@@ -29,7 +29,6 @@
#include "butil/files/scoped_file.h"
#include "butil/files/scoped_temp_dir.h"
#include "butil/strings/utf_string_conversions.h"
#include "test/test_file_util.h"
#include "butil/threading/platform_thread.h"
#include <gtest/gtest.h>
#include <gtest/gtest.h>
......
......@@ -8,7 +8,6 @@
#include "butil/debug/stack_trace.h"
#include "butil/logging.h"
#include "test/test_timeouts.h"
#include <gtest/gtest.h>
namespace butil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment