Commit Graph

35 Commits

Author SHA1 Message Date
Allan Odgaard
db13d4c1f9 Use std::string::back() instead of operator[] with size()-1 2014-03-31 08:27:18 +07:00
Allan Odgaard
003d32832e Suppress “unused variable” warning from code generated by ragel 2014-03-25 12:41:37 +07:00
Allan Odgaard
d7660bd89e Detect first loop iteration using std::exchange “idiom” 2014-03-23 22:47:15 +07:00
Allan Odgaard
c2397484b8 Use C++11 for loop
Majority of the edits done using the following ruby script:

    def update_loops(src)
      dst, cnt = '', 0

      block_indent, variable = nil, nil
      src.each_line do |line|
        if block_indent
          if line =~ /^#{block_indent}([{}\t])|^\t*$/
            block_indent = nil if $1 == '}'
            line = line.gsub(%r{ ([^a-z>]) \(\*#{variable}\) | \*#{variable}\b | \b#{variable}(->) }x) do
              $1.to_s + variable + ($2 == "->" ? "." : "")
            end
          else
            block_indent = nil
          end
        elsif line =~ /^(\t*)c?iterate\((\w+), (?!diacritics::make_range)(.*\))$/
          block_indent, variable = $1, $2
          line = "#$1for(auto const& #$2 : #$3\n"
          cnt += 1
        end
        dst << line
      end
      return dst, cnt
    end

    paths.each do |path|
      src = IO.read(path)

      cnt = 1
      while cnt != 0
        src, cnt = update_loops(src)
        STDERR << "#{path}: #{cnt}\n"
      end

      File.open(path, "w") { |io| io << src }
    end
2014-03-03 10:34:13 +07:00
Allan Odgaard
1c6fd700d0 Catch potential exceptions from loading Cap’n Proto data files
Might fix #1134
2013-10-19 23:24:53 +02:00
Allan Odgaard
dff40138f1 Add proper sorting of numeric plist keys 2013-10-08 21:59:55 +02:00
Allan Odgaard
96283a6554 Update to Cap’n Proto v0.3.0 2013-09-06 11:53:58 +02:00
Allan Odgaard
e2660960e7 Reject bundle index cache if version is not the current 2013-09-06 11:53:58 +02:00
Allan Odgaard
2107223460 Don’t close file descriptor until after ~PackedFdMessageReader()
The message reader may use the file descriptor in its destructor, which is why we can’t close it until that object has been destroyed.
2013-09-06 11:53:41 +02:00
Allan Odgaard
1c308c810d Use map::emplace instead of inserting std::pair (C++11) 2013-09-05 20:59:11 +02:00
Allan Odgaard
9f99fe92b6 Don’t access invalid iterator when creating delta plists 2013-08-24 01:19:29 +02:00
Allan Odgaard
c8802cc534 Support keys with dots in delta property lists functions 2013-08-21 13:44:47 +02:00
Allan Odgaard
e36133ec7a Update plist delta code 2013-08-21 13:44:17 +02:00
Allan Odgaard
8df374fdb3 Instantiate bool version of plist::get<T> 2013-08-19 23:36:00 +02:00
Allan Odgaard
5c02b4ff5c Use cap’n proto for bundle index
This makes loading time roughly twice as fast, although some of the speed gain is because we no longer need to convert CFPropertyListRef → plist::any_t.
2013-08-18 17:29:29 +02:00
Allan Odgaard
4080e1dc96 Add support for serialization of cache_t with cap’n proto
See http://kentonv.github.io/capnproto/install.html for how to install.
2013-08-18 17:14:23 +02:00
Allan Odgaard
5d5399ecd9 Add member data accessor for cache_t’s content filter function 2013-08-16 22:40:09 +02:00
Allan Odgaard
6a4fe2fb3c Add date parsing to plist::parse_ascii 2013-08-16 22:40:09 +02:00
Allan Odgaard
e8bbcaf76e Improve speed of loading (parsing) bundle index 2013-08-16 22:40:08 +02:00
Allan Odgaard
36c5dbba6b Make dictionary map function optional for cache_t::load 2013-08-16 22:40:07 +02:00
Allan Odgaard
df42c5e638 When rescanning a non-existing bundle item path, rescan parent
For example when creating a new bundle (‘foo.tmBundle’) and then saving a new snippet in this bundle (‘bar.tmSnippet’) we may ask to rescan the ‘Snippets’ folder (in the bundle) before the bundle itself does a content (re)scan, which effectively makes the ‘Snippets’ rescan a no-op.

Should fix #1034
2013-08-14 10:41:30 +02:00
Allan Odgaard
62a16dd6a9 Do recursive rescan of updated bundles
Previously we would rescan the parent path which was effectively a no-op.

Also pass the “recursive” flag from fs-events to cache_t::reload.
2013-08-02 15:30:48 +02:00
Allan Odgaard
20cea4ef4f Make cache_t::erase also remove descendants 2013-08-02 15:24:29 +02:00
Allan Odgaard
c2749b0719 Bump version of bundle cache format
The cache update code has an issue causing some users to get an incomplete view of what’s on disk. Bumping the version forces re-indexing, and is not a long-term fix.
2013-08-01 11:36:27 +02:00
Jacob Bandes-Storch
d89571956d Move fs_cache to plist framework 2013-07-28 21:57:50 +02:00
Allan Odgaard
72c34bc33a Update testing system for plist framework 2013-07-26 13:53:58 +02:00
Allan Odgaard
3026001988 Fix issue with merging delta property lists 2013-07-21 13:25:28 +02:00
Allan Odgaard
cbe937d3f3 Convert CFURL → std::string in plist::convert
This is mainly for debugging purposes (printing a CFDictionary).
2013-05-13 18:10:47 +07:00
Allan Odgaard
c6375e2ed9 Add success/failure to plist::parse_ascii API 2013-03-17 15:44:07 +01:00
Allan Odgaard
b139ac5097 Change push_back → emplace_back (C++11)
This is mainly motivated by readability, so I only did a few select replacements.
2013-02-08 11:20:35 +01:00
Allan Odgaard
e75e7ec8e5 Change text::format → std::to_string (C++11) 2013-02-08 11:20:34 +01:00
Allan Odgaard
f8db67153b Support custom sort order of plist keys 2012-09-03 21:51:31 +02:00
Allan Odgaard
cbe91ff831 Assume compiler support for explicit keyword
Since we require a fairly recent clang for other features, there is no reason to test for this one.
2012-08-29 14:27:35 +02:00
Jacob Bandes-Storch
e3aa997b06 Use libc++: replace std::tr1 with std 2012-08-28 13:30:20 +02:00
Allan Odgaard
9894969e67 Initial commit 2012-08-09 16:25:56 +02:00